var m_act;
var m2_act;
function initial(tabval,menuval){
	if(tabval==''){
		m_act= 8;
	}else{
		m_act =tabval;
	}
	
	if(menuval==''){
		m2_act= 10;
	}else{
		m2_act =menuval;
	}
	init();
	onloadsettheme();
	onloadsignin();
}
function init()
{
	if(m2_act != 10 && m2_act != 9)
	{	
		document.getElementById('tt_'+ m_act).className = "act";//alert(m_act);
	}
	document.getElementById('m_t_'+m2_act).className = "w_12_off";
	document.getElementById('m_i_'+m2_act).className = 'icons2 icon-m-'+m2_act;
	document.getElementById('m_cur1_'+m2_act).className = 'cur1_on';
	document.getElementById('m_cur2_'+m2_act).className = 'cur2_on';
	document.getElementById('m_curbg_'+m2_act).className = 'curbg_on';
}
function htab(a, b, c, d)
{
	for(var i=1; i<=b; i++)
	{
		if(i == a){
			
			
			document.getElementById(c+i).className = "act";
			document.getElementById(d+i).style.display = "block"
		}
		else{
			
			document.getElementById(c+i).className = "nact";
			document.getElementById(d+i).style.display = "none"
		}
	}
}
function ttab(a, b, c, d)
{
	for(var i=1; i<=b; i++)
	{
		if(i == a){
			document.getElementById(c+i).className = "act";
			m_act = i;
		}
		else{
			document.getElementById(c+i).className = "nact";
		}
	}
}

function over_ttab(a)
{
	document.getElementById('tt_'+a).className = "act";
}
function out_ttab(a)
{
	if(m_act == a)
	{
		document.getElementById('tt_'+a).className = "act";
	}
	else
	{
		document.getElementById('tt_'+a).className = 'nact';
	}
}
function ttab(a, b, c, d)
{
	for(var i=1; i<=b; i++)
	{
		if(i == a){
			//alert(c+i);
			document.getElementById(c+i).className = "act";
			document.getElementById(d+i).style.display="block";
			m_act=a;
		}
		else{
			document.getElementById(c+i).className = "nact";
			document.getElementById(d+i).style.display="none";
		}
	}
}

function tp_menu_off(a)
{
	document.getElementById('m_t_'+a).className = "w_12_off";
	document.getElementById('m_i_'+a).className = 'icons2 icon-m-'+a;
	document.getElementById('m_cur1_'+a).className = 'cur1_on';
	document.getElementById('m_cur2_'+a).className = 'cur2_on';
	document.getElementById('m_curbg_'+a).className = 'curbg_on';
}
function tp_menu_on(a)
{
	if(m2_act == a)
	{
		document.getElementById('m_t_'+a).className = "w_12_off";
		document.getElementById('m_i_'+a).className = 'icons2 icon-m-'+a;
		document.getElementById('m_cur1_'+a).className = 'cur1_on';
		document.getElementById('m_cur2_'+a).className = 'cur2_on';
		document.getElementById('m_curbg_'+a).className = 'curbg_on';

	}
	else
	{
		document.getElementById('m_t_'+a).className = "w_12_on";
		document.getElementById('m_i_'+a).className = 'icons icon-'+a;
		document.getElementById('m_cur1_'+a).className = 'cur1_off';
		document.getElementById('m_cur2_'+a).className = 'cur2_off';
		document.getElementById('m_curbg_'+a).className = 'curbg_off';
	}
}

function onloadsettheme(){
		if(readCookie('mytheme')){
			settheme(readCookie('mytheme'));	
		}else{
			setthemeclassname='mast';
			settheme(setthemeclassname);	
		}
	}
function settheme(themeclassname){		//Onclick will set themes
		url = "/active18/common/update_theme.php";			//alert(url);
		par="theme="+themeclassname;	//alert(url+par);
		document.getElementById('main').className=themeclassname;
		callAHAH(url, 'POST',par, displayContent);
		Set_Cookie( 'mytheme', themeclassname, '', '/', '', '' );
	}
function 	displayContent(){}//Coz cant do without it :)
function Set_Cookie( name, value, expires, path, domain, secure ){
		var today = new Date();
		today.setTime( today.getTime() );
		if ( expires )
		{
		expires = expires * 1000 * 60 * 60 * 24;
		}
		var expires_date = new Date( today.getTime() + (expires) );
		document.cookie = name + "=" +escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
	}
function Get_Cookie( name ) {	
		var start = document.cookie.indexOf( name + "=" );
		var len = start + name.length + 1;
		if ( ( !start ) &&
		( name != document.cookie.substring( 0, name.length ) ) )
		{
		return null;
		}
		if ( start == -1 ) return null;
		var end = document.cookie.indexOf( ";", len );
		if ( end == -1 ) end = document.cookie.length;
		return unescape( document.cookie.substring( len, end ) );
	}	


