function echeckinvite(str,ermsgid) {
      var at="@"
      var dot="."
      var lat=str.indexOf(at)
      var lstr=str.length
      var ldot=str.indexOf(dot)
      if (str.indexOf(at)==-1){
	      document.getElementById(ermsgid).style.display="block";
        document.getElementById(ermsgid).innerHTML='Invalid Email Id';
         return false;
      }

      if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	      document.getElementById(ermsgid).style.display="block";
         document.getElementById(ermsgid).innerHTML='Invalid Email Id';
         return false;
      }


      if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	      document.getElementById(ermsgid).style.display="block";
           document.getElementById(ermsgid).innerHTML='Invalid Email Id';
          return false;
      }

       if (str.indexOf(at,(lat+1))!=-1){
	       document.getElementById(ermsgid).style.display="block";
           document.getElementById(ermsgid).innerHTML='Invalid Email Id';
          return false;
       }

       if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	       document.getElementById(ermsgid).style.display="block";
           document.getElementById(ermsgid).innerHTML='Invalid Email Id';
          return false;
       }

       if (str.indexOf(dot,(lat+2))==-1){
	       document.getElementById(ermsg).style.display="block";
	 document.getElementById(ermsgid).innerHTML='Invalid Email Id';
          return false;
       }
       if (str.indexOf(" ")!=-1){
	       document.getElementById(ermsgid).style.display="block";
          document.getElementById(ermsgid).innerHTML='Invalid Email Id';
          return false;
   }

       return true;
   }
function validateLogin(){
   var emailID=document.getElementById('lemail');
   var password=document.getElementById('lpassword');
   if ((emailID.value==null)||(emailID.value=="")){
      document.getElementById('errormsgdisplay').style.display="block";
	document.getElementById('errormsgdisplay').innerHTML='Enter Email Id';
	setTimeout('document.getElementById(\'errormsgdisplay\').style.display="none"', 5000);

      emailID.focus();
      return false;
   }
   if (echeckinvite(emailID.value,'errormsgdisplay')==false){
      emailID.focus();
     return false;
   }
   if ((password.value==null)||(password.value=="")){
      document.getElementById('errormsgdisplay').style.display="block";
      document.getElementById('errormsgdisplay').innerHTML='Enter Password';
      password.focus();
      setTimeout('document.getElementById(\'errormsgdisplay\').style.display="none"', 5000);
      return false;
      return false;
   }
  return true;
 }
function validateRegister(){
   var emailID=document.getElementById('rregemail');
   if ((emailID.value==null)||(emailID.value=="")){
	 document.getElementById('errormsgdisplay').style.display="block";
	document.getElementById('errormsgdisplay').innerHTML='Enter Email Id';
	setTimeout('document.getElementById(\'errormsgdisplay\').style.display="none"', 5000);

      emailID.focus();
      return false;
   }
   if (echeckinvite(emailID.value,'errormsgdisplay')==false){
      emailID.focus();
     return false;
   }
   return true;
 }
function validateForgotPass(){
	var emailID=document.getElementById('lfpassemail');
   if ((emailID.value==null)||(emailID.value=="")){
	emailID.focus();
      document.getElementById('errormsgdisplay').style.display="block";
	document.getElementById('errormsgdisplay').innerHTML='Enter Email Id';
	setTimeout('document.getElementById(\'errormsgdisplay\').style.display="none"', 5000);
      return false;
   }
   if (echeckinvite(emailID.value,'errormsgdisplay')==false){
      emailID.focus();
     return false;
   }
   return true;
 }

function validateAjaxLogin(){
   var emailID=document.getElementById('email');
   var password=document.getElementById('password');
   if ((emailID.value==null)||(emailID.value=="") ||(emailID.value=="Email Id")){
      document.getElementById('loginerrormsg').style.display="block";
      document.getElementById('fpasserrormsg').style.display="none";      
      document.getElementById('loginerrormsg').innerHTML='Enter Email Id';
      emailID.focus();
      return false;
   }
   if (echeckinvite(emailID.value,'loginerrormsg')==false){
      emailID.focus();
     return false;
   }
   if ((password.value==null)||(password.value=="")||(password.value=="*****")){
      document.getElementById('loginerrormsg').style.display="block";
      document.getElementById('fpasserrormsg').style.display="none";
      document.getElementById('loginerrormsg').innerHTML='Enter Password';
      password.focus();
      return false;
   }
  return ajaxlogin();
 }
