function validcalc(id)
{
	
	if(document.frmdetail.downamt.value!="")
	{
		if(isNaN(document.frmdetail.downamt.value))
		{
		alert('Please Enter Proper Amount');
		document.frmdetail.downamt.focus();
		document.frmdetail.downamt.value="";
		return false;
		}
		if(parseInt(document.frmdetail.downamt.value) > parseInt(document.frmdetail.hidprice.value))
		{
			alert('Please Enter Proper Amount');
			document.frmdetail.downamt.focus();
			document.frmdetail.downamt.value="";
			return false;
		}
	}
	
	
	/*if(trim(document.frmdetail.omail.value).length < 1)
	{
		alert('Please Enter Email');
		document.frmdetail.omail.focus();
		return false;
	}
	if (echeck(trim(document.frmdetail.omail.value))==false)
	{
        document.frmdetail.omail.value="";
        document.frmdetail.omail.focus();
        return false;
	}
	if(trim(document.frmdetail.txtaddress.value).length < 1)
	{
		alert('Please Enter Address');
		document.frmdetail.txtaddress.focus();
		return false;
	}
	if(trim(document.frmdetail.txtcontactno.value).length < 1)
	{
		alert('Please Enter Contact NO');
		document.frmdetail.txtcontactno.focus();
		return false;
	}
	 if(trim(document.frmdetail.txtcontactno.value).length > 0)
 	{
		var phone= trim(document.frmdetail.txtcontactno.value);
	
		if (isNaN(phone)) 
		{
     		alert("The Contact Number Contains illegal characters.");
			document.frmdetail.txtcontactno.value="";
			document.frmdetail.txtcontactno.focus();
	 		return false;
		}
		
	}*/
	login_submit(id); 
}	
function login_submit(id) 
{		
	
	var downamt =document.frmdetail.downamt.value;
	var mon =document.frmdetail.mon.value;
	var url="displaycalc.php?downpayment="+downamt+"&month="+mon+"&id="+id; 
	 http.open("GET", url, true);
	 http.onreadystatechange = handleHttpResponse_login;
	 http.send(null);
}

function handleHttpResponse_login() {
  if (http.readyState == 4) 
 {
	
	
  		results = http.responseText;  		
		document.getElementById("disp_msg").innerHTML=results;						
  }
}


function echeck(str)
{
        var at="@"
        var dot="."
        var lat=str.indexOf(at)
        var lstr=str.length
        var ldot=str.indexOf(dot)
        if (str.indexOf(at)==-1){
           alert("Invalid E-mail ID")
           return false;
        }

        if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
           alert("Invalid E-mail ID")
           return false
        }

        if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
            alert("Invalid E-mail ID")
            return false;
        }

         if (str.indexOf(at,(lat+1))!=-1){
            alert("Invalid E-mail ID")
            return false;
         }

         if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
            alert("Invalid E-mail ID")
            return false;
         }

         if (str.indexOf(dot,(lat+2))==-1){
            alert("Invalid E-mail ID")
            return false;
         }
        
         if (str.indexOf(" ")!=-1){
            alert("Invalid E-mail ID")
            return false;
         }
          return true ;                   
}
function getHTTPObject() 
{
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object	
