// JavaScript Document
// Function for  E mail Validation  /////
function validateEmail1(addr,man,db) {
	if (addr == '' && man) {
	   if (db) alert('Please enter the email address.');
	   return false;
	}
	var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';
	for (i=0; i<invalidChars.length; i++) {
	   if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
		  if (db) alert('Email address contains invalid characters.');
		  return false;
	   }
	}
	for (i=0; i<addr.length; i++) {
	   if (addr.charCodeAt(i)>127) {
		  if (db) alert("Email address contains non ascii characters.");
		  return false;
	   }
	}

	var atPos = addr.indexOf('@',0);
	if (atPos == -1) {
	   if (db) alert('Email address must contain an @ symbol.');
	   return false;
	}
	if (atPos == 0) {
	   if (db) alert('Email address must not start with @ symbol.');
	   return false;
	}
	if (addr.indexOf('@', atPos + 1) > - 1) {
	   if (db) alert('Email address must contain only one @ symbol.');
	   return false;
	}
	if (addr.indexOf('.', atPos) == -1) {
	   if (db) alert('Email address must contain a period in the domain name.');
	   return false;
	}
	if (addr.indexOf('@.',0) != -1) {
	   if (db) alert('Period must not immediately follow @ in email address.');
	   return false;
	}
	if (addr.indexOf('.@',0) != -1){
	   if (db) alert('Period must not immediately precede @ in email address.');
	   return false;
	}
	if (addr.indexOf('..',0) != -1) {
	   if (db) alert('Two periods must not be adjacent in email address.');
	   return false;
	}
	var suffix = addr.substring(addr.lastIndexOf('.')+1);
	if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
	   if (db) alert('Invalid primary domain in email address.');
	   return false;
	}
return true;

//  Radio button Validation


function valButton(btn) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}
}


function Loginval()
{
	if (!validateEmail(document.login_form.email.value,1,1)) 
{
document.login_form.email.focus();
return false;
}

	if (document.login_form.password.value == "")
	{
	alert("Please enter the password.");
	document.login_form.password.focus();
	return false;
	}
return true;

}

//feedback form validation

function feedbackvalidate()
{

	if (document.feedback.type.value == "0")
	{
		alert("Please select feedback category.");
		document.feedback.type.focus();
		return false;
	}
	
	if (document.feedback.contactname.value == "")
	{
		alert("Please enter your name.");
		document.feedback.contactname.focus();
		return false;
	}
	
	if (!validateEmail(document.feedback.email.value,1,1)) 
	{
		document.feedback.email.focus();
		return false;
	}
	
	if (document.feedback.message.value == "")
	{
		alert("Please enter your feedback.");
		document.feedback.message.focus();
		return false;
	}
	
	var vcode=document.getElementById("txtVCode").value;
	if(vcode=="")
	{					
		alert('Please enter verification code');
		document.getElementById('txtVCode').focus();						
		return false;
	}
	else if(vcode!=security_code)
	{	    	
		alert('Verification code is invalid');
		document.getElementById('txtVCode').focus();
		return false;
	}
	
return true;

}
//advertisement form validation



//forward link to a friend form validation

function forwardlinkValidate()
{


	if (document.forwardmail.name.value == "")
	{
	alert("Please enter your name.");
	document.forwardmail.name.focus();
	return false;
	}
	
	if (!validateEmail(document.forwardmail.myemail.value,1,1)) 
	{
	document.forwardmail.myemail.focus();
	return false;
	}
	
	if (document.forwardmail.friname.value == "")
	{
	alert("Please enter your friend's name.");
	document.forwardmail.friname.focus();
	return false;
	}
	
	if (!validateEmail(document.forwardmail.friemail.value,1,1)) 
	{
	document.forwardmail.friemail.focus();
	return false;
	}
	
	if (document.forwardmail.subject.value == "")
	{
	alert("Please enter the subject.");
	document.forwardmail.subject.focus();
	return false;
	}
	
	if (document.forwardmail.message.value == "")
	{
	alert("Please enter the message.");
	document.forwardmail.message.focus();
	return false;
	}
	
return true;

}

//forward link to a friend validation end here