function validateAjaxRegister(){
   var emailID=document.getElementById('regemail');
   if ((emailID.value==null)||(emailID.value=="")||(emailID.value=="Email Id")){
      document.getElementById('regerrormsg').style.display="block";
      document.getElementById('regerrormsg').innerHTML='Enter Email Id';
      emailID.focus();
      return false;
   }
   if (echeckinvite(emailID.value,'regerrormsg')==false){
      emailID.focus();
     return false;
   }
   return ajaxregister();
 }
function validateAjaxForgotPass(){
	var emailID=document.getElementById('fpassemail');
   if ((emailID.value==null)||(emailID.value=="")||(emailID.value=="Email Id")){
	document.getElementById('loginerrormsg').style.display="none";
      document.getElementById('fpasserrormsg').style.display="block";
      document.getElementById('fpasserrormsg').innerHTML='Enter Email Id';
      emailID.focus();
      return false;
   }
   if (echeckinvite(emailID.value,'fpasserrormsg')==false){
      emailID.focus();
     return false;
   }
   return ajaxforgotpass();
 }
function ajaxlogin(){
Email=document.getElementById('email').value;
Password=document.getElementById('password').value;
logincheck= HttpRequest("/?action=ajaxlogin&email="+ Email +"&password="+ Password +"&id="+Math.random());
//logincheck=logincheck.substring(3);
if(logincheck==1){
	return true;
}
else{
	document.getElementById('loginerrormsg').style.display="block";
	document.getElementById('loginerrormsg').innerHTML=logincheck;
	return false;
}
}
function ajaxregister(){
Email=document.getElementById('regemail').value;
regcheck= HttpRequest("/?action=ajaxregister&regemail="+ Email +"&id="+Math.random());
//regcheck=regcheck.substring(3);
if(regcheck==1){
	return true;
}
else{
	document.getElementById('regerrormsg').style.display="block";
	document.getElementById('regerrormsg').innerHTML=regcheck;
	return false;
}
}
function ajaxforgotpass(){
Email=document.getElementById('fpassemail').value;
fpasscheck= HttpRequest("/?action=ajaxfpass&fpassemail="+ Email +"&id="+Math.random());
//fpasscheck=fpasscheck.substring(3);
if(fpasscheck==1){
	document.getElementById('fpasssucmsg').style.display="block";
	document.getElementById('fpasserrormsg').style.display="none";
	document.getElementById('fpasssucmsg').innerHTML='Password sent to your mailbox.Please Check Spam folder too';
	return false;
}
else{
	document.getElementById('fpasserrormsg').style.display="block";
	document.getElementById('fpasserrormsg').innerHTML=fpasscheck;
	return false;
}
}
function AddFriend(username,firstname,lastname,receiverid,senderid){
	if(firstname!=''){
		name=firstname+" "+lastname;
	}
	else{
		name=username;
	}
	if(senderid==''){
		document.getElementById('infomsgdisplay').style.display="block";
		document.getElementById('infomsgdisplay').innerHTML='Please <a href="javascript:void(0);" onClick="showdiv(\'asklogin\');showdiv(\'transparent_body\')">Login</a> or <a href="javascript:void(0);" onClick="showdiv(\'askregister\');showdiv(\'transparent_body\')">Register</a> to add '+name+' as friend';
		setTimeout('document.getElementById(\'infomsgdisplay\').style.display="none"', 20000);
		return false;
   }
   else{
	 var addconfirm=confirm("Do you want to add "+name+" as your friend?");
	if(addconfirm){
		addfriend= HttpRequest("/?action=addfriend&receiverid="+receiverid+"&id="+Math.random());
	//	addfriend=addfriend.substring(3);
		if(addfriend==1){
			document.getElementById('successmsgdisplay').style.display="block";
			document.getElementById('successmsgdisplay').innerHTML='Friend request has been sent to '+name;
			setTimeout('document.getElementById(\'successmsgdisplay\').style.display="none"', 5000);
			return false;

		}
		else{
			document.getElementById('warningmsgdisplay').style.display="block";
			document.getElementById('warningmsgdisplay').innerHTML=addfriend;
			setTimeout('document.getElementById(\'warningmsgdisplay\').style.display="none"', 5000);
			return false;
		}

	}
	else{
		return false;
	}
	 
   }
}

