function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
  	{
  		// Firefox, Opera 8.0+, Safari
  		xmlHttp=new XMLHttpRequest();
  	}
	catch (e)
  	{
  		// Internet Explorer
  		try
    	{
   			 xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    	}
  		catch (e)
    	{
    		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    	}
  	}
	
	return xmlHttp;
}



function buyerValidation(){
	
	    var categoryid=document.buyerForm.categoryid; 
		var quantity=document.buyerForm.quantity; 
		var deliverytime=document.buyerForm.deliverytime; 
		var companyName=document.buyerForm.companyName; 
		var address=document.buyerForm.address; 
		var postalcode=document.buyerForm.postalcode; 
		var country=document.buyerForm.country;
		var city=document.buyerForm.city;
		var firstName=document.buyerForm.firstName; 
		var surName=document.buyerForm.surName; 
		var Phone=document.buyerForm.phone; 
		var Password=document.buyerForm.password;	
		var Confirmpassword=document.buyerForm.confirmpassword;	
		var SecurityCode=document.buyerForm.SecurityCode;
		
		if((categoryid.value==null)|| (categoryid.value==""))
		{
		scroll(findPosX(categoryid),findPosY(categoryid));	
		document.getElementById(categoryid.id+'error').style.visibility = 'visible'; 
		return false;
		}
		if((quantity.value==null)|| (quantity.value==""))
		{
		scroll(findPosX(quantity),findPosY(quantity));	
		document.getElementById('quantityerror').style.visibility = 'visible'; 
		return false;
		}
		if((deliverytime.value==null)|| (deliverytime.value==""))
		{
		scroll(findPosX(deliverytime),findPosY(deliverytime));	
		document.getElementById('deliverytimeerror').style.visibility = 'visible'; 
		return false;
		}
		if((companyName.value==null)|| (companyName.value==""))
		{
		scroll(findPosX(companyName),findPosY(companyName));
		document.getElementById('companyerror').style.visibility = 'visible'; 
		
		return false;
		}
		if((address.value==null)|| (address.value==""))
		{
		scroll(findPosX(address),findPosY(address));
		document.getElementById('addresserror').style.visibility = 'visible'; 
		return false;
		}
		if((postalcode.value==null)|| (postalcode.value==""))
		{
		scroll(findPosX(postalcode),findPosY(postalcode));
		document.getElementById('postalcodeerror').style.visibility = 'visible'; 
		return false;
		}
		if((city.value==null)|| (city.value==""))
		{
		scroll(findPosX(city),findPosY(city));
		document.getElementById('cityerror').style.visibility = 'visible'; 
		return false;
		}
		if((country.value==null)|| (country.value==""))
		{
		scroll(findPosX(country),findPosY(country));
		document.getElementById('countryerror').style.visibility = 'visible'; 
		return false;
		}
		if((firstName.value==null)|| (firstName.value==""))
		{
		scroll(findPosX(firstName),findPosY(firstName));
		document.getElementById('firstnameerror').style.visibility = 'visible'; 
		return false;
		}
		if((surName.value==null)|| (surName.value==""))
		{
		scroll(findPosX(surName),findPosY(surName));
		document.getElementById('surnameerror').style.visibility = 'visible'; 
		return false;
		}
		if((Phone.value==null)|| (Phone.value==""))
		{
		scroll(findPosX(Phone),findPosY(Phone));
		document.getElementById('phoneerror').style.visibility = 'visible'; 
		return false;
		}
		if ((Phone.value!=null)&& (Phone.value!=""))
	    {
	       if (checkInternationalPhone(Phone.value)==false){
			    scroll(findPosX(Phone),findPosY(Phone));
		        Phone.value="";
				
				if (window['Global_Invalid_Telphone_Number'] != undefined)
				{
					document.getElementById('phoneerror').innerHTML=Global_Invalid_Telphone_Number;
				}
				else
				{
					document.getElementById('phoneerror').innerHTML="Enter valid Phone Number";
				}
				document.getElementById('phoneerror').style.visibility = 'visible'; 
				return false
	        }
			
	     }
		 
		 if(ValidateEmail1()==false)
	     {
	       return false;
	     }
		 if((Password.value==null)|| (Password.value==""))
		 {
		 scroll(findPosX(Password),findPosY(Password));
		 document.getElementById('passworderror').style.visibility = 'visible'; 
		 return false;
		 }
		 if((Confirmpassword.value==null)|| (Confirmpassword.value==""))
		 {
		 scroll(findPosX(Confirmpassword),findPosY(Confirmpassword));
		 document.getElementById('confirmpassworderror').style.visibility = 'visible'; 
		 return false;
		 }
		 if(Password.value!=Confirmpassword.value) 
		 {
		 scroll(findPosX(Confirmpassword),findPosY(Confirmpassword));
		 Confirmpassword.value="";
		 if (window['Global_Confirmatiom_Password_Mismatch'] != undefined)
		{
			document.getElementById('confirmpassworderror').innerHTML=Global_Confirmatiom_Password_Mismatch;
		}
		else
		{
			document.getElementById('confirmpassworderror').innerHTML="Confirm Password should be same as Password" ;
		}
		 document.getElementById('confirmpassworderror').style.visibility = 'visible'; 
		 return false;
		 }
		 if(!document.buyerForm.terms.checked)
		 {
		  document.getElementById('termserror').style.visibility = 'visible'; 
		  return false;
		 }	
		 if((SecurityCode.value==null) || (SecurityCode.value==""))
		 {
		 scroll(findPosX(SecurityCode),findPosY(SecurityCode));
		 document.getElementById('securitycodeerror').style.visibility = 'visible'; 
		 return false;
		 }
		checkcapchacodeForBuyer(SecurityCode.value);	
        return false;
		 
	
}