function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function loginverify_new(frm)
{
		var f_idval = "";
	if (document.getElementById('f_id') != null)
	{
			f_idval = $('#f_id').val();
	}
	if (document.getElementById('f_id_new') != null)
	{

		if(f_idval == "")
		{

				f_idval = $('#f_id_new').val();
		}
	}	

	if (f_idval=="")
	{		
		alert("please enter username");
		return false;
	}
	
	f_fwdval= "";
	if (document.getElementById('f_pwd') != null)
	{
			f_fwdval = $('#f_pwd').val();
	}
	 if (document.getElementById('f_id_new') != null)
	{
			if(f_fwdval == "")
		{
			f_fwdval = $('#f_pwd_new').val();
		}
	}
	
	if (f_fwdval=="")
	{		
		alert("please enter password");
		return false;
	}

}
function loginverify(f_source)
{
	remembermeval = 0 ;
	if(f_source == '')
	{
		if (document.getElementById('f_sourceret') != null)
		{
				f_source = $('#f_sourceret').val();
		}
	}
	if(f_source == '')
	{
		if (document.getElementById('f_sourcelogin') != null)
		{
				f_source = $('#f_sourcelogin').val();
		}
	}
	if(f_source == '')
		f_source = "jquery";

	var f_idval = "";
	if (document.getElementById('f_id') != null)
	{
			f_idval = $('#f_id').val();
			
			if (document.getElementById('rememberme') != null)
			{
				if (document.getElementById('rememberme').checked == true)
				{
					remembermeval = $('#rememberme:checked').val();
					
				}
			}
	}
	if (document.getElementById('f_id_new') != null)
	{

		if(f_idval == "")
		{	
			f_idval = $('#f_id_new').val();
			if (document.getElementById('rememberme_new') != null)
			{
				if (document.getElementById('rememberme_new').checked == true)
				{
					remembermeval = $('#rememberme_new:checked').val();				
				}
			}
		}
	}
	if (document.getElementById('f_id_listen') != null)
	{
		if(f_idval == "")
		{
				f_idval = $('#f_id_listen').val();
		}
	}
	if (document.getElementById('f_id_plan') != null)
	{
		if(f_idval == "")
		{
				f_idval = $('#f_id_plan').val();
		}
	}
	if (document.getElementById('f_id_read') != null)
	{
		if(f_idval == "")
		{
				f_idval = $('#f_id_read').val();
		}
	}

	if (f_idval=="")
	{		
		alert("please enter username");
		return;
	}
	
	f_fwdval= "";
	if (document.getElementById('f_pwd') != null)
	{
			f_fwdval = $('#f_pwd').val();
	}
	 if (document.getElementById('f_id_new') != null)
	{
			if(f_fwdval == "")
		{
			f_fwdval = $('#f_pwd_new').val();
		}
	}
	 if (document.getElementById('f_pwd_listen') != null)
	{
			if(f_fwdval == "")
		{
			f_fwdval = $('#f_pwd_listen').val();
		}
	}
	if (document.getElementById('f_pwd_plan') != null)
	{
			if(f_fwdval == "")
		{
			f_fwdval = $('#f_pwd_plan').val();
		}
	}
	if (document.getElementById('f_pwd_read') != null)
	{
			if(f_fwdval == "")
		{
			f_fwdval = $('#f_pwd_read').val();
		}
	}
	if (f_fwdval=="")
	{		
		alert("please enter password");
		return;
	}
	if (document.getElementById('rcode') != null)
	{
		if(document.getElementById("rcode").value == "")
		{		
			alert("please enter captcha code");
			return;
		}
	}
	// Encryption of Username
//	var m_len = 0;
//	var m_value = "";
//	m_value = f_idval;
//	m_len = (m_value).length;
//	for(m_ctr=m_len; m_len <= 5; m_len++)
//		m_value += " ";
//	f_idval = IiI(IIj(m_value, jj, ""));
//
//	// Encryption of Password
//	var m_len = 0;
//	var m_value = "";
//	m_value = f_fwdval;
//	m_len = (m_value).length;
//	for(m_ctr=m_len; m_len <= 5; m_len++)
//		m_value += " ";
//	f_fwdval = IiI(IIj(m_value, jj, ""));
var f_referrer;
if (document.getElementById('f_referrer') != null)
		{		
				f_referrer = $('#f_referrer').val();
				f_mailsstr=f_referrer.match("xiphiasportal.com\/mails/");
				if(f_mailsstr != null && f_mailsstr !='')
				{
					f_source = "email";
				}	
				else
				{
					f_mailsstr=f_referrer.match("biggboss2.xiphiasportal.com\/");
					if(f_mailsstr != null && f_mailsstr !='')
					{
						f_source = "biggboss";
					}
					else
					{
							f_mailsstr=f_referrer.match("dostana.xiphiasportal.com\/");
							if(f_mailsstr != null && f_mailsstr !='')
							{
								f_source = "dostana";
							}	

					}

				}
		}
		
		
	
	newwinChecked = "";
	if (document.getElementById('newwinCheck') != null)
		newwinChecked = document.getElementById('newwinCheck').checked;
	$.post("/active18/loginverify.php", {'f_id': f_idval,'f_pwd': f_fwdval,'f_source': f_source,'f_referrer': f_referrer,'rcode': $('#rcode').val(),'rememberme':remembermeval}, function(data) {
			returnstr = data.split("|");
			$("#rcode").val('');
			$('#disperrhome').html('');
			if(returnstr[0]=="Error")
			{
							err = returnstr[1];
							msgdisp="";
							messagedispaly="";
							if (err == 1 ) { 
									
                                    messagedispaly = '<b>The password you entered is not correct. Password is casesensitive </b><span ><a href="#" class="bl_12" onclick="forgotin();">forgot password?</a></span>';
									msgdisp = '<b>The password you entered is not correct.</b>';
                                }
                                else if (err == 2)
                                {
                                    messagedispaly = '<b>Sorry! this is not a valid xiphiasportal.com Username </b>';
									msgdisp = '<b>Sorry! this is not a valid xiphiasportal.com Username </b>';
                                }
								else if (err == 3)
                                {
									location.href='/login.php?err='+err;									
                                }                               														
                                else if (err == 5)
                                {
                                    location.href='/login.php?err='+err;
                                }
								else if (err == 10)
								{
									messagedispaly = '<b>Sorry! the code you entered was invalid. </b>';
									msgdisp = '<b>Sorry! the code you entered was invalid. </b>';
								}

								if (f_source == "home")
								{
									$('#disperrpop').html(msgdisp);
									return;
								}
								if (f_source == "jquery")
								{
									$('#disperrhome').html(msgdisp);
									return;
								}
								$('#displayerroralt').html(messagedispaly);
		}
		else if(f_source == 'email' && returnstr[0]=="success")
		{
			window.location.href="http://www.in.com/mails/mailstartup";
		}
		else if(f_source == 'biggboss' && returnstr[0]=="success")
		{
			window.location.href="http://biggboss2.in.com";
		}
		else if(f_source == 'dostana' && returnstr[0]=="success")
		{
			window.location.href="http://dostana.xiphiasportal.com";
		}
		else if(f_source == 'invitefriends' && returnstr[0]=="success")
		{
			window.location.href="http://www.in.com/mails/invitefriends.php";
		}
		else if (f_source == 'social' && returnstr[0]=="success")
		{
			
			window.location.href =  "http://www.xiphiasportal.com/active18/social/userindex.php";
		}
		else if (f_source == 'myfeeds' && returnstr[0]=="success")
		{
			window.location.href =  "http://www.xiphiasportal.com/active18/readnow/";
		}
		else if(returnstr[0]=="success")
		{
				displaysignin_top();	
			if (document.getElementById('f_callback') != null)
			{
				var strcallback = $('#f_callback').val();
				if(strcallback.length > 0)
				{						
					location.href = strcallback ;
				}
				else
				{				
					 reloadpage();
					//window.location.reload();
				}
			}
			else
			{
				 reloadpage();
				//window.location.reload();
			}

		}
		
		else
			{	
				
				displaysignin_top();	
				if (document.getElementById('f_callback') != null)
				{
					var strcallback = $('#f_callback').val();
					if(strcallback.length > 0)
					{						
						location.href = strcallback ;
					}
					else{
						//window.location.reload();
						 reloadpage();
					}
				}
				else
				{
					 reloadpage();
					//window.location.reload();
				}
				

			}
			
	});
}
function logoutfnnew(testvar)
{
	sitename = "http://" + window.location.hostname;
var str_username="" ;	
	$.post("/logout.php",'', function(data) {					
		strlogout = '<div ><a href="#"  onclick="addsignin(\''+sitename+'\',\'\',\'\');" class="w_11"><b>Sign in</b></a> </div>';
			if (document.getElementById('topsignin') != null)
				{					
						$('#topsignin').html(strlogout);
				}			
		});
}
function newtopsigninnew(testvar)
{
	sitename = "http://" + window.location.hostname;
	var str_username="";
		if(readCookie('ui') == null || readCookie('ui') == '' || readCookie('ui')== undefined ||  readCookie('ui')== 'deleted' )
		{
			
			strlogin = '<div ><a href="#" onclick="addsignin(\''+sitename+'\',\'\',\'\');" class="w_11"><b>Sign in</b></a> </div>';
			$('#topsignin').html(strlogin);	

			

										
		}
		else 
		{
			var display_name ="";
			var displayshort_name ="";
			var strhomelink ="";
			if(readCookie('dispname') != null && readCookie('dispname') != '' && readCookie('dispname')!= undefined)
			{			
				display_name = readCookie('dispname');
				if(display_name != '')
				{
					displayshort_name = display_name.split('+');
				}
			}
			strlogin = '<div ><B>Hi</B> <a href="http://www.xiphiasportal.com/active18/social/userindex.php" class="w_11"><b>'+displayshort_name[0]+'!</b></a> &nbsp;&nbsp;</div>';
			$('#topsignin').html(strlogin);		
			
		}	
}
function reloadpage()
{
	if(location.href == 'http://www.in.com' || location.href == 'http://www.xiphiasportal.com/' || location.href == 'http://www.xiphiasportal.com/index.html')
	{			
		newtopsignin();
		homeads();
	}
	else if(location.href.indexOf('login.php') != -1)
	{

		location.href = '/';
	}
	else
	{
		window.location.reload();
	}
}
function logoutfn()
{
	location.href="/logout.php";
}
function logoutfnold(testvar)
{

var str_username="" ;
	
	$.post("/logout/",'', function(data) {
		
			str = '<div><h2><i>Signin</i></h2></div><div style="width:268px;"><div class="gD_12 PT10"><b>Username:</b></div><div><input type="text" name="f_id" id="f_id" value="" size="44" class="txtInput" /></div><div class="gD_12 PT10"><b>Password:</b></div><div><input type="password" name="f_pwd" id="f_pwd" value="" size="44" class="txtInput" /></div><div class="PT15"><div class="FL gD_12"><input type="checkbox" name="newwinCheck" id="newwinCheck" /> <b>Open mail in new window</b></div><div class="FR PR10"><a href="javascript:loginverify(\'ajaxhome\');"><img src="images/home_login.gif" /></a></div><div class="CL"></div></div><div class="PT10"><a href="javascript:mailsend();" class="bl_12" style="text-decoration:underline;">Forgot Password?</a> <a href="/mails/new_reg.php" class="bl_12" style="margin-left:74px;text-decoration:underline;" >Register Now!</a></div></div>';
			if(readCookie('un')!='' && readCookie('un')!=null)
			{
				$.post("/active18/getusername.php",'', function(data1) { 
					str_username = data1;
					
					if (document.getElementById('f_id') != null)
					{
							$('#f_id').val(str_username);							
					}
					if (document.getElementById('f_id_new') != null)
					{
							$('#f_id_new').val(str_username);							
					}
					if(str_username != '')
					{
							if (document.getElementById('rememberme') != null)
								document.getElementById('rememberme').checked = true;
							if (document.getElementById('rememberme_new') != null)
								document.getElementById('rememberme_new').checked = true;
					}

				});
			}
			strhomelink = '<div style="padding:3px 8px 0px 8px;"><div class="PB5"><h2>Sign in</h2></div><div style="width:268px;"><form name="frmloginverify" method="POST" action="http://www.in.com/active18/loginverifyothers.php" ><div><input type="text" id="f_id" name="f_id" value="'+str_username+'" class="txtInput" style="width:250px;" /><input type="hidden" id="f_idmain" name="f_idmain" value="" size="27" class="txtInput4" /><input type="hidden" id="f_pwdmain" name="f_pwdmain" value="" /></div><div class="PT5"><input type="Password" id="f_pwd" name="f_pwd" value="" class="txtInput" onkeypress="{if (event.keyCode==13) loginverify_new(this.form)}" style="width:250px;" /></div><div class="PT5 gD_12"><INPUT TYPE="checkbox" NAME="rememberme" id="rememberme" value="1"> Remember me on this computer.</div><div class="PT10 PB10"><div class="FL"><input type="image" src="http://www.xiphiasportal.com/active18/images/home_login.gif"  onclick="return loginverify_new(this.form)"/></div><div class="FL PL10 PT10"><a href="#" class="bl_2_12" onclick="forgotin();">Forgot Password?</a> &nbsp;&nbsp;</div><div class="CL"></div><div class="PT10"><a href="/mails/new_reg.php"><img src="http://www.xiphiasportal.com/active18/images/h_signupfree3.gif" /></a></div></div><div style="display:none;"><INPUT TYPE="hidden" id="f_sourceret" name="f_sourceret" value="'+location.href+'"><INPUT TYPE="hidden" id="f_callback" name="f_callback" value=""></div><div id="disperrhome"></div></div></form></div>';

			//strhomelink = '<div style="padding:5px 10px;"><div class="PB5"><h2>Sign in</h2></div><div style="width:268px;"><div><input type="text" id="f_id" name="" value="'+str_username+'" class="txtInput" style="width:260px;" /><input type="hidden" id="f_idmain" name="f_idmain" value="" size="27" class="txtInput4" /><input type="hidden" id="f_pwdmain" name="f_pwdmain" value="" /></div><div class="PT5"><input type="Password" id="f_pwd" value=""  value="" class="txtInput" style="width:260px;" onkeypress="{if (event.keyCode==13) loginverify(\'\')}"  /></div><div class="PT5"><div class="FL PT3 PR5"><a href="#" onclick="loginverify(\'\')"><img src="http://www.xiphiasportal.com/active18/images/home_login.gif" /></a></div><div class="FL PL10 PT10"><a href="#" onclick="forgotin();" class="bl_2_12">Forgot Password?</a> &nbsp;&nbsp; </div><div class="CL"></div></div><div class="PT10"><a href="/mails/new_reg.php"><img src="http://www.xiphiasportal.com/active18/images/h_signupfree3.gif" /></a></div></div></div>';
		


			strlogout = '<div ><a href="#"  onclick="addsignin(\'home\',\'\',\'\');" class="w_11"><b>Sign in</b></a></div>';

		
			if (document.getElementById('homesignin') != null)
						$('#homesignin').html(strhomelink);
			if (document.getElementById('homesignin1') != null)
						$('#homesignin1').show();
			if (document.getElementById('topsignin') != null)
				{					
						$('#topsignin').html(strlogout);
				}
				

				displaysignout_top();
				location.href="http://www.in.com/";
		});


}
/*if(readCookie('ui')!=''){	alert(readCookie('ui'));
	setTimeout("callalertstop()", 30000);
}*/
//setTimeout("callalertstop()", 30000);