function DeleteFriend(username,firstname,lastname,receiverid,senderid){
	if(firstname!=''){
		name=firstname+" "+lastname;
	}
	else{
		name=username;
	}
	if(senderid==''){
		document.getElementById('infomsgdisplay').style.display="block";
		document.getElementById('infomsgdisplay').innerHTML='Please <a href="javascript:void(0);" onClick="showdiv(\'asklogin\');showdiv(\'transparent_body\')">Login</a> or <a href="javascript:void(0);" onClick="showdiv(\'askregister\');showdiv(\'transparent_body\')">Register</a> to delete '+name+' from friendlist';
		setTimeout('document.getElementById(\'infomsgdisplay\').style.display="none"', 20000);
		return false;
   }
   else{
	 var deleteconfirm=confirm("Do you want to delete "+name+" from your friend list?");
	if(deleteconfirm){
		deletefriend= HttpRequest("/?action=deletefriend&receiverid="+receiverid+"&id="+Math.random());
	//	addfriend=addfriend.substring(3);
		if(deletefriend==1){
			document.getElementById('successmsgdisplay').style.display="block";
			document.getElementById('successmsgdisplay').innerHTML=name+' has been deleted from your friendlist';
			location.reload();

		}
		else{
			document.getElementById('warningmsgdisplay').style.display="block";
			document.getElementById('warningmsgdisplay').innerHTML=deletefriend;
			setTimeout('document.getElementById(\'warningmsgdisplay\').style.display="none"', 5000);
			return false;
		}

	}
	else{
		return false;
	}
	 
   }
}

function deletemessage(msgid){
	 var deleteconfirm=confirm("Do you want to Delete this Message?");
	if(deleteconfirm){
		HttpRequest("/?action=deletemessage&messageid="+msgid+"&id="+Math.random());
		location.reload();
		document.getElementById('successmsgdisplay').style.display="block";
		document.getElementById('successmsgdisplay').innerHTML='Message Deleted Successfully';
		setTimeout('document.getElementById(\'successmsgdisplay\').style.display="none"', 5000);
		return false;
	}
	else{
		return false;
	}
	 
   }
function postmessage(obj) {
	if(document.getElementById("message").value=='' || document.getElementById("message").value==null){
		document.getElementById('errormsgdisplay').style.display="block";
		document.getElementById('errormsgdisplay').innerHTML='Please enter your message';
		setTimeout('document.getElementById(\'errormsgdisplay\').style.display="none"', 5000);
	}
	else{	
	      var poststr = "receiverid=" + encodeURIComponent( document.getElementById("receiverid").value ) + "&message=" + encodeURIComponent( document.getElementById("message").value ) +"&postmessagesubmit=Post Message";
	      HttpPostRequest('/?action=messages', poststr);
	}
}
function replypostmessage(obj,sectionid,username) {
	if(document.getElementById("replymessage"+sectionid).value=='' || document.getElementById("replymessage"+sectionid).value==null){
		document.getElementById('errormsgdisplay').style.display="block";
		document.getElementById('errormsgdisplay').innerHTML='Please enter your message';
		setTimeout('document.getElementById(\'errormsgdisplay\').style.display="none"', 5000);
	}
	else{	
	      var poststr = "replyreceiverid=" + encodeURIComponent( document.getElementById("replyreceiverid"+sectionid).value ) + "&replymessage=" + encodeURIComponent( document.getElementById("replymessage"+sectionid).value ) +"&replypostmessagesubmit=Post Message";
	      HttpRequest('/?action=replymessages&'+poststr);
	      showdiv("acknowledgementdiv"+sectionid);
	      document.getElementById("replymessage"+sectionid).value='';
	      hidediv("msgreply"+sectionid);
	      document.getElementById("acknowledgementdiv"+sectionid).innerHTML='Message post successfully. <a href=/'+username+'/messages>Click here</\a> to see the message.';
	}
}
function HttpPostRequest(url,parameters)
 {
http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
		location.reload();
         } else {
            alert('There was a problem with the request.');
         }
      }
   }
