//homeleftnav

//property show and hide functions
function sname(){
		document.searchn.keyword.value="Enter name";
}
function smail(){
		document.searchn.keyword.value="Enter email";
}



//show lease interface table

function blurcvview(){
	if(document.viewcv.cvo.value==""){
		document.viewcv.cvo.value="Enter CV ID";
		document.getElementById('cvo').style.color='#cccccc';
	}
}
function clickcvview(){
	if(document.viewcv.cvo.value=="Enter CV ID"){
		document.viewcv.cvo.value="";
		document.getElementById('cvo').style.color='#000000';
	}
}
//show cv view interface
function hideps(){
document.getElementById('pfs').innerHTML='';
document.getElementById('pfl').innerHTML='';
document.getElementById('pfr').innerHTML='';
}
function hidecview(){
document.getElementById('cvview').innerHTML='';
}
//hide property interface
//end property interface 

//start friends search interface




function clearfage(){
	if(document.frsearch.fage.value=="From"){
		document.frsearch.fage.value="";
		document.getElementById('fage').style.color="#000000";
	}
}
function cleartage(){
	if(document.frsearch.tage.value=="To"){
		document.frsearch.tage.value="";
		document.getElementById('tage').style.color="#000000";
	}
}
function popfage(){
	if(document.frsearch.fage.value==""){
		document.frsearch.fage.value="From";
		document.getElementById('fage').style.color="#cccccc";
	}
}
function poptage(){
	if(document.frsearch.tage.value==""){
		document.frsearch.tage.value="To";
		document.getElementById('tage').style.color="#cccccc";
	}
}

//search by old school
function hidefsearch(){
	document.getElementById('fcity').innerHTML='';
	document.getElementById('fcountry').innerHTML='';
	document.getElementById('fosf').innerHTML='';
	document.getElementById('fwp').innerHTML='';
	document.getElementById('fprofession').innerHTML='';
}
//hide new friends search 
//ends friends search interface
//homeleftnav ends

//userpanu 
function frsignup(){
showsignup();
}

function hidesignup(){
defualt();
}
//userpanu ends

//userpan
function showcpassword(){
document.getElementById("cpassword").style.visibility="visible";
document.getElementById("cpasswordd").innerHTML="<table width='309' border='0' bordercolor='#CCCCCC' bgcolor='#ECE9D8'>      <tr>        <td colspan='4' bgcolor='#CBC7B8'><div align='center'>CHANGE PASSWORD </div></td>      </tr>      <tr>        <td width='126' bgcolor='#ECE9D8'><span class='style10'>Current Password :</span></td>        <td width='167' colspan='3' bgcolor='#ECE9D8'><div align='left'>            <input name='curpassword' type='password' maxlength='25'/>        <font color='red'>*</font></div></td>      </tr>      <tr>        <td bgcolor='#ECE9D8'><span class='style10'>Password</span></td>        <td colspan='3' bgcolor='#ECE9D8'><div align='left'>            <input name='newpassword' type='password' maxlength='25' onKeyup='purluserpan();'  /> <input name='urlname' type='hidden'/><input name='fdname' type='hidden' value='password'/>          <font color='red'>*</font><br />          <span class='style21 style3'> atleast 6 letters</span> </span></div></td>      </tr>      <tr>        <td bgcolor='#ECE9D8'><span class='style10'>Confirm Password:</span></td>        <td colspan='3' bgcolor='#ECE9D8'><div align='left'>            <input name='cpassword' type='password' />            <font color='red'>*</font></div></td>      </tr>      <tr>        <td colspan='4' bgcolor='#ECE9D8'><div align='center'>            <input type='button' name='Submit32' value='Change' onClick='valcpassword();' />			<input type='button' name='cancel' value='Cancel' onclick='hidecpassword();'  />        </div></td>      </tr>  </table>";
}
function hidecpassword(){
document.getElementById("cpassword").style.visibility="hidden";
}
function valcpassword(){
	var newpas=document.chpassword.newpassword.value;
	if(document.chpassword.newpassword.value!=document.chpassword.cpassword.value){
		alert("The new passwords you provided do not match.");
	}
	else if(document.chpassword.curpassword.value==""){
		alert("Please provide your current password.");
	}
	else if(document.chpassword.newpassword.value==""){
		alert("Please provide a new password.");
	}
	
	else if(newpas.length<6){
		alert("Your password must atleast contain six letters.");
	}
	else{
		userpanasync();
	}
}
function valuservisan(){
	if(document.chpassword.urlname.value==""){
		alert("To change the information bar display, Select a valid display option");
	}
	else{
		uservisanasync();
	}
}
//userpan ends

