

function validation(){
	var c = document.fm1;
	
	if(c.enqType.value=="")
			{
				c.enqType.focus();
				alert('Enter Select Enquiry Type');
				return false;
			}
	if(c.name.value=="")
			{
				c.name.focus();
				alert('Enter Your Name');
				return false;
			}
	if(c.telnum.value=="")
			{
				c.telnum.focus();
				alert('Enter Your Telephone Number');
				return false;
			}
		if(c.email.value=="")
			{
				c.email.focus();
				alert('Enter Your E-mail Address');
				return false;
			}
		
	    if(c.email.value!="")
				{
					var str = c.email.value ;
					var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid	
           			var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
			if (!reg1.test(str) && reg2.test(str)){ // if syntax is valid
		   		//return true;
				}else{
				alert ("||Enter_Proper_Email_Address||");
				c.email.focus();
				return false;
					}
		}
		if(c.country.value=="")
			{
				c.country.focus();
				alert('Select Your Country');
				return false;
			}	
		if(c.enquiry.value=="")
			{
				c.enquiry.focus();
				alert('Enter Your Feedback');
				return false;
			}	
	if(c.Securitycode.value=='')
	{
		alert('Please Enter Security Code');
		c.Securitycode.focus();
		return false;
	}
}

function show(obj){
	if (obj == "Service Enquiries"){
		document.getElementById("td1").style.display = "block";
		document.getElementById("td2").style.display = "block";
	}else{
		document.getElementById("td1").style.display = "none";
		document.getElementById("td2").style.display = "none";
	}
}


function validation2(){
	var c = document.fm2;
	
	if(c.name.value=="")
			{
				c.name.focus();
				alert("Enter Your Name");
				return false;
			}
	
		if(c.email.value=="")
			{
				c.email.focus();
				alert('Enter Your E-mail Address');
				return false;
			}
		
	    if(c.email.value!="")
				{
					var str = c.email.value ;
					var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid	
           			var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
			if (!reg1.test(str) && reg2.test(str)){ // if syntax is valid
		   		//return true;
				}else{
				alert ("Enter Proper Email Address");
				c.email.focus();
				return false;
					}
		}

		if(c.telnum.value=="")
			{
				c.telnum.focus();
				alert('Enter Your Telephone Number');
				return false;
			}
		if(c.country.value=="")
			{
				c.country.focus();
				alert('Select Your Country');
				return false;
			}	
		if(c.enquiry.value=="")
			{
				c.enquiry.focus();
				alert('Enter Your Feedback');
				return false;
			}	
	if(c.Securitycode.value=='')
	{
		alert('Please Enter Security Code');
		c.Securitycode.focus();
		return false;
	}
}

function validation3(){
	var c = document.fm3;
	
	if(c.name.value=="")
			{
				c.name.focus();
				alert("Enter Your Name");
				return false;
			}
	
		if(c.email.value=="")
			{
				c.email.focus();
				alert('Enter Your E-mail Address');
				return false;
			}
		
	    if(c.email.value!="")
				{
					var str = c.email.value ;
					var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid	
           			var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
			if (!reg1.test(str) && reg2.test(str)){ // if syntax is valid
		   		//return true;
				}else{
				alert ("Enter Proper Email Address");
				c.email.focus();
				return false;
					}
		}

		if(c.telnum.value=="")
			{
				c.telnum.focus();
				alert('Enter Your Telephone Number');
				return false;
			}
		
		if(c.enquiry.value=="")
			{
				c.enquiry.focus();
				alert('Enter Your Feedback');
				return false;
			}	
	if(c.Securitycode.value=='')
	{
		alert('Please Enter Security Code');
		c.Securitycode.focus();
		return false;
	}
}

