// This function called in registration.tpl
function alertError(error){
	Modalbox.show('<div class=\'warning\'><p>'+error+'</p><br><p><input type=\'button\' value=\'Ok\' class=\"groovybutton\" onclick=\'Modalbox.hide()\'/></p></div>', {title: 'MaleEscortReview.com Alert', width: 300});
}

 function AdvSearch1234(url)
 {

	// alert(url);

	document.AdvSearch.action=url;

	document.AdvSearch.submit();

	


 }


//THIS FUNCTION GET STATE //
function getState(frmObj)
{
	
	server_path= document.frmSearch.server_url.value;
	var docObj = null;
	if (typeof window.ActiveXObject != 'undefined')
	{
		docObj = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		docObj = new XMLHttpRequest();
	}
	
	var country_id = frmObj.sele_country.value;
	if(country_id == 42 || country_id == 43)
	{
		document.getElementById("stateHide").style.display = '';		
		document.getElementById("cityHide").style.display = 'none';
		
		//THIS CODE USE FOR GET THE STATE LIST //
		docObj.open("GET", server_path+"index_ajax.php?file=getstates&country_id="+ country_id, false);
		docObj.send(null);
		var Res = docObj.responseText;
		document.getElementById("states").innerHTML = Res;
	}
	else
	{
		document.getElementById("stateHide").style.display = 'none';
		document.getElementById("cityHide").style.display = '';
		docObj.open("GET", server_path+"index_ajax.php?file=getcity&country_id="+ country_id, false);
		docObj.send(null);
		var Res = docObj.responseText;
		document.getElementById("city").innerHTML = Res;
	}
}

function getStateescort(frmObj)
{
	
	server_path= document.frmSearch.server_url.value;
	var docObj = null;
	if (typeof window.ActiveXObject != 'undefined')
	{
		docObj = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		docObj = new XMLHttpRequest();
	}
	
	var country_id = frmObj.sele_country.value;
	if(country_id == 42 || country_id == 43)
	{
		document.getElementById("escortsearchboxcontry").style.display = 'none';		
		document.getElementById("escortsearchboxstate").style.display = '';		
		document.getElementById("escortsearchboxcity").style.display = 'none';
		
		//THIS CODE USE FOR GET THE STATE LIST //
		docObj.open("GET", server_path+"index_ajax.php?file=getstatesescort&country_id="+ country_id, false);
		docObj.send(null);
		var Res = docObj.responseText;
		document.getElementById("statesescort").innerHTML = Res;
	}
	else
	{
		document.getElementById("escortsearchboxcontry").style.display = 'none';
		document.getElementById("escortsearchboxstate").style.display = 'none';
		document.getElementById("escortsearchboxcity").style.display = '';
		docObj.open("GET", server_path+"index_ajax.php?file=getcityescort&country_id="+ country_id, false);
		docObj.send(null);
		var Res = docObj.responseText;
		document.getElementById("cityescort").innerHTML = Res;
	}
}



function getStatezip(frmObj)
{
	var docObj = null;
	if (typeof window.ActiveXObject != 'undefined')
	{
		docObj = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		docObj = new XMLHttpRequest();
	}
	//alert("general");
	var country_id = frmObj.sele_country.value;		

		//THIS CODE USE FOR GET THE  //
		document.frmSearchWorld.txtctrid.value=frmObj.sele_country.value;		
		docObj.open("GET", "http://www.maleescortreview.com/index_ajax.php?file=getcity_zip&country_id="+ country_id, false);
		docObj.send(null);
		var Res = docObj.responseText;
		
		if(Res != "" || Res != " ")
		{
			document.getElementById("city").innerHTML = Res;			
		}
		else
		{
			alert(Res)
			document.getElementById("city").innerHTML = "No City Available";
		}
}

