﻿function land(ref, target)
{
lowtarget=target.toLowerCase();
if (lowtarget=="_self") {window.location=loc;}
else {if (lowtarget=="_top") {top.location=loc;}
else {if (lowtarget=="_blank") {window.open(loc);}
else {if (lowtarget=="_parent") {parent.location=loc;}
else {parent.frames[target].location=loc;};
}}}
}
function jump(menu)
{
ref=menu.choice.options[menu.choice.selectedIndex].value;
splitc=ref.lastIndexOf("*");
target="";
if (splitc!=-1)
{loc=ref.substring(0,splitc);
target=ref.substring(splitc+1,1000);}
else {loc=ref; target="_self";};
if (ref != "") {land(loc,target);}
}
function surfto(form) {
var myindex2=form.select2.selectedIndex
var translation="http://test.ai.org/demand?mtlang=enes&translate="
if (document.location.href.match(/\?/))
{
location=translation + form.select2.options[myindex2].value;
}
else
{
location=form.select2.options[myindex2].value;
}
}
function hideDiv(pass) {
var divs = document.getElementsByTagName('div');
for(i=0;i<divs.length;i++){
if(divs[i].id.match(pass)){//if they are 'see' divs
if (document.getElementById) // DOM3 = IE5, NS6
divs[i].style.display="none";// show/hide
else
if (document.layers) // Netscape 4
document.layers[divs[i]].display = 'none';
else // IE 4
document.all.hideShow.divs[i].visibility = 'none';
}
}
}
function showDiv(pass) {
var divs = document.getElementsByTagName('div');
for(i=0;i<divs.length;i++){
if(divs[i].id.match(pass)){
if (document.getElementById)
divs[i].style.display="block";
else
if (document.layers) // Netscape 4
document.layers[divs[i]].display = 'block';
else // IE 4
document.all.hideShow.divs[i].visibility = 'block';
}
}
} 
function gettip(image)
{
document.getElementById('tip').innerHTML="<img src='" + image + "' />"
}
function reset()
{
document.getElementById('tip').innerHTML="<img src='" + image + "' />"
}
function OpenWindow(url, width, height)
{
    var load = window.open(url,'','scrollbars=no,menubar=no,height=' + height + ',width=' + width + ',resizable=no,toolbar=no,location=no,status=no');
}
 
// isEmail (STRING s [, BOOLEAN emptyOK])
// whitespace characters
var whitespace = " \t\n\r";
// 
// Email address must be of form a@b.c ... in other words:
// * there must be at least one character before the @
// * there must be at least one character before and after the .
// * the characters @ and . are both required
function isValidEmail(s)
{   
    if (isEmpty(s)) return false;
   
    // is s whitespace?
    if (isWhitespace(s)) return false;
        
    // there must be >= 1 character before @, so we
    // start looking at character position 1 
    // (i.e. second character)
    var i = 1;
    var sLength = s.length;
    // look for @
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }
    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;
    // look for .
    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }
    // there must be at least one character after the .
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
}
// Check whether string s is empty.
function isEmpty(s)
{   
    return ((s == null) || (s.length == 0))
}
// Returns true if string s is empty or 
// whitespace characters only.
function isWhitespace(s)
{   
    var i;
    // Is s empty?
    if (isEmpty(s)) return true;
    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (whitespace.indexOf(c) == -1) return false;
    }
    // All characters are whitespace.
    return true;
}
function checkForm() { 
    if (!isValidEmail(document.subscribeForm.elements['Email Address'].value)) {
    document.subscribeForm.elements['Email Address'].style.backgroundColor='yellow';
        alert("Please enter a valid Email Address. (name@host.com)");
        document.subscribeForm.elements['Email Address'].focus();
        return false;
    }
}
function populateElementIdInnerHTML_oc3(element_id)
{
    
    if (opener)
    {
        var update4_html = opener.document.transfer4_html.popup4_html.value;
        if (update4_html)
        {            document.getElementById(element_id).innerHTML = update4_html;
        }
    }
    else
    {
        document.getElementById(element_id).innerHTML ="<p><b>Sorry, unable to locate the parent page</b></p>";
    }
}
function populateElementIdInnerHTML_oc4(element_id)
{
    
    if (opener)
    {
        var update5_html = opener.document.transfer5_html.popup5_html.value;
        if (update5_html)
        {            document.getElementById(element_id).innerHTML = update5_html;
        }
    }
    else
    {
        document.getElementById(element_id).innerHTML ="<p><b>Sorry, unable to locate the parent page</b></p>";
    }
}
function populateElementIdInnerHTML_oc5(element_id)
{
    
    if (opener)
    {
        var update6_html = opener.document.transfer6_html.popup6_html.value;
        if (update6_html)
        {            document.getElementById(element_id).innerHTML = update6_html;
        }
    }
    else
    {
        document.getElementById(element_id).innerHTML ="<p><b>Sorry, unable to locate the parent page</b></p>";
    }
}
function populateElementIdInnerHTML_oc6(element_id)
{
    
    if (opener)
    {
        var update7_html = opener.document.transfer7_html.popup7_html.value;
        if (update7_html)
        {            document.getElementById(element_id).innerHTML = update7_html;
        }
    }
    else
    {
        document.getElementById(element_id).innerHTML ="<p><b>Sorry, unable to locate the parent page</b></p>";
    }
}


/*document.write('<script type="text/javascript" src="http://www.in.gov/ai/rightnow/syndication_widget/arss.js"></script>');*/
function faqload(){
/*    document.getElementById('want').style.display='none';document.getElementById('faq').style.display='none';
    --old faq code--*/
}
RightNow.Client.Controller.addComponent({
                c: '153',
                description: false,
                div_id: "faqdivload",
                navigation: false,
                recommended: false,
                related: false,
                search_box: false,
                truncate_size: 50,
                number_answers: 6,
                instance_id: "skw_0",
                module: "KnowledgeSyndication",
                type: 3
                },
                "http://iot.widget.custhelp.com/ci/ws/get"
);


function menu_goto( menuform )
{
    var baseurl = "http://www.in.gov" ;
    selecteditem = menuform.newurl.selectedIndex ;
    newurl = menuform.newurl.options[ selecteditem ].value ;
    if (newurl.length != 0) {
      location.href = baseurl + newurl ;
    }
}
