function hideSplash() {
    document.getElementById("splashscreen").style.display = "none";
}

function setDivHeight(height) {
    //document.getElementById("FlashDiv").style.height = height + 'px';
    document.getElementById("FlashItem").style.height = height + 'px';
}

function showIconText(id,text) {
    document.getElementById(id).innerHTML = text;
}

function hideIconText(id) {
    document.getElementById(id).innerHTML = "";
}

function showLanguage() {
    document.getElementById("language_selector").style.visibility = "visible";
    document.getElementById("language_selector").style.display = "block";
    var t = setTimeout("hideLanguage('language_selector')",3000)
}

function hideLanguage() {
    document.getElementById("language_selector").style.visibility = "hidden";
    document.getElementById("language_selector").style.display = "none";
}

 function openSite(url){
    var winHeight = screen.height - 66;
    var winWidth = screen.width -10;
    var str = "left=0, top=0, width=";
    str += winWidth;
    str += ", height=";
    str += winHeight;
    str += ";"
    window.open(url, "_blank", str);
}

var hideNationalSitesTimerId = 0;
function showNationalSites() {
    window.clearTimeout(hideNationalSitesTimerId);
    div = document.getElementById('nationalsites');
    div.style.visibility = "visible";
    
}

function hideNationalSitesTimer() {
    hideNationalSitesTimerId = setTimeout("hideNationalSites()",500);
}
function hideNationalSites() {

    div = document.getElementById('nationalsites');
    div.style.visibility = "hidden";
}

function popup(url, width, height) {
    callmewin=window.open(url,'','width=' + width + ',height=' + height + ',resizable=0,status=0,left=100,top=50,menubar=0,scrollbars=yes,toolbar=0,location=0,directories=0,titlebar=no')
}

function popupMind440(url)
{
    popup(url,440,500);
}


function diclink(url) {
    popup(url,610,550);
}

function videolink(url) {
    var winleft = (screen.width - 320) / 2;
    var winUp = (screen.height - 360) / 2; 
    callmewin=window.open(url,'','width=320,height=360, left='+winleft+',  top='+winUp+',resizable=1,status=0,menubar=0,scrollbars=auto,toolbar=0,location=0,directories=0,titlebar=0')
}

function popupFullScreen(url) {
    params = 'width=' + screen.width;
    params += ', height=' + screen.height;
    params += ', top=0, left=0'
    params += ', fullscreen=yes,status=0,menubar=0,scrollbars=auto,toolbar=0,location=0,directories=0,titlebar=0';

    newwin = window.open(url, 'windowname4', params);
    if (window.focus) { newwin.focus() }
}

function poponClick(languagePath){
	//Set variables, version is IE version number
	var ua = window.navigator.appVersion;
	var msie = ua.indexOf ( "MSIE " );
	var version = ua.substring(msie+5,msie+6);
	//Open new window
	var winHeight = screen.height - 66;
	var winWidth = screen.width -10;
	var str = "left=0, top=0, scrollbars=0,resizable=0,status=0,dependent=yes,alwaysRaised=yes,width=";
	str += winWidth;
	str += ", height=";
	str += winHeight;
	str += ";"
	var win = window.open (languagePath, 'master', str);

	if(navigator.appName != 'Netscape'){
		
		//Check version number and run correct code
	
		if (version >= "7"){
			if (win) {
			window.open('', '_parent','');
			//window.close();
			}
		} else if (version == "5" || version == "6"){
			self.opener = this;
			//setTimeout('self.close()',500);
		}
		else {
			window.resizeTo(winWidth,winHeight);
			if (win){
				//win.close()
			}
			var vindue = languagePath; 
			window.location.href = vindue; 
			return;
		};
	}
}

function submitform()
{
    var element = document.getElementById('query');
    var text = Url.encode(element.value);
    var site = Url.encode(document.getElementById('site').value);
    url =  '/Search.aspx?query=' + text + '&site=' + site + '&page=1';
    if (site != 'widex-com')
    {
        url = '/' + site + url;
    }
    window.location.href= url;
}
        
function GetHostName()
{
    var hostname = window.location.hostname;
    if (window.location.port != "")
    hostname += ":" + window.location.port;
    return hostname;
}

function IsEnter(e)
{
    try
    {
        var keynum

        if(window.event) // IE
        {
            keynum = e.keyCode
        }
        else if(e.which) // Netscape/Firefox/Opera
        {
            keynum = e.which
        }

        if(keynum==13)
        {
            submitform();
            return false;
        }
        return true;
    } 
    catch(e)
    {
        alert(e);
    }
}
     
var Url = {   
  
    // public method for url encoding   
    encode : function (string) {   
        return escape(this._utf8_encode(string));   
    },   
  
    // public method for url decoding   
    decode : function (string) {   
        return this._utf8_decode(unescape(string));   
    },   
  
    // private method for UTF-8 encoding   
    _utf8_encode : function (string) {   
        string = string.replace(/\r\n/g,"\n");   
        var utftext = "";   
  
        for (var n = 0; n < string.length; n++) {   
  
            var c = string.charCodeAt(n);   
  
            if (c < 128) {   
                utftext += String.fromCharCode(c);   
            }   
            else if((c > 127) && (c < 2048)) {   
                utftext += String.fromCharCode((c >> 6) | 192);   
                utftext += String.fromCharCode((c & 63) | 128);   
            }   
            else {   
                utftext += String.fromCharCode((c >> 12) | 224);   
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);   
                utftext += String.fromCharCode((c & 63) | 128);   
            }   
  
        }   
  
        return utftext;   
    },   
  
    // private method for UTF-8 decoding   
    _utf8_decode : function (utftext) {   
        var string = "";   
        var i = 0;   
        var c = c1 = c2 = 0;   
  
        while ( i < utftext.length ) {   
  
            c = utftext.charCodeAt(i);   
  
            if (c < 128) {   
                string += String.fromCharCode(c);   
                i++;   
            }   
            else if((c > 191) && (c < 224)) {   
                c2 = utftext.charCodeAt(i+1);   
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));   
                i += 2;   
            }   
            else {   
                c2 = utftext.charCodeAt(i+1);   
                c3 = utftext.charCodeAt(i+2);   
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));   
                i += 3;   
            }   
  
        }   
  
        return string;   
    }   
  
} 

//Code for Agent_SE
function MM_jumpMenu(targ,selObj,restore){ //v3.0
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    if (restore) selObj.selectedIndex=0;
}