function callalertstop()
{
	
	if(readCookie('ui') != null || readCookie('ui') != '' || readCookie('ui')!= undefined || readCookie('ui')!= 'deleted' )
	{		//alert("C:" + readCookie('ui'));
		
		str = "";
		$.post("/active18/common/alerts.php",{'lastappid':jsmenuval},function(data) {	
			//alert(data);			
			if(data != "" && data != "<script>window.location='/login.php?err=0'</script>" && data != "<script>window.location='/home/index.php?msg=1'</script>" && data != "<script>window.location='/'</script>")
			{		
				
				str = data.split("|");
	
				if(str[3]!='undefined' && str[2] != '' && str[5] != '' && str[3] != '')
				{					
					$('#fromnamealerttop').html(str[2]);
					strlink  = '<a href="/mails/openmailstartup/'+str[0]+'" )">'+str[3]+'</a>';				
					$('#messagealerttop').html(strlink);				
					$('#alertstop').slideToggle("slow");
					setTimeout("hidecallalertstop('alertstop')", 10000);
				}
				str = "";
			}
			if(data == "<script>window.location='/'</script>" || data == "<script>window.location='/login.php?err=0'</script>")
			{
				
				window.location="/";
			}
			data ="";
			
		});
	}
	//setTimeout("callalertstop()", 30000);
}
// this code added in alerts.php
//function updateaccess(ins,uia) {
//	
//	$.post("/mails/updatelastaccess.php", {'lastappid': ins,'uia':uia});
//}
function hidecallalertstop(alertname)
{
	$('#'+alertname).hide();
}
function changestatus(userid)
{		
	msg = $('#currstatus').val();
	$('#mystatus').html('');
	$.post('/active18/social/changestatus.php',{'msg':msg},function(data){ 
		if(msg != '')
		{
			$('#mystatus').html("<b>"+msg+"</b> [ <a title=\"Edit status\"  href=\"#\" class=\"bl_3_11\" onclick=\"$(\'#mystatus\').hide();$(\'#editstatus\').show();\" >Edit</a> ]");
		}
		else
		{
			$('#mystatus').html("<b>"+msg+"</b> [ <a title=\"Update status\"  href=\"#\" class=\"bl_3_11\" onclick=\"$(\'#mystatus\').hide();$(\'#editstatus\').show();\" >Update your status</a> ]");
		}
		$('#editstatus').hide();
			$('#mystatus').show();
			
			
	});
	
}
function newtopsignin()
{
	var str_username="";
	//$.post('/active18/common/functiongetvalue.php',{'passstr':readCookie('ui')},function(data){
		
//if(data =='Signin')


		if(readCookie('ui') == null || readCookie('ui') == '' || readCookie('ui')== undefined ||  readCookie('ui')== 'deleted' )
		{
			
			strlogin = '<div ><a href="#"  onclick="addsignin(\'home\',\'\',\'\');" class="w_11"><b>Sign in</b></a></div>';
			$('#topsignin').html(strlogin);	
			
			if(readCookie('un')!='' && readCookie('un')!=null)
			{
				$.post("/active18/getusername.php",'', function(data1) { 
					str_username = data1;

					if (document.getElementById('f_id') != null)
					{
							$('#f_id').val(str_username);							
					}
					if (document.getElementById('f_id_new') != null)
					{
							$('#f_id_new').val(str_username);							
					}
					if(str_username != '')
					{
							if (document.getElementById('rememberme') != null)
								document.getElementById('rememberme').checked = true;
							if (document.getElementById('rememberme_new') != null)
								document.getElementById('rememberme_new').checked = true;
					}

				});
			}

			
			strhomelink = '<div style="padding:3px 8px 0px 8px;"><div class="PB5"><h2>Sign in</h2></div><div style="width:268px;"><form name="frmloginverify" method="POST" action="http://www.in.com/active18/loginverifyothers.php" ><div><input type="text" id="f_id" name="f_id" value="'+str_username+'" class="txtInput" style="width:250px;" /><input type="hidden" id="f_idmain" name="f_idmain" value="" size="27" class="txtInput4" /><input type="hidden" id="f_pwdmain" name="f_pwdmain" value="" /></div><div class="PT5"><input type="Password" id="f_pwd" name="f_pwd" value="" class="txtInput" onkeypress="{if (event.keyCode==13) loginverify_new(this.form)}" style="width:250px;" /></div><div class="PT5 gD_12"><INPUT TYPE="checkbox" NAME="rememberme" id="rememberme" value="1"> Remember me on this computer.</div><div class="PT10 PB10"><div class="FL"><input type="image" src="http://www.xiphiasportal.com/active18/images/home_login.gif"  onclick="return loginverify_new(this.form)"/></div><div class="FL PL10 PT10"><a href="#" class="bl_2_12" onclick="forgotin();">Forgot Password?</a> &nbsp;&nbsp;</div><div class="CL"></div><div class="PT10"><a href="/mails/new_reg.php"><img src="http://www.xiphiasportal.com/active18/images/h_signupfree3.gif" /></a></div></div><div style="display:none;"><INPUT TYPE="hidden" id="f_sourceret" name="f_sourceret" value="'+location.href+'"><INPUT TYPE="hidden" id="f_callback" name="f_callback" value=""></div><div id="disperrhome"></div></div></form></div>';
				
			//strhomelink = '<div style="padding:5px 10px;"><div class="PB5"><h2>Sign in</h2></div><div style="width:268px;"><div><input type="text" id="f_id" name="" value="'+str_username+'" class="txtInput" style="width:260px;" /><input type="hidden" id="f_idmain" name="f_idmain" value="" size="27" class="txtInput4" /><input type="hidden" id="f_pwdmain" name="f_pwdmain" value="" /></div><div class="PT5"><input type="Password" id="f_pwd" value=""  value="" class="txtInput" style="width:260px;" onkeypress="{if (event.keyCode==13) loginverify(\'\')}"  /></div><div class="PT5"><div class="FL PT3 PR5"><a href="#" onclick="loginverify(\'\')"><img src="http://www.xiphiasportal.com/active18/images/home_login.gif" /></a></div><div class="FL PL10 PT10"><a href="#" onclick="forgotin();" class="bl_2_12">Forgot Password?</a> &nbsp;&nbsp; </div><div class="CL"></div></div><div class="PT10"><a href="/mails/new_reg.php"><img src="http://www.xiphiasportal.com/active18/images/h_signupfree3.gif" /></a></div></div></div>';
			if (document.getElementById('homesignin') != null)
					$('#homesignin').html(strhomelink);
			displaysignout_top();

			
				
		}
		else 
		{
			displaysignin_top();
			var display_name ="";
			var displayshort_name ="";
			var strhomelink ="";
			if(readCookie('dispname') != null && readCookie('dispname') != '' && readCookie('dispname')!= undefined)
			{			
				display_name = readCookie('dispname');
				if(display_name != '')
				{
					displayshort_name = display_name.split('+');
				}
			}
			strlogin = '<div ><B>Hi</B> <a href="/active18/social/userindex.php" class="w_11"><b>'+displayshort_name[0]+'</b></a> &nbsp;&nbsp;&nbsp; <a href="/mails/openstartup/settings"  class="w_11">Settings</a> &nbsp;|&nbsp; <a href="javascript:void(0);" class="w_11" onclick="logoutfn()">Sign out</a></div>';
			
			strhomeadd ='<iframe src="http://stat.in.com/active18/addserver/homeadd300.html" height="305" width="365" frameborder=0></iframe>';	
			
			strhomelink = "<div class='loader'></div>";
			
		
			$('#topsignin').html(strlogin);	
			if (document.getElementById('homesignin') != null) // this will be execute for home page
			{
					$('#homesignin').html(strhomelink);		
					$.post("/active18/mails/fetchmailcount.php", "", function(data1) {
						$.post("/active18/social/fetchfriendrequest.php", "", function(friendrequest) {						
							friendrequest = friendrequest.split('~#~');
							userimage = 'http://www.xiphiasportal.com/active18/images/h_profile_icon.jpg'; 				
		//					if(friendrequest[1].length > 0)
		//					{
		//						userimagearr = friendrequest[1].split('|');
		//						userimage = '/active18/social/thumbnail_4/'+userimagearr[1]+'/'+userimagearr[0]+'.gif';						
		//					}	
							if(friendrequest[2] != '' && friendrequest[2] != undefined && friendrequest[3] != undefined )
							{
								orguserpic = '/active18/social/thumbnail_5/'+friendrequest[3]+'/'+friendrequest[2]+'.gif';
							}
							else
							{
								if(friendrequest[4] != '' && friendrequest[4] != undefined)
								{
									orguserpic = '/active18/social/images/'+friendrequest[4]+'_blank.jpg';
								}
								else
								{
									orguserpic = '/active18/social/images/M_blank.jpg';
								}
							}
						strhomelink = '<div style="padding:5px 10px;"><div class="pr_brd_b" style="padding-bottom:7px;"><div class="FL" style="width:60px;"><img src='+orguserpic+' width="50" height="38"></div><div class="FL"><h3>'+displayshort_name[0]+'</h3>';

						if(friendrequest[1] != '')
							{
									strhomelink = strhomelink + '<p class="gD_11" id="mystatus">'+friendrequest[1]+' [ <a href="#" title=\"Edit status\" class="bl_3_11" onclick="$(\'#mystatus\').hide();$(\'#editstatus\').show();">Edit</a> ]</p><div style="display:none" id="editstatus"><p class="FL PR3"><input type="text" name="currstatus" id="currstatus" value="'+friendrequest[1]+'" class="txtInput2" style="width:150px;" /></p><p class="FL"><input type="image"  alt=\"Update status\" src="http://www.xiphiasportal.com/active18/images/h_update.gif" border="0" onclick="changestatus();$(\'#mystatus\').show();$(\'#editstatus\').hide();"/></p><p class="CL"></p></div>';
							}
							else
							{
									strhomelink = strhomelink + '<p class="gD_11" id="mystatus"> [ <a href="#" title=\"Update status\" class="bl_3_11" onclick="$(\'#mystatus\').hide();$(\'#editstatus\').show();">Update your status</a> ]</p><div style="display:none" id="editstatus"><p class="FL PR3"><input type="text" name="currstatus" id="currstatus" value="" class="txtInput2" style="width:150px;" /></p><p class="FL"><input type="image" src="http://www.xiphiasportal.com/active18/images/h_update.gif"  alt=\"Update status\" border="0"  onclick="changestatus();$(\'#mystatus\').show();$(\'#editstatus\').hide();"/></p><p class="CL"></p></div>';
							}
						strhomelink = strhomelink + '</div><div class="CL"></div></div><div style="padding:6px 0px;"><div class="FL PR5"><img src="http://www.xiphiasportal.com/active18/images/h_mail_icon.gif" /></div><div class="FL"><a href="/mails/mailstartup" class="bl_2_12">'+data1+'</a></div><div class="CL"></div></div><div style="padding:6px 0px;"><div class="FL PR5"><img src="http://www.xiphiasportal.com/active18/images/h_profile_icon.jpg" /></div><div class="FL gD_12"><a href="/active18/social/userindex.php" class="bl_2_12">My Profile</a>';

						if(friendrequest[0] != "" && friendrequest[0].length > 2)
						{
								strhomelink = strhomelink + '<span class="gL_11">&nbsp;-&nbsp;'+friendrequest[0]+'</span> <!--p class="PT3"><a href="#"	class="bl_3_11">3 Friend requests</a>, <a href="#" class="bl_3_11">2 Messages</a></p-->';
						}

						strhomelink = strhomelink + '</div><div class="CL"></div></div><div style="padding:6px 0px;"><div class="FL PR5 PT3"><img src="http://www.xiphiasportal.com/active18/images/h_feed_icon.jpg" /></div><div class="FL"><a href="/news/myfeeds.html" class="bl_2_12">My Feeds</a></div><div class="CL"></div></div><div style="padding:6px 0px;"><div class="FL PR5"><img src="http://www.xiphiasportal.com/active18/images/lightbulb.gif"></div><div class="FL"><a href="/mails/invitefriends.php" class="bl_2_12">Invite your friends Now!</a></div><div class="CL"></div></div></div>';
						if (document.getElementById('homesignin') != null)
							$('#homesignin').html(strhomelink);
					
						});
					});
			}// this is for home page
		
			
		}
		
	
//	});
	
	
}