function rightEnqVal(){
	var c = document.rtfmEnq;
	
	if(c.contName.value=="")
			{
				c.contName.focus();
				alert("Enter Your Name");
				return false;
			}
	
		if(c.contEmail.value=="")
			{
				c.contEmail.focus();
				alert('Enter Your E-mail Address');
				return false;
			}
		
	    if(c.contEmail.value!="")
				{
					var str = c.contEmail.value ;
					var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid	
           			var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
			if (!reg1.test(str) && reg2.test(str)){ // if syntax is valid
		   		//return true;
				}else{
				alert ("Enter Proper Email Address");
				c.contEmail.focus();
				return false;
					}
		}

		if(c.contPhone.value=="")
			{
				c.contPhone.focus();
				alert('Enter Your Telephone Number');
				return false;
			}
		
		if(c.cmdEnquiry.value=="")
			{
				c.cmdEnquiry.focus();
				alert('Enter Your Comments/ Requests');
				return false;
			}	
	if(c.Security_code.value=='')
	{
		alert('Please Enter Security Code');
		c.Security_code.focus();
		return false;
	}
}

function getdomainname()
{
	var domain = document.propertysell;
	var dname = domain.domainname.value;
	var dname = dname.toLowerCase();
	
	if(dname != "")
	{
		window.location="http://www.worldwidegroup.eu/en/sell-property-"+dname+".html"; 
		//window.location="http://vv2/first/worldwidegroup/en/sell-property-"+dname+".html";
	}
	else { 
		window.location="http://www.worldwidegroup.eu/en/sell-your-property.html"; 
		//window.location="http://vv2/first/worldwidegroup/en/sell-property.html";
	}
	
}

function getdomainname1()
{
	var domain = document.propertysell;
	var dname = domain.domainname.value;
	var newdname = dname.split(",");
	var path = newdname[0];
	var domname = newdname[1];
	var varyname = newdname[2];
	var domname = domname.toLowerCase();

	if(domname != "")
	{
		if(path == 0 )
			window.location="http://www.worldwidegroup.eu/en/sell-property-"+domname+".html"; 
		else
			window.location="http://"+varyname+"/sell-your-property.html";
		//window.location="http://vv2/first/worldwidegroup/en/sell-property-"+dname+".html";
	}
	else { 
		window.location="http://www.worldwidegroup.eu/en/sell-your-property.html"; 
		//window.location="http://vv2/first/worldwidegroup/en/sell-property.html";
	}
	
}
function getdomainnamerent()
{
	var domain = document.propertysell;
	var dname = domain.domainname.value;
	var dname = dname.toLowerCase();
	
	if(dname != "")
	{
		window.location="http://www.worldwidegroup.eu/en/rent-property-"+dname+".html"; 
		//window.location="http://vv2/first/worldwidegroup/en/rent-property-"+dname+".html";
	}
	else { 
		window.location="http://www.worldwidegroup.eu/en/rent-property.html"; 
		//window.location="http://vv2/first/worldwidegroup/en/rent-property.html";
	}
	
}


///start 300 pounf offer form
function validation300(){
	var c = document.holidayFrm;
	
	if(c.name.value=="")
			{
				c.name.focus();
				alert('Enter Your Name');
				return false;
			}
	
		if(c.email.value=="")
			{
				c.email.focus();
				alert('Enter Your E-mail Address');
				return false;
			}
		
	    if(c.email.value!="")
				{
					var str = c.email.value ;
					var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid	
           			var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
			if (!reg1.test(str) && reg2.test(str)){ // if syntax is valid
		   		//return true;
				}else{
				alert ("||Enter_Proper_Email_Address||");
				c.email.focus();
				return false;
					}
		}
		if(c.telnum.value=="")
			{
				c.telnum.focus();
				alert('Enter Your Telephone Number');
				return false;
			}
		if(c.inteCountry.value=="")
			{
				c.inteCountry.focus();
				alert('Enter your interested in purchasing property location');
				return false;
			}	
	if(c.Securitycode.value=='')
	{
		alert('Please Enter Security Code');
		c.Securitycode.focus();
		return false;
	}
}
//end