function valims(){
	if(document.ims.sinbox.checked==false && document.ims.ssms.checked==false){
		alert("Please select either inbox, sms or both");
		return false;
	}
	
	if(document.ims.ssms.checked==true){
	alert("Your credit is too low for sms. Please recharge your account");
	return false;
	}
	return true;
}

function sschool(){
	i=document.searchschool.searchtype.selectedIndex;
	soptions=document.searchschool.searchtype.options[i].value;
	if(soptions=="oldfrnd"){
	document.searchschool.keyword.value="Enter name of school here";
	soption=document.searchschool.keyword.value;
	}
	if(soptions=="prof"){
	document.searchschool.keyword.value="Enter profession name here";
	soption=document.searchschool.keyword.value;
	}
	if(soptions=="country"){
	document.searchschool.keyword.value="Enter country name here";
	soption=document.searchschool.keyword.value;
	
	}
	if(soptions=="city"){
	document.searchschool.keyword.value="Enter city name here";
	soption=document.searchschool.keyword.value;
	
	}
	if(soptions=="wplace"){
	document.searchschool.keyword.value="Enter city name company";
	soption=document.searchschool.keyword.value;
	
	}
	
	
	
}

function sschooln(){
	i=document.searchn.searchtype.selectedIndex;
	soptions=document.searchn.searchtype.options[i].value;
if(soptions=="namesf"){
	document.searchn.keyword.value="Enter friends name here";
	soption=document.searchn.keyword.value;
	}
	if(soptions=="email"){
	document.searchn.keyword.value="Enter friends email here";
	soption=document.searchn.keyword.value;
	}	
	
}


function valfsearch(){
i=document.searchschool.searchtype.selectedIndex;
	soptions=document.searchschool.searchtype.options[i].value;
fage=document.searchschool.fage.value;
tage=document.searchschool.tage.value;
if(document.searchschool.fage.value>document.searchschool.tage.value){
alert("Please make sure your from age is smaller than the to age");
return false;
}
if((fage=="" && tage!="") || (fage!="" && tage=="")){
alert("Please enter a corresponding age intervals");
return false;
}
if(document.searchschool.keyword.value=="Enter name of school here" || document.searchschool.keyword.value=="Enter profession name here" || document.searchschool.keyword.value=="Enter country name here" || document.searchschool.keyword.value=="Enter city name here" || document.searchschool.keyword.value==""){
alert("Please enter a valid keyword");
return false;
}
return true;

}
function mtykeyword(){
if(document.searchschool.searchtype.options[document.searchschool.searchtype.selectedIndex].value=="All"){
alert("Please select a valid search type before entering a keyword");
document.searchschool.keyword.value="Select a search type";
}
}


//meetfriends ends
function valnsearch(){
	 if(document.searchn.keyword.value=="Enter friends name here" || document.searchn.keyword.value=="Enter friends email here" || document.searchn.keyword.value<" "){
		 alert("Please enter a valid key word");
		 return false
	 }
	 return true;
}

function clearkw(){
	
	if(document.searchn.keyword.value=="Enter name" || document.searchn.keyword.value=="Enter email"){
		document.searchn.keyword.value="";
		document.getElementById("keyword").style.color="#000000";
	}
}

function popkw(){
	if(document.searchn.keyword.value==""){
		document.getElementById("keyword").style.color="#cccccc";
		
	}
}
//index search bar
function rpwd(){
	document.getElementById("rpassword").style.visibility="visible";
}
function hiderpwd(){
	document.getElementById("rpassword").style.visibility="hidden";
}
function poppwd(){
	if(document.gpassword.password.value==""){
		document.gpassword.password.value="Enter your email here";
	}
}
function clearpwd(){
	if(document.gpassword.password.value=="Enter your email here"){
		document.gpassword.password.value="";
	}
}

function userpanv(){
	
		document.getElementById("cpassword").style.visibility="visible";
		document.getElementById("cpasswordd").innerHTML="<table width='309' border='0' bordercolor='#CCCCCC' bgcolor='#ECE9D8'>      <tr>        <td colspan='4' bgcolor='#CBC7B8'><div align='center'>CHANGE INFO. BAR DISPLAY </div></td>      </tr>      <tr>        <td colspan='4' bgcolor='#ECE9D8'><select name='datavalue' onChange='purluservisan();'>    <option value='' selected>- - Select option - -</option> <option value='no'>Always Minimize</option>    <option value='yes'>Always Display</option>  </select><input name='urlname' type='hidden'/></td>        </tr>                  <tr>        <td colspan='4' bgcolor='#ECE9D8'><div align='center'>            <input type='button' name='Submit32' value='Change' onClick='valuservisan();' />			<input type='button' name='cancel' value='Cancel' onclick='hidecpassword();'  />        </div></td>      </tr>  </table>";
		
}

