// Get base url
url = document.location.href;
xend = url.lastIndexOf("/") + 1;
var base_url = url.substring(0, xend);

//function used to verify the account details
function funAjaxLoadDropdown()
{
  with(document.forms["frmEventsCalendar"])
  {
    //var strUserName=trimAll(txt_reg_mem_loginName.value);
	//var strPostRegData="usrname="+strUserName;
	var strPostRegData = "";
	TxtBoxValues = new Array("txtState","txtCity","txtCounty","txtZipCode","txtCompanyName","txtKeyword","txtClothing","txtShoes","txtPersonal","txtEntertainment","txtS_Services","txtHealth","txtGear","txtSale","txtRest");
	for(var i=0; i < TxtBoxValues.length; i++)
	{
		var Dropdownvalue = elements[TxtBoxValues[i]].value;
		Dropdownvalue = Dropdownvalue.replace(/&/, "~%~");

		if(strPostRegData != "")	
			strPostRegData += "&"+TxtBoxValues[i]+"="+Dropdownvalue;
		else
			strPostRegData = TxtBoxValues[i]+"="+Dropdownvalue;
	}
	var MerIds = hid_merids.value;
	var AdvIds = hid_advids.value;
	strPostRegData += "&merids="+MerIds+"&advids="+AdvIds;

//alert (strPostRegData);
	//show loading image 
	document.getElementById("tr_image_loading").style.display="";
    
	 url="male_load_dropdown_values.php";

	//Does URL begin with http?
	if(url.substring(0, 4) != 'http')
	{
	  url = base_url + url;
	}
	
	http_req = null;
	if(window.XMLHttpRequest)     http_req = new XMLHttpRequest();
	else if(window.ActiveXObject) http_req = new ActiveXObject("Microsoft.XMLHTTP");
	if(http_req)
	{
		http_req.onreadystatechange = funResponsLoadDropdown;
		http_req.open("POST", url, true);
		http_req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		http_req.send(strPostRegData);
	}
  }
}

//function used to verify the account details
function funResponsLoadDropdown()
{
  if(http_req.readyState== 4)
  {
	//show loading image 
	document.getElementById("tr_image_loading").style.display="none";

    //Response text is=> "valid" or "invalid"
	var strResponseTxt= http_req.responseText;	

	var strClsName;
    with(document.forms["frmEventsCalendar"])
	{
		 if(strResponseTxt != "")
		 {		 	
			//alert (strResponseTxt);
			//document.getElementById("displayresult").innerHTML = strResponseTxt;
			var arrInsPopUpDatas = strResponseTxt.split("~#~");
			document.getElementById("anylinkState").innerHTML = arrInsPopUpDatas[0];
			document.getElementById("anylinkCity").innerHTML = arrInsPopUpDatas[1];
			document.getElementById("anylinkCounty").innerHTML = arrInsPopUpDatas[2];
			document.getElementById("anylinkZip").innerHTML = arrInsPopUpDatas[3];
			document.getElementById("anylinkCompanyName").innerHTML = arrInsPopUpDatas[4];
			document.getElementById("anylinkKeyword").innerHTML = arrInsPopUpDatas[5];
			document.getElementById("anylinkClothing").innerHTML = arrInsPopUpDatas[6];
			document.getElementById("anylinkShoes").innerHTML = arrInsPopUpDatas[7];
			document.getElementById("anylinkPersonal").innerHTML = arrInsPopUpDatas[8];
			document.getElementById("anylinkEntertainment").innerHTML = arrInsPopUpDatas[9];
			document.getElementById("anylinkS_Services").innerHTML = arrInsPopUpDatas[10];
			document.getElementById("anylinkHealth").innerHTML = arrInsPopUpDatas[11];
			document.getElementById("anylinkGear").innerHTML = arrInsPopUpDatas[12];
			document.getElementById("anylinkSale").innerHTML = arrInsPopUpDatas[13];
			document.getElementById("anylinkRest").innerHTML = arrInsPopUpDatas[14];
		 }

	}//with ends
  
  }//response check ends
}