function messagedisplay(msg,msgid,time){
	document.getElementById(msgid).style.display="block";
	document.getElementById(msgid).innerHTML=msg;
	if(time!=0){
		setTimeout(document.getElementById(msgid).style.display=+"none", time);
	}
}
function messageattachdisplay(msg,msgid,time){
	document.getElementById(msgid).style.display="block";
	document.getElementById(msgid).innerHTML=document.getElementById(msgid).innerHTML+"<br/>"+msg;
	if(time!=0){
		setTimeout(hidediv(msgid),time);
	}
}

function replyfrndrequest(newstatus,senderid){
	 if(newstatus==1){
		 var requestconfirm=confirm("Do you want to Accept this Friend Request?");
	 }
	 else{
		var requestconfirm=confirm("Do you want to Decline this Friend Request?");
	 }

	if(requestconfirm){
		requeststatus= HttpRequest("/?action=replyfriendrequest&senderid="+senderid+"&status="+newstatus+"id="+Math.random());
		location.reload();
	}
	else{
		return false;
	}
	 
   }
 function validateInviteFriend(){
   var senderemail=document.getElementById('invitesenderemail'); 
   var receiveremail=document.getElementById('invitereceiveremail');
   var message=document.getElementById('message'); 	
  
   if ((senderemail.value==null)||(senderemail.value=="")){
	document.getElementById('invitefrienderrormsg').style.display="block";
      document.getElementById('invitefrienderrormsg').innerHTML='Enter Your Email Id';
      senderemail.focus();
      return false;
   }
   if (echeckinvite(senderemail.value,'invitefrienderrormsg')==false){
      senderemail.focus();
     return false;
   }
   if ((receiveremail.value==null)||(receiveremail.value=="")){
	document.getElementById('invitefrienderrormsg').style.display="block";
      document.getElementById('invitefrienderrormsg').innerHTML='Enter Your Friend\'s Email Id';
      receiveremail.focus();
      return false;
   }
   if (echeckinvite(receiveremail.value,'invitefrienderrormsg')==false){
      receiveremail.focus();
     return false;
   }	
   return true;
 }

function IsAlpha(strString)
   {
   var strValidChars = "abcdefghijklmnopqrstuvwxyz.ABCDEFGHIJKLMNOPQRSTUVWXYZ";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }

function IsNumeric(strString)
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
function isValidURL(url){
    var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/;
    if(RegExp.test(url)){
        return true;
    }else{
        return false;
    }
}
function isValidDate(dateStr,ermsgid) {
// Checks for the following valid date formats:
// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
// Also separates date into month, day, and year variables

var datePat = /^(\d{4})(\/|-)(\d{1,2})\2(\d{1,2})$/;
//var datePat = /^(\d{4})(\/|-)(\d{2})\2(d{2})$/;

// To require a 4 digit year entry, use this line instead:
// var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;
var dt = new Date();
var y  = dt.getYear();
var m = dt.getMonth()+1;
var d = dt.getDate();
if(d<10){
	d="0"+d;
}
if(m<10){
	m="0"+m;
}
// Y2K compliant
if (y < 1000) y +=1900;

var currentdate=y+"0"+m+"0"+d;
// -->

var matchArray = dateStr.match(datePat); // is the format ok?
if (matchArray == null) {
document.getElementById(ermsgid).style.display="block";
document.getElementById(ermsgid).innerHTML='Please enter "Date of Birth" in (YYYY-MM-DD) format';
return false;
}
month = matchArray[3]; // parse date into variables
day = matchArray[4];
year = matchArray[1];
var dob=year+"0"+month+"0"+day;
if(currentdate<=dob){
document.getElementById(ermsgid).style.display="block";
document.getElementById(ermsgid).innerHTML='Please enter valid "Date Of Birth"';	
return false;
}

if (month < 1 || month > 12) { // check month range
document.getElementById(ermsgid).style.display="block";
document.getElementById(ermsgid).innerHTML='Please enter valid "Date Of Birth"';	
return false;
}
if (day < 1 || day > 31) {
document.getElementById(ermsgid).style.display="block";
document.getElementById(ermsgid).innerHTML='Please enter valid "Date Of Birth"';
return false;
}
if ((month==4 || month==6 || month==9 || month==11) && day==31) {
document.getElementById(ermsgid).style.display="block";
document.getElementById(ermsgid).innerHTML='Please enter valid "Date Of Birth"';	
return false;
}
if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day>29 || (day==29 && !isleap)) {
document.getElementById(ermsgid).style.display="block";
document.getElementById(ermsgid).innerHTML='Please enter valid "Date Of Birth"';
return false;
   }
}
return true;  // date is valid
}