function advertisevalidate()
{


	if (document.advertise.companyname.value == "")
	{
		alert("Please enter the company name.");
		document.advertise.companyname.focus();
		return false;
	}
	
	
	var Phone=document.advertise.phone
	
	if ((Phone.value==null)||(Phone.value=="")){
	alert("Please enter your Contact number.")
	Phone.focus()
	return false
	}
	if (checkInternationalPhone(Phone.value)==false){
	alert("Please enter a valid Contact number.")
	Phone.value=""
	Phone.focus()
	return false
	}

	if (!validateEmail(document.advertise.email.value,1,1)) 
	{
	document.advertise.email.focus();
	return false;
	}
	
	if (document.advertise.typebusiness.value == "")
	{
	alert("Please enter the Services.");
	document.advertise.typebusiness.focus();
	return false;
	}
	
	if (document.advertise.address.value == "")
	{
		alert("Please enter the address.");
		document.advertise.address.focus();
		return false;
	}
	
	var vcode=document.getElementById("txtVCode").value;
	if(vcode=="")
	{					
		alert('Please enter verification code');
		document.getElementById('txtVCode').focus();						
		return false;
	}
	else if(vcode!=security_code)
	{	    	
		alert('Verification code is invalid');
		document.getElementById('txtVCode').focus();
		return false;
	}
	
return true;

}


//search form validation
function validatesearchForm2()
{
	if(document.mainsearch_form.search.value=="Enter Business Name/Keyword/Category/Brand")
	{
	alert('Please enter keywords.');
	document.mainsearch_form.search.focus();
	document.mainsearch_form.search.value="";
	return false;
	}
	if(document.mainsearch_form.search.value=="")
	{
	alert('Please enter keywords.');
	document.mainsearch_form.search.focus();
	return false;
	}
	
	
	return true;
}


////////////////////Registration//////////////////////////





function ValidateNo(NumStr, String)
{    
for(var Idx=0; Idx<NumStr.length; Idx++)    
{        
var Char = NumStr.charAt(Idx);        
var Match = false;        
for(var Idx1=0; Idx1<String.length; Idx1++)        
{            
if(Char == String.charAt (Idx1))                
Match = true;        
}        
if (!Match)           
 return false;    
 }   
  return true;} 



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 = 6;

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 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){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

// Function for  E mail Validation  /////
function validateEmail(addr,man,db) {
	if (addr == '' && man) {
	   if (db) alert('Please enter the email address.');
	   return false;
	}
	var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';
	for (i=0; i<invalidChars.length; i++) {
	   if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
		  if (db) alert('Email address contains invalid characters.');
		  return false;
	   }
	}
	for (i=0; i<addr.length; i++) {
	   if (addr.charCodeAt(i)>127) {
		  if (db) alert("Email address contains non ascii characters.");
		  return false;
	   }
	}

	var atPos = addr.indexOf('@',0);
	if (atPos == -1) {
	   if (db) alert('Email address must contain an @ symbol.');
	   return false;
	}
	if (atPos == 0) {
	   if (db) alert('Email address must not start with @ symbol.');
	   return false;
	}
	if (addr.indexOf('@', atPos + 1) > - 1) {
	   if (db) alert('Email address must contain only one @ symbol.');
	   return false;
	}
	if (addr.indexOf('.', atPos) == -1) {
	   if (db) alert('Email address must contain a period in the domain name.');
	   return false;
	}
	if (addr.indexOf('@.',0) != -1) {
	   if (db) alert('Period must not immediately follow @ symbol in email address');
	   return false;
	}
	if (addr.indexOf('.@',0) != -1){
	   if (db) alert('Period must not immediately precede @ symbol in email address');
	   return false;
	}
	if (addr.indexOf('..',0) != -1) {
	   if (db) alert('Two periods must not be adjacent in email address.');
	   return false;
	}
	var suffix = addr.substring(addr.lastIndexOf('.')+1);
	if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
	   if (db) alert('Invalid primary domain in email address.');
	   return false;
	}
return true;

//  Radio button Validation


function valButton(btn) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}
}