///start cms General  form
function validationgeneral(){
	var c = document.contactgeneral;
	
	if(c.name.value=="")
			{
				c.name.focus();
				alert('Enter Your Name');
				return false;
			}
	
		if(c.email.value=="")
			{
				c.email.focus();
				alert('Enter Your E-mail Address');
				return false;
			}
		
	    if(c.email.value!="")
				{
					var str = c.email.value ;
					var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid	
           			var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
			if (!reg1.test(str) && reg2.test(str)){ // if syntax is valid
		   		//return true;
				}else{
				alert ("||Enter_Proper_Email_Address||");
				c.email.focus();
				return false;
					}
		}
		
		if(c.enquiry.value=="")
			{
				c.enquiry.focus();
				alert('Enter your Enquiry');
				return false;
			}	
	if(c.Securitycode.value=='')
	{
		alert('Please Enter Security Code');
		c.Securitycode.focus();
		return false;
	}
}
//end

//For Quick Sell House
function validateform(){
	var est = document.estimate;
	
	if(est.fName.value=="")
	{
		est.fName.focus();
		alert('Please Enter Your Name');
		return false;
	}
	if(est.faddr.value=="")
	{
		est.faddr.focus();
		alert('Please Enter Your Address');
		return false;
	}
	if(est.fCity.value=="")
	{
		est.fCity.focus();
		alert('Please Enter Your City');
		return false;
	}
	if(est.fNumber.value=="")
	{
		est.fNumber.focus();
		alert('Please Enter Your Number');
		return false;
	}
	if(est.fNumber1.value=="")
	{
		est.fNumber1.focus();
		alert('Please Enter the Confirm Number');
		return false;
	}
	if(est.fNumber.value != est.fNumber1.value)
	{
		est.fNumber1.focus();
		alert('Confirm Number Should be same as Contact Number');
		return false;
	}
	if(est.fEmail.value=="")
		{
			est.fEmail.focus();
			alert('Please Enter Your E-mail Address');
			return false;
		}
	
	if(est.fEmail.value!="")
			{
				var str = est.fEmail.value ;
				var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid	
	   			var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
		if (!reg1.test(str) && reg2.test(str)){ // if syntax is valid
	   		//return true;
			}else{
			alert ("Please Enter Proper Email Address");
			est.fEmail.focus();
			return false;
				}
	}
	if(est.fPrice.value=="")
	{
		est.fPrice.focus();
		alert('Please Enter Price');
		return false;
	}
	if(est.fSecure.value=="")
	{
		est.fSecure.focus();
		alert('Please Enter Secured Debt');
		return false;
	}
	if(est.Securitycode.value=="")
		{
			est.Securitycode.focus();
			alert('Please Enter Security Code');
			return false;
		}
}


//For Fast Sell House
function enqValidate(){
	var c = document.fhome;
	
	if(c.name.value=="")
	{
		c.name.focus();
		alert('Enter Your Name');
		return false;
	}
	
	if(c.email.value=="")
	{
		c.email.focus();
		alert('Enter Your E-mail Address');
		return false;
	}
		
	 if(c.email.value!="")
	{
		var str = c.email.value ;
		var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid	
        var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
		if (!reg1.test(str) && reg2.test(str)){ // if syntax is valid
		   //return true;
		}else{
			alert ("Enter_Proper_Email_Address");
			c.email.focus();
			return false;
		}
	}

	if(c.areaCode.value=="")
	{
		c.areaCode.focus();
		alert('Please Enter Your Area Code');
		return false;
	}
	if(c.cnumber.value=="")
	{
		c.cnumber.focus();
		alert('Please Enter Your Contact Number');
		return false;
	}


	if(c.plocation.value=="")
	{
		c.plocation.focus();
		alert('Please Enter Your Property Location');
		return false;
	}

	if(c.Securitycode.value=='')
	{
		alert('Please Enter Security Code');
		c.Securitycode.focus();
		return false;
	}
}

