/* - - - - - - - - - - - - - - - - - - - - - - -
 JavaScript
 Thursday, February 15, 2007 12:11:22 PM
 HAPedit 3.1.11.111
 - - - - - - - - - - - - - - - - - - - - - - - */


<!-- mouse rightclick disable-->
/*var msg_box ="You dont have permission to copy";

function dis_rightclickIE(){
	if (navigator.appName == 'Church Peoplemeet Says' && (event.button == 2 || event.button == 3))
		alert(msg_box)
}

function dis_rightclickNS(e){
	if ((document.layers||document.getElementById&&!document.all) && (e.which==2||e.which==3))
	{
	alert(msg_box)
	return false;
	}
}  

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=dis_rightclickNS;
}
else if (document.all&&!document.getElementById){
document.onmousedown=dis_rightclickIE;
}
document.oncontextmenu=new Function("alert(msg_box);return false")
 */
//**************

function hideshowdiv(tot,k,c)
 {
 for(j=1;j<=tot;j++)
 {
    if(k==j)
    {
     document.getElementById('hideShow'+k).style.visibility = 'visible';
	 if(c=='b')
	   document.getElementById('gita'+k).style.color="blue";
	 else if(c=='r')
	   document.getElementById('gita'+k).style.color="red";
	 else if(c=='g')
	   document.getElementById('gita'+k).style.color="green";
	 else if(c=='y')
	   document.getElementById('gita'+k).style.color="#B5B00D";
	
	 
	}
   else
   {
    document.getElementById('hideShow'+j).style.visibility='hidden';
    }
   
  }

}

function HideDIV(d) { document.getElementById(d).style.display = "none"; }
function DisplayDIV(d) { document.getElementById(d).style.display = "block"; }
//communitys invite friends
function checkfrd(){
		
  if(document.getElementById('frdlist').value=='')
  {
	alert("Please Select Anyone of your friend to invite");
	return false;
	
	  
  }
		
 if(document.mailservice.msg.value=='')
		{
			if(confirm("Are you sure you want to submit with empty message"))
			return true;
			else
			return false;
		}
       
	 		return true;	
	} 
function onerightfun()
{
for(i=0;i<document.mailservice.toadd.length;i++)
{
if(document.mailservice.toadd.options[i].selected==true)
{
var newvalue = new Option(document.mailservice.toadd.options[i].value);
document.mailservice.elements[5].options[document.mailservice.elements[5].length]=newvalue;
document.mailservice.toadd.remove(i);
i--;
}
}
for(i=0;i<document.mailservice.elements[5].length;i++)
{
document.mailservice.elements[5].options[i].selected=true;
}
}

function oneleftfun()
{


for(i=0;i<document.mailservice.elements[5].length;i++)
{
if(document.mailservice.elements[5].options[i].selected==true)
{
var newvalue = new Option(document.mailservice.elements[5].options[i].value);

document.mailservice.toadd.options[document.mailservice.toadd.length]=newvalue;

document.mailservice.elements[5].remove(i);
i--;
}
}
for(i=0;i<document.mailservice.elements[5].length;i++)
{
document.mailservice.elements[5].options[i].selected=true;
}
}
//Credit Cart Verification

//Community form validation
function checkcommunity()
{
	
if(document.community.group_name.value=="" || document.community.group_icon.value=="" || document.community.group_desc.value=="")
{
	 alert("Fill all the detals");
	 return false;
}
   else
     return true;
	
}

function checkfriend()
{
	
if(document.addfriend.m_user.value=="")
{
	 alert("Enter User Name That U want to add");
	 document.addfriend.m_user.focus();
	 return false;
}
   else
     return true;
	
}

function charity1()
{
	
if(document.charity.charity_name.value=="")
{
	 alert("Please enter charity name");
	 document.charity.charity_name.focus();
	 return false;
}
   else
     return true;
	
}