function includejsfiles(script_filename) {
    document.write('<' + 'script');
    document.write(' language="javascript"');
    document.write(' type="text/javascript"');
    document.write(' src="' + script_filename + '">');
    document.write('</' + 'script' + '>');
}

function rightads(param) 
{
	if((readCookie('ui') != null && readCookie('ui') != '' && readCookie('ui')!= undefined && readCookie('ui')!= 'deleted' ) && (param == "1"))
	//if(param == "1")// for watch
	{
			strrightadd ='<script type="text/javascript"> OAS_AD(\'Middle\'); </script> <!-- OAS AD \'Middle\' end -->';
	}
	else
	{
		if(readCookie('ui') == null || readCookie('ui') == '' || readCookie('ui')== undefined ||  readCookie('ui')== 'deleted' )
		{
			if(location.href == 'http://www.in.com/listen' || location.href == 'http://www.in.com/listen/' || location.href == 'http://www.in.com/listen/#' || location.href == 'http://www.in.com/music' || location.href == 'http://www.in.com/music/' || location.href == 'http://www.in.com/music/#' || location.href == 'http://www.in.com/music/index.html' || location.href == 'http://www.in.com/listen/index.html'  || location.href == 'http://www.in.com/active18/listen' || location.href == 'http://www.in.com/active18/listen/' || location.href == 'http://www.in.com/active18/listen/#' || location.href == 'http://www.in.com/active18/listen/index.html')
			{	
				strrightadd ='<iframe src="http://www.in.com/active18/addserver/promo1.html" height="250" width="300" frameborder=0></iframe>';
			}
			else
			{
				strrightadd ='<script type="text/javascript"> OAS_AD(\'Middle\'); </script> <!-- OAS AD \'Middle\' end -->';
			}
		}
		else 
		{
			//strrightadd ='<a href="/active18/readnow/"><img src="http://www.xiphiasportal.com/active18/images/read01.jpg" /></a>';
			
			//strrightadd ='<a href="/mails/referral/friendreferal.php"><img src="http://www.xiphiasportal.com/active18/addserver/referral/referalB_300x250.jpg" /></a>';
			
			//strrightadd ='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="300" height="250"><param name="movie" value="http://stat.in.com/active18/addserver/photobanner/photos_v1.swf" /> <param name="quality" value="high" />  <embed src="http://stat.in.com/active18/addserver/photobanner/photos_v1.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="300" height="250"></embed></object>';
			
			//strrightadd ='<iframe src="http://www.in.com/active18/addserver/photobanner/photo.html" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" width="300" height="250"></iframe>';
			
			
			if(location.href == 'http://www.in.com/listen' || location.href == 'http://www.in.com/listen/' || location.href == 'http://www.in.com/listen/#' || location.href == 'http://www.in.com/music' || location.href == 'http://www.in.com/music/' || location.href == 'http://www.in.com/music/#' || location.href == 'http://www.in.com/music/index.html' || location.href == 'http://www.in.com/listen/index.html'  || location.href == 'http://www.in.com/active18/listen' || location.href == 'http://www.in.com/active18/listen/' || location.href == 'http://www.in.com/active18/listen/#' || location.href == 'http://www.in.com/active18/listen/index.html')
			{
				strrightadd ='<iframe src="http://www.in.com/active18/addserver/photobanner/photo.html" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" width="300" height="250"></iframe>';
			}
			else
			{
				strrightadd ='<script type="text/javascript"> OAS_AD(\'Middle\'); </script> <!-- OAS AD \'Middle\' end -->';
			}
			
		}
	}
	if (document.getElementById('rightadd300') != null)
			$('#rightadd300').html(strrightadd);
			
}
function homeads()
{
		if(readCookie('ui') == null || readCookie('ui') == '' || readCookie('ui')== undefined ||  readCookie('ui')== 'deleted' )
		{
			
			$('#invitefrndsign').show();
			$('#invitefrndsign1').hide();
			$('#homeadd300login').hide();
			$('#homeadd300').show();

		} 
		else 
		{
			
			$('#invitefrndsign').hide();
			$('#invitefrndsign1').show();
			$('#homeadd300').hide();
			$('#homeadd300login').show();
		}
			
			
}
function displaysignout_top()
{
			$('#login2maildiv02').hide();
			$('#tmenu6').hide();
			$('#login2maildiv01').show();
			$('#login2maildiv11').show();
}
function displaysignin_top()
{
			$('#login2maildiv02').show();
			$('#tmenu6').show();
			$('#login2maildiv01').hide();
			$('#login2maildiv11').hide();
}

function clearthis(e,v)
	{
		if(e.value==v)
			e.value="";
	}
function displaythis(e,v)
	{
		if(e.value=="")
			e.value=v;
	}