//function used to verify the account details
function funAjaxLoadDropdownList()
{
  with(document.forms["frmEventsCalendarList"])
  {
    //var strUserName=trimAll(txt_reg_mem_loginName.value);
	//var strPostRegData="usrname="+strUserName;
	var strPostRegData = "";
	TxtBoxValues = new Array("txtState","txtCity","txtCounty","txtZipCode","txtCompanyName","txtKeyword","txtClothing","txtShoes","txtPersonal","txtEntertainment","txtS_Services","txtHealth","txtGear","txtSale","txtRest");
	for(var i=0; i < TxtBoxValues.length; i++)
	{
		var Dropdownvalue = elements[TxtBoxValues[i]].value;
		Dropdownvalue = Dropdownvalue.replace(/&/, "~%~");

		if(strPostRegData != "")	
			strPostRegData += "&"+TxtBoxValues[i]+"="+Dropdownvalue;
		else
			strPostRegData = TxtBoxValues[i]+"="+Dropdownvalue;
	}
	var MerIds = hid_merids.value;
	var AdvIds = hid_advids.value;
	strPostRegData += "&merids="+MerIds+"&advids="+AdvIds;

//alert (strPostRegData);
	//show loading image 
	document.getElementById("tr_image_loading").style.display="";
    
	 url="male_load_dropdown_values.php";

	//Does URL begin with http?
	if(url.substring(0, 4) != 'http')
	{
	  url = base_url + url;
	}
	
	http_req = null;
	if(window.XMLHttpRequest)     http_req = new XMLHttpRequest();
	else if(window.ActiveXObject) http_req = new ActiveXObject("Microsoft.XMLHTTP");
	if(http_req)
	{
		http_req.onreadystatechange = funResponsLoadDropdownList;
		http_req.open("POST", url, true);
		http_req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		http_req.send(strPostRegData);
	}
  }
}

//function used to verify the account details
function funResponsLoadDropdownList()
{
  if(http_req.readyState== 4)
  {
	//show loading image 
	document.getElementById("tr_image_loading").style.display="none";

    //Response text is=> "valid" or "invalid"
	var strResponseTxt= http_req.responseText;	

	var strClsName;
    with(document.forms["frmEventsCalendarList"])
	{
		 if(strResponseTxt != "")
		 {		 	
			//alert (strResponseTxt);
			//document.getElementById("displayresult").innerHTML = strResponseTxt;
			var arrInsPopUpDatas = strResponseTxt.split("~#~");
			document.getElementById("anylinkState").innerHTML = arrInsPopUpDatas[0];
			document.getElementById("anylinkCity").innerHTML = arrInsPopUpDatas[1];
			document.getElementById("anylinkCounty").innerHTML = arrInsPopUpDatas[2];
			document.getElementById("anylinkZip").innerHTML = arrInsPopUpDatas[3];
			document.getElementById("anylinkCompanyName").innerHTML = arrInsPopUpDatas[4];
			document.getElementById("anylinkKeyword").innerHTML = arrInsPopUpDatas[5];
			document.getElementById("anylinkClothing").innerHTML = arrInsPopUpDatas[6];
			document.getElementById("anylinkShoes").innerHTML = arrInsPopUpDatas[7];
			document.getElementById("anylinkPersonal").innerHTML = arrInsPopUpDatas[8];
			document.getElementById("anylinkEntertainment").innerHTML = arrInsPopUpDatas[9];
			document.getElementById("anylinkS_Services").innerHTML = arrInsPopUpDatas[10];
			document.getElementById("anylinkHealth").innerHTML = arrInsPopUpDatas[11];
			document.getElementById("anylinkGear").innerHTML = arrInsPopUpDatas[12];
			document.getElementById("anylinkSale").innerHTML = arrInsPopUpDatas[13];
			document.getElementById("anylinkRest").innerHTML = arrInsPopUpDatas[14];
		 }

	}//with ends
  
  }//response check ends
}


//function used to verify the account details
function fnreducewebsiteclicks(type,adv_id)
{
  with(document.forms["fmprintads"])
  {
    var type=type;
	var adv_id=adv_id;
	var strPostRegData = "";
	strPostRegData = "type="+type+"&adv_id="+adv_id;

	 url="redirect_file.php";

	//Does URL begin with http?
	if(url.substring(0, 4) != 'http')
	{
	  url = base_url + url;
	}
	
	http_req = null;
	if(window.XMLHttpRequest)     http_req = new XMLHttpRequest();
	else if(window.ActiveXObject) http_req = new ActiveXObject("Microsoft.XMLHTTP");
	if(http_req)
	{
		http_req.onreadystatechange = funredclicks;
		http_req.open("POST", url, true);
		http_req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		http_req.send(strPostRegData);
	}
  }
}

//function used to verify the account details
function funredclicks()
{
  if(http_req.readyState== 4)
  {
	
	var strResponseTxt= http_req.responseText;	
  }//response check ends
}