function Registrationval()
{
	
if (!validateEmail(document.registration_form.email.value,1,1)) 
{
document.registration_form.email.focus();
return false;
}

if (document.registration_form.password.value == "")
{
alert("Please enter the password.");
document.registration_form.password.focus();
return false;
}
if (document.registration_form.password.value.length<6 ) 
{
   alert('Password must be atleast 6 characters long.');
   document.registration_form.password.focus();
   return false;
}
if (document.registration_form.password.value.length>14 ) 
{
   alert('Password must be less than 14 characters.');
   document.registration_form.password.focus();
   return false;
}
if (document.registration_form.cpassword.value == "")
{
alert("Please enter the confirm password.");
document.registration_form.cpassword.focus();
return false;
}

if (document.registration_form.password.value != document.registration_form.cpassword.value)
{
alert("Password and confirm password must  be same.");
document.registration_form.password.focus();
return false;
}
if (document.registration_form.fullname.value == "")
{
alert("Please enter the fullname!");
document.registration_form.fullname.focus();
return false;
}
/*if (document.registration_form.dob_date.value == "0")
{
alert("Please select the date!");
document.registration_form.dob_date.focus();
return false;
}
if (document.registration_form.dob_month.value == "0")
{
alert("Please select the month!");
document.registration_form.dob_month.focus();
return false;
}
if (document.registration_form.dob_year.value == "0")
{
alert("Please select the year!");
document.registration_form.dob_year.focus();
return false;
}*/

/*if (document.registration_form.gender.value == "Select")
{
alert("Please select the Gender!");
document.registration_form.gender.focus();
return false;
}*/

if (document.registration_form.country.value == "0")
{
alert("Please select the Country!");
document.registration_form.country.focus();
return false;
}


/*if (!document.registration_form.terms.checked)
{
alert("Please select Terms and Conditions !");

return false;
}*/

/*if (!document.registration_form.terms[0].checked)
{
alert("Please Select Terms and condition!");
return false;
}
if (document.registration_form.fullname.value == "")
{
alert("Please enter the Fullname!");
document.registration_form.fullname.focus();
return false;
}
if ( document.registration_form.usertype.selectedIndex == 0 )
{
alert ( "Please choose usertype!" );
document.registration_form.usertype.focus();
return false;
}

if ( document.registration_form.dob_date.selectedIndex == 0 )
{
alert ( "Please choose date of birth!" );
document.registration_form.dob_date.focus();
return false;
}
if ( document.registration_form.dob_month.selectedIndex == 0 )
{
alert ( "Please choose month of birth!" );
document.registration_form.dob_month.focus();
return false;
}
if ( document.registration_form.dob_year.selectedIndex == 0 )
{
alert ( "Please choose year of birth!" );
document.registration_form.dob_year.focus();
return false;
}

if (!document.registration_form.gender[0].checked && !document.registration_form.gender[1].checked)
{
alert("Please Select gender!");
return false;
}
if ( document.registration_form.country.selectedIndex == 0 )
{
alert ( "Please choose Country!" );
document.registration_form.country.focus();
return false;
}

if ( document.registration_form.country.selectedIndex == 223 && document.registration_form.emirate.value =="" )
{

alert("Please enter Emirate!");
document.registration_form.emirate.focus();
return false;

}
var Phone=document.registration_form.phone

if ((Phone.value==null)||(Phone.value=="")){
alert("Please enter your telephone number")
Phone.focus()
return false
}
if (checkInternationalPhone(Phone.value)==false){
alert("Please enter a valid telephone number")
Phone.value=""
Phone.focus()
return false
}

if ( document.registration_form.mobilebrand.selectedIndex == 0 )
{
alert ( "Please choose mobilebrand!" );
document.registration_form.mobilebrand.focus();
return false;
}
if ( document.registration_form.occupation.selectedIndex == 0 )
{
alert ( "Please choose occupation!" );
document.registration_form.occupation.focus();
return false;
}

if (document.registration_form.vercode.value == "")
{
alert("Please enter the image verification code!");
document.registration_form.vercode.focus();
return false;
}*/

return true;


}


function Registrationval_edit()
{
//	alert('sdf');
if (document.registration_form.fullname.value == "")
{
alert("Please enter the fullname!");
document.registration_form.fullname.focus();
return false;
}

var Phone=document.registration_form.phone

if ((Phone.value==null)||(Phone.value=="")){
alert("Please enter your telephone number")
Phone.focus()
return false
}
if (checkInternationalPhone(Phone.value)==false){
alert("Please enter a valid telephone number")
//Phone.value=""
Phone.focus()
return false
}

var mobile=document.registration_form.mobile

if ((mobile.value==null)||(mobile.value=="")){
alert("Please enter your mobile number")
mobile.focus()
return false
}
if (checkInternationalPhone(mobile.value)==false){
alert("Please enter a valid mobile number")
//Phone.value=""
mobile.focus()
return false
}

return true;


}

/////////////////////////End////////////////////////////

/////////////////////////Start Change Password////////////////////////////
function ChangePasswordForm()
{
	
	var pass = document.passwordsettings.oldpassword1.value;
	
	if(document.passwordsettings.oldpassword1.value=="")
	{
	alert('Please enter your old password.');
	document.passwordsettings.oldpassword1.focus();
	return false;
	}
	
	//alert("mgn");
	/*alert(hex_hmac_md5(document.passwordsettings.oldpassword1.value));
	
	if ((document.passwordsettings.oldpassword.value!="") || (document.passwordsettings.oldpassword1.value!=""))
	{
		if (document.passwordsettings.oldpassword.value!=document.passwordsettings.oldpassword1.value)
		{
			alert ("Your Old Password doesn't match");
			return false;
		}
	}*/
	
	
	if(document.passwordsettings.password1.value=="")
	{
	alert('Please enter your new password.');
	document.passwordsettings.password1.focus();
	return false;
	}
	
	
	
	if(document.passwordsettings.password2.value=="")
	{
	alert('Please enter the confirm password.');
	document.passwordsettings.password2.focus();
	return false;
	}
	
	
	if ((document.passwordsettings.password1.value!="") || (document.passwordsettings.password2.value!=""))
	{
		if (document.passwordsettings.password1.value!=document.passwordsettings.password2.value)
		{
			alert ("New password and confirm password doesn't match.");
			return false;
		}
	}
	
		
return true;
}