function validateFullRegister(){
   if (document.getElementById('contactno').value!=null && document.getElementById('contactno').value!="" ){
	   if(IsNumeric(document.getElementById('contactno').value) == false || document.getElementById('contactno').value.length!=10 || (document.getElementById('contactno').value.substr(0, 1)!=8 && document.getElementById('contactno').value.substr(0, 1)!=9)){
      document.getElementById('fullregerrormsg').style.display="block";
      document.getElementById('fullregerrormsg').innerHTML='Please enter 10 digit valid "Mobile Number"';
      document.getElementById('contactno').focus();
      return false;
	   }
   }
   if (document.getElementById('alternateemail').value!=null && document.getElementById('alternateemail').value!="" ){
	   if (echeckinvite(document.getElementById('alternateemail').value,'fullregerrormsg')==false){
	      document.getElementById('alternateemail').focus();
	     return false;
	   }
   }
   if (document.getElementById('website').value!=null && document.getElementById('website').value!="" ){
	   if (isValidURL(document.getElementById('website').value)==false){
		document.getElementById('fullregerrormsg').style.display="block";
	        document.getElementById('fullregerrormsg').innerHTML='Please enter valid "Website URL"';	   
	        document.getElementById('website').focus();
	     return false;
	   }
   }	
   if (document.getElementById('dob').value!=null && document.getElementById('dob').value!="" ){
	   if (isValidDate(document.getElementById('dob').value,'fullregerrormsg')==false){
	        document.getElementById('dob').focus();
	     return false;
	   }
   }
   if (document.getElementById('txtPhoto').value!=null && document.getElementById('txtPhoto').value!="" ){
	   document.getElementById('photouploadmessage').style.display="";
   }
   return true;

}

