var strurl="http://www.perfectscoremortgages.com/rates/process.php";
var week='true';
function callxmlhttp(type)
{
	document.getElementById('loading').style.display='block';
	if(type=='week')
		week='true';
	else
		week='false';
	xmlhttpPost(strurl); 
}
function xmlhttpPost(strURL) 
{
	var xmlHttpReq = false;
	var self = this;
	// Mozilla/Safari
	if (window.XMLHttpRequest) {
		self.xmlHttpReq = new XMLHttpRequest();
	}
	// IE
	else if (window.ActiveXObject) {
		self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
	}
	self.xmlHttpReq.open('POST', strURL, true);
	self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	self.xmlHttpReq.onreadystatechange = function() 
	{
		if (self.xmlHttpReq.readyState == 4) 
		{
			
				updatepage(self.xmlHttpReq.responseText);
		}
	}
	 self.xmlHttpReq.send(getdata());
 }
function getdata()
{
	var postdata='';
	if(week=='true' )
		postdata="ratesby=week";
	else if (week=='false')
		postdata="ratesby=month";
	return postdata;
}
function updatepage(str)
{
	if(document.getElementById('loading')!=null)
		document.getElementById('loading').style.display='none';
    document.getElementById('mortagerate').innerHTML='';
	document.getElementById('mortagerate').innerHTML=str;
	
	/* var tFrame = document.getElementById("mortagerate");
	 
                var doc = tFrame.contentDocument;
              
                if (doc == undefined || doc == null)
                    doc = tFrame.contentWindow.document;
                doc.open();
                doc.write(str);
                doc.close();*/
                //document.getElementById('frameContent').style.visibility="visible";
     
}
xmlhttpPost(strurl);