/////////////////////////End////////////////////////////


/////////////////////////View Reminder////////////////////////////



function validateReminderForm()
{

if(document.addreminder.vName.value == "")
{
alert("Please enter the reminder name.!");
document.addreminder.vName.focus();
return false;
}
if ( document.addreminder.dtDate.value ==0 )
{
alert ( "Please select the date." );
document.addreminder.dtDate.focus();
return false;
}
if ( document.addreminder.dtMonth.value == 0 )
{
alert ( "Please select the month." );
document.addreminder.dtMonth.focus();
return false;
}
if ( document.addreminder.dtYear.value == 0 )
{
alert ( "Please select the year." );
document.addreminder.dtYear.focus();
return false;
}
if ( document.addreminder.dtHour.value == 0 )
{
alert ( "Please select the hours." );
document.addreminder.dtHour.focus();
return false;
}

if ( document.addreminder.dtMinute.value == 0 )
{
alert ( "Please select the minutes." );
document.addreminder.dtMinute.focus();
return false;
}
if ( document.addreminder.vAlarmType.value == 0 )
{
alert ( "Please select alarm type." );
document.addreminder.vAlarmType.focus();
return false;
}
if ( document.addreminder.vRepeatType.value == 0 )
{
alert ( "Please select repeat type." );
document.addreminder.vRepeatType.focus();
return false;
}
if ( document.addreminder.vRemindVia.value == 0 )
{
alert ( "Please select the value for reminder via." );
document.addreminder.vRemindVia.focus();
return false;
}

return true;

}
/////////////////////////End////////////////////////////


/////////////////////////View Reminder////////////////////////////



function validateContact_Form()
{
	
if(document.addreminder_c.Mc_Email.value=="")
	{

	alert('Please enter the email ID.');
	document.addreminder_c.Mc_Email.focus();
	return false;
	}
	var Temp     =document.addreminder_c.Mc_Email;
	var AtSym    = Temp.value.indexOf('@');
	var Period   = Temp.value.lastIndexOf('.');
	var Space    = Temp.value.indexOf(' ');
	var Length   = Temp.value.length - 1;
	
	if(AtSym < 1 || Period <= AtSym+1 || Period == Length || Temp.value=='')
	{
	alert('Invalid email address.');
	document.addreminder_c.Mc_Email.focus();
	return false;
	}	
	var Phone=document.addreminder_c.Mc_Mobile

	if ((Phone.value==null)||(Phone.value=="")){
	alert("Please enter your mobile number.")
	Phone.focus()
	return false
	}
	if (checkInternationalPhone(Phone.value)==false){
	alert("Please enter the valid mobile number.")
	Phone.value=""
	Phone.focus()
	return false
	}
	
return true;
}
/////////////////////////End////////////////////////////

/////////////////////////Add Article////////////////////////////

function validateArticleEvent()
{	

	if(document.addarticle.Art_CatId.value == 0)
	{
	alert("Please select the article type.");
	document.addarticle.Art_CatId.focus();
	return false;
	}

	if(document.addarticle.vArticleTitle.value == "")
	{
	alert("Please enter the article title.");
	document.addarticle.vArticleTitle.focus();
	return false;
	}
	
	if(document.addarticle.vArticleContent.value == "")
	{
	alert("Please enter the article content.");
	document.addarticle.vArticleContent.focus();
	return false;
	}	
		
	
return true;
}
/////////////////////////End////////////////////////////


/////////////////////////Edit Article////////////////////////////

function validateArticleEdit()
{	

	if(document.editarticle.Art_CatId.value == 0)
	{
	alert("Please select the article type.");
	document.editarticle.Art_CatId.focus();
	return false;
	}

	if(document.editarticle.vArticleTitle.value == "")
	{
	alert("Please enter the article title.");
	document.editarticle.vArticleTitle.focus();
	return false;
	}
	
	if(document.editarticle.vArticleContent.value == "")
	{
	alert("Please enter the article content.");
	document.editarticle.vArticleContent.focus();
	return false;
	}	
	
	
return true;
}
/////////////////////////End////////////////////////////




/*//////////////Career Validation//////////////*/
	
