        function csId(csId){ return document.getElementById(csId); }
	function csSub(csVal){
	try{ if(csVal) csId('hpMoreMenu'+csVal).style.display = 'block';	}catch(err){}
	}	
	function csSubOut(csVal){ try{csId(csVal).style.display = 'none'; }catch(err){}}
	function csSubTime(csVal){ try{setTimeout("csSubOut('"+csVal+"')", 4000);  }catch(err){}}
	function csSubOver(csVal){ try{csId(csVal).style.display = 'block'; }catch(err){}}	
	function searchnow(element){
		var str = csId(element).value;			
		if((str!="") && (str!="search on ibibo")){
			/*var user = csId('usrSrch').value;
			if (user == '' )user = 0;*/			
			document.location.href="http://search.ibibo.com/isearch/result/provider/searchibibo_all/1/?q="+URLEncode(str);			
		}else{
			csId(element).focus();
		}
	}	
	function URLEncode (clearString){
		var output = '';
		var x = 0;
		clearString = clearString.toString();
		var regex = /(^[a-zA-Z0-9_.]*)/;
		while (x < clearString.length) {
			var match = regex.exec(clearString.substr(x));
			if (match != null && match.length > 1 && match[1] != '') {
			output += match[1];
			x += match[1].length;
			} else {
			if (clearString[x] == ' ')
			output += '+';
			else {
				var charCode = clearString.charCodeAt(x);
				var hexVal = charCode.toString(16);
				output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
			}
			x++;
			}
		}
		return output;
	}

/* FOR SHOWING MAIL COUNT */
	var cslCookies = document.cookie.split( ';' );	
	var allC ="";
	for ( i = 0; i < cslCookies.length; i++ ){			
		cslTempCookie = cslCookies[i].split( '=' );
		cslCookieN = cslTempCookie[0].replace(/^\s+|\s+$/g, '');	
		allC = allC + ","+cslCookieN;
	}
	if( (allC.indexOf('smimid')!=-1) && (allC.indexOf('e,')!=-1) && (allC.indexOf('u,')!=-1)){
		var EUnReadCount=0;
		function mycallH(ret)
		{
		  var el = csId('unreadCount');
		  if((el!=null)&& (el!='undefined')){
		   if(parseInt(ret.unread)>=0){
			if(parseInt(ret.unread)>999) ret.unread="999+";
			var ii =(""+ ret.unread).length;
			if(ii>3) ii=3;			
			try{
			if(parseInt(ret.unread)!=0){			
				csId('unreadMain').style.display =  "block";
				csId('unreadCount').innerHTML="<span style='cursor:pointer' onclick=\'javascript:location.href=\"http://mail.ibibo.com/cgi-bin/login?fun=passport&V=1030\";\'>"+ret.unread+"</span>"; 			
			}
			}catch(e){}		
			EUnReadCount = ret.unread;
			try{ csId('EUnReadCount').innerHTML=EUnReadCount; }catch(e){}		
			try{
				if(parseInt(EUnReadCount)!=0){        	
					csId('emailCount').innerHTML = EUnReadCount;		
					/*csId('unreadEmailCnt').style.display = "block";*/		
				} else {
					csId('emailCount').innerHTML = '0';
				}
			}catch(e){}		
		 }
	  }	
	}

	 var csc_count = 0;
	function csUser( csCookieN ) {
		 if(document.getElementById('csUsername')==null){
			csc_count = csc_count+1;
			if(csc_count<=3){
				setTimeout("csUser('fn')",50);
				return;
			}
                }
		var csCookies = document.cookie.split( ';' );	
		for ( i = 0; i < csCookies.length; i++ ){			
			csTempCookie = csCookies[i].split( '=' );
			csCookieN = csTempCookie[0].replace(/^\s+|\s+$/g, '');	
			if (csCookieN == 'fn'){
				csCookieNVal = unescape( csTempCookie[1].replace(/^\s+|\s+$/g, '') );
				csCookieNVal = csCookieNVal.replace(/\+/g, ' ');			
				if(csCookieNVal){			
					if(csCookieNVal.length > 25) csCookieNVal = csCookieNVal.substring(0,25)+'..';				
					if(document.getElementById('csUsername')!=null){
						csId('csUsername').innerHTML = csCookieNVal;
						csId('csUsername').style.display = 'inline';
					}
				}
			}	
		}	
	}

	setTimeout("csUser('fn')",300);
}
/* FOR SHOWING SEPARATE HEADER FOR CLIENT REQUEST*/
function checkClientCookie(){

	if(document.getElementById('regularHeader')==null){
		setTimeout('checkClientCookie()',50);return;
	}
	if(document.getElementById('clientHeader')==null){
		setTimeout('checkClientCookie()',50);return;
	}
		
	var csCooks = document.cookie.split( ';' );	
	var clientCookie = false;
	var sts = document.createElement('style');
	sts.setAttribute('type', 'text/css');
	var newStyle = 'body {background: url(http://static.cs.ibcdn.com/csimages/head/hd_bg.gif) repeat-x 0 -5px}\n #pageShdw {top: 26px;}'; 
	for ( i = 0; i < csCooks.length; i++ ){			
		csTempCookie = csCooks[i].split( '=' );
		csCookieN = csTempCookie[0].replace(/^\s+|\s+$/g, '');	
		if (csCookieN == 'wherefrom'){
			clientCookie = true;
			break;
		}	
	}
	if(clientCookie==true){
		newStyle = 'body {background:none }\n #pageShdw {top: 56px;}'; 	
	}else{
		newStyle = 'body {background: url(http://static.cs.ibcdn.com/csimages/head/hd_bg.gif) repeat-x 0 -5px}\n #pageShdw {top: 26px;}'; 
	}
	if(navigator.appName=='Microsoft Internet Explorer'){// IE
		sts.styleSheet.cssText = newStyle;
	} else {// w3c
		var cssText = document.createTextNode(newStyle);
		sts.appendChild(cssText);
	}
	var headRef = document.getElementsByTagName('head')[0];
	headRef.appendChild(sts); 

	if(clientCookie==true){
		csId('regularHeader').style.display='none';
		csId('clientHeader').style.display='block';
	}else{
		csId('clientHeader').style.display='none';
		csId('regularHeader').style.display='block';
	}


}
//setTimeout('checkClientCookie()',50);



