/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

Purpose		: All AJAX related function

CFD Path	:

Change History	: Mohammad Created Last Modified 04-27-2007

Mod#	 	Date	 		Who   		Description
-------		--------  		------  	---------------------------------
00000001	04/18/2007		Mohammad 	Created

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
<!--
	//Create a boolean variable to check for a valid Internet Explorer instance.
	var xmlhttp = false;
	//Check if we are using IE.
	try {
	//If the Javascript version is greater than 5.
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	//If not, then use the older active x object.
		try {
		//If we are using Internet Explorer.
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
		//Else we must be using a non-IE browser.
			xmlhttp = false;
		}
	}
	//If we are using a non-IE browser, create a javascript instance of the object.
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
	}

	// This function is customize for registration and list your property
	function makerequest(serverPage, objID)
	{
		// This is the function to call with serverPage as the page to dynamically call and objId is the div id
		//alert(serverPage);
		var obj = document.getElementById(objID);
		try
		{
			xmlhttp.open("GET", serverPage,true);
			xmlhttp.onreadystatechange = function()
			{
			if (xmlhttp.readyState==4)
				{
					//obj.innerHTML = xmlhttp.responseText;
					obj.innerHTML = xmlhttp.responseText.substr(0,(xmlhttp.responseText.length-1));
					mystr = xmlhttp.responseText.substr(0,(xmlhttp.responseText.length-1));
					var thelength=xmlhttp.responseText.length;
					var last_char=xmlhttp.responseText.charAt(thelength-1);
					//alert(obj.innerHTML)
					if(eval(last_char)==0)
					{
						return false;
					}
					else
					{
						return true;
					}
				}
				else
				{
					document.getElementById(objID).innerHTML = 'processing.....please wait';
				}
			}
			xmlhttp.send(null);
		}
		catch(e)
		{
		}
	}



	// This function is a general function for any where use

	function makeajaxrequest(serverPage,objID)
	{

		// This is the function to call with serverPage as the page to dynamically call and objId is the div id
		//alert(serverPage);
		var obj = document.getElementById(objID);
		try
		{
			xmlhttp.open("GET",serverPage,true);
			xmlhttp.onreadystatechange = function()
			{
			if (xmlhttp.readyState==4)
			{
				//alert(xmlhttp.responseText);
				obj.innerHTML = xmlhttp.responseText;
			}
			}
			xmlhttp.send(null);
		}
		catch(e)
		{
		}
	}

	function ajaxrequest(serverPage,objID)
	{
		// This is the function to call with serverPage as the page to dynamically call and objId is the div id
		//alert(objID);
		var obj = document.getElementById(objID);
		try
		{
			xmlhttp.open("GET",serverPage,true);
			xmlhttp.onreadystatechange = function()
			{
			if (xmlhttp.readyState==4)
				{
					//alert(xmlhttp.responseText);
					obj.innerHTML = xmlhttp.responseText;
				}
			}
			xmlhttp.send(null);
		}
		catch(e)
		{
		}
    }

	function makeajaxpostrequest(serverPage,objID,propertyid)
	{
		// This is the function to call with serverPage as the page to dynamically call and objId is the div id
		var obj = document.getElementById(objID);
		try
		{
			xmlhttp.open("POST",serverPage,true);
			xmlhttp.onreadystatechange = function()
			{
			if (xmlhttp.readyState==4)
				{
					obj.innerHTML = xmlhttp.responseText;
				}
			}
			xmlhttp.send(null);
		}
		catch(e)
		{
		}
    }

	// This function is an ajax function for finding banner member balance

	function makeajaxbannerrequest(serverPage,objID,sitebanners)
	{

		// This is the function to call with serverPage as the page to dynamically call and objId is the div id
		//alert(serverPage);
		var obj = document.getElementById(objID);
		try
		{
			xmlhttp.open("GET",serverPage,true);
			xmlhttp.onreadystatechange = function()
			{
			if (xmlhttp.readyState==4)
			{
				//alert(xmlhttp.responseText);
				obj.innerHTML = xmlhttp.responseText;


				if(sitebanners == '1')
				{
					val = document.user.userid.value;

					document.user.member_id.value = val;
					document.user.member_id.setAttribute('readonly','readonly');
				}
				else if(sitebanners == '3')
				{
					val = document.user.membername.value;
					if(val == "" || val=="undefined")
					{
						document.user.username.value = document.user.contact_email.value;
						document.user.new_existing['0'].checked=true;
					}
					else
					{
						document.user.username.value = val;
						document.user.new_existing['1'].checked=true;
					}
				}
				else if(sitebanners == '4')
				{
					val = document.user.mname.value;
					if(val == "" || val=="undefined")
					{
						//document.user.username.value = document.user.contact_email.value;
						document.user.new_existing['0'].checked=true;
					}
					else
					{
						//document.user.username.value = val;
						document.user.new_existing['1'].checked=true;
					}
				}
				else if(sitebanners == '5')
				{
					val = document.microsite.userid.value;
					document.microsite.member_id.value = val;
					document.microsite.member_id.setAttribute('readonly','readonly');
				}
				else
				{
					val = document.user.useramount.value;

					document.user.amount.value = val;
					document.user.amount.setAttribute('readonly','readonly');
					document.user.num_impressions.value = val / 0.1;
					document.getElementById('divNum_Impressions').innerHTML = "Number of Impressions: " + val / 0.1 + " views";
				}
			}
			else
			{
				obj.innerHTML = '<table width="100%" class="whitefill"><tr><td height="10" valign="center" align="left" class="text" style="color:000000;"><font style="font-size:9px">Loading</font>&nbsp;&nbsp;<input type="image" name="imageField" src="/images/loading.gif"/></td></tr></table>';
			}
			}
			xmlhttp.send(null);
		}
		catch(e)
		{
		}
	}




	function makerequestspecialfordcr(serverPage, objID)
	{
		// This is the function to call with serverPage as the page to dynamically call and objId is the div id
		//alert(serverPage);
		var obj = document.getElementById(objID);
		try
		{
			xmlhttp.open("GET", serverPage,true);
			xmlhttp.onreadystatechange = function()
			{
			if (xmlhttp.readyState==4)
				{
					//obj.innerHTML = xmlhttp.responseText;
					obj.innerHTML = xmlhttp.responseText.substr(0,(xmlhttp.responseText.length-1));
					mystr = xmlhttp.responseText.substr(0,(xmlhttp.responseText.length-1));
					var thelength=xmlhttp.responseText.length;
					var last_char=xmlhttp.responseText.charAt(thelength-1);
					//alert(obj.innerHTML)
					return true;
				}
				else
				{
					document.getElementById(objID).innerHTML = 'processing.....please wait';
				}
			}
			xmlhttp.send(null);
		}
		catch(e)
		{
		}
	}

	function displayclientdetails(serverPage,objID)
	{

		// This is the function to call with serverPage as the page to dynamically call and objId is the div id
		//alert(serverPage);
		var obj = document.getElementById(objID);
		try
		{
			xmlhttp.open("GET",serverPage,true);
			xmlhttp.onreadystatechange = function()
			{
			if (xmlhttp.readyState==4)
			{
				//alert(xmlhttp.responseText);
				obj.innerHTML = xmlhttp.responseText;


				val = document.user.userid.value;
				if(val!='')
				{
					document.user.username.value = val;
					document.user.username.setAttribute('readonly','readonly');
				}
			}
			else
			{
				obj.innerHTML = '<table width="100%" class="whitefill"><tr><td height="10" valign="center" align="left" class="text" style="color:000000;"><font style="font-size:9px">Loading</font>&nbsp;&nbsp;<input type="image" name="imageField" src="/images/loading.gif"/></td></tr></table>';
			}
			}
			xmlhttp.send(null);
		}
		catch(e)
		{
		}
	}