function checkevent1()
{
	
if(document.events1.event_name.value=="" || document.events1.event_icon.value=="" || document.events1.event_desc.value=="")
{
	 alert("Fill all the detals");
	 return false;
}
    else
       return true;
	
}
 function checkevent2()
   {
    if(document.events2.event_name.value=="")
     {
       alert("Please enter Event name.");
       document.events2.event_name.focus();
       return false;
     }
    if(document.events2.skip_icon.checked==false)
     {
       if(document.events2.event_icon.value=="")
        {
          alert("Please select Event icon.");
          document.events2.event_icon.focus();
          return false;
        }
      }
	
	  
   if(document.events2.event_desc.value=="")
     {
       alert("Please enter Event Description.");
       document.events2.event_desc.focus();
       return false;
     }
   else
     return true;
  }

function del_group(group_id)
 {
  isconform=confirm("Do you really want to delete this Group?");
  if(isconform)
   window.location="viewcommunity.php?action=del_group&group_id=" + group_id ;
 }
 
  
function del_event(event_id)
 {
  isconform=confirm("Do you really want to delete this Event?");
  if(isconform)
   window.location="event_details.php?action=del_event&event_id=" + event_id ;
 }
 
 function deedempty()
{

 if((document.deed.user_purpose.value=='') || (document.deed.deed_text.value==''))
 {
   alert('Fill all the details');
   return false;
 }
 return true;

}

function checkdeed()
{
	var flag=false;
	var tol_no=document.getElementById('tot').value;
   var i;
   var count=0;
   for(i=1; i<tol_no; i++)
    {
     var path=eval ("document.deed.y"+i);
     if(path.checked==true)
	 {
       count=count+1;
	   $flag=true;
	 }
    }
   if(flag==false)
    {
     alert('Please select the deed.');
	 return false;
	 
    }
   else
    {
        document.deed.submit();
    }
 }

function checkdetails()
 {
   if(document.frmpay.OrderTotal.value=="")
    {
      alert("Please select Card Type.");
      document.frmpay.OrderTotal.focus();
      return false;
    }
   if(document.frmpay.CreditCardNumber.value=="")
    {
      alert("Please insert Card No.");
      document.frmpay.CreditCardNumber.focus();
      return false;
    }
   if(document.frmpay.ExpMonth.value=="")
    {
      alert("Please insert Expires On Month.");
      document.frmpay.ExpMonth.focus();
      return false;
    }   
   if(document.frmpay.ExpYear.value=="")
    {
      alert("Please insert Expires On Year.");
      document.frmpay.ExpYear.focus();
      return false;
    }
   if(document.frmpay.CVV2.value=="")
    {
      alert("Please insert CVV No.");
      document.frmpay.CVV2.focus();
      return false;
    }
   if(document.frmpay.card_fname.value=="")
    {
      alert("Please insert Card First Name.");
      document.frmpay.card_fname.focus();
      return false;
    }
   if(document.frmpay.card_lname.value=="")
    {
      alert("Please insert Card Last Name    .");
      document.frmpay.card_lname.focus();
      return false;
    }
   if(document.frmpay.card_address.value=="")
    {
      alert("Please insert Card Address1.");
      document.frmpay.card_address.focus();
      return false;
    }      
   if(document.frmpay.card_street2.value=="")
    {
      alert("Please insert Card Street.");
      document.frmpay.card_street2.focus();
      return false;
    }     
   if(document.frmpay.card_city.value=="")
    {
      alert("Please insert Card City.");
      document.frmpay.card_city.focus();
      return false;
    }         
   if(document.frmpay.card_state.value=="")
    {
      alert("Please insert Card State.");
      document.frmpay.card_state.focus();
      return false;
    }        
   if(document.frmpay.card_zip.value=="")
    {
      alert("Please insert Card Zip.");
      document.frmpay.card_zip.focus();
      return false;
    }        
   if(document.frmpay.card_phone.value=="")
    {
      alert("Please insert Card Phone No.");
      document.frmpay.card_phone.focus();
      return false;
    }
   return true;
 }