function popup(strFile, intWidth, intHeight) {
  var desktop;
  if (desktop && desktop.location) desktop.close();
  desktop = window.open(strFile, "_blank","toolbar=0,location=0,position=1,directories=0,status=0,menubar=0,scrollbars=1,resizable=0, left=100,top=200,width=" + intWidth + ",height=" + intHeight);
}


function qvalidate(){
	var q = document.qbox;
	
	if(q.qname.value=="")
			{
				q.qname.focus();
				alert("Enter Your Name");
				return false;
			}
	
		if(q.qemail.value=="")
			{
				q.qemail.focus();
				alert('Enter Your E-mail Address');
				return false;
			}
		
	    if(q.qemail.value!="")
				{
					var str = q.qemail.value ;
					var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid	
           			var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
			if (!reg1.test(str) && reg2.test(str)){ // if syntax is valid
		   		//return true;
				}else{
				alert ("Enter Proper Email Address");
				q.qemail.focus();
				return false;
					}
		}

		if(q.qcomments.value=="")
		{
			q.qcomments.focus();
			alert('Enter Your Comments');
			return false;
		}	
		if(q.qscode.value=='')
		{
			alert('Please Enter Security Code');
			q.qscode.focus();
			return false;
		}
}

var xmlHttp 
function GetXmlHttpObject(){ 
	var objXMLHttp=null 
	if (window.XMLHttpRequest){ 
	objXMLHttp=new XMLHttpRequest() 
	}else if (window.ActiveXObject){ 
	objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") 
	} // End ElseIf.
	return objXMLHttp 
	} 

function Ajx_Update_EnqBook(contName,contEmail,contPhone,fromDate,toDate,cmdEnquiry){

	var xmlHttp=GetXmlHttpObject() 
	if (xmlHttp==null){ 
		alert ("Browser does not support HTTP Request") 
		return 
	} // End If.


var errListMsg ='0';
		if(cmdEnquiry ==""){	
			errListMsg ='5';
		}	
		if(contPhone==""){	
			errListMsg ='4';
		}	
		if(contEmail !="")
		{
			var str = contEmail;
			var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
			var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
			if (!reg1.test(str) && reg2.test(str))
			{ 	// if syntax is valid
		   		//return true;
			}
			else
			{
				errListMsg ='3';
			}
		}		
		if(contEmail==""){
			errListMsg ='2';
		}	

		if(contName==""){
			errListMsg ='1';
		}


if(errListMsg =='0'){
	if(xmlHttp != null){
		var param = "contName="+contName + "&contEmail=" + contEmail + "&contPhone=" + contPhone  + "&fromDate=" + fromDate + "&toDate=" + toDate + "&cmdEnquiry=" + cmdEnquiry;


		xmlHttp.open("POST",  js_http_path +"ajx_right_enqry.php?rand="+Math.random(1,10), true);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", param.length);
		xmlHttp.setRequestHeader("Connection", "close");
		xmlHttp.onreadystatechange = function () {
		if (xmlHttp.readyState == 4) { 
			var updatePerson = xmlHttp.responseText
			var txtAreCont = document.getElementById('acxIds6');
			document.getElementById('logErr').innerHTML = updatePerson;
			document.getElementById('acxIds1').value = "";
			document.getElementById('acxIds2').value = "";
			document.getElementById('acxIds3').value = "";
			document.getElementById('acxIds4').value = "";
			document.getElementById('acxIds5').value = "";
			txtAreCont.value = "";
		} 
	};
		xmlHttp.send(param);
	}
}

	if(errListMsg =='5'){
		document.getElementById("logErr").innerHTML = "Please enter your Comments/ Requests";
	}
	if(errListMsg =='4'){
		document.getElementById("logErr").innerHTML = "Please enter your Phone Number";
	}
	if(errListMsg =='2'){
		document.getElementById("logErr").innerHTML = "Please enter your Email";
	}	
	if(errListMsg =='3'){
		document.getElementById("logErr").innerHTML = "Please enter Proper Email Address";
	}
	if(errListMsg =='1'){
		document.getElementById("logErr").innerHTML = "Please enter your Full Name";
	}




}