function opiv(){
	
		document.getElementById("cpassword").style.visibility="visible";
		document.getElementById("cpasswordd").innerHTML="<table width='309' border='0' bordercolor='#CCCCCC' bgcolor='#ECE9D8'>      <tr>        <td colspan='4' bgcolor='#CBC7B8'><div align='center'>INVITE FRIENDS </div></td>      </tr>        <tr>    <td colspan='4' bgcolor='#ECE9D8'>Name:    <input name='name' type='text' id='name' onKeyUp='changename();'/></td>  </tr>  <tr>    <td colspan='4' bgcolor='#ECE9D8'>E-mail:    <input name='email' type='text' id='email' /></td>  </tr>  <tr>    <td colspan='4' bgcolor='#ECE9D8'><span class='style1' id='nf'>Your friend </span> is: </td>  </tr>  <tr>    <td colspan='4' bgcolor='#ECE9D8'><label>      <input name='jstatus' type='radio' value='job' />seeking for Job</label>      <label>      <input type='radio' name='jstatus' value='employer' />an employer</label></td>  </tr>  <tr>          <td colspan='4' bgcolor='#ECE9D8'><input name='mfriend' type='checkbox' id='mfriend' value='checkbox' />Loves making friends<br /><input name='bman' type='checkbox' id='bman' value='checkbox' />business man/woman</td></tr>                  <tr>        <td colspan='4' bgcolor='#ECE9D8'><div align='center'>            <input type='submit' name='button' value='Invite ' />			<input type='button' name='cancel' value='Cancel' onclick='hidecpassword();'  />        </div></td>      </tr>  </table>";
		
}
function changename(){
	document.getElementById("nf").firstChild.nodeValue=document.chpassword.name.value + " ";
	
	document.chpassword.Submit.value="Invite " + document.chpassword.name.value;
}
function valinv(){
	if(document.chpassword.name.value<" "){
		alert("Please enter friend's name");
		return false;
	}
	if(document.chpassword.email.value<" "){
		alert("Please enter friend's email");
		return false;
	}
	return true;

}
function purluserpan(){
	if(document.chpassword.newpassword.value!=""){
		var oldvalue=document.chpassword.curpassword.value;
		var valuedata=document.chpassword.newpassword.value;
		var username=document.chpassword.username.value;
		var fdname=document.chpassword.fdname.value;
		
		document.chpassword.urlname.value="cpassword.php?dataname="+fdname+"&id="+username+"&datavalue="+valuedata+"&oldvalue="+oldvalue;
	}
	else{
		document.chpassword.urlname.value="";
	}
}
function purluservisan(){
	if(document.chpassword.datavalue.value!=""){
		var valuedata=document.chpassword.datavalue.value;
		var username=document.chpassword.username.value;
		
		document.chpassword.urlname.value="userpanvisibility.php?id="+username+"&datavalue="+valuedata;
	}
	else{
		document.chpassword.urlname.value="";
	}
}

function schoolmenu(){
		document.getElementById('market').innerHTML='';
			document.getElementById('cvview').innerHTML='';
	document.getElementById('schoolmm').innerHTML='<form id="form1" name="form1" method="post" action="schoolbank.php" onsubmit="return valschoolid();" style="background-color:#00FF33">        <label><font size="-1">Edit school:</font> <br />        <input name="schoolid" type="text" id="schoolid" style="color:#cccccc;" value="School ID" size="10" onblur="bluri();" onclick="clicki();" />        </label>        <label>        <input type="submit" name="Submit" value="Go" />        </label>        <strong><a href="educational.php">View Nigerian Schools</a></strong>      </form>  ';
}

function valschoolid(){
	if(document.form1.schoolid.value<" " || document.form1.schoolid.value=="School ID"){
		alert("Please enter a school ID");
		return false;
	}
	return true;
}
function bluri(){
	if(document.form1.schoolid.value==""){
		document.form1.schoolid.value="School ID";
		document.getElementById('schoolid').style.color='#cccccc';
	}
}
function clicki(){
	if(document.form1.schoolid.value=="School ID"){
		document.form1.schoolid.value="";
		document.getElementById('schoolid').style.color='#000000';
	}
}