// donation.php
function charitycheck()
{
	
	var s='\n';
	var flag=true;
	
	
	if((document.charity.charity_name.value=='') || (document.charity.charity_provide.value=='') || (document.charity.r.checked=='false'))
{
           s=s+"Fill all the details"+'\n';
           flag=false;

}


 if(flag==false)
  {
	  alert(s);
	  return false;
  }
  else
    return true;

}
//Email checking
function invitecheck()
{
	
	var s='\n';
	var flag=true;
	var x=0;
	
     if(document.getElementById('email1').value=='')
     {
		flag=false;
	    s=s+"Fill atleast one email id"+'\n';
     	}
  for(i=1;i<=5;i++)
  {
	if(document.getElementById('email'+i).value!='')
    {
	    mai = document.getElementById('email'+i).value;
	    val = true;
		dot = mai.lastIndexOf(".");
 		at = mai.indexOf("@");
		dom = dot - at;
		sp = mai.indexOf(" ");

		if(dom >= 4 && at >1 && sp == -1)
  		 val = true;
		else
		 val = false;
	
 	    if(val == false)
	     {
		   x=2;
		   }

      }
	}
	if(x==2)
	 {
		 s=s+"Invalid Email";
		 flag=false;
	 }
	
if(flag==false)
  {
	  alert(s);
	  return false;
  }
  else
    return true;

}



function reportcheck()
{
	if(document.report.r.checked == 'false')
	{
		alert("please select type of report");
		document.report.r.focus();
		return false;
	}
	else if(document.report.msg.value=='')
	{
	   alert("please enter report details");
		document.report.msg.focus();
		return false;	
	}
	return true;
}



//Registration Page Verification

function regcheck()
{
	var s='\n';
	var flag=true;
 
  if((document.regis_frm1.user.value=='') || (document.regis_frm1.pass.value=='') || (document.regis_frm1.pass1.value=='') || (document.regis_frm1.email.value=='') || (document.regis_frm1.relation.options[document.regis_frm1.relation.selectedIndex].value == 'selectone') || (document.regis_frm1.sex1.options[document.regis_frm1.sex1.selectedIndex].value == 'selectone') || (document.regis_frm1.country_id.options[document.regis_frm1.country_id.selectedIndex].value == 'selectone') || (document.regis_frm1.day1.options[document.regis_frm1.day1.selectedIndex].value == 'selectone') || (document.regis_frm1.mon1.options[document.regis_frm1.mon1.selectedIndex].value == 'selectone')  || (document.regis_frm1.year1.options[document.regis_frm1.year1.selectedIndex].value == 'selectone') || (document.regis_frm1.maritals1.options[document.regis_frm1.maritals1.selectedIndex].value == 'selectone') || (document.regis_frm1.city.value==''))
   {
           s=s+"Fill all the details"+'\n';
           flag=false;
   }
 
 
   
  if(document.regis_frm1.pass.value!='')
    {
      if(document.regis_frm1.pass.value.length<6)
       {
          s=s+"Password Shouldbe >=6 characters"+'\n';
          flag=false;
	    }
     }
 

   if(document.regis_frm1.pass1.value!='')
  {
      if(document.regis_frm1.pass1.value.length<6)
      {
          s=s+"Retypepwd Shouldbe >=6 characters"+'\n';
          flag=false;
	
       }
   }
 if(document.regis_frm1.pass.value!='' && document.regis_frm1.pass1.value!='')
 {
	 if(document.regis_frm1.pass.value.length>=6 && document.regis_frm1.pass1.value.length>=6)
	 {
	 if(document.regis_frm1.pass.value!=document.regis_frm1.pass1.value)
	 {
		 
          s=s+"Pwd and Retypepwd should match"+'\n';
          flag=false;
	 }
	 }
 }
  
  if(document.regis_frm1.email.value!='')
  {
	    mai = document.regis_frm1.email.value;
	    val = true;
		dot = mai.lastIndexOf(".");
 		at = mai.indexOf("@");
		dom = dot - at;
		sp = mai.indexOf(" ");

		if(dom >= 4 && at >1 && sp == -1)
  		 val = true;
		else
		 val = false;
	
 	if(val == false)
	 {
		  s=s+"Invalid email"+'\n';
          flag=false;
		
	   }

  }
  
  if(document.regis_frm1.agree.checked == false)
  {
	       s=s+"Please check terms & conditions"+'\n';
           flag=false;
  }
 
  
  
   
  if(flag==false)
  {
	  alert(s);
	  return false;
  }

 return true;
	 
}
  
