var game_Hour = '';
var from_Hour = '';
var from_Hour_new = '';
var to_Hour_new = '';
var to_Hour = '';
var zhcontent = '';
/*********functions realted to egobox start *****************/
function showEgoBox(mailcount,scrapscount,challengescount,loyaltypoints,favgamecount,buddycount,username_cookie,avatar,gender)
{	
		//zhcontent = '<a class="head01" href="http://www.zapak.com/happyhours.php" style="font-size: 11px;"><b><u>It\'s Happy Hours on Zapak! Play between<br/> 4 to 8 PM and earn double loyalty points!</u></b></a>';
			
		zhcontent ='';
            if(document.getElementById("signout"))
			document.getElementById("signout").innerHTML = '| <a href="'+SECURE_SERVER_URL+'/zlogout.php" target="_parent">Signout</a>';			
			if(document.getElementById("userid"))
			document.getElementById("userid").innerHTML = username_cookie;
			if(document.getElementById("useridyes"))
			document.getElementById("useridyes").style.display = 'none';
			
			if(document.getElementById("myzapak"))
			document.getElementById("myzapak").style.display = 'block';
			
			if(document.getElementById("zhousie"))
		    document.getElementById("zhousie").innerHTML = zhcontent;
			
			if(document.getElementById("div5"))
			slide('div5');
			
		document.getElementById("loginbox").style.display = 'none';
		document.getElementById("egobox").style.display = '';
		
	printegobox(mailcount,scrapscount,challengescount,loyaltypoints,username_cookie,avatar,gender);
	
}


function hideEgoBox()
{
	
        if(document.getElementById("userid"))
		document.getElementById("userid").innerHTML = 'Stranger';
		
		document.getElementById("loginbox").style.display = '';
		document.getElementById("egobox").style.display = 'none';
		
		if(document.getElementById("signout"))
		document.getElementById("signout").innerHTML = '';
		
		/* if(document.getElementById("zhousie"))
		{
		
			document.getElementById("zhousie").innerHTML = '<a class="head01" href="http://www.zapak.com/happyhours.php" style="font-size: 11px;"><b><u>It\'s Happy Hours on Zapak! Login & Play between<br/> 4 to 8 PM and earn double loyalty points!</u></b></a>';
		
}*/

      
}
/***************** function common egobox ends **************************/



   
   //function for submitting search form egobox
function submitform()
{
 if(document.searchform.textfield.value=='' || document.searchform.textfield.value=='Jump to your favourite game')document.searchform.textfield.value='NULL';document.searchform.submit();

}

//functin for search form

   function searchcheck()
{
if(document.searchform.textfield.value=='')
{
document.searchform.textfield.style.color='white';
document.searchform.textfield.value='NULL';

return true;
}
else{
return true;

}
}



   //function for submitting search form egobox
function submitegoform()
{
 if(document.searchegoform.textfield.value=='' || document.searchegoform.textfield.value=='Jump to your favourite game')document.searchegoform.textfield.value='NULL';document.searchegoform.submit();

}