function validateCareer()
{
	
	if((document.addcareer.vJobType.value=="Select")||(document.addcareer.vJobType.value==null)||(document.addcareer.vJobType.value==0))
	{
	document.addcareer.vJobType.className = "";
	alert('Please select your career type.');
	document.addcareer.vJobType.focus();
	return false;
	}
	else{
	document.addcareer.vJobType.className = "";
	}
	
	if((document.addcareer.vName.value=="")||(document.addcareer.vName.value==null)||(document.addcareer.vName.value==0))
	{
	document.addcareer.vName.className = "lgntfld";
	alert('Please enter your name.');
	document.addcareer.vName.focus();
	return false;
	}
	else{
	document.addcareer.vName.className = "lgntfld";
	}	
	
		
	if((document.addcareer.vAddress.value=="")||(document.addcareer.vAddress.value==null)||(document.addcareer.vAddress.value==0))
	{
	document.addcareer.vAddress.className = "";
	alert('Please enter your address.');
	document.addcareer.vAddress.focus();
	return false;
	}
	else{
	document.addcareer.vAddress.className = "";
	}	
	
	

	if(document.addcareer.vEmail.value=="")
	{

	alert('Please enter your email ID.');
	document.addcareer.vEmail.focus();
	return false;
	}
	var Temp     =document.addcareer.vEmail;
	var AtSym    = Temp.value.indexOf('@');
	var Period   = Temp.value.lastIndexOf('.');
	var Space    = Temp.value.indexOf(' ');
	var Length   = Temp.value.length - 1;
	
	if(AtSym < 1 || Period <= AtSym+1 || Period == Length || Temp.value=='')
	{
	alert('Invalid email address.');
	document.addcareer.vEmail.focus();
	return false;
	}	
	
	
	if((document.addcareer.vResumeURL.value=="")||(document.addcareer.vResumeURL.value==null)||(document.addcareer.vResumeURL.value==0))
	{
	document.addcareer.vResumeURL.className = "";
	alert('Please upload your resume with ".doc or .txt or .pdf" format.');
	document.addcareer.vResumeURL.focus();
	return false;
	}
	else{
	document.addcareer.vResumeURL.className = "";
	}			
	
	
	if(document.addcareer.vResumeURL.value!="")
	{
		 var extensions = new Array("doc","pdf","txt");  
		   		 
		   
		 var image_file = document.addcareer.vResumeURL.value;  		
		 
		 var image_length = document.addcareer.vResumeURL.value.length;  		   
		 var pos = image_file.lastIndexOf('.') + 1;  		   
		 var ext = image_file.substring(pos, image_length);  		   
		 var final_ext = ext.toLowerCase();  
		  
		 for (i = 0; i < extensions.length; i++)  
		 {  
			 if(extensions[i] == final_ext)  
			 {  
				 return true;  
			 }  
		 }  
		   
		 alert("You must upload a file with one of the following extensions: "+ extensions.join(', ') +".");  
		 
		 document.addcareer.vResumeURL.value="";
		 document.addcareer.vResumeURL.focus();
		 return false;  
	}
	else
		return false;
	
	
return true;
}


/*//////////////Career Validation//////////////*/


/*//////////////Free Listing Validation//////////////*/
	
function validateFreeListingEvent()
{
	
	
	if((document.addfreelist.classname.value=="Select")||(document.addfreelist.classname.value==null)||(document.addfreelist.classname.value==0))
	{
	document.addfreelist.classname.className = "lgntfld";
	alert('Please select your classification.');
	document.addfreelist.classname.focus();
	return false;
	}
	else{
	document.addfreelist.classname.className = "lgntfld";
	}
	
	if((document.addfreelist.vCustomerName.value=="")||(document.addfreelist.vCustomerName.value==null)||(document.addfreelist.vCustomerName.value==0))
	{
	document.addfreelist.vCustomerName.className = "lgntfld";
	alert('Please enter your business name.');
	document.addfreelist.vCustomerName.focus();
	return false;
	}
	else{
	document.addfreelist.vCustomerName.className = "lgntfld";
	}	
	
		
	if((document.addfreelist.vAddress.value=="")||(document.addfreelist.vAddress.value==null)||(document.addfreelist.vAddress.value==0))
	{
	document.addfreelist.vAddress.className = "";
	alert('Please enter your address.');
	document.addfreelist.vAddress.focus();
	return false;
	}
	else{
	document.addfreelist.vAddress.className = "";
	}	
	
	if((document.addfreelist.vPOBox.value=="")||(document.addfreelist.vPOBox.value==null)||(document.addfreelist.vPOBox.value==0))
	{
	document.addfreelist.vPOBox.className = "lgntfld";
	alert('Please enter the PO BOX number.');
	document.addfreelist.vPOBox.focus();
	return false;
	}
	else{
	document.addfreelist.vPOBox.className = "lgntfld";
	}	


if ( document.addfreelist.intCountry.selectedIndex == 0 ) {
       	   alert('Please select the country.');
		   document.addfreelist.intCountry.focus();
	   return false;
	   }
	
	
	var Phone=document.addfreelist.vPhone
	
	if ((Phone.value==null)||(Phone.value=="")){
	alert("Please enter your telephone number.")
	Phone.focus()
	return false
	}
	if (checkInternationalPhone(Phone.value)==false){
	alert("Please enter a valid telephone number.")
	Phone.value=""
	Phone.focus()
	return false
	}
if (!validateEmail(document.addfreelist.vEmail.value,1,1)) 
	{
	document.addfreelist.vEmail.focus();
	return false;
	}


	
	
	
return true;
}