//edit_profile.php
function editprofilecheck()
{
	var s='\n';
	var flag=true;
 
  if((document.edit_frm1.email.value=='') || (document.edit_frm1.pass.value=='') || (document.edit_frm1.sex1.options[document.edit_frm1.sex1.selectedIndex].value == 'selectone') || (document.edit_frm1.country_id.options[document.edit_frm1.country_id.selectedIndex].value == 'selectone') || (document.edit_frm1.day1.options[document.edit_frm1.day1.selectedIndex].value == 'selectone') || (document.edit_frm1.mon1.options[document.edit_frm1.mon1.selectedIndex].value == 'selectone')  || (document.edit_frm1.year1.options[document.edit_frm1.year1.selectedIndex].value == 'selectone') || (document.edit_frm1.maritals1.options[document.edit_frm1.maritals1.selectedIndex].value == 'selectone') || (document.edit_frm1.city.value==''))
   {
           s=s+"Fill all the details"+'\n';
           flag=false;
   }
 
 
   
  if(document.edit_frm1.pass.value!='')
    {
      if(document.edit_frm1.pass.value.length<6)
       {
          s=s+"Password Shouldbe >=6 characters"+'\n';
          flag=false;
	    }
     }
  
  if(document.edit_frm1.email.value!='')
  {
	    mai = document.edit_frm1.email.value;
	    val = true;
		dot = mai.lastIndexOf(".");
 		at = mai.indexOf("@");
		dom = dot - at;
		sp = mai.indexOf(" ");

		if(dom >= 4 && at >1 && sp == -1)
  		 val = true;
		else
		 val = false;
	
 	if(val == false)
	 {
		  s=s+"Invalid email"+'\n';
          flag=false;
		
	   }

  }
  
  if(flag==false)
  {
	  alert(s);
	  return false;
  }

 return true;
	 
}
//  profile form validation
function prof()
{
  if(document.edit_frm1.zip.value=="")
  {
    alert("Please enter Zipcode");
    document.edit_frm1.zip.focus();
	return false;
  }
  return true;
	
} 


 function open_chat_box(m_id,box_id)
 {
   window.open("chat_box.php?action=loadin&r_id="+box_id ,m_id+"pid"+box_id,"location=0,scrollbars=no,height=450,width=508,left=10,top=20");
 }

function close_chat_box(r_id,m_id)
{
var ajaxRequest;  // The variable that makes Ajax possible!
try{
    // Opera 8.0+, Firefox, Safari
    ajaxRequest = new XMLHttpRequest();
  } catch (e){
    // Internet Explorer Browsers
    try{
      ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try{
        ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e){
        // Something went wrong
        alert("Your browser broke!");
        return false;
      }
    }
  }
  // Create a function that will receive data sent from the server
  ajaxRequest.onreadystatechange = function()
   {
    if(ajaxRequest.readyState == 4)
     {  
      window.opener.document.location.reload();
      var mystat = ajaxRequest.responseText;
     }
   }
  var queryString = "?m_id=" + m_id + "&r_id=" + r_id;
  ajaxRequest.open("GET", "close_room.php" + queryString, true);
  ajaxRequest.send(null); 
}

 function op_win()
 {
   window.open("view_condition.php" ,"pid1","location=0,scrollbars=yes,height=420,width=780,left=10,top=20");
 }

function loginverify()
 {
   if(document.login.user.value=="")
    {
      alert("Please Enter Username.");
      document.login.user.focus();
      return false;
    }
   if(document.login.pass.value=="")
    {
      alert("Please Enter Password.");
      document.login.pass.focus();
      return false;
    }
   else
    return true;
 }
 

function checkpaytype()
 {
   if(document.addon.payment_type.value=="")
    {
      alert("Please select payment type.");
      document.addon.payment_type.focus();
      return false;
    }
   else
    return true;
 }