function hideDiv(id){
document.getElementById(id).style.visibility ='hidden';
return false;
}
function ValidateEmail1(){
	var emailID=document.buyerForm.email; 
	if ((emailID.value==null)||(emailID.value=="")){
		emailID.value="";
		document.getElementById('emailerror').style.visibility = 'visible'; 
		return false;
	}
	if (echeck(emailID.value,emailID)==false){
		emailID.value=""
		document.getElementById('emailerror').style.visibility = 'visible'; 
		return false;
	}
	
	return true;
 }
 
 
 function ValidateMail1(){
	var emailID=document.companysignupForm.email; 
	if ((emailID.value==null)||(emailID.value=="")){
		emailID.value="";
		document.getElementById('emailerror').style.visibility = 'visible'; 
		return false;
	}
	if (echeck(emailID.value,emailID)==false){
		emailID.value=""
		document.getElementById('emailerror').innerHTML="Enter valid Email";
		document.getElementById('emailerror').style.visibility = 'visible'; 
		return false;
	}
	
	return true;
 }
 
function echeck(str,email) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false;
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false;
		 }

 		 return true;					
	}
	
 
 

	 /**
 * DHTML phone number validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 7;

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}
function trim(s)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not a whitespace, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (c != " ") returnString += c;
    }
    return returnString;
}
function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
var bracket=3
strPhone=trim(strPhone)
if(strPhone.indexOf("+")>1) return false
if(strPhone.indexOf("-")!=-1)bracket=bracket+1
if(strPhone.indexOf("(")!=-1 && strPhone.indexOf("(")>bracket)return false
var brchr=strPhone.indexOf("(")
if(strPhone.indexOf("(")!=-1 && strPhone.charAt(brchr+2)!=")")return false
if(strPhone.indexOf("(")==-1 && strPhone.indexOf(")")!=-1)return false
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

function checkcapchacode(thecode) {
http.open("GET", url + escape(thecode), true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}

function checkcapchacodeForBuyer(thecode) {
http.open("GET", url + escape(thecode), true);
http.onreadystatechange = handleHttpResponseBuyer;
http.send(null);
}

var url = 'captcheck.php?code=';
var captchaOK = 2; 

function getHTTPObject()
 {
   try {
    req = new XMLHttpRequest();
	} catch (err1)
	{
	try {
	req = new ActiveXObject("Msxml12.XMLHTTP");
	} catch (err2)
	{
	try {
	req = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (err3)
	{
	req = false;
	}
  }
}
return req;
}

var http = getHTTPObject();
function handleHttpResponse() {
if (http.readyState == 4) {	
captchaOK = http.responseText;
if(captchaOK != 1) {
	if (window['Global_Enter_Correct_Security_Message'] != undefined)
	{
		document.getElementById('securitycodeerror').innerHTML=Global_Enter_Correct_Security_Message;
	}
	else
	{
		document.getElementById('securitycodeerror').innerHTML="Please enter correct security code";
	}
	document.getElementById('securitycodeerror').style.visibility = 'visible'; 
	return false;
}
document.companysignupForm.submit();
}
}

function handleHttpResponseBuyer() {
if (http.readyState == 4) {	
captchaOK = http.responseText;
if(captchaOK != 1) {
	if (window['Global_Enter_Correct_Security_Message'] != undefined)
	{
		document.getElementById('securitycodeerror').innerHTML=Global_Enter_Correct_Security_Message;
	}
	else
	{
		document.getElementById('securitycodeerror').innerHTML="Please enter correct security code";
	}
	document.getElementById('securitycodeerror').style.visibility = 'visible'; 
	return false;
}
document.buyerForm.submit();
}
}


function validCompany()
{
	   
        var companyName=document.companysignupForm.companyName; 
		var merchantLogo=document.companysignupForm.merchantLogo;
		var website=document.companysignupForm.website; 
		var businessArea=document.companysignupForm.businessArea;
		var address=document.companysignupForm.address; 
		var country=document.companysignupForm.country;
		var city=document.companysignupForm.city;
		var postCode=document.companysignupForm.postCode; 
		var shortdesc=document.companysignupForm.shortdesc; 
		var userName=document.companysignupForm.userName; 
		var surname=document.companysignupForm.surname;			
		var Phone=document.companysignupForm.phone;	
		var email=document.companysignupForm.email;
		var password=document.companysignupForm.password;	
		var confirmPassword=document.companysignupForm.confirmPassword;	
		var SecurityCode=document.companysignupForm.SecurityCode;
		if((businessArea.value==null)|| (businessArea.value==""))
		{	
		scroll(findPosX(businessArea),findPosY(businessArea));
		document.getElementById('businessAreaerror').style.visibility = 'visible'; 
		return false;
		}
		if((companyName.value==null)|| (companyName.value==""))
		{
		scroll(findPosX(companyName),findPosY(companyName));
		document.getElementById('companyerror').style.visibility = 'visible'; 
		return false;
		}
		if((website.value==null)|| (website.value==""))
		{
		scroll(findPosX(website),findPosY(website));
		document.getElementById('websiteurlerror').style.visibility = 'visible'; 
		return false;
		}
		if((website.value!=null)|| (website.value!=""))
		{
		 
           if(isValidURL(website.value)==false)
			{
				scroll(findPosX(website),findPosY(website));
                document.getElementById('websiteurlerror').style.visibility = 'visible'; 
				return false;
			}
		}
		
		
		if((merchantLogo.value!=null) && (merchantLogo.value!=""))
		{
			if(Checkfiles(merchantLogo)==false)
			{
			    scroll(findPosX(merchantLogo),findPosY(merchantLogo));
				document.getElementById('logoerror').style.visibility = 'visible'; 
				return false;
				
			}
		}

		if((address.value==null)|| (address.value==""))
		{
		scroll(findPosX(address),findPosY(address));
		document.getElementById('addresserror').style.visibility = 'visible'; 
		return false;
		}
		if((postCode.value==null)|| (postCode.value==""))
		{
		scroll(findPosX(postCode),findPosY(postCode));
		document.getElementById('postcodeurlerror').style.visibility = 'visible'; 
		return false;
		}
		if((city.value==null)|| (city.value==""))
		{
		scroll(findPosX(city),findPosY(city));
		document.getElementById('cityerror').style.visibility = 'visible'; 
		return false;
		}
		if((country.value==null)|| (country.value==""))
		{
		scroll(findPosX(country),findPosY(country));
		document.getElementById('countryerror').style.visibility = 'visible'; 
		return false;
		}
		if((shortdesc.value==null)|| (shortdesc.value==""))
		{
		scroll(findPosX(shortdesc),findPosY(shortdesc));
		document.getElementById('shortdescerror').style.visibility = 'visible'; 
		return false;
		}
		if((userName.value==null)|| (userName.value==""))
		{
		scroll(findPosX(userName),findPosY(userName));
		document.getElementById('firstnameerror').style.visibility = 'visible'; 
		return false;
		}
		if((surname.value==null)|| (surname.value==""))
		{
		scroll(findPosX(surname),findPosY(surname));
		document.getElementById('surnameerror').style.visibility = 'visible'; 
		return false;
		}
		if((Phone.value==null)|| (Phone.value==""))
		{
		scroll(findPosX(Phone),findPosY(Phone));
		document.getElementById('phoneerror').style.visibility = 'visible'; 
		return false;
		}
		if ((Phone.value!=null)&& (Phone.value!=""))
	    {
	       if (checkInternationalPhone(Phone.value)==false){
			   scroll(findPosX(Phone),findPosY(Phone));
		        Phone.value="";
				document.getElementById('phoneerror').innerHTML="Enter valid Phone Numbers";
				document.getElementById('phoneerror').style.visibility = 'visible'; 
				return false
	        }
			
	     }
		 if(ValidateMail1()==false)
	     {
	       return false;
	     }
		 if((password.value==null)|| (password.value==""))
		 {
		 scroll(findPosX(password),findPosY(password));
		 document.getElementById('passworderror').style.visibility = 'visible'; 
		 return false;
		 }
		 if((confirmPassword.value==null) || (confirmPassword.value==""))
		 {
		 scroll(findPosX(confirmPassword),findPosY(confirmPassword));
		 document.getElementById('confirmpassworderror').style.visibility = 'visible'; 
		 return false;
		 }
		 if(password.value!=confirmPassword.value)
		 {
		 scroll(findPosX(confirmPassword),findPosY(confirmPassword));
		 confirmPassword.value="";
		 document.getElementById('confirmpassworderror').innerHTML="Confirm Password should be same";
		 document.getElementById('confirmpassworderror').style.visibility = 'visible'; 
		 return false;
		 }
		 
		 
		 if(!document.getElementById('terms').checked)
		 {
		  document.getElementById('termserror').style.visibility = 'visible'; 
		  return false;
		 }	
		 
		 if((SecurityCode.value==null) || (SecurityCode.value==""))
		 {
		 scroll(findPosX(SecurityCode),findPosY(SecurityCode));
		 document.getElementById('securitycodeerror').style.visibility = 'visible'; 
		 return false;
		 }
		checkcapchacode(SecurityCode.value);	
        return false;
}

function validLead()
{  
        var companyName=document.companysignupForm.companyName; 
		var merchantLogo=document.companysignupForm.merchantLogo;
		var website=document.companysignupForm.website; 
		var businessArea=document.companysignupForm.businessArea;
		var address=document.companysignupForm.address; 
		var country=document.companysignupForm.country;
		var city=document.companysignupForm.city;
		var postCode=document.companysignupForm.postCode; 
		var shortdesc=document.companysignupForm.shortdesc; 
		var userName=document.companysignupForm.userName; 
		var surname=document.companysignupForm.surname;			
		var Phone=document.companysignupForm.phone;	
		var email=document.companysignupForm.email;
		var password=document.companysignupForm.password;	
		var confirmPassword=document.companysignupForm.confirmPassword;	
		var SecurityCode=document.companysignupForm.SecurityCode;
		if((businessArea.value==null)|| (businessArea.value==""))
		{	
		scroll(findPosX(businessArea),findPosY(businessArea));
		document.getElementById('businessAreaerror').style.visibility = 'visible'; 
		return false;
		}
		if((companyName.value==null)|| (companyName.value==""))
		{
		scroll(findPosX(companyName),findPosY(companyName));
		document.getElementById('companyerror').style.visibility = 'visible'; 
		return false;
		}
		
		if((website.value==null)|| (website.value==""))
		{
		scroll(findPosX(website),findPosY(website));
		document.getElementById('websiteurlerror').style.visibility = 'visible'; 
		return false;
		}
		if((website.value!=null)|| (website.value!=""))
		{
		 
           if(isValidURL(website.value)==false)
			{
				scroll(findPosX(website),findPosY(website));
                document.getElementById('websiteurlerror').style.visibility = 'visible'; 
				return false;
			}
		}
		
		if((merchantLogo.value!=null) && (merchantLogo.value!=""))
		{
			
			if(Checkfiles(merchantLogo)==false)
			{
			   scroll(findPosX(merchantLogo),findPosY(merchantLogo));
				document.getElementById('logoerror').style.visibility = 'visible'; 
				return false;
				
			}
		}

		if((address.value==null)|| (address.value==""))
		{
		scroll(findPosX(address),findPosY(address));
		document.getElementById('addresserror').style.visibility = 'visible'; 
		return false;
		}
		if((postCode.value==null)|| (postCode.value==""))
		{
		scroll(findPosX(postCode),findPosY(postCode));
		document.getElementById('postcodeurlerror').style.visibility = 'visible'; 
		return false;
		}
		if((city.value==null)|| (city.value==""))
		{
		scroll(findPosX(city),findPosY(city));
		document.getElementById('cityerror').style.visibility = 'visible'; 
		return false;
		}
		if((country.value==null)|| (country.value==""))
		{
		scroll(findPosX(country),findPosY(country));
		document.getElementById('countryerror').style.visibility = 'visible'; 
		return false;
		}
		if((shortdesc.value==null)|| (shortdesc.value==""))
		{
		scroll(findPosX(shortdesc),findPosY(shortdesc));
		document.getElementById('shortdescerror').style.visibility = 'visible'; 
		return false;
		}
		if((userName.value==null)|| (userName.value==""))
		{
		scroll(findPosX(userName),findPosY(userName));
		document.getElementById('firstnameerror').style.visibility = 'visible'; 
		return false;
		}
		if((surname.value==null)|| (surname.value==""))
		{
		scroll(findPosX(surname),findPosY(surname));
		document.getElementById('surnameerror').style.visibility = 'visible'; 
		return false;
		}
		if((Phone.value==null)|| (Phone.value==""))
		{
		scroll(findPosX(Phone),findPosY(Phone));
		document.getElementById('phoneerror').style.visibility = 'visible'; 
		return false;
		}
		if ((Phone.value!=null)&& (Phone.value!=""))
	    {
	       if (checkInternationalPhone(Phone.value)==false){
			   scroll(findPosX(Phone),findPosY(Phone));
		        Phone.value="";
				document.getElementById('phoneerror').innerHTML="Enter valid Phone Number";
				document.getElementById('phoneerror').style.visibility = 'visible'; 
				return false
	        }
			
	     }
		 if(ValidateMail1()==false)
	     {
	       return false;
	     }
		 if((password.value==null)|| (password.value==""))
		 {
		 scroll(findPosX(password),findPosY(password));
		 document.getElementById('passworderror').style.visibility = 'visible'; 
		 return false;
		 }
		 if((confirmPassword.value==null) || (confirmPassword.value==""))
		 {
		 scroll(findPosX(confirmPassword),findPosY(confirmPassword));
		 document.getElementById('confirmpassworderror').style.visibility = 'visible'; 
		 return false;
		 }
		 if(password.value!=confirmPassword.value)
		 {
		 scroll(findPosX(confirmPassword),findPosY(confirmPassword));
		 confirmPassword.value="";
		 document.getElementById('confirmpassworderror').innerHTML="Confirm Password should be same";
		 document.getElementById('confirmpassworderror').style.visibility = 'visible'; 
		 return false;
		 }
		 
		 if((SecurityCode.value==null) || (SecurityCode.value==""))
		 {
		 scroll(findPosX(SecurityCode),findPosY(SecurityCode));
		 document.getElementById('securitycodeerror').style.visibility = 'visible'; 
		 return false;
		 }
		 
		  checkcapchacode(SecurityCode.value);	
        return false;
}


function validateBillingDetail()
{
        var firstName=document.billingDetailForm.FirstName; 
		var surName=document.billingDetailForm.SurName; 
		var Phone=document.billingDetailForm.PhoneNumber; 
		var companyName=document.billingDetailForm.CompanyName; 
		var address=document.billingDetailForm.Address; 
		var postalcode=document.billingDetailForm.PostalCode; 
		if((firstName.value==null)|| (firstName.value==""))
		{
		document.getElementById('nameerror').style.visibility = 'visible'; 
		return false;
		}
		if((surName.value==null)|| (surName.value==""))
		{
		document.getElementById('surnameerror').style.visibility = 'visible'; 
		return false;
		}
		if((Phone.value==null)|| (Phone.value==""))
		{
		document.getElementById('phoneerror').style.visibility = 'visible'; 
		return false;
		}
		if ((Phone.value!=null)&& (Phone.value!=""))
	    {
	       if (checkInternationalPhone(Phone.value)==false){
		        Phone.value="";
				document.getElementById('phoneerror').innerHTML="Enter valid Phone Number";
				document.getElementById('phoneerror').style.visibility = 'visible'; 
				return false
	        }
			
	     }
		if((companyName.value==null)|| (companyName.value==""))
		{
		document.getElementById('companyerror').style.visibility = 'visible'; 
		return false;
		}
		if((address.value==null)|| (address.value==""))
		{
		document.getElementById('addresserror').style.visibility = 'visible'; 
		return false;
		}
		if((postalcode.value==null)|| (postalcode.value==""))
		{
		document.getElementById('postalcodeerror').style.visibility = 'visible'; 
		return false;
		}
  return true;

}

function checkSignupForPayPerLeadForm()
{
		if (!CheckVatCode())
		{
			return false;
		}
		
		if(!document.payperleadForm.terms.checked)
		{
		document.getElementById('termserror').style.visibility = 'visible'; 
		return false;
		}	
		return true;
 }

function checkSignupForAnotherCategoryForm()
{
		if(!document.signupIntoAnotherCategoryForm.terms.checked)
		{
		document.getElementById('termserror').style.visibility = 'visible'; 
		return false;
		}	
		return true;
 
}


function checkval(theForm){
	var res;
	var accountlead=document.getElementById('amountlead');
	document.getElementById('amount').value=parseFloat(accountlead.value);
	if (document.getElementById('amount').value == "") 
	{
        alert("You didn't enter amount.\n");
		res=1;
    } 
	else if (isNaN(parseInt(document.getElementById('amount').value))) {
        alert("The amount contains illegal characters.\n");
		res=1;
      } 
	else if (document.getElementById('amount').value<10)
	{
		alert("Transaction can not be done below 10 Euro");
		res=1;
	}
	if (res==0)
	{
		var tax;
		tax=(document.getElementById('amount').value)*(16/100);
		document.getElementById('tax').value=tax;
		document.myform.submit();
	}
}

function checkvalWithTermsAndCondition(theForm){
	var res;
	var accountlead=document.getElementById('amountlead');
	document.getElementById('amount').value=parseFloat(accountlead.value);
	if (document.getElementById('amount').value == "") 
	{
        alert("You didn't enter amount.\n");
		res=1;
    } 
	else if (isNaN(parseInt(document.getElementById('amount').value))) {
        alert("The amount contains illegal characters.\n");
		res=1;
      } 
	else if (document.getElementById('amount').value<10)
	{
		alert("Transaction can not be done below 10 Euro");
		res=1;
	}

    if(!document.getElementById('terms').checked)
	{
		  document.getElementById('termserror').style.visibility = 'visible'; 
		  return false;
	}	
		 
	if (res==0)
	{
		var tax;
		tax=(document.getElementById('amount').value)*(16/100);
		document.getElementById('tax').value=tax;
		document.myform.submit();
	}
}



function isValidURL(url){

    var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/;
    if(RegExp.test(url)){
        return true;
    }else{
        return false;
    }
}



function Checkfiles(Filename)
{	
var fileName = Filename.value;
var ext = fileName.substring(fileName.lastIndexOf('.') + 1);
if(ext == "gif" || ext == "GIF" || ext == "JPEG" || ext == "jpeg" || ext == "jpg" || ext == "JPG" || ext == "doc")
{
return true;
} 
else
{
document.getElementById('logoerror').innerHTML="Upload Gif or Jpg images only";
Filename.value="";
Filename.focus();
return false;
}
}


 function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

function unselect(ele){
		var val = ele.value.substr(0,1);
		if(val == 'p'){
		ele.options[ele.selectedIndex].selected=false
		alert("Parent category can not be selected!");
		}
		hideDiv(ele.id+'error');
	}
	


