// JavaScript Document
var xmlHttp

function getPrice(package) 
{			
	if(package=='Custom Solution') 
	{
		Settextpkg(package);
	}
	else
	{ 
		Settextpkg(package);	
		
		var strURL="chkuser.php?step=5&package="+package;	
		var req = GetXmlHttpObject();	
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {			
					if (req.status == 200) {						
						
						document.frm.price_quoted.value = req.responseText;
						
						document.getElementById('div_price').innerHTML= '<input type="hidden" name="pricequoted" id="pricequoted" value='+  req.responseText +'>'; } 
					else { alert("There was a problem while using XMLHTTP:\n" + req.statusText);}
				}				
			}			
			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
}

function formValidation(frm)
{
	if(validateEmpty(frm.username, "Username")
			|| validateEmpty(frm.password, "Password")			
			|| validateEmpty(frm.confirmpass, "Re-type password")						
			|| validateSame(frm.password, frm.confirmpass)						
			|| validateEmpty(frm.email, "Email address")
			|| validateEmail(frm.email)					
			|| validateEmpty(frm.phno, "Contact phone 1")			
			|| validateEmpty(frm.fname, "First name")
			|| validateEmpty(frm.lname, "Last name")			
			|| validateEmpty(frm.address, "Address")											
			|| validateEmpty(frm.state, "State")			
			|| validateEmpty(frm.countryid, "Country")	
			|| validateCode(frm.code)
			|| validateCondition(frm.username,frm.flg, "Username already exist.")
			)
		return false;
		
	return true;	
}
function formValidation2(frm)
{
	if(validateEmpty(frm.project_name, "Project Name"))return false;
	if(validateEmpty(frm.username, "Username"))return false;
	if(frm.createnew.checked==true){
	if(validateEmpty(frm.password, "Password")			
			|| validateEmpty(frm.confirmpass, "Re-type password")						
			|| validateSame(frm.password, frm.confirmpass)						
			|| validateEmpty(frm.email, "Email address")
			|| validateEmail(frm.email)					
			|| validateEmpty(frm.phno, "Contact phone 1")			
			|| validateEmpty(frm.fname, "First name")
			|| validateEmpty(frm.lname, "Last name")			
			|| validateEmpty(frm.address, "Address")											
			|| validateEmpty(frm.state, "State")			
			|| validateEmpty(frm.countryid, "Country")	
			|| validateCondition(frm.username,frm.flg, "Username already exist.")
			)
		return false;
		
		return true;
	}
		
		if(frm.flg.value=="False" && frm.createnew.checked==true)
		{
			alert("Username already exist.");
			return false;
		}
	return true;	
}

function formValidation1(frm)
{
	if(validateEmpty(frm.projectname, "Name of project")
			|| validateTerm(frm.term)
			|| validateCondition(frm.projectname,frm.flg, "Project already exist.")
			)
		return false;		
	return true;	
}
function formValidation3(frm)
{
	if(validateEmpty(frm.projectname, "Name of project")
			|| validateCondition(frm.projectname,frm.flg, "Project already exist.")
			)
		return false;		
	return true;	
}

function SetText(value)
{
	if (value=='Yes')
	{
		document.frm.price.value='Price Quoted';
		document.frm.price_quoted.readOnly=false;
		document.frm.estimation_no.readOnly=false;
		document.frm.quoteby.readOnly=false;
	}
	else if (value=='No')
	{
		document.frm.price_quoted.value='0';
		document.frm.estimation_no.value='0000';
		document.frm.quoteby.value ='';
		document.frm.price.value='Package Price';
		document.frm.price_quoted.readOnly=true;
		document.frm.estimation_no.readOnly=true;
		document.frm.quoteby.readOnly=true;
	}
}

function Settextpkg(value)
{	
	if(value=="Custom Solution")
	{
		document.frm.price_quoted.value=0;
		document.frm.estimation_no.value='0000';
		document.frm.quoteby.value='';
		document.getElementById("a").style.display='';
		document.getElementById("b").style.display='';
		document.getElementById("c").style.display='';
		document.getElementById("d").style.display='';
		document.getElementById("e").style.display='';
		document.getElementById("f").style.display='';
		document.getElementById("g").style.display='';
		document.getElementById("h").style.display='';
		document.getElementById("i").style.display='';
	}
	else if(value != "Custom Solution")
	{		
		document.frm.estimation.options[document.frm.estimation.selectedIndex].value='No';
		document.frm.estimation_no.value='0000';
		document.frm.quoteby.value='';
		document.getElementById("a").style.display='none';
		document.getElementById("b").style.display='none';
		document.getElementById("c").style.display='none';
		document.getElementById("d").style.display='none';
		document.getElementById("e").style.display='none';
		document.getElementById("f").style.display='none';
		document.getElementById("g").style.display='none';
		document.getElementById("h").style.display='none';
		document.getElementById("i").style.display='none';
	}
}

function showMe (it, box) { 
  var vis = (box.checked) ? "block" : "none";   
  document.getElementById(it).style.display = vis;
} 

function hideMe (it, box) { 
  var vis = (box.checked) ? "none" : "none"; 
  document.getElementById(it).style.display = vis;
}


//show popup