//functin for search form

   function searchegocheck()
{
if(document.searchegoform.textfield.value=='')
{
document.searchegoform.textfield.style.color='white';
document.searchegoform.textfield.value='NULL';

return true;
}
else{
return true;

}
}



   function printegobox(mailcount,scrapcount,challengecount,loyaltycount,userid,avatar,gender)
   { 

   var wwwzapakPath = WWW_SERVER_URL; //added by devendra to work in all pages	
   var myzapak = MY_SERVER_URL; //
   var mailzapakPath = EMAIL_SERVER_URL; //added by devendra to work in all pages
 var avatarimg='';

   var myzapakPath = SOCIAL_SERVER_URL; //added by cp for rajandra to work on social pages  

   var egoboxcontent = '';
if(avatar=='0'){
	if(gender=='Male')
	{
	avatarimg= SOCIAL_SERVER_URL+'/public/images/boy.jpg';
	}else{
	avatarimg= SOCIAL_SERVER_URL+'/public/images/gal.jpg';
	}
}else if(avatar=='1')
		{

 		avatarimg=SOCIAL_SERVER_URL+'/images/profiles/'+userid+'.jpeg';
		}else{
avatarimg='http://images.api.weeworld.com/zapak/'+userid+'/weemee/scale/0.45.png?xPad=0&amp;yPad=-14&amp;showlogo=false';
}


   egoboxcontent += '<div><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="padding: 0px 5px 5px 0px;" valign="bottom" width="10%" align="left"><div id="avatar" style="background-color: rgb(255, 255, 255);" style="margin-right:5px"><a href="'+myzapakPath+'/public/home/show/'+'" target="_top"><img style1="margin: 0px 0px 0px -13px;" src="'+avatarimg+'" border="0" width="70" height="70"></a></div></td><td class="disT" valign="top" width="339" align="left" background="'+RESOURCE_SERVER_URL+'/www/images/sebg1.gif"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td colspan="5" class="loginbox disL" valign="middle" align="left" height="54"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tbody><tr>';


   egoboxcontent += '<td class="bltxt01" valign="top" width="73" align="center"><a href="'+myzapakPath+'/public/friends/show/'+'" target="_top">Buddies</a><br><span class="bltxt02"><a href="'+myzapakPath+'/public/friends/show/'+'" target="_top">'+mailcount+'&nbsp;</a></span></td><td valign="top" width="1" align="left" bgcolor="#adadad"><img src="'+RESOURCE_SERVER_URL+'/www/images/spacer.gif" width="1" height="1"></td>';


  egoboxcontent += '<td class="bltxt01" valign="top" width="73" align="center"><a href="'+myzapakPath+'/public/scraps/show/'+'" target="_top">Scraps</a><br><span class="bltxt02"><a href="'+myzapakPath+'/public/scraps/show/'+'" target="_top">'+scrapcount+'&nbsp;</a></span></td><td valign="top" width="1" align="left" bgcolor="#adadad"><img src="'+RESOURCE_SERVER_URL+'/www/images/spacer.gif" width="1" height="1"></td>';

 
 egoboxcontent += '<td class="bltxt01" valign="top" width="85" align="center"><a href="'+myzapak+'/zprchallenge.php'+'" target="_top">Challenges </a><br><span class="bltxt02"><a href="'+myzapak+'/zprchallenge.php'+'" target="_top">'+challengecount+'&nbsp;</a></span></td><td valign="top" width="1" align="left" bgcolor="#adadad"><img src="'+RESOURCE_SERVER_URL+'/www/images/spacer.gif" width="1" height="1"></td>';
   
 
  egoboxcontent += '<td class="bltxt01" valign="top" width="77" align="center"><a href="'+myzapak+'/zloyaltymypoints.php" target="_top">Loyalty Points</a><br><span class="bltxt02"><a href="'+myzapak+'/zloyaltymypoints.php" target="_top">'+loyaltycount+'&nbsp;</a></span></td>'; 
   
 
   egoboxcontent += '</tr></tbody></table></td></tr><tr><td valign="top" width="1%" align="left"><img src="'+RESOURCE_SERVER_URL+'/www/images/secorL.gif" width="8" height="30"></td><td valign="top" width="4%" align="left"><img src="'+RESOURCE_SERVER_URL+'/www/images/magni.gif" width="30" height="30"></td><td style="padding-left: 18px; padding-right: 18px;" valign="middle" width="82%" align="left" background="'+RESOURCE_SERVER_URL+'/www/images/tseBg.gif"><form action="'+wwwzapakPath+'/zsearch.php" method="get" name="searchegoform" id="searchegoform" onsubmit="javascript:searchegocheck()" target="_top"><input name="select" value="ALL" type="hidden"><input name="type" value="GAME" type="hidden"><input name="startindex" value="0" type="hidden"><input name="rows" value="21" type="hidden"><input name="textfield" class="input" value="Jump to your favourite game" style="width: 200px; height: 18px;" onclick="document.searchegoform.textfield.value = \'\';" type="text" align="left"></form></td><td valign="middle" width="12%" align="left" background="'+RESOURCE_SERVER_URL+'/www/images/tseBg.gif"><a href="javascript:submitegoform();"><img src="'+RESOURCE_SERVER_URL+'/www/images/search.gif" width="56" border="0" height="11"></a></td><td valign="top" width="1%" align="left"><img src="'+RESOURCE_SERVER_URL+'/www/images/secorR.gif" width="7" height="30"></td></tr></tbody></table></td></tr></tbody></table>';
   egoboxcontent += '</div>';
 

document.getElementById("egobox").innerHTML = egoboxcontent;
   }
   
   