function getregion()
{
document.getElementById('div_state').style.position="absolute";
document.getElementById('div_state').style.visibility="hidden";  
document.getElementById('div_city').style.position="absolute";
document.getElementById('div_city').style.visibility="hidden";
var ajaxRequest;  // The variable that makes Ajax possible!
var country_id = document.getElementById('country_id').value;
try{
    // Opera 8.0+, Firefox, Safari
    ajaxRequest = new XMLHttpRequest();
  } catch (e){
    // Internet Explorer Browsers
    try{
      ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try{
        ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e){
        // Something went wrong
        alert("Your browser broke!");
        return false;
      }
    }
  }
  // Create a function that will receive data sent from the server
  ajaxRequest.onreadystatechange = function()
   {
    if(ajaxRequest.readyState == 4)
     {
      document.getElementById('div_state').style.position="relative";
      document.getElementById('div_state').style.visibility="visible";
      var ajaxDisplay = document.getElementById("div_state");
      ajaxDisplay.innerHTML = ajaxRequest.responseText;
     }
   }
  var country_id = document.getElementById('country_id').value;
  var queryString = "?action=region&country_id=" + country_id;
//  alert(country_id+queryString);
  //ajaxRequest.open("GET", "bank_rup.php", true);
  ajaxRequest.open("GET", "checkvalue.php" + queryString, true);
  ajaxRequest.send(null); 
}

function getcity4()
{
document.getElementById('div_city').style.position="absolute";
document.getElementById('div_city').style.visibility="hidden";
var ajaxRequest;  // The variable that makes Ajax possible!
var country_id = document.getElementById('country_id').value;
try{
    // Opera 8.0+, Firefox, Safari
    ajaxRequest = new XMLHttpRequest();
  } catch (e){
    // Internet Explorer Browsers
    try{
      ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try{
        ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e){
        // Something went wrong
        alert("Your browser broke!");
        return false;
      }
    }
  }
  // Create a function that will receive data sent from the server
  ajaxRequest.onreadystatechange = function()
   {
    if(ajaxRequest.readyState == 4)
     {
      document.getElementById('div_city').style.position="relative";
      document.getElementById('div_city').style.visibility="visible";
      var ajaxDisplay = document.getElementById("div_city");
      ajaxDisplay.innerHTML = ajaxRequest.responseText;
     }
   }
  var region_id = document.getElementById('region_id').value;
  var country_id = document.getElementById('country_id').value;
  var queryString = "?action=city&region_id=" + region_id+"&country_id=" + country_id;
  //ajaxRequest.open("GET", "bank_rup.php", true);
  ajaxRequest.open("GET", "checkvalue.php" + queryString, true);
  ajaxRequest.send(null); 
}

function getzip_code()
 {
   var country_id = document.getElementById('country_id').value;
   if(country_id == 254)
     {   
       document.getElementById('div_zip_code1').style.position="relative";
       document.getElementById('div_zip_code1').style.visibility="visible";
       document.getElementById('div_zip_code').style.position="relative";
       document.getElementById('div_zip_code').style.visibility="visible";
     }
   else
     {       
       document.getElementById('div_zip_code1').style.position="absolute";
       document.getElementById('div_zip_code1').style.visibility="hidden";
       document.getElementById('div_zip_code').style.position="absolute";
       document.getElementById('div_zip_code').style.visibility="hidden";
     }
  }


function getname()
{
document.getElementById('div_name').style.position="absolute";
document.getElementById('div_name').style.visibility="hidden";
var ajaxRequest;  // The variable that makes Ajax possible!
var country_id = document.getElementById('country_id').value;
if(country_id==254)
 {
   document.getElementById('div_cityname').style.position="absolute";
   document.getElementById('div_cityname').style.visibility="hidden";
 }
else
 {
  document.getElementById('div_cityname').style.position="relative";
  document.getElementById('div_cityname').style.visibility="visible";
 }
try{
    // Opera 8.0+, Firefox, Safari
    ajaxRequest = new XMLHttpRequest();
  } catch (e){
    // Internet Explorer Browsers
    try{
      ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try{
        ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e){
        // Something went wrong
        alert("Your browser broke!");
        return false;
      }
    }
  }
  // Create a function that will receive data sent from the server
  ajaxRequest.onreadystatechange = function()
   {
    if(ajaxRequest.readyState == 4)
     {
      document.getElementById('div_name').style.position="relative";
      document.getElementById('div_name').style.visibility="visible";
      var ajaxDisplay = document.getElementById("div_name");
      ajaxDisplay.innerHTML = ajaxRequest.responseText;
     }
   }
  var country_id = document.getElementById('country_id').value;
  var queryString = "?action=name&country_id=" + country_id;
  //ajaxRequest.open("GET", "bank_rup.php", true);
  ajaxRequest.open("GET", "checkvalue.php" + queryString, true);
  ajaxRequest.send(null); 
}