/*//////////////Free Listing Validation End//////////////*/



/*//////////////Directory Validation//////////////*/
	
function validateOrderCopy()
{
	if((document.addDirectory.first.value=="")||(document.addDirectory.first.value==null)||
	(document.addDirectory.first.value==0))
	{	
		alert('Please enter your first name.');
		document.addDirectory.first.focus();
		return false;
	}		
		
	if((document.addDirectory.last.value=="")||(document.addDirectory.last.value==null)||
	(document.addDirectory.last.value==0))
	{	
		alert('Please enter your last name.');
		document.addDirectory.last.focus();
		return false;
	}
	
	if((document.addDirectory.address1.value=="")||(document.addDirectory.address1.value==null)||(document.addDirectory.address1.value==0))
	{	
		alert('Please enter your address.');
		document.addDirectory.address1.focus();
		return false;
	}
	
	if ( document.addDirectory.city.value=="" )
	{
	   alert('Please enter your city.');
	   document.addDirectory.city.focus();
	   return false;
	}
	
	/*if ( document.addDirectory.zip.value=="" )
	{
	   alert('Please enter your zip/postal code.');
	   document.addDirectory.zip.focus();
	   return false;
	}*/
	
	/*var zip=document.addDirectory.zip;
	
	if ((zip.value==null)||(zip.value=="")){
		alert("Please enter your zip/postal code.")
		zip.focus()
		return false
	}
	if (checkInternationalPhone(zip.value)==false){
		alert("Please enter a valid zip/postal code.")
		zip.value=""
		zip.focus()
		return false
	}*/
	
	
	if ( document.addDirectory.country.value == 0 ) {
	   alert('Please select the country.');
	   document.addDirectory.country.focus();
	   return false;
	}
	
	if (!validateEmail(document.addDirectory.email.value,1,1)) 
	{
		document.addDirectory.email.focus();
		return false;
	}

	
	var Phone=document.addDirectory.phone;
	
	if ((Phone.value==null)||(Phone.value=="")){
		alert("Please enter your telephone number.")
		Phone.focus()
		return false
	}
	if (checkInternationalPhone(Phone.value)==false){
		alert("Please enter a valid telephone number.")
		Phone.value=""
		Phone.focus()
		return false
	}


	if ( document.addDirectory.rate.value == 0  || document.addDirectory.rate.value == '') {
	   alert('Please select atleast one directory.');
	   //document.addDirectory.rate.focus();
	   return false;
	}
	
	if ( document.addDirectory.condition.checked == false)
	{
	   alert('Please accecpt terms & condition');
	   document.addDirectory.condition.focus();
	   return false;
	}
	
return true;
}


var security_code;
function fixedSize(valudx)
{
	security_code=valudx;
}

/*//////////////Directory Validation End//////////////*/




