// var Nav = window.navigator.appName;
// var Ver = window.parseInt(navigator.appVersion);
// var Agent = window.navigator.userAgent; 
// alert ("Browser: " + Nav +  " Version: " + Ver + " Agent: " + Agent); 

mydate = new Date();
var TimeStamp = mydate.getTime();

var num = Math.random();
num = num * 100
num = Math.round(num);
var ord = num * TimeStamp


// MaxWorldwide code
var axel = Math.random() + "";
var PageId = axel * 1000000000000000000;
// This part of script alleviates a Netscape document.write bug
NS4 = document.layers;
if (NS4) {
origWidth = innerWidth;
origHeight = innerHeight;
}
function reDo() {
if (innerWidth != origWidth || innerHeight != origHeight)
location.reload();
}
if (NS4) onresize = reDo;
// MaxWorldwide code


function msieversion()
{
	var Agent = window.navigator.userAgent; 
	var msie = Agent.indexOf ( "MSIE " ) 
    if ( msie > 0 )        // is Microsoft Internet Explorer; return version number
        return parseInt ( Agent.substring ( msie+5, Agent.indexOf ( ".", msie ) ) );
    else
        return 0;    // is other browser	
}

function problem(page,is_search)
{
	if (is_search == "2")
		win=window.open("http://www.searchbug.com/problem.aspx?URL=" + page,"problem", "top=250,left=200,width=480,height=350,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");
	else
		win=window.open("http://www.searchbug.com/problem1.aspx?is_search=" + is_search + "&page="+ page,"problem", "top=250,left=200,width=480,height=400,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");
	if (win.opener == null)
	   	win.opener = self;	  
}

function report_problem(page)
{
   win=window.open("/problem1.aspx?page="+ page,"problem", "top=250,left=200,width=500,height=350,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");
	if (win.opener == null)
	   	win.opener = self;	  
}

function answer(problem,page)
{
	win=window.open("/problem1.aspx?problem=" + problem + "&page="+ page,"problem", "top=250,left=200,width=480,height=300,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");
	if (win.opener == null)
   	win.opener = self;	  
}


function goThere()
{
	top.location='http://www.searchbug.com/' + document.popular.searches.options[document.popular.searches.selectedIndex].value;
}

function SpacesToPluses (InString)
{
	OutString="";
	for (Count=0; Count < InString.length; Count++)
	{
 		TempChar=InString.substring (Count, Count+1);
  		if (TempChar!=" ")
		OutString=OutString+TempChar;
		else
		{
			TempChar="+";
			OutString=OutString+TempChar;
		}
	}
return (escape(OutString));
}

function SpacesToDashes (InString)
{
	OutString="";
	for (Count=0; Count < InString.length; Count++)
	{
 		TempChar=InString.substring (Count, Count+1);
  		if (TempChar!=" ")
		OutString=OutString+TempChar;
		else
		{
			TempChar="-";
			OutString=OutString+TempChar;
		}
	}
return (escape(OutString));
}


function test()
{
	if (document.searchinternet.query.value == "")
		alert('Please Enter Keywords!');
	else
		location = document.searchinternet.selection.options[document.searchinternet.selection.selectedIndex].value + SpacesToPluses(document.searchinternet.query.value);
}


function remember(name,value)
{
//	alert ("name:" + name + ", value: " + value);
//	if (value != "")
	{
		var expdate = "Mon, 01-Jan-2008 00:00:00 GMT"
		var path = "/"
		if (name == "state")
			value = escape (value.toUpperCase());
		else
			value = escape (value);
			
		document.cookie = name + "=" + value + "; expires=" + expdate + "; path=" + path;
	}
}

function rememberText (formname, cookieName, cookieValue)
{
	if (formname.remember.checked == true)
		remember(cookieName, cookieValue);	
}

function check(formname)
{

//alert(formname.name);
	if (formname.query.value == "")
		alert('Please Enter Keywords!');
	else
		location = formname.selection.options[formname.selection.selectedIndex].value + SpacesToPluses(formname.query.value);
}


function makeDefault(formname)
{
//alert ("formname.name: " + formname.name);
	if (formname.remember.checked == true)
	{
		remember(formname.name,formname.selection.options[formname.selection.selectedIndex].text);
	}	
}



function showCookies()

{
    var the_cookie = document.cookie;
    var the_cookie = unescape(the_cookie);
//    var broken_cookie = the_cookie.split(":");
//    var the_name = broken_cookie[1];
    alert("Cookies:  " + the_cookie);

}



function readCookie(name) {
	if (document.cookie == '') { 
    
   // there's no cookie, so go no further
    
	return "";
	} else {
    
   // there is a cookie
	var firstChar, lastChar;
	var theBigCookie = document.cookie;
	firstChar = theBigCookie.indexOf(name);
	
   // find the start of 'name'
	if(firstChar != -1)  {
	
   // if you found the cookie
	firstChar += name.length + 1;
	    
   // skip 'name' and '='
	   
	lastChar = theBigCookie.indexOf(';', firstChar);
	    
   // Find the end of the value string (i.e. the next ';').
	    
	if(lastChar == -1) lastChar = theBigCookie.length;
	    
	return unescape(theBigCookie.substring(firstChar, lastChar));
	} else {
	
   // If there was no cookie of that name, return false.
	
	return "";
	
	}
    }
}