function validateCreateBlog(){
   if (document.getElementById('regemail').value==null || document.getElementById('regemail').value=="" ){
	   document.getElementById('fullregerrormsg').style.display="block";
	   document.getElementById('regemail').focus();
           document.getElementById('fullregerrormsg').innerHTML='Please enter "Registration Email Id"';
           return false;
	   }
   if (document.getElementById('regemail').value!='' && echeckinvite(document.getElementById('regemail').value,'fullregerrormsg')==false){
	      document.getElementById('regemail').focus();
	     return false;
	   }	   
   if (document.getElementById('username').value==null || document.getElementById('username').value=="" ){
	   document.getElementById('fullregerrormsg').style.display="block";
	   document.getElementById('username').focus();
           document.getElementById('fullregerrormsg').innerHTML='Please enter "Username" which can be used in Blog Site like http://blogs.indiaonapage.com/"username"/blog.htm';
           return false;
	   }

   if (document.getElementById('contactno').value!=null && document.getElementById('contactno').value!="" ){
	   if(IsNumeric(document.getElementById('contactno').value) == false || document.getElementById('contactno').value.length!=10 || (document.getElementById('contactno').value.substr(0, 1)!=8 && document.getElementById('contactno').value.substr(0, 1)!=9)){
      document.getElementById('fullregerrormsg').style.display="block";
      document.getElementById('fullregerrormsg').innerHTML='Please enter 10 digit valid "Mobile Number"';
      document.getElementById('contactno').focus();
      return false;
	   }
   }
   if (document.getElementById('alternateemail').value!=null && document.getElementById('alternateemail').value!="" ){
	   if (echeckinvite(document.getElementById('alternateemail').value,'fullregerrormsg')==false){
	      document.getElementById('alternateemail').focus();
	     return false;
	   }
   }
   if (document.getElementById('website').value!=null && document.getElementById('website').value!="" ){
	   if (isValidURL(document.getElementById('website').value)==false){
		document.getElementById('fullregerrormsg').style.display="block";
	        document.getElementById('fullregerrormsg').innerHTML='Please enter valid "Website URL"';	   
	        document.getElementById('website').focus();
	     return false;
	   }
   }	
   if (document.getElementById('dob').value!=null && document.getElementById('dob').value!="" ){
	   if (isValidDate(document.getElementById('dob').value,'fullregerrormsg')==false){
	        document.getElementById('dob').focus();
	     return false;
	   }
   }
   return true;

}
function ajaxrecentloginmember(divstatus){
	var page=document.getElementById('recentlogedincurrentpage').value;
	if(divstatus=='increase'){
		page=parseInt(page)+1;
	}
	else if(divstatus=='decrease'){
		page=parseInt(page)-1;
	}
	output=HttpRequest("/?action=getrecentloginmembers&page="+page+"&id="+Math.random());
	iddetails('recentloginmemberdiv').innerHTML=output;
}
function ajaxnewmember(divstatus){
	var page=document.getElementById('currentpage').value;
	if(divstatus=='increase'){
		page=parseInt(page)+1;
	}
	else if(divstatus=='decrease'){
		page=parseInt(page)-1;
	}
	output=HttpRequest("/?action=getnewmembers&page="+page+"&id="+Math.random());
	iddetails('newmemberdiv').innerHTML=output;
//	ajaxcontent('/?action=getnewmembers&page='+page, 'newmemberdiv', '', 'Error');
}
function myfriendlist(divstatus){
	var page=document.getElementById('myfrndcurrentpage').value;
	if(divstatus=='increase'){
		page=parseInt(page)+1;
	}
	else if(divstatus=='decrease'){
		page=parseInt(page)-1;
	}
	output=HttpRequest("/?action=getmyajaxfriendlist&page="+page+"&id="+Math.random());
	iddetails('myfrndlistdiv').innerHTML=output;
//	ajaxcontent('/?action=getnewmembers&page='+page, 'newmemberdiv', '', 'Error');
}
function userfriendlist(divstatus){
	var page=document.getElementById('userfrndcurrentpage').value;
	if(divstatus=='increase'){
		page=parseInt(page)+1;
	}
	else if(divstatus=='decrease'){
		page=parseInt(page)-1;
	}
	output=HttpRequest("/?action=userajaxfriendlist&page="+page+"&id="+Math.random());
	iddetails('myfrndlistdiv').innerHTML=output;
//	ajaxcontent('/?action=getnewmembers&page='+page, 'newmemberdiv', '', 'Error');
}
//myfriendrequest
function sendchat(username){
         var chatmsg=document.getElementById('chatmsgentry').value;	
	 var poststr = "receiverusername=" + username + "&chatmessage=" + encodeURIComponent(chatmsg) +"&chatmessagesubmit=Post Chat";
         output=HttpRequest("/?action=sendchatmessage&"+poststr);
	 document.getElementById('chatmsg').innerHTML=output;
	 document.getElementById('chatmsgentry').value='';
	 document.getElementById('divchatstatus').innerHTML='';

      }
function Smiles(which) {
  document.getElementById('chatmsgentry').value = document.getElementById('chatmsgentry').value + which;
  document.getElementById('chatmsgentry').focus();
  }
