var home="";
var xmlHttp=null;

if (document.all){
 home +="<div style='float:left; width:15px; height:15px;'><img src='http://content.cricketnirvana.com/images/home-button.jpg' border='0' alt='Make this site your Home Page'   align='left'></div><div style='float:left; border:0px solid red; margin-left:3px; margin-top:2px;'><A HREF='#' class='link-drkblue' onClick=\"this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\'http://www.cricketnirvana.com\')\";>";
  home +='Make this site your Home Page</a>';
}

// If it's Mozilla, tell user to drag link onto Home button
else if (document.getElementById){
 home +="<div style='float:left; width:15px; height:15px;'><img src='http://content.cricketnirvana.com/images/home-button.jpg' border='0' alt='Drag this link onto your Home button to make this your Home Page'  title='Drag this link onto your Home button in your tool bar to make this your Home Page' align='left'></div><div style='float:left; border:0px solid red; margin-left:3px; margin-top:1px;'><a href='http://www.cricketnirvana.com' onclick='return test();' class='link-drkblue'  title='Drag this link onto your Home button to make this your Home Page'>&nbsp;Make this site your Home Page </a>";
}

// If it's Netscape 4 or lower, give instructions to set Home Page
else if (document.layers){
 home +="<div style='float:left; width:15px; height:15px;'><img src='http://content.cricketnirvana.com/images/home-button.jpg' border='0' alt='Drag this link onto your Home button to make this your Home Page'  title='Drag this link onto your Home button in your tool bar to make this your Home Page' align='left'></div><div style='float:left; border:0px solid red; margin-left:3px; margin-top:1px;'><a href='http://www.cricketnirvana.com' onclick='return test();' class='link-drkblue'  title='Drag this link onto your Home button to make this your Home Page'>&nbsp;Make this site your Home Page </a>";
}

// If it's any other browser, for which I don't know the specifications of home paging, display instructions
//else {
  //home +='<b>Make this site your home page:</b><br>- Go to <b>Preferences</b> in the <B>Edit</B> Menu.<br>- Choose <b>Navigator</b> from the list on the left.<br>- Click on the <b>"Use Current Page"</b> button.';
//}
//  End -->


//document.write("<div class='welcome-user' ><div class='make-homepage'><div style='width:365px; float:right'>"+home+"&nbsp;&nbsp;|&nbsp;&nbsp; <a class='link-drkblue' href=\"javascript:bookmarksite('Cricket Nirvana','http://www.cricketnirvana.com')\">Bookmark this site</a></div></div></div><div class='welcome-box'><div class='welcome-holder'>Welcome:</div> <div class='username-holder' id='welcome'>Guest |</div><div class='signoutwelcome-holder' id='login'><a href='http://www.cricketnirvana.com/userlogin/userlogin.aspx' class='link-drkblue'><b>Sign In</b></a></div></div></div>");
//<div class='welcome-user' ><div class='make-homepage'><div style='width:365px; float:right'>"+home+"&nbsp;&nbsp;|&nbsp;&nbsp; <a class='link-drkblue' href=\"javascript:bookmarksite('Cricket Nirvana','http://www.cricketnirvana.com')\">Bookmark this site</a></div></div></div>

document.write("<div style='background:#fff;width:989px; height:30px; margin-top:-22px; float:left;'><div id='guru-search' style='padding-left:247px'>");
//document.write("<" + "!-- Start Guruji Integration -->");
//document.write("<form name='gsearch' target='_top' id='searchForm' action='/guruji_search.html' style='padding:0px;margin:0px;'>");
document.write("<input type='hidden' value='cricketnirvana.com' name='client' id='client'/>");
document.write("<input type='hidden' value='en' name='hl' id='hl'/>");
document.write("<input type='hidden' value='tw;TB:0;GMP:1;' name='cfeed' id='cfeed'/><table cellspacing='0' cellpadding='0' border='0' style='border-collapse: collapse;'>");
document.write("	<tbody>");
document.write("		<tr>");
document.write("			<td valign='top'>");
document.write("				<input size='20' id='q' name='q' onfocus=\"if (this.value == 'Search...') {this.value = '';}\" onblur=\"if (this.value == '') {this.value = 'Search...';}\"); value=\"Search...\" style='border: 1px solid rgb(51, 102, 204); font-family: Tahoma; font-size: 8pt; float:left; height: 17px; width: 155px;'/>");
document.write("			</td>");
document.write("			<td valign='top'>");
document.write("				<input type='button' onclick='postdata()' style='border: 1px solid rgb(51, 102, 204); background: rgb(51, 102, 204) none repeat scroll 0%; width: 25px; height: 21px; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: Tahoma; font-size: 8pt; color: white;' value='Go'/>&nbsp;");
document.write("			</td>");
document.write("			<td valign='top'>");
document.write("				<select id='site' style='font-size: 10pt;' name='site' id='site' class='textfield'><option value='cricketnirvana.com'>cricketnirvana</option><option value=''>Web</option></select>");
document.write("			</td>");
document.write("		</tr>");
document.write("	</tbody>");
document.write("</table>");
//document.write("</form>");
//document.write("<" + "!-- End Guruji Integration -->");
document.write("</div>");