function validateOrderShopCopy()
{
	if((document.bill.fname.value=="")||(document.bill.fname.value==null)||
	(document.bill.fname.value==0))
	{	
		alert('Please enter your first name.');
		document.bill.fname.focus();
		return false;
	}		
		
	if((document.bill.lname.value=="")||(document.bill.lname.value==null)||
	(document.bill.lname.value==0))
	{	
		alert('Please enter your last name.');
		document.bill.lname.focus();
		return false;
	}
	
	if((document.bill.address1.value=="")||(document.bill.address1.value==null)||(document.bill.address1.value==0))
	{	
		alert('Please enter your address.');
		document.bill.address1.focus();
		return false;
	}
	
	if ( document.bill.city.value=="" )
	{
	   alert('Please enter your city.');
	   document.bill.city.focus();
	   return false;
	}
	
	/*if ( document.bill.zip.value=="" )
	{
	   alert('Please enter your zip/postal code.');
	   document.bill.zip.focus();
	   return false;
	}*/
	
	/*var zip=document.bill.zip;
	
	if ((zip.value==null)||(zip.value=="")){
		alert("Please enter your zip/postal code.")
		zip.focus()
		return false
	}
	if (checkInternationalPhone(zip.value)==false){
		alert("Please enter a valid zip/postal code.")
		zip.value=""
		zip.focus()
		return false
	}*/
	
	
	if ( document.bill.country.value == 0 ) {
	   alert('Please select the country.');
	   document.bill.country.focus();
	   return false;
	}
	
	if (!validateEmail(document.bill.email.value,1,1)) 
	{
		document.bill.email.focus();
		return false;
	}

	
	var Phone=document.bill.phone;
	
	if ((Phone.value==null)||(Phone.value=="")){
		alert("Please enter your telephone number.")
		Phone.focus()
		return false
	}
	if (checkInternationalPhone(Phone.value)==false){
		alert("Please enter a valid telephone number.")
		Phone.value=""
		Phone.focus()
		return false
	}


	if ( document.bill.fax.value == '') {
	   alert('Please enter your fax number.');
	   document.bill.fax.focus();
	   return false;
	}
	
/*	if ( document.bill.condition.checked == false)
	{
	   alert('Please accecpt terms & condition');
	   document.bill.condition.focus();
	   return false;
	}
*/	
return true;
}