function submitZipSearch(frmObj)
{
	if(frmObj.sele_country_US.value=='')
	{
	    alertError("Please Select Country.");
	    return false;
	}
  	if(frmObj.txt_search_zip_US.value=="")
  	{
	    alertError("Please enter zip code.");
	    return false;
	}
	else if(frmObj.txt_search_range_US.value=="")
  	{
	    alertError("Please enter range.");
	    return false;
	}
	else
	{
		if(frmObj.sele_country_US.value=='canada')
			frmObj.action.value=='canadasearch';
		else
			frmObj.action.value=='usasearch';
		frmObj.submit();
	}
}

function submitCitySearch(frmObj)
{
	if(frmObj.sele_country.value=='')
	{
	    alertError("Please Select Country.");
	    return false;
	}
  	if(frmObj.sele_city.value=="")
  	{
	    alertError("Please Select City.");
	    return false;
	}
	else if(frmObj.txt_search_range.value=="")
  	{
	    alertError("Please enter range.");
	    return false;
	}
	else
	{		
		frmObj.submit();
	}
}

function askespert(file,frmname)
{
	//alert(file);
	var name = frmname;
	frmname.file.value=file;
	//alert(frmname.file.value);
	//alert(document.name.file.value); 
	frmname.submit();
}

/*
function getStateSelected(country_id)
{
	var docObj = null;
	if (typeof window.ActiveXObject != 'undefined')
	{
		docObj = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		docObj = new XMLHttpRequest();
	}
	//alert("general");
	if(country_id == 42 || country_id == 43)
	{
		document.getElementById("stateHide").style.display = 'block';

		//THIS CODE USE FOR GET THE STATE LIST //
		docObj.open("GET", "index_ajax.php?file=getstates&country_id="+ country_id, false);
		docObj.send(null);
		var Res = docObj.responseText;
		document.getElementById("states").innerHTML = Res;

	}
	else
	{
		document.getElementById("stateHide").style.display = 'none';
		//THIS CODE USE FOR GET THE  //
		document.getElementById("cityHide").style.display = '';
		docObj.open("GET", "index_ajax.php?file=getcity&country_id="+ country_id, false);
		docObj.send(null);
		var Res = docObj.responseText;
		document.getElementById("city").innerHTML = Res;
	}
}
*/

//THIS FUNCTION GET CITY //
function getCitybyStateId(frmObj){

	server_path= document.frmSearch.server_url.value;
	var docObj = null;
	if (typeof window.ActiveXObject != 'undefined'){
		docObj = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		docObj = new XMLHttpRequest();
	}
	var state_id = frmObj.sele_state.value;
	docObj.open("GET", server_path+"index_ajax.php?file=getcity&state_id="+ state_id, false);
	docObj.send(null);
	var Res = docObj.responseText;
	document.getElementById("cityHide").style.display = '';  //VISIBLE  CITY CONTROLE
	document.getElementById("city").innerHTML = Res;
}


function getCitybyStateIdescort(frmObj){

	server_path= document.frmSearch.server_url.value;
	var docObj = null;
	if (typeof window.ActiveXObject != 'undefined'){
		docObj = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		docObj = new XMLHttpRequest();
	}
	var state_id = frmObj.sele_state.value;
	docObj.open("GET", server_path+"index_ajax.php?file=getcityescort&state_id="+ state_id, false);
	docObj.send(null);
	var Res = docObj.responseText;
	document.getElementById("escortsearchboxcontry").style.display = 'none';  //VISIBLE  CITY CONTROLE
	document.getElementById("escortsearchboxstate").style.display = 'none';  //VISIBLE  CITY CONTROLE
	document.getElementById("escortsearchboxcity").style.display = '';  //VISIBLE  CITY CONTROLE
	document.getElementById("cityescort").innerHTML = Res;
}



//THIS FUNCTION SHOW AND HIDE OTHER CITY//
function showHideOther(frmObj){
	if(frmObj.sele_city.value == 'other'){
		document.getElementById("txt_other_cityHide").style.display = '';
	}else{
		document.getElementById("txt_other_cityHide").style.display = 'none';
	}
}