document.write("<div class='welcome-user' style='height:25px;' ><div class='welcome-box'><div class='user-box-welcome'><div class='welcome-holder'>Welcome:</div><div class='username-holder' id='welcome'>Guest</div></div><div  id='edit' ></div><div class='user-box-welcome' style='margin-left:5px;'><div class='signoutwelcome-holder' id='login'><a href='http://www.cricketnirvana.com/userlogin/userlogin.aspx' class='username-holder'><b>Sign In</b></a></div></div></div></div></div>");

//document.write("<div class='welcome-user' ><div class='welcome-box'><div class='welcome-holder'>Welcome:</div> <div class='username-holder' id='welcome'>Guest |</div><div class='signoutwelcome-holder' id='login'><a href='/userlogin/userlogin.aspx' class='link-drkblue'>Sign In</a></div></div></div>");
ReadCookie();

function postdata()
{var box = document.getElementById('q');
 if (!box.value) {
	document.getElementById('cfeed').value = "";
	document.getElementById('client').value = "";
	document.getElementById('hl').value = "";
 return;
 }
 document.getElementById("guruji").click();  
}

function ReadCookie()
{   
    var cookiecontent = new String();
    if(document.cookie.length > 0)
    {
	    var cookiename = 'hcookie';
	    var cookiebegin = document.cookie.indexOf(cookiename + "=");
	    var cookieend = 0;
	
	      if(cookiebegin > -1) 
	      {
		    cookiebegin += cookiename.length;		
		    cookieend = document.cookie.indexOf(";",cookiebegin);
		   
	    	 if(cookieend < cookiebegin)
		     {
		        cookieend = document.cookie.length; 
		     }
		    cookiecontent = document.cookie.substring(cookiebegin,cookieend);
		    //alert(cookiecontent);
		    cookiecontent = cookiecontent.substring(cookiecontent.indexOf('user_name'),cookiecontent.indexOf('&'));
	        //alert(cookiecontent);
	        cookiecontent=cookiecontent.substring(cookiecontent.indexOf("=")+1);
	        cookiecontent +="";
	      }else{cookiecontent="Guest";}
	}
	else
	{
	 cookiecontent="Guest";
	}
	 document.getElementById("welcome").innerHTML="<b>"+cookiecontent+"<b/>";
	 
	 if(cookiecontent=="Guest")
	 {
	   document.getElementById("login").innerHTML="<a href='javascript:forgotpassword()'  class='username-holder'><b>Forgot Password<b/></a>"	 ;	   
	   document.getElementById("edit").innerHTML="<div class='user-box-welcome' style='margin-left:5px;'><a href='http://www.cricketnirvana.com/userlogin/login.aspx' class='username-holder'><b>Sign In</b></a></div>";
	 }
	 else
	 {
	 document.getElementById("login").innerHTML="<a href='http://www.cricketnirvana.com/userlogin/signout.aspx' class='username-holder'><b>Sign Out</b></a>"; 
	 document.getElementById("edit").innerHTML="<div class='user-box-welcome' style='margin-left:5px;'><a href='http://www.cricketnirvana.com/userlogin/edit_profile.aspx' class='username-holder'><b>Edit Profile<b/></a></div>";
	 }
	
//document.write("<div class=\"welcome-user\" ><div class=\"welcome-box\">Welcome: <span class=\"text-link-blue\">"+cookiecontent+"</span> | <a href=\"#\" class=\"link-drkblue\">Sign Out</a></div></div>");


} 

function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "http://www.cricketnirvana.com");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

function test()
{
return false;
}


		
//document.write("<SCRIPT LANGUAGE=JavaScript FOR=window EVENT=onbeforeunload>");
//document.write("alert('Trapping Closing event')");
//document.write("</SCRIPT>");


function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}


//var i=gup('clkid')
function gup( name )
{  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  
  var regexS = "[\\?&]"+name+"=([^&#]*)";  
  var regex = new RegExp( regexS );  
  var results = regex.exec( window.location.href );  
  if( results == null )    
  {
    var i=10;
    return 10;
  }
  else
  {
    setCookie("c_name",results[1],1);   
    xmlHttp=GetXmlHttpObject();
       if (xmlHttp==null)
       {
          alert ("Your browser does not support AJAX!");
          return;
       }     
       var d = new Date();
       var timeStamp = d.getMilliseconds ();
            timeStamp =timeStamp+""+d.getSeconds()+""; 
            timeStamp =timeStamp+""+d.getTime() +""; 
        
            var url="/userlogin/clientclick.aspx";
            url=url+"?id="+results[1];
            url=url+"&time="+timeStamp;        
      
          xmlHttp.onreadystatechange=detail;
          xmlHttp.open("GET",url,true);
          xmlHttp.send(null);     
      
  }
 
}
 function detail()
 {
   if (xmlHttp.readyState==4)
    {   
      var arr=xmlHttp.responseText;
    }
 }
 
 function setCookie(c_name,value,expiredays)
{ var exdate=new Date();
     exdate.setDate(exdate.getDate()+expiredays);
    document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
/*
function repSearch()
{
	document.frmsearch.action ="/search.aspx";
	document.frmsearch.submit();
}
*/

function forgotpassword()
{
window.open('http://www.cricketnirvana.com/userlogin/forgotpassword.aspx','example', config='left=100,top=50,width=670,height=500')
return ;
}