function deflt(img_id,m_id)
 {
  isconform=confirm("Do you really want to Change Default Picture?");
  if(isconform)
   window.location="profile_picture.php?action=def&img_id=" + img_id + "&m_id="+m_id;
 }


function del(img_id)
 {
  isconform=confirm("Do you really want to Delete Picture?");
  if(isconform)
   window.location="profile_picture.php?action=delete&img_id=" + img_id;
 }


 function search_lt()
 {
   document.page_limit_form.submit();
 }

   //var limt = document.getElementById('page_lt').value;
   //window.location="search.php?action=search&action1=page&" + str + "&limt=" +limt;
   //window.location="search.php?action=search&action1=page&" + str + "&limt=" +limt;

function galleryname()
 {
   if(document.pic_gal.gal_name.value=="")
    {
      alert("Please insert gallery name.");
      document.pic_gal.gal_name.focus();
      return false;
    }
   if(document.pic_gal.is_public.checked==true)
   {
     if(document.pic_gal.pass.value=="")
      {
        alert("Please insert password.");
        document.pic_gal.pass.focus();
        return false;
      }
    }
   else
    return true;
 }


function del_gallery(gal_id)
 {
  isconform=confirm("Do you really want to Delete Gallery?");
  if(isconform)
   window.location="picture_gallery.php?action=delete&gal_id=" + gal_id ;
 }



function del_gal_pic(gpic_id,id)
 {
  isconform=confirm("Do you really want to Delete Picture?");
  if(isconform)
   window.location="gallery_pictures.php?action=delete&gpic_id=" + gpic_id +"&id="+id;
 }

function del_community_pic(pic_id,id)
 {
  isconform=confirm("Do you really want to Delete Picture?");
  if(isconform)
   window.location="community_pictures.php?action=delete&pic_id=" + pic_id +"&id="+id;
 }


 function del_friend(id)
 {
  isconform=confirm("Do you really want to remove your friend from friendlist?");
  if(isconform)
   window.location="myfriends.php?action=deletef&id=" + id;
 }

 
 function deflt_gal_pic(gpic_id,gal_id)
 {
  isconform=confirm("Do you really want to Change Default Picture?");
  if(isconform)
   window.location="gallery_pictures.php?action=def_gal_pic&gpic_id=" + gpic_id + "&gal_id="+gal_id;
 }

function checkimage()
 {
   if(document.picture.pic_name.value=="")
    {
      alert("Please select picture.");
      document.picture.pic_name.focus();
      return false;
    }
   else
    return true;
 }

function checkaudio()
 {
   if(document.audio.audio_name.value=="")
    {
      alert("Please select you audio file.");
      document.audio.audio_name.focus();
      return false;
    }
   else
    return true;
 }

 function del_audio(audio_id)
 {
  isconform=confirm("Do you really want to delete audio file?");
  if(isconform)
   window.location="profile_audio.php?action=delete_audio&audio_id=" + audio_id ;
 }

function checkvideo()
 {
   if(document.video.video_name.value=="")
    {
      alert("Please select you video file.");
      document.video.video_name.focus();
      return false;
    }
   else
    return true;
 }

 function del_video(video_id)
 {
  isconform=confirm("Do you really want to delete video file?");
  if(isconform)
   window.location="profile_video.php?action=delete_video&video_id=" + video_id ;
 }

function checkblog()
 {
   if(document.blog.blog_head.value=="")
    {
      alert("Please insert Blog heading.");
      document.blog.blog_head.focus();
      return false;
    }   
   if(document.blog.blog_desc.value=="")
    {
      alert("Please insert Blog descrition.");
      document.blog.blog_desc.focus();
      return false;
    }
   else
    return true;
 }

 function del_blog(blog_id)
 {
  isconform=confirm("Do you really want to delete Story?");
  if(isconform)
   window.location="myblog.php?action=delete_blog&story_id=" + blog_id ;
 }