//THIS IS VALIDTION FOR POST MEAST
function validMeats(frmObj){
	
	if(document.getElementById("countryHide").style.display == '' && frmObj.action.value !="update")
		if(!validateInputField(frmObj.sele_country, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Country')) return false;
	
	/*if(document.getElementById("stateHide").style.display == ''){
		if(!validateInputField(frmObj.sele_state, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'State')) return false;
	}*/

	if(document.getElementById("changeCSC").value == 0)
	{
		if(document.getElementById("chk_selected_city").value==0)
		{
			if (document.getElementById("sele_country").value==42 || document.getElementById("sele_country").value==43)
			{
				alert("Please Enter Zip And Click Next To Select Actual City.");
			}
			else
				alert("Please Enter City And Click Next To Select Actual City.");
			return false;
		}
		
		if(document.getElementById("dvShowCityDetails").innerHTML == "")
		{
			alert("Please Select City From List.");
			return false;
		}
	}
	/*if(document.getElementById("txt_other_cityHide").style.display == ''){
		if(!validateInputField(frmObj.txt_other_city, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Other City')) return false;
	}*/
	if(!validateInputField(frmObj.sele_ends, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Ends')) return false;

	if(!validateInputField(frmObj.sele_location, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Location')) return false;

	if(!validateInputField(frmObj.sele_activity, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Activity')) return false;	
	
}

 //THIS FUNCTION OPEN ESCORT PROFILE
 function popUpOfProfile(member_id,ses_member_id){
window.open("http://www.maleescortreview.com/profile/"+member_id+"/",'','scrollbars, width=1000, height=600');
//window.open("http://www.maleescortreview.com/index.php?file=view_member_profile&username="+member_id,'','scrollbars, width=1000, height=600');

	 /*if(ses_member_id != ''){
		window.open("index.php?file=view_top_profile&member_id="+member_id,'','scrollbars, width=800, height=593');
	 }else{
		location.href = "index.php?file=login&MSG_CODE=MUST_LOGIN"
	 }*/
	 //if(ses_member_id != ''){		
	//	window.open("profile/"+member_id+"/",'','width=800, height=600, status=no, scrollbars='true',location=no, toolbar=no, resizable=yes');
	//window.open("profile/"+member_id+"/",'','scrollbars, width=800, height=600');

//	window.open("profile/"+member_id+"/",'','toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,width=800,height=600,overflow-y:scroll');
	 /*}else{

		location.href = "index.php?file=login&MSG_CODE=MUST_LOGIN"
	 }*/
 }

   //THIS FUNCTION OPEN WITHOUT MEMBER PROFILE
  function popUpOfWithOutPhotoProfile(member_id,sess_member_id ){
	 if(sess_member_id != ''){
		window.open("index.php?file=view_member_profile&member_id="+member_id+"&is_photo_upload=no",'_new','scrollbars, width=800, height=593');
	 }else{
		location.href = "index.php?file=login&MSG_CODE=MUST_LOGIN"
	 }
 }


function transferurl(frm){
	 
		location.href = "index.php?file=member_search_by_city&"+document.frmVerifiedMemberescort.sele_country_escort.value;
 }

 function transferurlreview(frm){
	 
		location.href = "index.php?file=review_search_by_city&"+document.frmVerifiedMemberreview.sele_country_escort.value;
 }



//THIS FUNCTION VIEW LARG IMGAE
  //THIS FUNCTION OPEN LARGE PHOTO
 function popUpOfImage(image_id){
		window.open("index.php?file=imagewindow&image_id="+image_id,image_id+'_new','scrollbars, width=800, height=593');
 }

// function to view listing images by vinayak
function popUpListingImage(city_section_name,city_section_id){

		window.open('index.php?file=view_listing_images&city_section_name='+city_section_name+'&city_section_id='+city_section_id ,'listing_image','scrollbars, width=800, height=600');
 }
 //THIS FUNCTION VALID SEARCH TEXTBOX
function validcountry(frmObj){
	if(!validateInputField(frmObj.sele_country, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Search Database for'))
		return false;
}

function escort_search(frmObj){
		new Ajax.Updater('mid_body', 'index_ajax.php', { parameters: $('frmEsortSearch').serialize(true)
				, onLoading: showWaitingImage( 'mid_body' ),	evalScripts: true});
}


function bb_gis_all_profiles_a(frmObj){
		new Ajax.Updater('mid_body', 'index_ajax.php', { parameters: $('frmMemberSearch').serialize(true)
				, onLoading: showWaitingImage( 'mid_body' ),	evalScripts: true});
}

function bb_gis_with_pics_a(frmObj){
		new Ajax.Updater('mid_body', 'index_ajax.php', { parameters: $('frmMemberSearch').serialize(true)
				, onLoading: showWaitingImage( 'mid_body' ),	evalScripts: true});
}

function advance_search(frmObj){
		new Ajax.Updater('mid_body', 'index_ajax.php', { parameters: $('frmAdvSearch').serialize(true)
				, onLoading: showWaitingImage( 'mid_body' ),	evalScripts: true});
}

function all_pics(frmObj){
		new Ajax.Updater('mid_body', 'index_ajax.php', { parameters: $('frmAllpics').serialize(true)
				, onLoading: showWaitingImage( 'mid_body' ),	evalScripts: true});
}


function profile_name_a(frmObj){
		new Ajax.Updater('mid_body', 'index_ajax.php', { parameters: $('frmProSearch').serialize(true)
				, onLoading: showWaitingImage( 'mid_body' ),	evalScripts: true});
}
function profile_name_join(frmObj){
		// For Username
	if(frmObj.txt_search_handle.value == ""){
		alert("Please enter Username");
		frmObj.txt_username.focus();
		return false;
	}
	frmObj.username.value=frmObj.txt_username.value;
}

function validSearchNew(frmObj){
	if(!validateInputField(frmObj.txt_searchkey, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Search Database for'))
		return false;
}

/* chetan added this funciton for file askmichael_detail.tpl copy form askadmin.js*/
function openVotePopupNew(url, newWindow) {
	window.open(url,'_new','scrollbars,resizable=yes,width=350, height=280');
}
/* chetan added this funciton for file askmichael_database.tpl copy form askadmin.js*/
function askddatabaseNew(url){
		new Ajax.Updater('mid_body', url, { parameters: $('adba').serialize(true)
			, onLoading: showWaitingImage( 'mid_body' ),	evalScripts: true});
}

/* CLOSE CODE OF CHETAN for the askmichal_database*/

/* code of chetan for the Askmichael_actionmail.tpl */
function validSendQusAnsNew(frmObj){
	frmObj=document.sendmail;
	if(!validateInputField(frmObj.txt_send_to, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'To'))
		return false;
	if(!validateInputField(frmObj.txt_send_to, FIELD_TYPE_MAIL, CNT_NOT_NULL, 'To'))
	    return false;

	if(!validateInputField(frmObj.txt_from, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'From'))
		return false;
	if(!validateInputField(frmObj.txt_from, FIELD_TYPE_MAIL, CNT_NOT_NULL, 'From'))
	    return false;

	/*if(!validateInputField(frmObj.txt_subject, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Subject'))
	return false;*/
}

/* code of chetan for the Askmichael_actionmail.tpl */

function openChatPopup(URL,un,mid,mpic)
{
	window.open('http://bareback.com:8080/?0,0,3,0,0&nn='+un+'&pu=http://bareback.com/view_member_chat_profile.php?'+mid+'&au=http://bareback.com/images/member/'+mpic, "chatWindow",'width=655,height=500,status=no,scrollbars=no, location=no,toolbar=no,resizable=no');
}

// Search ajax function
function a_req(url){
	new Ajax.Updater('mid_body', url, { parameters: $('frmsearch').serialize(true)
		, onLoading: showWaitingImage( 'mid_body' ),	evalScripts: true});
}

function ajax_req_forgotlogin(url){	
	new Ajax.Updater('mid_body', url, { onLoading: showWaitingImage( 'mid_body' )});
}

function ajax_req_escort(url){	
	new Ajax.Updater('escortsearchbox', url, { onLoading: showWaitingImage( 'escortsearchbox' )});
}


function ajax_req_middle(url){
	new Ajax.Updater('middle_ajx', url, { onLoading: showWaitingImage( 'middle_ajx' )});
}

function quickSearch(frmObj, by)
{
	
	if ( by == 1)
		url='index_ajax.php?file=review_quick_search_a&action=byEName&txtEscortName='+frmObj.txtEscortName.value;
	else
		url='index_ajax.php?file=review_quick_search_a&action=byRName&txtReviewerName='+frmObj.txtReviewerName.value;	
	new Ajax.Updater('mid_body', url, { onLoading: showWaitingImage( 'mid_body' )});
}

// CHECK LOGIN INFORMATION
function checkLogin1(frmObj)
{
	// For Username
	if(frmObj.txt_username.value == ""){
		alert("Please enter Username");
		frmObj.txt_username.focus();
		return false;
	}
	// For Password
	if(frmObj.txt_password.value == ""){
		alert("Please enter password");
		frmObj.txt_password.focus();
		return false;
	}
	frmObj.UserName.value=frmObj.txt_username.value;
	frmObj.PassWord.value=frmObj.txt_password.value;

}
function popup_circuit()
{
  	circuit_id=document.frm.cp.value;
  	window.open("index.php?file=circuit_parties&circuit_id="+circuit_id,'_newpop','scrollbars, width=800, height=593');
}
function popUpOfProfileImage(image_id)
{
		server_path= document.frmSearch.server_url.value;
		window.open(server_path+"index.php?file=view_photo&image_id="+image_id+"&status=xxx",'_new','scrollbars, width=800, height=593');
}
function hotImage()
{
	new Ajax.Updater('mid_body', 'index_ajax.php', { parameters: $('frmHotImg').serialize(true)
			, onLoading: showWaitingImage( 'mid_body' ),	evalScripts: true});
}

function popUpHOTImage(image_id,show,sort)
{
	window.open("index.php?file=view_photo&image_id="+image_id+"&show="+show+"&sort="+sort,'_new','scrollbars, width=800, height=593');
}

function popup_plink()
{
  	circuit_id=document.frm.cp.value;

  	url="index_ajax.php?file=circuit_hit_counter&circuit_id="+ circuit_id;
	new Ajax.Updater('test', url);

	plink=document.frm.plink.value;
  	w=window.open('http://'+plink,'windowname2','scrollbars, width=800, height=593,toolbar=1,menubar=yes,location=yes,resizable=yes');
}

function circuit_party_hit_counter(circuit_id)
{

	var docObj = null;
	if (typeof window.ActiveXObject != 'undefined'){
		docObj = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		docObj = new XMLHttpRequest();
	}

	url="index_ajax.php?file=circuit_hit_counter&circuit_id="+ circuit_id;
	//url="/user/circuit_hit_counter.php?circuit_id="+ circuit_id;

	//new Ajax.Updater('test', url);
	docObj.open("GET", url, false);
	docObj.send(null);
	var Res = docObj.responseText;
	//alert(Res);
}




function validNewCityMail(frmObj){

	// For the filter of the basic varaibles types
	var NumOnly 		= "0123456789";
	var AlphaOnly 		= "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var AlphaNumeric 	= AlphaOnly + NumOnly;


	if(!inValidCharSet(frmObj.txt_handle.value,AlphaNumeric)){
		alert("Please enter valid handle")
		frmObj.txt_handle.focus();
		return false;
	}

	if(!validateInputField(frmObj.txt_handle, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Handle')) return false;
	if(frmObj.txt_handle.value.length < 4 || frmObj.txt_handle.value.length > 16) {
		alert("Enter Valid Handle ,Must be at least 4 and no more then 16 characters");
		frmObj.txt_handle.focus();
		return false;
	}

	if(!validateInputField(frmObj.txt_email, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Your Email Address')) return false;
	if(!validateInputField(frmObj.txt_email, FIELD_TYPE_MAIL, CNT_NOT_NULL, 'Your Email Address'))
	    return false;



if(frmObj.txt_country != undefined)  {
		if(!validateInputField(frmObj.txt_country, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Country'))
			return false;
	}

	if(frmObj.txt_city != undefined)  {
		if(!validateInputField(frmObj.txt_city, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'City'))
			return false;
	}
return true;

}

 function popUpOfNewCity(){
			window.open("index.php?file=new_city_request",'_new','scrollbars=no,menubar=no, location=yes,toolbar=no,width=400, height=400');
 }
 function fnload(url)
 {
	 new Ajax.Updater('mid_body', url, { parameters: $('frmselopt').serialize(true), onLoading: showWaitingImage( 'mid_body' ),	evalScripts: true});
 }

//for gold price options on pay pages
function setTarget()
{
	if(document.form2.txtsetre.value!='')
	{
		if(document.form2.txtsetre.value=='1'){
			document.form2.action="https://secure2.segpay.com/billing/poset.cgi?x-eticketid=110807:4133";
			document.form2.submit();
		}
		else if(document.form2.txtsetre.value=='2'){
			document.form2.action="https://secure2.segpay.com/billing/poset.cgi?x-eticketid=110807:4129";
			document.form2.submit();
		}
		else if(document.form2.txtsetre.value=='3')
			{
			document.form2.action="https://secure2.segpay.com/billing/poset.cgi?x-eticketid=110807:4128";
			document.form2.submit();
			}
		else if(document.form2.txtsetre.value=='4')
		{
			document.form2.action="https://secure2.segpay.com/billing/poset.cgi?x-eticketid=110807:4127";			
			document.form2.submit();

		}
	}
	else
	{
		alert('Please select one option');
		return false;
	}
}
function funselect(optval)
{
	document.form2.txtsetre.value=optval.value;
}

//for silver price options on pay pages
function setTarget1()
{
	if(document.form.txtsetre1.value!='')
	{
		if(document.form.txtsetre1.value=='1'){
			document.form.action="https://secure2.segpay.com/billing/poset.cgi?x-eticketid=110807:4132";
			document.form.submit();
		}
		else if(document.form.txtsetre1.value=='2'){
      		document.form.action="https://secure2.segpay.com/billing/poset.cgi?x-eticketid=110807:4126";
			document.form.submit();
		}
		else if(document.form.txtsetre1.value=='3'){
			document.form.action="https://secure2.segpay.com/billing/poset.cgi?x-eticketid=110807:4125";
			document.form.submit();
			}
		else if(document.form.txtsetre1.value=='4'){
			document.form.action="https://secure2.segpay.com/billing/poset.cgi?x-eticketid=110807:4124";
			document.form.submit();
		}
	}
	else
	{
		alert('Please select one option');
		return false;
	}
}
function funselect1(optval)
{
	document.form.txtsetre1.value=optval.value;
}
function setCheckAll(objfrm){
	var chkall = objfrm.chkAll.checked;
	var chkitemlength = objfrm.chkitem.length;
	if(chkall){
		if(chkitemlength == undefined ){
			objfrm.chkitem.checked = true;
		}else{
			 for(i=0;i<chkitemlength;i++){
				objfrm.chkitem[i].checked = true;
			 }
		}
	}else{
		if(chkitemlength == undefined ){
			objfrm.chkitem.checked = false;
		}else{
			 for(i=0;i<chkitemlength;i++){
				objfrm.chkitem[i].checked = false;
			 }
		}
	}
}

function funSaveLink(file,link,memid,title,flag)
{
	var t;
	t=prompt("Please enter search title",title);
	title=t;	
	/***************** Browser ******************/
	var http = null;
	var isOpera=navigator.userAgent.indexOf('Opera')>-1;
	var isIE=navigator.userAgent.indexOf('MSIE')>1&&!isOpera;
	var isMoz=navigator.userAgent.indexOf('Mozilla/5.')==0&&!isOpera;
		
	if(isIE)
		http = new ActiveXObject("Microsoft.XMLHTTP");
	else if(isMoz)
		http = new XMLHttpRequest();
	/***************** Browser ******************/
	var url = file+"?slink="+link+"&memid="+memid+"&stitle="+title+"&flag="+flag;	
	var randomno = parseInt(Math.random()*99999999);  // cache buster	
	url=url + "&rand=" + randomno;
	http.open("GET", url, false);
	http.send(null);
	alert(http.responseText);
}
function fnCFocus(obj) 
{
	obj.style.backgroundColor = '#ffffff';
	obj.style.borderColor = '#D7D7EC';
	obj.style.color = '#000000';
}

function fnCBlur(obj) 
{
	obj.style.backgroundColor = '#ffffff';
	obj.style.borderColor = '#D7D7EC';
	obj.style.color = '#000000';
}
function hasOptions(obj) {
	if (obj!=null && obj.options!=null) { return true; }
	return false;
	}

function moveOptionUp(obj) {
	if (!hasOptions(obj)) { return; }
	for (i=0; i<obj.options.length; i++) {
		if (obj.options[i].selected) {
			if (i != 0 && !obj.options[i-1].selected) {
				swapOptions(obj,i,i-1);
				obj.options[i-1].selected = true;
				}
			}
		}
	}
function moveOptionDown(obj) {
	//alert(obj.options.length);
	if (!hasOptions(obj)) { return; }
	for (i=obj.options.length-1; i>=0; i--) {
		if (obj.options[i].selected) {
			if (i != (obj.options.length-1) && ! obj.options[i+1].selected) {
				swapOptions(obj,i,i+1);
				obj.options[i+1].selected = true;
				}
			}
		}
	}
function swapOptions(obj,i,j) {
	var o = obj.options;
	var i_selected = o[i].selected;
	var j_selected = o[j].selected;
	var temp = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
	var temp2= new Option(o[j].text, o[j].value, o[j].defaultSelected, o[j].selected);
	o[i] = temp2;
	o[j] = temp;
	o[i].selected = j_selected;
	o[j].selected = i_selected;
	}

function makelist()
{

 objlist=document.frm.txtboard;
 objorderA=document.frm.hidorder;
 
  for(i=0;i<objlist.length;i++)
  {
   if(objorderA.value!='')
     objorderA.value+=","+objlist.options[i].value;
    else
	   objorderA.value=objlist.options[i].value;
  }
  document.frm.swap_action.value="swapaction";
  document.frm.submit();
}	

function saveEvent(frmObj){	
	if(!validateInputField(frmObj.vtitle, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Title'))
		return false;	
	else if(!validateInputField(frmObj.txtDFROM, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Beginning'))
		return false;
	else if(!validateInputField(frmObj.txtDFROM1, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Ending'))
		return false;
	else if(!validateInputField(frmObj.vwebsite, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Website'))
		return false;

	if(!validateInputField(frmObj.sele_country, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Country')) return false;
	
	if(document.getElementById("changeCSC").value == 0)
	{
		if(document.getElementById("chk_selected_city").value==0)
		{
			if (document.getElementById("sele_country").value==42 || document.getElementById("sele_country").value==43)
			{
				alert("Please Enter Zip And Click Next To Select Actual City.");
			}
			else
				alert("Please Enter City And Click Next To Select Actual City.");
			return false;
		}
		
		if(document.getElementById("dvShowCityDetails").innerHTML == "")
		{
			alert("Please Select City From List.");
			return false;
		}
	}	
	else if (document.getElementById("filename0").value == "" && document.getElementById("filename1").value == "" && document.getElementById("filename2").value == "" && document.getElementById("filename3").value == "" && document.getElementById("filename4").value == "")
	{
		alert("Please upload atleast one image.");
		return false;
	}
	else
	{
		new Ajax.Updater('calendar', 'index_ajax.php', { parameters: $('frmEvent').serialize(true)
			, onLoading: showWaitingImage( 'eventsdataview' ),	evalScripts: true});
	}
}

function cmbSelect(frmObj, page)
{
	if (page==1)
	{
		var url='index_ajax.php?file=bb_calweeks&week='+frmObj.week.value+'&year='+frmObj.year.value;
	}
	else 
	{
		var url='index_ajax.php?file=bb_month&month='+frmObj.month.value+'&year='+frmObj.year.value;
	}
	
	new Ajax.Updater('calendar', url, { onLoading: showWaitingImage( 'calendar' )});	
}

//THIS FUNCTION IS USE FOR OPEN POPUP
function openPopup(URL){
	var handelPopup;
	var checkbrow;
	handelPopup = window.open(URL, 'View Message', 'scrollbars=yes, resizable=no, menubar=no');
	handelPopup.resizeTo(810, 627);
}



function fnSelUserType(id)
{
	Modalbox.hide();
	if (id==1)
		window.location.href='index.php?file=register_gen';
	else
		window.location.href='index.php?file=escort_register';
}

function Search(URL)
{	
	new Ajax.Updater('mid_body', URL, {onLoading: showWaitingImage( 'mid_body' )});
}

// Ask Esperts js functions
function validAskAdmin(frmObj){

	if(frmObj.sele_areas.value=="")
	{
		alert("Please select Question Area.");
		return false;		
	}
	else if(frmObj.txt_question_subject.value=="")
	{
		alert("Please enter subject.");
		return false;
	}
	else
	{
		frmObj.submit();
	}
}

function openVotePopup(url, newWindow) {
	server_path= document.frmsearch.server_url.value;
		window.open(server_path+url,'_new','scrollbars,resizable=yes,width=350, height=280');
}

//THIS FUNCTION VALID SEARCH TEXTBOX 
function validSearch(frmObj){
	if(!validateInputField(frmObj.txt_searchkey, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Search Database for'))
		return false;
}

//THIS FUNCTION VALID SEARCH TEXTBOX 
function validcountry(frmObj){
	if(!validateInputField(frmObj.sele_country, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Search Database for'))
		return false;
}


//THIS FUINCTION VALID 
function validSendQusAns(frmObj){
	
	if(!validateInputField(frmObj.txt_send_to, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'To'))
		return false;
	if(!validateInputField(frmObj.txt_send_to, FIELD_TYPE_MAIL, CNT_NOT_NULL, 'To'))
	    return false;	
		
	if(!validateInputField(frmObj.txt_from, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'From'))
		return false;
	if(!validateInputField(frmObj.txt_from, FIELD_TYPE_MAIL, CNT_NOT_NULL, 'From'))
	    return false;
		
	if(!validateInputField(frmObj.txt_subject, FIELD_TYPE_VARCHAR, CNT_NOT_NULL, 'Subject'))
	return false;
}

  function removeblankspace(frmObj,w) 
{
		var txtUserName = frmObj.txtUserName.value.replace(/^\s+|\s+$/g,"");
		var txtUserName1 = frmObj.txtUserName;
		txtUserName1.value = txtUserName;
		//var r={'special':/[\W]/g}
		//txtUserName1.value = txtUserName1.value.replace(r[w],'');
}


function popUpHOTVideo(video_id,show,sort)
{
	if (show=='selfv')
	{
		server_path= "http://www.maleescortreview.com/";
		window.open(server_path+"index.php?file=watch_self_video&vp="+video_id+"&show="+show+"&sort="+sort,'_new','scrollbars, width=500, height=440');
	}
	else
	{
		server_path= "http://www.maleescortreview.com/";
		window.open(server_path+"index.php?file=watch_video&vp="+video_id+"&show="+show+"&sort="+sort,'_new','scrollbars, width=500, height=440');
	}	
}