function chatwindow(name,username,senderusername){
	output=HttpRequest("/?action=getchatwindow&name="+name+"&username="+username+"&senderusername="+senderusername);
	 document.getElementById('getchatwindowdiv').innerHTML=output;
      }

function validateinvitefriend(){
   if (document.getElementById('emailprovider').value==null || document.getElementById('emailprovider').value=="" ){
      document.getElementById('errormsgdisplay').style.display="block";
		alert('Please select "Email Provider Name"');
		document.getElementById('errormsgdisplay').innerHTML='Please select "Email Provider Name"';
		setTimeout('document.getElementById(\'errormsgdisplay\').style.display="none"', 10000);	
	      document.getElementById('emailprovider').focus();
	      return false;
	   }
	
	if (document.getElementById('inviteremail').value==null || document.getElementById('inviteremail').value=="" ){
      document.getElementById('errormsgdisplay').style.display="block";
		alert('Please enter "Your Email Id"');
		document.getElementById('errormsgdisplay').innerHTML='Please enter "Your Email Id"';
		setTimeout('document.getElementById(\'errormsgdisplay\').style.display="none"', 10000);	
	      document.getElementById('inviteremail').focus();
	      return false;
	   }
	if (document.getElementById('inviterpassword').value==null || document.getElementById('inviterpassword').value=="" ){
      document.getElementById('errormsgdisplay').style.display="block";
		alert('Please enter "Your Email Id\'s Password"');
		document.getElementById('errormsgdisplay').innerHTML='Please enter "Your Email Id\'s password"';
		setTimeout('document.getElementById(\'errormsgdisplay\').style.display="none"', 10000);	
	      document.getElementById('inviterpassword').focus();
	      return false;
	   }	
	if(document.getElementById('inviteall').checked==true){
		showdiv('transparent_body');
		showdiv('inviteallfriendmessage');
	}
	return true;
}

function validatehiddeninvitefriend(){
   if (document.getElementById('hiddenemailprovider').value==null || document.getElementById('hiddenemailprovider').value=="" ){
      document.getElementById('errormsgdisplay').style.display="block";
		alert('Please select "Email Provider Name"');
		document.getElementById('errormsgdisplay').innerHTML='Please select "Email Provider Name"';
		setTimeout('document.getElementById(\'errormsgdisplay\').style.display="none"', 10000);	
	      document.getElementById('hiddenemailprovider').focus();
	      return false;
	   }
	
	if (document.getElementById('hiddeninviteremail').value==null || document.getElementById('hiddeninviteremail').value=="" ){
      document.getElementById('errormsgdisplay').style.display="block";
		alert('Please enter "Your Email Id"');
		document.getElementById('errormsgdisplay').innerHTML='Please enter "Your Email Id"';
		setTimeout('document.getElementById(\'errormsgdisplay\').style.display="none"', 10000);	
	      document.getElementById('hiddeninviteremail').focus();
	      return false;
	   }
	if (document.getElementById('hiddeninviterpassword').value==null || document.getElementById('hiddeninviterpassword').value=="" ){
      document.getElementById('errormsgdisplay').style.display="block";
		alert('Please enter "Your Email Id\'s Password"');
		document.getElementById('errormsgdisplay').innerHTML='Please enter "Your Email Id\'s password"';
		setTimeout('document.getElementById(\'errormsgdisplay\').style.display="none"', 10000);	
	      document.getElementById('hiddeninviterpassword').focus();
	      return false;
	   }	
	return true;
}

function settransheight(){
var viewportwidth;
 var viewportheight;
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }
alert('<p>Your viewport width is '+viewportwidth+'x'+viewportheight+'</p>');
	
}

function hidedisplayFBFanBox(hideid,displayid,url,status){
		HttpRequest("/?action=fbwindow&nodisplay="+status);
		if(iddetails(hideid)!=null){
			iddetails(hideid).style.display='none';iddetails(hideid).style.visibility='hidden';
		}
		if(iddetails(displayid)!=null){
			iddetails(displayid).style.display='block';iddetails(displayid).style.visibility='visible';
		}
}