function checkribbon()
 {
   if(document.send_ribbon.ribbon_text.value=="")
    {
      alert("Please enter ribbon text.");
      document.send_ribbon.ribbon_text.focus();
      return false;
    }
   else
    return true;
 }

 function op_image_win(path)
 {
   window.open("view_image.php?path="+ path ,"pid2","location=0,scrollbars=yes,height=620,width=780,left=10,top=20");
 }
 
 function op_image_win_prof(path)
 {
   window.open("cropimage/view_profimg.php?path="+ path ,"pid2","location=0,scrollbars=no,height=600,width=600");
 }
 function op_image_win_new(path)
 {
   window.open("view_image.php?path="+ path ,"pid2","location=0,scrollbars=yes,height=620,width=780,left=10,top=20");
 }


function send_invitation(to_id)
 {
   window.open("invitation.php?action=invite&to_id="+ to_id ,"pid3","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
 }
 
 function send_join_group(group_id)
 {
   window.open("community_request.php?action=join&group_id="+ group_id ,"pid3","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
 }
  function send_unjoin_group(group_id)
 {
   window.open("community_request.php?action=unjoin&group_id="+ group_id ,"pid3","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
 }
 
function send_wink(to_id,color)
 {
   window.open("sendwink.php?action=sendwink&color="+ color +"&to_id="+to_id ,"pid4","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
 }
function send_wink1(to_id,color,j)
 {
	 //alert(document.getElementById('wink'+j).value);
	 var text=document.getElementById('wink'+j).value;
	 
  window.open("sendwink.php?action=sendwink&text="+ text +"&color="+ color +"&to_id="+to_id ,"pid4","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
 } 
function send_ribbon(to_id,color)
 {
   window.open("send_ribbon.php?action=send_ribbon&color="+ color +"&to_id="+to_id ,"pid4","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
 }

function send_hotlist(to_id)
 {
   window.open("sendhotlist.php?action=sendhot_list&to_id="+ to_id ,"pid5","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
 }
function suspend_account()
 {
   var win = window.open("blockuser.php?action=suspend" ,"pid6","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
   setTimeout("document.location.reload()", 1000);
 }
function activate_account()
 {
   var win = window.open("blockuser.php?action=activate","pid6","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
   setTimeout("document.location.reload()", 1000);
 }
function setstatus()
 {
   window.open("blockuser.php?action=setstatus","pid6","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
 }

function block_user(to_id)
 {
   window.open("blockuser.php?action=block&to_id="+ to_id ,"pid6","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
 }

function unblock_user(id)
 {
   window.open("blockuser.php?action=unblock&id="+ id ,"pid7","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
 }


 function invite_accept(from_id,id)
 {
   window.open("invitation_accept.php?action=accept&from_id="+ from_id +"&id="+id ,"pid8","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
 }
 
 function edit_friend(id,uname)
 {
   window.open("invitation_accept.php?action=editfriend&id="+ id +"&uname="+uname ,"pid8","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
 }
  
 function del_friend(id)
 {
   window.open("invitation_accept.php?action=delfriend&id="+ id ,"pid8","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
 }

 function invite_reject(from_id,id)
 {
   window.open("invitation_accept.php?action=reject&from_id="+ from_id +"&id="+id ,"pid9","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
 }
function group_request_accept(from_id,id,group_id)
 {
   window.open("community_request_accept.php?action=accept&from_id="+ from_id +"&id="+id +"&group_id="+group_id ,"pid8","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
 }

 function group_request_reject(from_id,id,group_id)
 {
   window.open("community_request_accept.php?action=reject&from_id="+ from_id +"&id="+id +"&group_id="+group_id ,"pid9","location=0,scrollbars=no,height=420,width=780,left=10,top=20");
 }
 function open_profile_pic(id)
 {
   window.open("view_profile_picture.php?id="+id ,"pid10","location=0,scrollbars=yes,height=620,width=780,left=10,top=20");
 }
function checksearch()
{
var ajaxRequest;  // The variable that makes Ajax possible!
var search_name = document.getElementById('search_name').value;
//alert(mail_to);
try{
    // Opera 8.0+, Firefox, Safari
    ajaxRequest = new XMLHttpRequest();
  } catch (e){
    // Internet Explorer Browsers
    try{
      ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try{
        ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e){
        // Something went wrong
        alert("Your browser broke!");
        return false;
      }
    }
  }
  // Create a function that will receive data sent from the server
  ajaxRequest.onreadystatechange = function()
   {
    if(ajaxRequest.readyState == 4)
     {  
      //document.getElementById('div_username').style.position="relative";
      //document.getElementById('div_username').style.visibility="visible";
      var ajaxDisplay = document.getElementById("div_username");
      ajaxDisplay.innerHTML = ajaxRequest.responseText;
     }
   }
  var search_name = document.getElementById('search_name').value;
  var queryString = "?search_name=" + search_name;
  ajaxRequest.open("GET", "checkusername.php" + queryString, true);
  ajaxRequest.send(null); 
}


function checkusername()
{
var ajaxRequest;  // The variable that makes Ajax possible!
var mail_to = document.getElementById('mail_to').value;
//alert(mail_to);
try{
    // Opera 8.0+, Firefox, Safari
    ajaxRequest = new XMLHttpRequest();
  } catch (e){
    // Internet Explorer Browsers
    try{
      ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try{
        ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e){
        // Something went wrong
        alert("Your browser broke!");
        return false;
      }
    }
  }
  // Create a function that will receive data sent from the server
  ajaxRequest.onreadystatechange = function()
   {
    if(ajaxRequest.readyState == 4)
     {  
      //document.getElementById('div_username').style.position="relative";
      //document.getElementById('div_username').style.visibility="visible";
      var ajaxDisplay = document.getElementById("div_username");
      ajaxDisplay.innerHTML = ajaxRequest.responseText;
     }
   }
  var mail_to = document.getElementById('mail_to').value;
  var queryString = "?mail_to=" + mail_to;
  ajaxRequest.open("GET", "checkusername.php" + queryString, true);
  ajaxRequest.send(null); 
}


function checkcompose()
 {
   if(document.send_msg.mail_to.value=="")
    {
      alert("Please insert username of your friends only.");
      document.send_msg.mail_to.focus();
      return false;
    }
   else
    document.send_msg.mail_to1.value=document.send_msg.mail_to.value;

   if(trimAll(document.send_msg.mail_sub.value)=="")
    {
      alert("Please insert subject.");
      document.send_msg.mail_sub.value="";
      document.send_msg.mail_sub.focus();
      return false;
    }
   if(trimAll(document.send_msg.mail_body.value)=="")
    {
      alert("Please write your message.");
      document.send_msg.mail_body.focus();
      return false;
    }
   else
    return true;
 }



function check_all()
 {
   var tol_no=document.getElementById('tot_no').value;
   var i;
   for(i=1;i<tol_no;i++)
     document.getElementById('chek'+i).checked=true;
 }

function delete_all()
 {
   var tol_no=document.getElementById('tot_no').value;
   var i;
   var count=0;
   for(i=1; i<tol_no; i++)
    {
     var path=eval ("document.delete_mail.chek"+i);
     if(path.checked==true)
       count=count+1;
    }
   if(count==0)
    {
     alert('Please select mail which you want to delete.');
    }
   else
    {
     isconform=confirm("Do you really want to delete all items?");
     if(isconform)
       document.delete_mail.submit();
    }
 }


function rating_verify()
 {
   if(document.rating.rate_pt.value=="")
    {
      alert("Please select rate point.");
      document.rating.rate_pt.focus();
      return false;
    }
   if(document.rating.rate_comment.value=="")
    {
      alert("Please insert comments.");
      document.rating.rate_comment.focus();
      return false;
    }
   else
    return true;
 }


function op_priv_chat(from,to)
{
window.open("privatechat.php?action=loadin&to_id=" + to + "&from_id=" + from , from+"im"+to,"location=0,scrollbars=no,height=400,width=500,left=20,top=10");

}

function trimAll(sString)
 {
  while (sString.substring(0,1) == ' ')
  {
   sString = sString.substring(1, sString.length);
  }
  while (sString.substring(sString.length-1, sString.length) == ' ')
  {
   sString = sString.substring(0,sString.length-1);
  }
  return sString;
 }
//-->

<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->