function validatePayment()
{
	
	
	
	
	if(document.form1.diff.checked==true)
	{
	
	
	if((document.form1.Dname.value=="")||(document.form1.Dname.value==null)||(document.form1.Dname.value==0))
	{	
	alert('Please enter your full name.');
	document.form1.Dname.focus();
	return false;
	}
	
	if((document.form1.DAddress1.value=="")||(document.form1.DAddress1.value==null)||(document.form1.DAddress1.value==0))
	{	
	alert('Please enter delivery address');
	document.form1.DAddress1.focus();
	return false;
	}
	
	
	if((document.form1.DCity.value=="")||(document.form1.DCity.value==null)||(document.form1.DCity.value==0))
	{
	alert('Please enter your city.');
	document.form1.DCity.focus();
	return false;
	}

	
	if((document.form1.DCountry.value=="")||(document.form1.DCountry.value==null)||(document.form1.DCountry.value==0))
	{	
	alert('Please select country.');
	document.form1.DCountry.focus();
	return false;
	}		
	
	
	
	
	}
	

	
	if((document.form1.vCountry.value=="")||(document.form1.vCountry.value==null)||(document.form1.vCountry.value==0))
	{	
	alert('Please select country.');
	document.form1.vCountry.focus();
	return false;
	}		
	
	
	
	if((document.form1.vPaymentType.value=="")||(document.form1.vPaymentType.value==null)||(document.form1.vPaymentType.value==0))
	{	
	alert('Please select payment type.');
	document.form1.vPaymentType.focus();
	return false;
	}		
	
	
		if((document.form1.vCardNo.value=="")||(document.form1.vCardNo.value==null)||(document.form1.vCardNo.value==0))
	{	
	alert('Please Enter the Card No.');
	document.form1.vCardNo.focus();
	return false;
	}
		
		
		var ccNumb = document.form1.vCardNo.value;
		var valid = "0123456789"  // Valid digits in a credit card number
		var len = ccNumb.length;  // The length of the submitted cc number
		var iCCN = parseInt(ccNumb);  // integer of ccNumb
		var sCCN = ccNumb.toString();  // string of ccNumb
		sCCN = sCCN.replace (/^\s+|\s+$/g,'');  // strip spaces
		var iTotal = 0;  // integer total set at zero
		var bNum = true;  // by default assume it is a number
		var bResult = false;  // by default assume it is NOT a valid cc
		var temp;  // temp variable for parsing string
		var calc;  // used for calculation of each digit
		
		// Determine if the ccNumb is in fact all numbers
		for (var j=0; j<len; j++) {
		temp = "" + sCCN.substring(j, j+1);
		if (valid.indexOf(temp) == "-1"){bNum = false;}
		}
		
		// if it is NOT a number, you can either alert to the fact, or just pass a failure
		if(!bNum){
		/*alert("Not a Number");*/bResult = false;
		}
		
		// Determine if it is the proper length 
		if((len == 0)&&(bResult)){  // nothing, field is blank AND passed above # check
		bResult = false;
		} else{  // ccNumb is a number and the proper length - let's see if it is a valid card number
		if(len >= 15){  // 15 or 16 for Amex or V/MC
		for(var i=len;i>0;i--){  // LOOP throught the digits of the card
		calc = parseInt(iCCN) % 10;  // right most digit
		calc = parseInt(calc);  // assure it is an integer
		iTotal += calc;  // running total of the card number as we loop - Do Nothing to first digit
		i--;  // decrement the count - move to the next digit in the card
		iCCN = iCCN / 10;                               // subtracts right most digit from ccNumb
		calc = parseInt(iCCN) % 10 ;    // NEXT right most digit
		calc = calc *2;                                 // multiply the digit by two
		// Instead of some screwy method of converting 16 to a string and then parsing 1 and 6 and then adding them to make 7,
		// I use a simple switch statement to change the value of calc2 to 7 if 16 is the multiple.
		switch(calc){
		case 10: calc = 1; break;       //5*2=10 & 1+0 = 1
		case 12: calc = 3; break;       //6*2=12 & 1+2 = 3
		case 14: calc = 5; break;       //7*2=14 & 1+4 = 5
		case 16: calc = 7; break;       //8*2=16 & 1+6 = 7
		case 18: calc = 9; break;       //9*2=18 & 1+8 = 9
		default: calc = calc;           //4*2= 8 &   8 = 8  -same for all lower numbers
		}                                               
		iCCN = iCCN / 10;  // subtracts right most digit from ccNum
		iTotal += calc;  // running total of the card number as we loop
		}  // END OF LOOP
		if ((iTotal%10)==0){  // check to see if the sum Mod 10 is zero
		bResult = true;  // This IS (or could be) a valid credit card number.
		} else {
		bResult = false;  // This could NOT be a valid credit card number
		}
		}
		}
		// change alert to on-page display or other indication as needed.
		
		if(!bResult){
		alert("This is Not a valid Credit Card Number!");
		document.form1.vCardNo.focus();
		return false;
		}
	
	
	
	
	if(isNaN(document.form1.vCardNo.value))
	{	
	alert('Please enter no only.');
	document.form1.vCardNo.select();
	document.form1.vCardNo.focus();
	return false;
	}
	

	if((document.form1.vExpDate1.value=="mm")||(document.form1.vExpDate1.value==null)||(document.form1.vExpDate1.value==0))
	{	
	alert('Please Enter the  Expiration Month');
	document.form1.vExpDate1.focus();
	return false;
	}
	
	if((document.form1.vExpDate2.value=="yy")||(document.form1.vExpDate2.value==null)||(document.form1.vExpDate2.value==0))
	{	
	alert('Please Enter the  Expiration Year');
	document.form1.vExpDate2.focus();
	return false;
	}
	
	if((document.form1.vExpDate3.value=="")||(document.form1.vExpDate3.value==null)||(document.form1.vExpDate3.value==0))
	{	
	alert('Please Enter the  Expiration CSC No.');
	document.form1.vExpDate3.focus();
	return false;
	}
	
	if((document.form1.vFirstName.value=="")||(document.form1.vFirstName.value==null)||(document.form1.vFirstName.value==0))
	{	
	alert('Please enter first name.');
	document.form1.vFirstName.focus();
	return false;
	}
	
	if((document.form1.vLastName.value=="")||(document.form1.vLastName.value==null)||(document.form1.vLastName.value==0))
	{	
	alert('Please enter last name.');
	document.form1.vLastName.focus();
	return false;
	}
	
	if((document.form1.vAddress1.value=="")||(document.form1.vAddress1.value==null)||(document.form1.vAddress1.value==0))
	{	
	alert('Please enter address1.');
	document.form1.vAddress1.focus();
	return false;
	}
	
	if((document.form1.vAddress2.value=="")||(document.form1.vAddress2.value==null)||(document.form1.vAddress2.value==0))
	{	
	alert('Please enter address2.');
	document.form1.vAddress2.focus();
	return false;
	}

	if((document.form1.vCity.value=="")||(document.form1.vCity.value==null)||(document.form1.vCity.value==0))
	{
	alert('Please enter your city.');
	document.form1.vCity.focus();
	return false;
	}

	if((document.form1.vState.value=="")||(document.form1.vState.value==null)||(document.form1.vState.value==0))
	{
	alert('Please select your state.');
	document.form1.vState.focus();
	return false;
	}

	if((document.form1.vZip.value=="")||(document.form1.vZip.value==null)||(document.form1.vZip.value==0))
	{
	alert('Please enter your zip/postal code.');
	document.form1.vZip.focus();
	return false;
	}
	
	if((document.form1.vPhone.value=="")||(document.form1.vPhone.value==null)||(document.form1.vPhone.value==0))
	{
	alert('Please select your phone no.');
	document.form1.vPhone.focus();
	return false;
	}

	if (!validateEmail(document.form1.email.value,1,1)) 
	{
	document.form1.email.focus();
	return false;
	}
	
	return true;



	
}





