  function xmlhttpPost(strURL,divName) {
//alert(strURL);
    var xmlHttpReq = false;
    var self = this;
    document.getElementById(divName).innerHTML="Processing ...<img align=top src='http://www.fundsfocus.com.au/manager/images/ajax2.gif' title='Update in progress...'>";
	// 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) 
		{
			//alert(self.xmlHttpReq.responseText);
				document.getElementById(divName).innerHTML=self.xmlHttpReq.responseText;
				if(self.xmlHttpReq.responseText!="&nbsp;")
				{
//					document.getElementById("mem_username").value="";
//					document.getElementById("mem_username").focus();
					alert("Email Already Exist");	
					document.getElementById("mem_email").value="";
					document.getElementById("mem_email").focus();
				document.getElementById(divName).innerHTML="This Email ID is already Registered.Either <a href='login.php' class='read'>Login</a>  or choose another Email ID.";

				}
				else
				{
//					document.getElementById("redbox").style.display='none';	
				if(self.xmlHttpReq.responseText!="&nbsp;")
				{				
					document.getElementById('mem_email').value="";		
					document.getElementById("mem_email").focus();
				}
				}
    }}
    self.xmlHttpReq.send('');
}

  function xmlhttpPost_redbox(strURL,divName) {
//alert(strURL);
    var xmlHttpReq = false;
    var self = this;
    //document.getElementById(divName).innerHTML="Processing ...<img align=top src='../manager/images/ajax2.gif' title='Update in progress...'>";
	// 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) 
		{
			//alert(self.xmlHttpReq.responseText);
				//document.getElementById(divName).innerHTML=self.xmlHttpReq.responseText;
				if(self.xmlHttpReq.responseText!="&nbsp;")
				{
//					document.getElementById("mem_username").value="";
//					document.getElementById("mem_username").focus();
					//alert("Email Already Exist");	
					window.location.href="http://www.fundsfocus.com.au/about/login.php?msg=This email address is already Registered.Please <a href='login.php' class='read'>Click here</a>for a password reminder.";
					document.getElementById("mem_email").value="";
					document.getElementById("mem_email").focus();
					document.getElementById("redbox").style.display='';
				document.getElementById(divName).innerHTML="This Email ID is already Registered.Either <a href='login.php' class='read'>Login</a>  or choose another Email ID.";

				}
				else
				{
					//document.getElementById("redbox").style.display='none';	
				if(self.xmlHttpReq.responseText!="&nbsp;")
				{				
				document.getElementById('mem_email').value="";		
				document.getElementById("mem_email").focus();
				}
				}
    }}
    self.xmlHttpReq.send('');
}


function updatepage(str,strnewdata)
{
	splitstr(str, "document.getElementById('" + strnewdata + "').options");
}


function billclick()
{
document.getElementById("label_state_div1").innerHTML="<strong>State</strong>";
document.getElementById("state_div").style.display='block';
}

function getState(strURL,combo) {
//alert(strURL+combo);
    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) 
		{
				if(self.xmlHttpReq.responseText!="")
				{
					str=self.xmlHttpReq.responseText;
					SplitStr(str, "document.getElementById('" + combo + "').options");
				}
				else {
					var ctrl = eval(document.getElementById(combo).options);
					clearcombo(ctrl);
					
				}
				
    }}
    self.xmlHttpReq.send('');
}
function SplitStr(argstr, argctrl){
	var ctrl = eval(argctrl)
    var prezar = argstr.split("|");
    argctrl.length = 0;
	clearcombo(ctrl);
    for (o=0; o < prezar.length-1; o+=2)
      ctrl[ctrl.length] = new Option(prezar[o+1], prezar[o]);
}

function clearcombo(argctrl){
  for (var i=argctrl.length-1; i>=1; i--){
    argctrl[i] = null;
  }
}
//setoption(document.getElementById('income_protection').value);


//alert(document.getElementById('income_protection'));
//document.getElementById('income_protection').value="";

function AddYear(combo)
{
		var d = new Date();
		var curr_year = d.getFullYear();
		
	//var year =curr_year-15;
	var year=1994;
	var i=0;
    for (o=1920; o <= year; o+=1)
      combo[++i] = new Option(o, o);
}

function AddMonth(combo)
{
	var m_names = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
	var i=1;
	var j=0
	for(i=1;i<=12;i++)
	//alert(m_names[j++]);
      combo[i] = new Option(m_names[j++],i);
}

function AddDay(combo)
{
	var d = new Date();
	var day=0;
	var year=d.getFullYear();
	var month=d.getMonth();
	
	if(month==2)
		day=year%4==0?29:28;
	else if(month==7 || month==8)	
		day=31;
	else
		day=month%2==0?30:31;
	for(i=1;i<=day;i++)
      combo[i] = new Option(i, i);
		
}

function checkCode(strURL,divName) {
    document.getElementById(divName).innerHTML="<img  src='http://www.fundsfocus.com.au/manager/images/ajax2.gif' title='in progress...'>";
	var xmlHttpReq = false;
//	alert(strURL);
    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) 
		{
				document.getElementById(divName).innerHTML='';
				str=self.xmlHttpReq.responseText;
				if(str=="false")
				{
					document.getElementById('code').value="";
					document.getElementById('code').focus();
					alert("Invalid Secutity Code Entered");
					return false;
					//window.location.href=window.location;
				}
				document.getElementById('send').disabled=false;
				
        }
    }
    self.xmlHttpReq.send('');
}

function checkCodeForApplyCommsec(strURL,divName) {
    document.getElementById(divName).innerHTML="<img  src='http://www.fundsfocus.com.au/manager/images/ajax2.gif' title='in progress...'>";
	var xmlHttpReq = false;
//	alert(strURL);
    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) 
		{
				document.getElementById(divName).innerHTML='';
				str=self.xmlHttpReq.responseText;
				if(str=="false")
				{
					document.getElementById('code').value="";
					document.getElementById('code').focus();
					alert("Invalid Secutity Code Entered from ajax");
					return false;
					//window.location.href=window.location;
				}else{
					//document.getElementById('send').disabled=false;
					document.form1.submit();
					return true;
				}
				
				
        }
    }
    self.xmlHttpReq.send('');
}
