﻿// JScript File
var CharOnly = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var CharWithSpace = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var NumberOnly = "0123456789";
var NumberWithDecimal = ".0123456789";
var CharNumBoth = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var CharNumBothWithSpace = "0123456789abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var AlphaNumericAllowed = "-,.0123456789abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var FaxAllowedChar = "-()0123456789";
var SpecialChar = "!@#$%^&*()+=_`~[]\\\';,{}|\"<>?/";
var characteronly=/^[a-zA-z\s]+$/;
var numonly=/^[\.0-9]+$/;
var number=/^[0-9]+$/;
var autonumber=/^[1-9]+$/;
var num_char=/^[0-9a-zA-Z\s]+$/;


function IsNumberOnly(InputStr)
{

	for(var i=0; i<InputStr.length; i++)
	{
		if (NumberOnly.indexOf(InputStr.charAt(i)) == -1) 
		{
			return false;
		}
	}
	return true;
}

function IsNumberWithDecimal(InputStr)
{
    var countDot = 0; // to check the existence of more than Decimal points
	for(var i=0; i<InputStr.length; i++)
	{
		if (NumberWithDecimal.indexOf(InputStr.charAt(i)) == -1) 
		{
			return false;
		}
		else
		{
			if(InputStr.charAt(i) == ".")
			{
				countDot = countDot + 1;
			}
			if(countDot > 1) 
			   return false;	
		}
	}
	return true;
}

function IsCharOnly(InputStr)
{
	for(var i=0; i<InputStr.length; i++)
	{
		if (CharOnly.indexOf(InputStr.charAt(i)) == -1) 
		{
			return false;
		}
	}
	return true;
}

function IsCharWithSpace(InputStr)
{
   for(var i=0; i<InputStr.length; i++)
   {
     if(CharWithSpace.indexOf(InputStr.charAt(i)) == -1)
     {
		return false;
     }	
   }
   return true;
}

function IsCharNumBoth(InputStr)
{
   for(var i=0; i<InputStr.length; i++)
   {
     if(CharNumBoth.indexOf(InputStr.charAt(i)) == -1)
     {
       return false;
     }    
   }
   return true;
}

function IsCharNumBothWithSpace(InputStr)
{
   for(var i=0; i<InputStr.length; i++)
   {
     if(CharNumBothWithSpace.indexOf(InputStr.charAt(i)) == -1)
     {
       return false;
     }     
   }
   return true;
}

function IsAlphaNumericAllowed(InputStr)
{
	for(var i=0; i<InputStr.length; i++)
	{
		if (AlphaNumericAllowed.indexOf(InputStr.charAt(i)) == -1) 
		{
			return false;
		}
	}
	return true;
}

function IsSpecialChar(InputStr)
{
   for(var i=0; i<InputStr.length; i++)
   {
     if(SpecialChar.indexOf(InputStr.charAt(i)) > -1)
     {
       return true;
     }
   }
   return false;
}

function IsLeftBlank(ctl)
{
	var InputStr = ctl.value;
	var tstring = "";
	InputStr = '' + InputStr;
	splitstring = InputStr.split(" ");
	for(i = 0; i < splitstring.length; i++)
	tstring += splitstring[i];
	if(tstring.length == 0)
	{
	   ctl.value = '';	   
	   return true;
	}
	else 
	{
	   return false;
	}
}

function IsValidEmailId(InputStr)
{
   var regexp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
   if(!regexp.test(InputStr))
   {
		return false;
   }
   return true;
}

function IsValidFaxNumber(InputStr)
{
	for(var i=0; i<InputStr.length; i++)
	{
		if (FaxAllowedChar.indexOf(InputStr.charAt(i)) == -1) 
		{
			return false;
		}
	}
	return true;
}

function IsValidateUrl(InputStr)
{ 						
    var tomatch= /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/
     if (tomatch.test(InputStr))
     {
       //alert("URL OK.");
         return true;
     }
     else
     {
       //alert("URL invalid. Try again.");
         return false; 
     }
}
 
function IsLeftBlank(ctl)
{
	var InputStr = ctl.value;
	var tstring = "";
	InputStr = '' + InputStr;
	splitstring = InputStr.split(" ");
	for(i = 0; i < splitstring.length; i++)
	tstring += splitstring[i];
	if(tstring.length == 0)
	{
	   ctl.value = '';	   
	   return true;
	}
	else 
	{
	   return false;
	}
}




function Trim(TRIM_VALUE)
{
	if(TRIM_VALUE.length < 1)
	{
		return"";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE=="")
	{
		return "";
	}
	else
	{
		return TRIM_VALUE;
	}
} //End	Function

function RTrim(VALUE)
{
	var	w_space	= String.fromCharCode(32);
	var	v_length = VALUE.length;
	var	strTemp	= "";
	if(v_length	< 0)
	{
		return"";
	}
	var	iTemp =	v_length -1;

	while(iTemp	> -1)
	{
		if(VALUE.charAt(iTemp) == w_space)
		{
		}
		else
		{
			strTemp	= VALUE.substring(0,iTemp +1);
			break;
		}
		iTemp =	iTemp-1;
	} //End	While
	return strTemp;
} //End	Function

function LTrim(VALUE)
{
	var	w_space	= String.fromCharCode(32);
	if(v_length	< 1)
	{
		return"";
	}
	var	v_length = VALUE.length;
	var	strTemp	= "";

	var	iTemp =	0;

	while(iTemp	< v_length)
	{
		if(VALUE.charAt(iTemp) == w_space)
		{
		}
		else
		{
			strTemp	= VALUE.substring(iTemp,v_length);
			break;
		}
		iTemp =	iTemp +	1;
	} //End	While
	return strTemp;
} //End	Function

function leftctlValidation() // For Left Control--
{
var txtemail=document.getElementById('ctl00_LeftCtll1_txtNewsLetter1');
var news =txtemail.id; 
        var regexpr = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
    if(Trim(txtemail.value)== "")
    {
    alert('Please Enter your email Id');
    txtemail.value = "";
    txtemail.focus();
    return false;
    }
        else if(!regexpr.test(txtemail.value))
        {
        alert('Please enter valid email Id');
        txtemail.value ="";
        txtemail.focus();
        return false;   
        }
        else
        {
        window.location.href='NewsLetterConfirmation.aspx?emaiID='+txtemail.value;
        }
}//End	Function

function CheckBlank() // for Header Control
{	
	var search=document.getElementById("ctl00_NewUserHeader1_txtSearch");
	if(search!=null)
	{
		if(Trim(search.value)=="")
		{
			alert("Please enter search text.");
			search.focus();
			return false;
		}
	}
}//End	Function
function OnEnter()
{
	if (event.keyCode ==13)
	{	
		var search=document.getElementById("ctl00_NewUserHeader1_txtSearch");		
		if(search!=null)
		{
			if(Trim(search.value)=="")
			{
				alert("Please enter search text.");
				search.focus();
				return false;
			}
			else
				return true;
		}			
	}
	else
	    return true;
}

function ValidatenewsEmail()
{   
    var tmp_validEmail=document.getElementById("ctl00_tmp_EmailID");    
    var regexp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;     
    
    if(document.getElementById("ctl00_tmp_EmailID").value == "")
    {
        alert('Please Enter your email Id');
        tmp_validEmail.value = "";
        tmp_validEmail.focus();
        return false;
    }
    else if(!regexp.test(tmp_validEmail.value))
    {
        alert('Please enter valid email Id');
        tmp_validEmail.value ="";
        valtmp_validEmailidEmail.focus();
        return false;   
    }    
}    

function checkSubmit()
{
            var Name=document.getElementById("ctl00_container_txtName");
			var MailingAddress=document.getElementById("ctl00_container_txtMailingAddress");
			var City=document.getElementById("ctl00_container_txtCity");
			var State=document.getElementById("ctl00_container_txtState");
			var ZipCode=document.getElementById ("ctl00_container_txtZip");
			var Country=document.getElementById("ctl00_container_ddlCountry");
			var Phone=document.getElementById("ctl00_container_txtPhone");
			var Mobile=document.getElementById("ctl00_container_txtMobile");
			var Email=document.getElementById("ctl00_container_txtEmail");	
			var Comment=document.getElementById("ctl00_container_txtComment");
			
			if(IsLeftBlank(Name))
   		    {
   		       alert("Please Enter Your Name");
   		       Name.focus();
   		       return false;
   		    }
   		    else if(!IsCharWithSpace(Name.value))
   		    {
   		       alert("Name can have only Characters");  
   		       Name.value = '';	    
   		       Name.focus();
   		       return false;
   		    }
   		    
   		    if(!IsLeftBlank(City))
   			{
   				if(!IsCharWithSpace(City.value))
   				{
   				alert("City Name can have only Characters"); 
   				City.value = '';
   				City.focus();
   				return false;
   				}
   			}
   			
   			if(!IsLeftBlank(State))
   			{
   				if(!IsCharWithSpace(State.value))
   				{
   					alert("State Name can have only Characters"); 
   					State.value = '';
   					State.focus();
   					return false;
   				}
   			}
   			
   		    if(!IsLeftBlank(ZipCode))
   			{
   				if(!IsNumberOnly(ZipCode.value))
   				{
   					alert("Zip Code can have only Numbers"); 
   					ZipCode.value = '';
   					ZipCode.focus();
   					return false;
   				}
   			}
   			   			
   			if(Country.selectedIndex == "0")
   			{
   				alert("Please Select Your Country");
   				return false;
   			}
   			
   			if(!IsLeftBlank(Phone))
   			{
   				if(!IsNumberOnly(Phone.value))
   				{
   					alert("Phone No. can have only Numbers");  
   					Phone.value = '';	    
   					Phone.focus();
   					return false;
   			    }
   			}   
   			
   			if(!IsLeftBlank(Mobile))
   			{
   				if(!IsNumberOnly(Mobile.value))
   				{
   					alert("Mobile/Cell No. can have only Numbers");  
   					Mobile.value = '';	    
   					Mobile.focus();
   					return false;
   			    }
   			}   		
   			
   		    if(IsLeftBlank(Email))
   			{
   				alert("Please Enter Your Email Id");
   				Email.focus();
   				return false;
   			}
   			else if(!IsValidEmailId(Email.value))
   			{
   				alert("Email Id is not Valid");  
   				Email.value = '';	    
   				Email.focus();
   				return false;
   			} 
   			// new validations end     
 

}//End	Function

function validateCustomerLogin()
{
       var UserName=document.getElementById("ctl00_container_txtUserName");
	   var Password=document.getElementById("ctl00_container_txtPassword");
	   var regexpr = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
			if(!Trim(UserName.value))
			{
				UserName.value='';
				alert("Please enter your email ID.");
				UserName.focus();
				return false;
			}
			else if(!regexpr.test(UserName.value))
			{
				UserName.value='';
				alert("Please enter valid email ID.");
				UserName.focus();
				return false;
            }
			else if(!Trim(Password.value))
			{
				Password.value='';
				alert("Please enter your password.");
				Password.focus();
				return false;
			}
}//End	Function

function checkOutStep()
{
 var Email=document.getElementById("ctl00_container_txtEmail");
 var Password=document.getElementById("ctl00_container_txtPwd");

       if(IsLeftBlank(Email))
   		    {
   		       alert("Please Enter Your Login Id");
   		       Email.focus();
   		       return false;
   		    }
  		    if(IsLeftBlank(Password))
   		    {
   		       alert("Please Enter Your Password");
   		       Password.focus();
   		       return false;
   		    }   		       		   
			else if(Password.value.length<6)
			{
				alert('Password should be atleast six characters long');
				Password.value = '';
				Password.focus();
				return false;
			}

}

function vaildate_CustomerReg()
{
       	    var FirstName=document.getElementById("ctl00_container_txtFirstName");
			var LastName=document.getElementById("ctl00_container_txtLastName");
			var CompanyName=document.getElementById("ctl00_container_txtCompanyName");			
			var Country=document.getElementById("ctl00_container_ddlCountry");
		   // var Country=document.getElementById("ctl00_container_ddlSCountry");
			var State=document.getElementById("ctl00_container_ddlState");
			
			//var State=document.getElementById("ctl00_container_ddlSState");
			var Suburb=document.getElementById ("ctl00_container_txtSuburb");
			var Street=document.getElementById("ctl00_container_txtStreet");
			var ZipCode=document.getElementById("ctl00_container_txtZipCode");
			var ContactPhoneNumber=document.getElementById("ctl00_container_txtContactPhone");
			var Fax=document.getElementById("ctl00_container_txtFax");
			var Email=document.getElementById("ctl00_container_txtEmail");
			var WebSite=document.getElementById("ctl00_container_txtWebsite");
			var Password=document.getElementById("ctl00_container_txtPassword");
			//var OtherState=document.getElementById("ctl00_container_txtOtherState");
			
   		   // new validations start
   		    if(IsLeftBlank(Street))
   		    {
   		       alert("Please Enter Street");
   		       Street.focus();
   		       return false;
   		    }
   		    else if(!IsAlphaNumericAllowed(Street.value))
   		    {
   		       alert("Street field has some Invalid Characters");
   		       Street.value = '';   		    
   		       Street.focus();
   		       return false;
   		    }
   		    
   		    if(IsLeftBlank(Suburb))
   		    {
   		       alert("Please Enter Town/Suburb");
   		       Suburb.focus();
   		       return false;
   		    }
   		    else if(!IsCharWithSpace(Suburb.value))
   		    {
   		       alert("Town/Suburb field can have only Characters"); 
   		       Suburb.value = '';
   		       Suburb.focus();
   		       return false;
   		    }
   		 	
   		 	if(Country.value == "-Select Country-")
			{
				
				alert("Please select your country");
				Country.focus();
				return false;
			} 
			
			if(State.value == "")
			{
				
				alert("Please select your State");
				State.focus();
				return false;
			} 
			else if (State.value == "" && OtherState == "")
			{
				alert("Please select state or enter your state.");
				State.focus();
				return false;
			} 
			if(State.value == "" && OtherState != "")
			{
			    if(!IsCharOnly(OtherState))
			    {
					alert("The Other State field can have only Characters");
					OtherState.value = '';
					OtherState.focus();
					return false;
			    }
			}
				
			if(IsLeftBlank(ZipCode))
   		    {
   		       alert("Please Enter ZipCode");
   		       ZipCode.focus();
   		       return false;
   		    }
   		    else if(!IsNumberOnly(ZipCode.value))
   		    {
   		       alert("ZipCode can have only Numbers");  
   		       ZipCode.value = '';	    
   		       ZipCode.focus();
   		       return false;
   		    }
   		    else if(ZipCode.value.length<5)
			{				
				alert("Please enter atleast 5 or 6 digits for ZipCode");
				ZipCode.focus();
				return false;
			}
			
			if(IsLeftBlank(ContactPhoneNumber))
   		    {
   		       alert("Please Enter ContactPhoneNumber");
   		       ContactPhoneNumber.focus();
   		       return false;
   		    }
   		    else if(!IsNumberOnly(ContactPhoneNumber.value))
   		    {
   		       alert("Contact Phone Number can have only Numbers");  
   		       ContactPhoneNumber.value = '';	    
   		       ContactPhoneNumber.focus();
   		       return false;
   		    }
   		    else if(ContactPhoneNumber.value.length<10)
			{				
				alert("Please enter 10 digits phone no.");
				ContactPhoneNumber.focus();
				return false;
			}
   		    
   		    if(!IsLeftBlank(Fax))
   		    {   			  
   		       if(!IsValidFaxNumber(Fax.value))
   		       {
   					alert("Fax field should accept only Numeric");
   					Fax.value = '';
   					Fax.focus();
   					return false;
   		       }
   		    }
   		    
   		    if(!IsLeftBlank(WebSite))
   		    {
   				if(!IsValidateUrl(WebSite.value))
   				{
   					alert("You must enter a Valid Url");  
   					WebSite.value = '';	    
   					WebSite.focus();
   					return false;
   				}
   				else
   				    return true;
   		    }
   		    
   		    if(IsLeftBlank(FirstName))
   		    {
   		       alert("Please Enter Your First Name");
   		       FirstName.focus();
   		       return false;
   		    }
   		    else if(!IsCharWithSpace(FirstName.value))
   		    {
   		       alert("First Name can have only Characters");  
   		       FirstName.value = '';	    
   		       FirstName.focus();
   		       return false;
   		    }
   		    
   		    if(IsLeftBlank(LastName))
   		    {
   		       alert("Please Enter Your Last Name");
   		       LastName.focus();
   		       return false;
   		    }
   		    else if(!IsCharWithSpace(LastName.value))
   		    {
   		       alert("Last Name can have only Characters");  
   		       LastName.value = '';	    
   		       LastName.focus();
   		       return false;
   		    }
   		    
   		    if(!IsLeftBlank(CompanyName))
   		    {
   		       if(IsSpecialChar(CompanyName.value))
   		       {
   					alert("Company Name can not have Special Characters");
   					CompanyName.value = '';
   					CompanyName.focus();
   					return false;
   		       }
   		    }
   		    
   		    if(IsLeftBlank(Email))
   		    {
   		       alert("Please Enter Your Email Id");
   		       Email.focus();
   		       return false;
   		    }
   		    else if(!IsValidEmailId(Email.value))
   		    {
   		       alert("Email Id is not Valid");  
   		       Email.value = '';	    
   		       Email.focus();
   		       return false;
   		    }
   		    
   		    if(IsLeftBlank(Password))
   		    {
   		       alert("Please Enter Your Password");
   		       Password.focus();
   		       return false;
   		    }   		       		   
			else if(Password.value.length<6)
			{
				alert('Password should be atleast six characters long');
				Password.focus();
				return false;
			}
   		   // new validations end   		


}//End Function

function vaildate_EditCustomerReg()
{
       	    var FirstName=document.getElementById("ctl00_container_txtFirstName");
			//var LastName=document.getElementById("ctl00_container_txtLastName");
			var CompanyName=document.getElementById("ctl00_container_txtCompanyName");			
			var Country=document.getElementById("ctl00_container_ddlCountry");
		    var State=document.getElementById("ctl00_container_ddlState");
		    var Suburb=document.getElementById ("ctl00_container_txtSuburb");
			var Street=document.getElementById("ctl00_container_txtStreet");
			var ZipCode=document.getElementById("ctl00_container_txtZipCode");
			var ContactPhoneNumber=document.getElementById("ctl00_container_txtContactPhone");
			var Fax=document.getElementById("ctl00_container_txtFax");
		    var WebSite=document.getElementById("ctl00_container_txtWebsite");
			var OtherState=document.getElementById("ctl00_container_txtOtherState");
			var Mobile =document.getElementById("ctl00_container_txtmobile");
			
   		   // new validations start
   		    if(IsLeftBlank(Street))
   		    {
   		       alert("Please Enter Street");
   		       Street.focus();
   		       return false;
   		    }
   		    else if(!IsAlphaNumericAllowed(Street.value))
   		    {
   		       alert("Street field has some Invalid Characters");
   		       Street.value = '';   		    
   		       Street.focus();
   		       return false;
   		    }
   		    
   		    if(IsLeftBlank(Suburb))
   		    {
   		       alert("Please Enter Town/Suburb");
   		       Suburb.focus();
   		       return false;
   		    }
   		    else if(!IsCharWithSpace(Suburb.value))
   		    {
   		       alert("Town/Suburb field can have only Characters"); 
   		       Suburb.value = '';
   		       Suburb.focus();
   		       return false;
   		    }
   		 	
   		 	if(Country.value == "-Select Country-")
			{
				
				alert("Please select your country");
				Country.focus();
				return false;
			} 
			
			if(State.value == "")
			{
				
				alert("Please select your State");
				State.focus();
				return false;
			} 
			else if (State.value == "" && OtherState == "")
			{
				alert("Please select state or enter your state.");
				State.focus();
				return false;
			} 
			if(State.value == "" && OtherState != "")
			{
			    if(!IsCharOnly(OtherState))
			    {
					alert("The Other State field can have only Characters");
					OtherState.value = '';
					OtherState.focus();
					return false;
			    }
			}
				
			if(IsLeftBlank(ZipCode))
   		    {
   		       alert("Please Enter ZipCode");
   		       ZipCode.focus();
   		       return false;
   		    }
   		    else if(!IsNumberOnly(ZipCode.value))
   		    {
   		       alert("ZipCode can have only Numbers");  
   		       ZipCode.value = '';	    
   		       ZipCode.focus();
   		       return false;
   		    }
   		    else if(ZipCode.value.length<5)
			{				
				alert("Please enter atleast 5 or 6 digits for ZipCode");
				ZipCode.focus();
				return false;
			}
			
			if(IsLeftBlank(ContactPhoneNumber))
   		    {
   		       alert("Please Enter ContactPhoneNumber");
   		       ContactPhoneNumber.focus();
   		       return false;
   		    }
   		    else if(!IsNumberOnly(ContactPhoneNumber.value))
   		    {
   		       alert("Contact Phone Number can have only Numbers");  
   		       ContactPhoneNumber.value = '';	    
   		       ContactPhoneNumber.focus();
   		       return false;
   		    }
   		    if(!IsLeftBlank(Mobile))
   		    {
   		         if(!IsNumberOnly(Mobile.value))
   		        {
   		          alert("Mobile Number can have only Numbers");  
   		          Mobile.value = '';	    
   		          Mobile.focus();
   		          return false;
   		         }
   		    }
   		    if(!IsLeftBlank(Fax))
   		    {   			  
   		       if(!IsValidFaxNumber(Fax.value))
   		       {
   					alert("Fax Number has some Invalid Characters");
   					Fax.value = '';
   					Fax.focus();
   					return false;
   		       }
   		    }
   		    
   		    if(!IsLeftBlank(WebSite))
   		    {
   				if(!IsValidateUrl(WebSite.value))
   				{
   					alert("You must enter a Valid Url");  
   					WebSite.value = '';	    
   					WebSite.focus();
   					return false;
   				}
   				else
   				    return true;
   		    }
   		    
   		    if(IsLeftBlank(FirstName))
   		    {
   		       alert("Please Enter Your First Name");
   		       FirstName.focus();
   		       return false;
   		    }
   		    else if(!IsCharWithSpace(FirstName.value))
   		    {
   		       alert("First Name can have only Characters");  
   		       FirstName.value = '';	    
   		       FirstName.focus();
   		       return false;
   		    }
   		    
//   		    if(IsLeftBlank(LastName))
//   		    {
//   		       alert("Please Enter Your Last Name");
//   		       LastName.focus();
//   		       return false;
//   		    }
//   		    else if(!IsCharWithSpace(LastName.value))
//   		    {
//   		       alert("Last Name can have only Characters");  
//   		       LastName.value = '';	    
//   		       LastName.focus();
//   		       return false;
//   		    }
   		    
   		    if(!IsLeftBlank(CompanyName))
   		    {
   		       if(IsSpecialChar(CompanyName.value))
   		       {
   					alert("Company Name can not have Special Characters");
   					CompanyName.value = '';
   					CompanyName.focus();
   					return false;
   		       }
   		    }

}//End Function

function CheckSubmit_ForgetPassword()
{
      var Email=document.getElementById("ctl00_container_txtEmail");
      
        if(!Trim(Email.value))
			{
				alert('Please enter your email ID');
				Email.focus();
				return false;
			}
			if (!IsValidEmailId(Email.value))
			{
				alert('Please enter valid email');
				Email.value='';
				Email.focus();
				return false;
			}			
 
}//End Function
function InitializeRequest()
{
	try
	{
		httprequest = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			httprequest = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			httprequest = null;
		}
	}
	if(!httprequest && typeof XMLHttpRequest != "undefined") 
	{
		httprequest = new XMLHttpRequest();
	}
}//end Function

function sendRequest()//Used at customer Registration and checkout billing Page
{
    var countryID=document.getElementById('ctl00_container_ddlCountry').value;  
   // var countryID=document.getElementById('ctl00_container_ddlSCountry').value;  
    if(countryID=="-Select Country-")
    {
    alert('Please select country name');
    return false;
    }
    
   
   
        InitializeRequest();
         var Url = "AjaxResponse.aspx?ctid=" + encodeURIComponent(countryID);         
         if(httprequest)
	        {
		    httprequest.onreadystatechange = ProcessResponse;
		    httprequest.open("GET", Url,  true);
		    httprequest.send();	
		    }	
	        	
   
}//end function

function ProcessResponse()
{
	if(httprequest.readyState == 4)
	{
		if(httprequest.status == 200)
		{			    		  		    			
			//alert(httprequest.responseText);
			FillDDL(httprequest.responseText);				
		}
		else
		{
			// do nothing
			//alert("There is a problem in getting response");			
		}
	}
}//end function

function FillDDL(response)
{		
	var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	xmlDoc.async = "false";
	xmlDoc.loadXML(response);	
	rState = xmlDoc.getElementsByTagName("AllStates");
	cState = xmlDoc.getElementsByTagName("tblCountry_States");	
	var ddlState=document.getElementById('ctl00_container_ddlState');
	if(cState.length > 0)
	{		
		var len = cState.length + 1;		
		var i=0;
										
		ddlState.options.length = len;
		ddlState.options[0].text = "-Select State-";
		ddlState.options[0].value = "";
		for(i=1; i<len; i++)
		{
			ddlState.options[i].value = cState[i-1].getAttribute("stateid");
			ddlState.options[i].text = cState[i-1].getAttribute("statename");
		}
	}		
	else
	{				
		ddlState.options.length = 1;
		ddlState.options[0].value = "";
		ddlState.options[0].text = "(No states listed)";
	}
}
//end function

function sendRequestcheckOut()//Used at checkout shipping Page
{
     var countryID=document.getElementById('ctl00_container_ddlSCountry').value;  
   // var countryID=document.getElementById('ctl00_container_ddlSCountry').value;  
    if(countryID=="-Select Country-")
    {
    alert('Please select country name');
    return false;
    }  
        InitializeRequest();
         var Url = "AjaxResponse.aspx?ctid=" + encodeURIComponent(countryID);         
         if(httprequest)
	        {
		    httprequest.onreadystatechange = ResponseProcess;
		    httprequest.open("GET", Url,  true);
		    httprequest.send();	
		    }	
	        	
   
}//end function

function ResponseProcess()
{
	if(httprequest.readyState == 4)
	{
		if(httprequest.status == 200)
		{			    		  		    			
			//alert(httprequest.responseText);
			FillDDLbilling(httprequest.responseText);				
		}
		else
		{
			// do nothing
			//alert("There is a problem in getting response");			
		}
	}
}//end function

function FillDDLbilling(response)
{		
	var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	xmlDoc.async = "false";
	xmlDoc.loadXML(response);	
	rState = xmlDoc.getElementsByTagName("AllStates");
	cState = xmlDoc.getElementsByTagName("tblCountry_States");	
	var ddlState=document.getElementById('ctl00_container_ddlSState');
	if(cState.length > 0)
	{		
		var len = cState.length + 1;		
		var i=0;
										
		ddlState.options.length = len;
		ddlState.options[0].text = "-Select State-";
		ddlState.options[0].value = "";
		for(i=1; i<len; i++)
		{
			ddlState.options[i].value = cState[i-1].getAttribute("stateid");
			ddlState.options[i].text = cState[i-1].getAttribute("statename");
		}
	}		
	else
	{				
		ddlState.options.length = 1;
		ddlState.options[0].value = "";
		ddlState.options[0].text = "(No states listed)";
	}
}//end funcion

function datatransfer()
{

   if ( document.getElementById('ctl00_container_chkShipping').checked == true )
   {
    document.getElementById('ctl00_container_txtSFname').value=  document.getElementById('ctl00_container_txtFname').value;
    document.getElementById('ctl00_container_txtSLname').value=  document.getElementById('ctl00_container_txtLname').value;
    document.getElementById('ctl00_container_txtScompany').value=  document.getElementById('ctl00_container_txtcompany').value;
    document.getElementById('ctl00_container_txtSStreet').value=  document.getElementById('ctl00_container_txtStreet').value; 
    document.getElementById('ctl00_container_txtSSuburb').value=  document.getElementById('ctl00_container_txtsuburb').value; 
    document.getElementById('ctl00_container_txtStatebilling').value= document.getElementById('ctl00_container_txtOtherState').value; 
    document.getElementById('ctl00_container_ddlSCountry').value=  document.getElementById('ctl00_container_ddlCountry').value; 
    document.getElementById('ctl00_container_txtSZipcode').value=  document.getElementById('ctl00_container_txtPostCode').value; 
    document.getElementById('ctl00_container_txtSPhone').value=  document.getElementById('ctl00_container_txtContactPhone').value; 
    document.getElementById('ctl00_container_TextBoxf1').value=  document.getElementById('ctl00_container_txtEmailId').value; 
    document.getElementById('ctl00_container_TextBoxf2').value=  document.getElementById('ctl00_container_txtFax').value; 
    sendRequestcheckOut();
    //document.getElementById('ctl00_container_ddlSState').options[0].text =document.getElementById('ctl00_container_ddlState').value; 
    document.getElementById('ctl00_container_ddlSState').value=  document.getElementById('ctl00_container_ddlState').value; 
   // alert(document.getElementById('ctl00_container_ddlState').value);
    //alert(document.getElementById('ctl00_container_ddlSState').value);

   // return false;
}
else
{
document.getElementById('ctl00_container_txtSFname').value="";
document.getElementById('ctl00_container_txtSLname').value="";
document.getElementById('ctl00_container_txtScompany').value="";
document.getElementById('ctl00_container_txtSStreet').value=""; 
document.getElementById('ctl00_container_txtSSuburb').value=""; 
document.getElementById('ctl00_container_ddlSCountry').value=""; 
document.getElementById('ctl00_container_ddlSState').value=""; 
document.getElementById('ctl00_container_txtSZipcode').value=""; 
document.getElementById('ctl00_container_txtSPhone').value=""; 
document.getElementById('ctl00_container_TextBoxf1').value="";
document.getElementById('ctl00_container_TextBoxf2').value="";
document.getElementById('ctl00_container_txtStatebilling').value="";
//return false;


}
}//end function

function CheckUniqueVeriSign(btnID)//checkout1 Page
{			
  for(var i=0;i< document.forms[0].elements.length;i++)
  {							
   	var x=document.forms[0].elements.item(i);
	if(x!=null && x.name !=null && x.id !=btnID && x.id.indexOf('ctl00_container_dtlCards')!=-1 && x.name.indexOf("rdoImg")!=-1)
    {
	 x.checked=false;						
	}									
  }
  return false;
}//end function

function CheckUniqueAuthorize(btnID)//Checkout Authorize Page
{			
  for(var i=0;i< document.forms[0].elements.length;i++)
  {							
   	var x=document.forms[0].elements.item(i);
	if(x!=null && x.name !=null && x.id !=btnID && x.id.indexOf('ctl00_container_dtlCard')!=-1 && x.name.indexOf("rdoImg")!=-1)
    {
	 x.checked=false;						
	}									
  }
  return false;
}//end function

function validateUpdatePassword()
		{	
			var	oldpwd=document.getElementById("ctl00_container_txtoldPassword");
			var	newpwd=document.getElementById("ctl00_container_txtnewPassword");
			var	Renewpwd=document.getElementById("ctl00_container_txtrenewPassword");
			if(!Trim(oldpwd.value))
			{
				alert("Please enter old Password.");
				oldpwd.focus();
				return false;
			}
			else if(!Trim(newpwd.value))
			{
				newpwd.value='';
				alert("Please enter new password.");
				newpwd.focus();
				return false;
			} 
			else if(newpwd.value.length<6)
			{
				alert("Password should be atleast six characters long.");
				newpwd.focus();
				return false;
			}	
			else if(!Trim(Renewpwd.value))
			{
				Renewpwd.value='';
				alert("Please re enter new password.");
				Renewpwd.focus();
				return false;
			} 
			else if(Renewpwd.value.length<6)
			{
				alert("Password should be atleast six characters long.");
				Renewpwd.focus();
				return false;
			}	
			else if(Renewpwd.value!= newpwd.value)
			{
				newpwd.value='';
				Renewpwd.value='';
				alert("Passwords do not match.");
				newpwd.focus();
				return false;
			}	
		}//end function
		
		
		 var submitcount=0;
function CheckOut_VeriSign()
     	{
		
		 var Total = document.getElementById('ctl00_container_lblTotal').innerText;		 
		 if(Total > 0)
     	 {     	
     	  var NameOnCard = document.getElementById('ctl00_container_txtNameOnCard');
		  var CardNumber = document.getElementById('ctl00_container_txtCardNumber');
		  var txtCCV = document.getElementById('ctl00_container_txtCCV');		  
		  if(IsLeftBlank(NameOnCard))
   		    {
   		       alert("Please enter the name that appears on your credit card.");
   		       NameOnCard.focus();
   		       return false;
   		    }
   		  if(IsLeftBlank(CardNumber))
   		    {
   		       alert("Please enter your credit card number.");
   		       CardNumber.focus();
   		       return false;
   		    } 
   		   if(ccCardNumber(CardNumber.value) == false)
   		   {
   		   alert("asdas");
   		     alert("Your credit card number appears to be invalid. Please check your card\nnumber making sure that it contains no spaces or other punctuation.");
   		     CardNumber.focus();
   		     return false;
   		   }
   		   if(IsLeftBlank(txtCCV))
   		    {
   		       alert("Please enter your credit cards CCV/AMEX number.");
   		       txtCCV.focus();
   		       return false;
   		    }   
   		    if(txtCCV.value.length > 3)
   		    {
   		     alert("Your Credit Card CCV/AMEX number appears to be invalid.");
   		     txtCCV.focus();
   		     return false;
   		    }
   		    if(txtCCV.value.length > 4)
   		    {
   		     alert("Your Credit Card CCV/AMEX number appears to be invalid.");
   		     txtCCV.focus();
   		     return false;
   		    }

		 }
		 var ChkAuthorisation = document.getElementById('ctl00_container_chkAuthorisation');
		 if(ChkAuthorisation.checked == false)
		 {
		  alert("You must agree to make this payment by checking the Authorisation checkbox.");
		  ChkAuthorisation.focus();
		  return false;
		 }
		 if (submitcount == 0) 
					{
						submitcount++;
						return true;
					} 
					else 
					{
						alert("Payment is already in progress.\n\nClick OK now and please wait for a response.");
						return false;
					}	
		}
		
		function ccCardNumber(cardNumber)
		{
		  var cardTotal=0;
		  var dnum=0;
		  var test=0;
		  if (cardNumber.length < 15) 
		  { 
			return (false); 
		  }
		  else
		  {
		   for(i = cardNumber.length; i >= 1; i--)
		   {
		    test = test + 1;
		    num = cardNumber.charAt(i-1);
		    if ((test % 2) != 0) 
			cardTotal=cardTotal+parseInt(num)
			else 
			{
			 dnum=parseInt(num)*2;
			 if (dnum >= 10) cardTotal=cardTotal+1+dnum-10
			 else cardTotal=cardTotal+dnum;
			}
		   }
		   if ((cardTotal % 10) != 0)
						{ 						
							return (false); 
						}
						else
						{ 
							return(true); 
						}
		  } 
		}//end function
		
		var submitcount = 0 ;
		function checkOutPaypal()
		{
		 var chkAutorisation = document.getElementById('ctl00_container_chkAuthorisation');
		 
		 if(chkAutorisation.checked == false)
		 {
		  alert("You must agree to make this payment by checking the Authorisation checkbox.");
		  chkAutorisation.focus();
		  return false;
		 }
		 
		 if(submitcount == 0)
		 {
		  submitcount++;
		  return true;
		 }
		 else   
		 {
		  alert("Payment is already in progress.\n\nClick OK now and please wait for a response.");
		  return false;
		 }		 
		 
		}// end function
function OpenPopup()
{
    var Card_Type=document.getElementById('ctl00_container_DropDownList1');
    if(Card_Type.options[Card_Type.options.selectedIndex].value=="Select")
    {
        alert("Please select credit card type.");
        Card_Type.focus();
        return false;
    } 
    else
    {
        window.open('Popupcards.aspx?card='+Card_Type.options[Card_Type.options.selectedIndex].value,'OrderStatus','height=303,width=450,top=250,left=400');
        return false;
    }
}
function checkOutAuthrize()
{
    var Total =document.getElementById('ctl00_container_HiddenField1');
    // var Total=document.getElementById('<%=lblamountpaid.ClientID%>');
    if( Total.value>0)
    { 
        var Card_Type=document.getElementById('ctl00_container_DropDownList1');
        var NameOnCard = document.getElementById('ctl00_container_txtNameOnCard');
        var CardNumber = document.getElementById('ctl00_container_txtCardNumber');             
        var txtCCV = document.getElementById('ctl00_container_txtCCV');		
        var select_month=document.getElementById('ctl00_container_ddlExpMonth');
        var select_year=document.getElementById('ctl00_container_ddlExpYear');
        var select_mth=select_month.options[select_month.options.selectedIndex].value;              
        var select_yr=select_year.options[select_year.options.selectedIndex].value;
        var dt_current=new Date();        
        var current_month=dt_current.getMonth()+1;
        var CardType=Card_Type.options[Card_Type.options.selectedIndex].text;
      
        var current_year=dt_current.getFullYear(); 
        
        if(Card_Type.options[Card_Type.options.selectedIndex].value=="Select")
        {
            alert("Please select credit card type.");
            Card_Type.focus();
            return false;
        } 

        if(IsLeftBlank(NameOnCard))
        {
            alert("Please enter the name of the credit card.");
            NameOnCard.focus();
            return false;
        }
        if(IsLeftBlank(CardNumber))
        {
            alert("Please enter your credit card number.");
            CardNumber.focus();
            return false;
        } 
       if (checkCreditCard (CardNumber.value, CardType))
        {  }
        else 
        {
            if(ccErrorNo=="5")
            {
                CardNumber.focus();
                return false;
            }
            else
            {
                alert (ccErrors[ccErrorNo]);
                CardNumber.focus();
                return false;
            }
        }       

        if(select_yr<current_year)
        { 
         alert("Please re-enter your expiration date as the one you entered occurs in the past.");
            select_yr.focus();
            return false;   		    
       
        }
        if(select_yr==current_year)
         {
          if(select_mth<current_month)
           {
            alert("Please re-enter your expiration date as the one you entered occurs in the past.");
            select_month.focus();
            return false;   		    
           }
         }       
        if(IsLeftBlank(txtCCV))
        {
            alert("Please enter your credit cards CCV/AMEX number.");
            txtCCV.focus();
            return false;
        }   
        if(txtCCV.value.length <  3)
        {
            alert("Your Credit Card CCV/AMEX number appears to be invalid.");
            txtCCV.focus();
            return false;
        }

        if (!IsNumberOnly(txtCCV))
        {
            alert("Credit Card CCV/AMEX  should be a number");
            txtCCV.focus();
            return false;
        }
         
        if(txtCCV.value.length > 4)
        {
            alert("Your Credit Card CCV/AMEX number appears to be invalid.");
            txtCCV.focus();
            return false;
        }
    }
    var ChkAuthorisation = document.getElementById('ctl00_container_chkAuthorisation');
    if(ChkAuthorisation.checked == false)
    {
        alert("You must agree to make this payment by checking the Authorisation checkbox.");
        ChkAuthorisation.focus();
        return false;
    }
    if (submitcount == 0) 
    {
        submitcount++;
        return true;
    } 
    else 
    {
        alert("Payment is already in progress.\n\nClick OK now and please wait for a response.");
        return false;
    }	
}//end function

function ProductSearch()
{
 var txtCategory=document.getElementById("ctl00_container_txtProductName");
 var ddlCategory = document.getElementById("ctl00_container_ddlCategory");
 
  if(ddlCategory.selectedIndex == "0")
   			{
   				alert("Please Select Your Category");
   				ddlCategory.focus();
   				return false;
   			}
  if(IsLeftBlank(txtCategory))
   		    {   		    
   		       alert("Please enter Product Name.");   		      
   		       txtCategory.focus();   		       
   		       return false;
   		    }    		   

}//end function
function chkSpaUser()
{
   var FirstName=document.getElementById("ctl00_container_txtFirstName");
   var lastname=document.getElementById("ctl00_container_txtLastName");
   var Company=document.getElementById("ctl00_container_txtCompanyName");
   var email=document.getElementById("ctl00_container_txtEmail");
   var phone=document.getElementById("ctl00_container_txtContactPhone");
   var zip=document.getElementById("ctl00_container_txtZipCode");
   var address=document.getElementById("ctl00_container_txtStreet");
   var city=document.getElementById("ctl00_container_txtSuburb");
   var state=document.getElementById("ctl00_container_ddlState");
   var otherstate=document.getElementById("ctl00_container_txtotherstate");
   var country=document.getElementById("ctl00_container_ddlCountry");
   var password=document.getElementById("ctl00_container_txtpassword");
   var mobile=document.getElementById("ctl00_container_txtmobile");
   
    if(IsLeftBlank(email))
   {
   alert("Enter your Email");
   email.focus();
   return false;
   }
   else if(!IsValidEmailId(email.value))
   {
   	  alert("Email is not Valid");  
   	  email.value = '';	    
      email.focus();
      return false;
    }
    
   if(IsLeftBlank(FirstName))
   {
   alert("Enter your First Name");
   FirstName.focus();
   return false;
   }
   else if(!FirstName.value.match(characteronly))
   {
   alert("First Name have only Characters");
   FirstName.value='';
   FirstName.focus();
   return false;
   }
   
   
    if(IsLeftBlank(lastname))
   {
   alert("Enter your Last Name");
   lastname.focus();
   return false;
   }
   
   
    if(IsLeftBlank(Company))
   {
   alert("Enter Company Name");
   Company.focus();
   return false;
   }
   
    if(IsLeftBlank(address))
    {
    alert("Enter Your Address");
    address.focus();
    return false;
    }
    
    if(IsLeftBlank(city))
    {
    alert("Enter Your City");
    city.focus();
    return false;
    }
    
      if(country.selectedIndex == "0" )
  {
  alert("Please Select Country");
  country.focus();
  return false;
  }
  
  if(IsLeftBlank(otherstate))
    {
    if(state.selectedIndex == "0" )
    {
    alert("Please Select State");
    state.focus();
    return false;
    }
    }
    
     if(IsLeftBlank(zip))
   {
   alert("Please Enter Zip/Postal Code");
   zip.focus();
   return false;
   }
   else if(!zip.value.match(num_char))
   {
   alert("Zip/Postal Code is not valid");
   zip.value='';
   zip.focus();
   return false;
   }
    if(IsLeftBlank(phone))
    {
    alert("Enter Your Phone No");
    phone.focus();
    return false;
    }
   else if(!phone.value.match(numonly))
   {
   alert("Phone Should be in Numerical");
   phone.value='';
   phone.focus();
   return false;
   }
   
    if(!IsLeftBlank(mobile))
    {
   
    if(!mobile.value.match(numonly))
   {
   alert("Phone Should be in Numerical");
   mobile.value='';
   mobile.focus();
   return false;
   }
   }
   
     if(IsLeftBlank(password))
  {
  alert("Please Enter Your Password");
  password.focus();
  return false;
  }
  else if(password.value.length<6)
  {
  alert("Password Should be 6 character long");
  password.value='';
  password.focus();
  return false;
  }
   
}
///////check User Shipping and Billing Address///////////
function chkUSer()
{
   
   var FirstName=document.getElementById("ctl00_container_txtFname");
   var lastname=document.getElementById("ctl00_container_txtLname");
   var email=document.getElementById("ctl00_container_txtEmailId");
   var phone=document.getElementById("ctl00_container_txtContactPhone");
   var zip=document.getElementById("ctl00_container_txtPostCode");
   var address=document.getElementById("ctl00_container_txtStreet");
   var city=document.getElementById("ctl00_container_txtsuburb");
   var state=document.getElementById("ctl00_container_ddlState");
   var otherstate=document.getElementById("ctl00_container_txtOtherState");
   var country=document.getElementById("ctl00_container_ddlCountry");
   var password=document.getElementById("ctl00_container_txtPwdId");
   
   var SFirstName=document.getElementById("ctl00_container_txtSFname");
   var Slastname=document.getElementById("ctl00_container_txtSLname");
   var Semail=document.getElementById("ctl00_container_TextBoxf1");
   var Sphone=document.getElementById("ctl00_container_txtSPhone");
   var Szip=document.getElementById("ctl00_container_txtSZipcode");
   var Saddress=document.getElementById("ctl00_container_txtSStreet");
   var Scity=document.getElementById("ctl00_container_txtSSuburb");
   var Sstate=document.getElementById("ctl00_container_ddlSState");
   var Sotherstate=document.getElementById("ctl00_container_txtOtherSState");
   var Scountry=document.getElementById("ctl00_container_ddlSCountry");
   var chkautorefill=document.getElementById("ctl00_container_chkautorefill");
   var chkdays=document.getElementById("ctl00_container_txtdays");
 
 
 if(chkautorefill.checked==true)
 {
 if(!chkdays.value.match(number))
 {
 alert("Enter Correct no of Days");
 chkdays.focus();
 return false
 }
 else if(chkdays.value<=0)
 {
 alert("Days Should be greater then zero");
 chkdays.focus();
 return false;
 }
 }
 else if(chkdays.value.length>0)
 {
 alert("First Check the Check box");
 chkautorefill.focus();
 return false;
 }
   if(IsLeftBlank(FirstName))
   {
   alert("Enter your First Name");
   FirstName.focus();
   return false;
   }
   else if(!FirstName.value.match(characteronly))
   {
   alert("First Name have only Characters");
   FirstName.value='';
   FirstName.focus();
   return false;
   }
   
   if(IsLeftBlank(lastname))
   {
   alert("Enter your Last Name");
   lastname.focus();
   return false;
   }
   
   if(IsLeftBlank(email))
   {
   alert("Enter your Email");
   email.focus();
   return false;
   }
   else if(!IsValidEmailId(email.value))
   {
   	  alert("Email is not Valid");  
   	  email.value = '';	    
      email.focus();
      return false;
    }
    
    if(IsLeftBlank(phone))
    {
    alert("Enter Your Phone No");
    phone.focus();
    return false;
    }
   else if(!phone.value.match(number))
   {
   alert("Phone Should be in Numerical");
   phone.value='';
   phone.focus();
   return false;
   }
   if(phone.value.length<10)
   {
   alert("Phone Number Should be 10 digit long");
   phone.value='';
   phone.focus();
   return false;
   }
   
   if(IsLeftBlank(address))
    {
    alert("Enter Your Address");
    address.focus();
    return false;
    }
    
    if(IsLeftBlank(city))
    {
    alert("Enter Your City");
    city.focus();
    return false;
    }
    
      if(country.selectedIndex == "0" )
  {
  alert("Please Select Country");
  country.focus();
  return false;
  }
  
    
    if(IsLeftBlank(otherstate))
    {
    if(state.selectedIndex == "0" )
    {
    alert("Please Select State");
    state.focus();
    return false;
    }
    }
   
   if(IsLeftBlank(zip))
   {
   alert("Please Enter Zip/Postal Code");
   zip.focus();
   return false;
   }
   else if(!zip.value.match(number))
   {
   alert("Zip/Postal Code is not valid");
   zip.value='';
   zip.focus();
   return false;
   }
   

  if(IsLeftBlank(password))
  {
  alert("Please Enter Your Password");
  password.focus();
  return false;
  }
  else if(password.value.length<6)
  {
  alert("Password Should must be 6 character long");
  password.value='';
  password.focus();
  return false;
  }
   
   
   if(IsLeftBlank(SFirstName))
   {
   alert("Enter your First Name");
   SFirstName.focus();
   return false;
   }
   else if(!SFirstName.value.match(characteronly))
   {
   alert("First Name have only Characters");
   FirstName.value='';
   FirstName.focus();
   return false;
   }
   
   if(IsLeftBlank(Slastname))
   {
   alert("Enter your Last Name");
   Slastname.focus();
   return false;
   }
   
   if(IsLeftBlank(Semail))
   {
   alert("Enter your Email");
   Semail.focus();
   return false;
   }
   else if(!IsValidEmailId(Semail.value))
   {
   	  alert("Email is not Valid");  
   	  Semail.value = '';	    
      Semail.focus();
      return false;
    }
    
    if(IsLeftBlank(Sphone))
    {
    alert("Enter Your Phone No");
    Sphone.focus();
    return false;
    }
   else if(!Sphone.value.match(numonly))
   {
   alert("Phone Should be in Numerical");
   Sphone.value='';
   Sphone.focus();
   return false;
   }
   
   if(IsLeftBlank(Saddress))
    {
    alert("Enter Your Address");
    Saddress.focus();
    return false;
    }
    
    if(IsLeftBlank(Scity))
    {
    alert("Enter Your City");
    Scity.focus();
    return false;
    }
    
    if(IsLeftBlank(Sotherstate))
    {
    if(Sstate.selectedIndex == "0" )
    {
    alert("Please Select State");
    Sstate.focus();
    return false;
    }
    }
   
   if(IsLeftBlank(Szip))
   {
   alert("Please Enter Zip/Postal Code");
   Szip.focus();
   return false;
   }
   else if(!Szip.value.match(num_char))
   {
   alert("Zip/Postal Code is not valid");
   Szip.value='';
   Szip.focus();
   return false;
   }
   
  if(Scountry.selectedIndex == "0" )
  {
  alert("Please Select Country");
  Scountry.focus();
  return false;
  }
  
}
/////////////////////////END////////////////////


function UpdateViewCart(rowindex)
{ 
   
   
  var txtQuantity = document.getElementById("ctl00_container_dtlCart_ctl0"+rowindex+"_txtQuantity");
      
   if(!IsNumberOnly(txtQuantity.value))
   		    {
   		       alert("Please enter numeric value only");  
   		       txtQuantity.value = '';	    
   		       txtQuantity.focus();
   		       return false;
   		    }	    
   		 

			    
if(txtQuantity.value < 1)
{
 alert("Please enter the quantity greater then Zero ");
txtQuantity.value = '';
txtQuantity.focus();
 return false;
}
return true;
 }//end function
 

function validateAccount()
{
 var txtSaveNote = document.getElementById("ctl00_container_txtSaveNote");
 if(txtSaveNote !=null)
 {
  if(!Trim(txtSaveNote.value))
				{
					alert("Please enter note.");					
					txtSaveNote.value="";
					txtSaveNote.focus();
					return false;
				}
 }
}

 function validateGiftVoucher()
		 { 
		    var VoucherAmount=document.getElementById("ctl00_container_txtVoucherAmount");
		    var RecipientEmail=document.getElementById("ctl00_container_txtrecipientEmail");
		    var a = document.getElementById("ctl00_container_rb1");
		    var b = document.getElementById("ctl00_container_rb2");
		    var c = document.getElementById("ctl00_container_rb3");
		    if(a.checked==false && b.checked==false)
			{
				if(!Trim(VoucherAmount.value))
				{
					alert("Please enter Voucher Amount.");
					c.checked=true;
					VoucherAmount.value="";
					VoucherAmount.focus();
					return false;
				}
				if(!IsNumberOnly(VoucherAmount.value))
				{
					VoucherAmount.value='';
		   			alert("Please enter a valid Voucher Amount.");
		   			VoucherAmount.focus();
					return false;
				}
			}
		    if(!Trim(RecipientEmail.value))
		    {
				alert("Please enter Recipient Email.");
				RecipientEmail.value="";
				RecipientEmail.focus();
				return false;
		    }
		    if(!IsValidEmailId(RecipientEmail.value))
			{
				RecipientEmail.value='';
				alert("Please enter valid email ID");
				RecipientEmail.focus();
				return false;
			}
		  }
		  function setrb3GiftVoucher()
		  {
		    var c = document.getElementById("ctl00_container_rb3");
			c.checked=true;
		  }
		  
		  
function AboutUscheckSubmit()
{
            var Name=document.getElementById("ctl00_container_txtName");//
			var MailingAddress=document.getElementById("ctl00_container_txtMailingAddress");
			var City=document.getElementById("ctl00_container_txtCity");
			var State=document.getElementById("ctl00_container_txtState");
			var ZipCode=document.getElementById ("ctl00_container_txtZip");
			//var Country=document.getElementById("ctl00_container_ddlCountry");
			var Phone=document.getElementById("ctl00_container_txtPhone");
			//var Mobile=document.getElementById("ctl00_container_txtMobile");
			var Email=document.getElementById("ctl00_container_txtEmail");	
			var Comment=document.getElementById("ctl00_container_txtComment");
			
			if(IsLeftBlank(Name))
   		    {
   		       alert("Please Enter Your Name");
   		       Name.focus();
   		       return false;
   		    }
   		    else if(!IsCharWithSpace(Name.value))
   		    {
   		       alert("Name can have only Characters");  
   		       Name.value = '';	    
   		       Name.focus();
   		       return false;
   		    }
   		    
   		    if(!IsLeftBlank(City))
   			{
   				if(!IsCharWithSpace(City.value))
   				{
   				alert("City Name can have only Characters"); 
   				City.value = '';
   				City.focus();
   				return false;
   				}
   			}
   			
   			if(!IsLeftBlank(State))
   			{
   				if(!IsCharWithSpace(State.value))
   				{
   					alert("State Name can have only Characters"); 
   					State.value = '';
   					State.focus();
   					return false;
   				}
   			}
   			
   		    if(!IsLeftBlank(ZipCode))
   			{
   				if(!IsNumberOnly(ZipCode.value))
   				{
   					alert("Zip Code can have only Numbers"); 
   					ZipCode.value = '';
   					ZipCode.focus();
   					return false;
   				}
   			}
   			   			
   			//if(Country.selectedIndex == "0")
   			//{
   			//	alert("Please Select Your Country");
   			//	return false;
   			//}
   			
   			if(!IsLeftBlank(Phone))
   			{
   				if(!IsNumberOnly(Phone.value))
   				{
   					alert("Phone No. can have only Numbers");  
   					Phone.value = '';	    
   					Phone.focus();
   					return false;
   			    }
   			}
   			else
   			{
   			alert("Please Enter Phone number"); 
   			Phone.focus(); 
   			return false;
   			}   
   			
   			//if(!IsLeftBlank(Mobile))
   			//{
   				//if(!IsNumberOnly(Mobile.value))
   				//{
   				//	alert("Mobile/Cell No. can have only Numbers");  
   				//	Mobile.value = '';	    
   				//	Mobile.focus();
   				//	return false;
   			    //}
   			//}   		
   			
   		    if(IsLeftBlank(Email))
   			{
   				alert("Please Enter Your Email Id");
   				Email.focus();
   				return false;
   			}
   			else if(!IsValidEmailId(Email.value))
   			{
   				alert("Email Id is not Valid");  
   				Email.value = '';	    
   				Email.focus();
   				return false;
   			} 
   			
   			}//End	Function
   			
   			
   			
   			
   			function advsearch()
 {
 var textfrom= document.getElementById("ctl00_container_txtPricefrom");
 var textto= document.getElementById("ctl00_container_txtPriceTo");
 if(!IsNumberWithDecimal(textfrom.value))
				{
					alert("Please enter valid value.");
					textfrom.value="";
					textfrom.focus();
					return false;
				}
				
				if(!IsNumberWithDecimal(textto.value))
				{
					alert("Please enter valid value.");
					textto.value="";
					textto.focus();
					return false;
				}
}//End Function

function AddTestimonials()
{
//id= id="" id="" id="ctl00_container_txtEmail" id="ctl00_container_txtComments" 
var fname=document.getElementById("ctl00_container_txtFname");
var lname=document.getElementById("ctl00_container_txtLName");
var Phone=document.getElementById("ctl00_container_txtPhone");
var email=document.getElementById("ctl00_container_txtEmail");
var coment=document.getElementById("ctl00_container_txtComments");
//ctl00_container_txtEmail
            if(IsLeftBlank(fname))
   		    {
   		       alert("Please Enter Your First Name");
   		       fname.focus();
   		       return false;
   		    }
   		    else if(!IsCharWithSpace(fname.value))
   		    {
   		       alert("Name can have only Characters");  
   		       fname.value = '';	    
   		       fname.focus();
   		       return false;
   		    }
   		    
   		    if(IsLeftBlank(lname))
   		    {
   		       alert("Please Enter Your Last Name");
   		       fname.focus();
   		       return false;
   		    }
   		    else if(!IsCharWithSpace(lname.value))
   		    {
   		       alert("Name can have only Characters");  
   		       lname.value = '';	    
   		       lname.focus();
   		       return false;
   		    }
   		    
   		    if(!IsLeftBlank(Phone))
   			{
   				if(!IsNumberOnly(Phone.value))
   				{
   					alert("Phone No. can have only Numbers");  
   					Phone.value = '';	    
   					Phone.focus();
   					return false;
   			    }
   			}  
   		    
   		     if(IsLeftBlank(email))
   			{
   				alert("Please Enter Your Email Id");
   				email.focus();
   				return false;
   			}
   			else if(!IsValidEmailId(email.value))
   			{
   				alert("Email Id is not Valid");  
   				email.value = '';	    
   				email.focus();
   				return false;
   			} 
   			
   			if(IsLeftBlank(coment))
   		    {
   		       alert("Please Enter Your Comments");
   		       coment.focus();
   		       return false;
   		    }
   		    else if(!IsCharWithSpace(coment.value))
   		    {
   		       alert("Name can have only Characters");  
   		       coment.value = '';	    
   		       coment.focus();
   		       return false;
   		    }
}

// SCRIPT FOR LEFT SWITCH MENU

/*Read the cookie and check which panel is open*/
function showOpened()
{
	if(document.cookie.length != 0)
	{	
		var dc = document.cookie;
		var prefix = "tableNm=";
		var begin = dc.indexOf("; " + prefix);
		if (begin == -1)
		{
			begin = dc.indexOf(prefix);
			if (begin != 0) return null;
		}
		else
		{
			begin += 2;
		}
		var end = document.cookie.indexOf(";", begin);
		if (end == -1)
		{
			end = dc.length;
		}
		
		sltTable= unescape(dc.substring(begin + prefix.length, end));
		
		if (sltTable != 0)
		{
			 //document.getElementById('tblClosed_' + sltTable).style.display = 'none';
			document.getElementById('tblOpened_' + sltTable).style.display = '';
		}
	}
}
///fuction change image of image button
function Open(img1, img1name)
{
  document.getElementById(img1).src="App_Themes/Theme1/images/"+img1name; 
}

function Close(img2,img2name)
{
   document.getElementById(img2).src="App_Themes/Theme1/images/"+img2name;
}


//////////////Show and hide panel
function showHide(showTbl, hideTbl,selTbl){	
	
	/*hide all panels*/
	/*for (i=1; i<25;i++)*/
	for (i=1; i<80;i++)
	{
		if(document.getElementById('tblOpened_' + i))
		{
			document.getElementById('tblOpened_' + i).style.display = 'none';
			document.getElementById('tblClosed_' + i).style.display = '';
		}
	}
	
	showTable=document.getElementById(showTbl);
	showTable.style.display = '';
	
//	hideTable=document.getElementById(hideTbl);
//	hideTable.style.display = 'none';
	
	document.cookie = "tableNm=" + selTbl;
    
    document.getElementById(hideTbl).style.backgroundColor = "wheat";    
}

function resetColor(hideTbl)
{
document.getElementById(hideTbl).style.backgroundColor = "beige";    
}


 function checkuser_exiting()
 {
 var textfrom= document.getElementById("ctl00_container_txtEmailId");
 var textto= document.getElementById("ctl00_container_txtPriceTo");
 if(IsLeftBlank(textfrom))
   			{
   				alert("Please Enter Your Email Id");
   				textfrom.focus();
   				return false;
   			}
   else if(!IsValidEmailId(textfrom.value))
   			{
   				alert("Email Id is not Valid");  
   				textfrom.value = '';	    
   				textfrom.focus();
   				return false;
   			} 			
   			
   			
				
				
}

function checkuser_exiting1()
 {
 var textfrom= document.getElementById("ctl00_container_txtEmailId");
 var txtpass= document.getElementById("ctl00_container_txtPwd");
 if(IsLeftBlank(textfrom))
   			{
   				alert("Please Enter Your Email Id");
   				textfrom.focus();
   				return false;
   			}
   			
   else if(!IsValidEmailId(textfrom.value))
   			{
   				alert("Email Id is not Valid");  
   				textfrom.value = '';	    
   				textfrom.focus();
   				return false;
   			} 			
   			
   if(IsLeftBlank(txtpass))
   			{
   				alert("Please Enter Your password");
   				txtpass.focus();
   				return false;
   			}			
				
				
}

function check_step2()
{
            var companyname=document.getElementById("ctl00_container_txtCompanyName");//
			var street=document.getElementById("ctl00_container_txtStreet");
			var City=document.getElementById("ctl00_container_txtSuburb");
			var State=document.getElementById("ctl00_container_ddlState");
			var ZipCode=document.getElementById ("ctl00_container_txtZipCode");
			var Country=document.getElementById("ctl00_container_ddlCountry");
			var Phone=document.getElementById("ctl00_container_txtContactPhone");
			var rbt=document.getElementById("ctl00_container_radioCheck_0");
			//var Mobile=document.getElementById("ctl00_container_txtotherstate");
			if(IsLeftBlank(companyname))
   			{
   				alert("Please Enter Your Full Name");
   				companyname.focus();
   				return false;
   			}		
   			
   			if(IsLeftBlank(street))
   			{
   				alert("Please Enter Your Street");
   				street.focus();
   				return false;
   			}		
   			
   			if(IsLeftBlank(City))
   			{
   				alert("Please Enter Your City");
   				City.focus();
   				return false;
   			}		
   		   			
   			if(Country.value=="-Select Country-")
   			{
   				alert("Please Enter Your country");
   				Country.focus();
   				return false;
   			}	
   			
   			if(State.value=="-Select State-")
   			{
   				alert("Please Enter Your state");
   				State.focus();
   				return false;
   			}		
   			
   			if(IsLeftBlank(ZipCode))
   			{
   				alert("Please Enter Your Zip Code");
   				ZipCode.focus();
   				return false;
   			}	
   			
   			if(IsLeftBlank(Phone))
   			{
   				alert("Please Enter Phone No.");
   				Phone.focus();
   				return false;
   			}
   			else if(!IsNumberOnly(Phone.value))	
   			{
   			    alert("Please Enter Phone No.");
   				Phone.focus();
   				return false;
   			}
   			
   			if(rbt.selectedIndex.value=="")
   			{
   				alert("Alert");
   				rbt.focus();
   				return false;
   			}	
   				
   			
   			
}

function check_step1()
{
   var FirstName=document.getElementById("ctl00_container_txtFirstName");
   var email=document.getElementById("ctl00_container_txtEmail");
   var conformemail=document.getElementById("ctl00_container_txtEmai2");
   var password=document.getElementById("ctl00_container_txtpassword");
   var conformpassword=document.getElementById("ctl00_container_txtpassword1");
   
   if(IsLeftBlank(FirstName))
   			{
   				alert("Please Enter First Name");
   				FirstName.focus();
   				return false;
   			}
   	 else if(!FirstInteger(FirstName.value))
   		    {
   		       alert("Name can have only Character at first place");  
   		       FirstName.value = '';	    
   		       FirstName.focus();
   		       return false;
   		    }	
   		
   			
   if(IsLeftBlank(email))
   			{
   				alert("Please enter Email Id");
   				email.focus();
   				return false;
   			}	
   			
   			
   if(IsLeftBlank(conformemail))
   			{
   				alert("Please enter confirm Email Id");
   				conformemail.focus();
   				return false;
   			}	
   			
   	if(email.value!=conformemail.value)	
   	{ 
   	            alert("Confirm Email Id and Email Id should be same");
   	            conformemail.value="";
   				conformemail.focus();
   				return false;
   	
   	}	
   			
   	if(IsLeftBlank(password))
   			{
   				alert("Please enter password");
   				password.focus();
   				return false;
   			}	
   			
   	if(IsLeftBlank(conformpassword))
   			{
   				alert("Please enter confirm password");
   				conformpassword.focus();
   				return false;
   			}	
   			
   		if(password.value!=conformpassword.value)	
   	         { 
   	            alert("Confirm password and password should be same");
   	            conformpassword.value="";
   				conformemail.focus();
   				return false;
   	
         	}																
      

}

function check_exstinguser()
{
  var Country=document.getElementById("ctl00_container_ddlCountry");
  var State=document.getElementById("ctl00_container_ddlState");
	      if(Country.value=="-Select Country-")
   			{
   				alert("Please Select Your country");
   				Country.focus();
   				return false;
   			}	
   			
   			if(State.value=="-Select State-")
   			{
   				alert("Please Select Your state");
   				State.focus();
   				return false;
   			}		


}

function chkShipping()
{
   
   var FullName=document.getElementById("ctl00_container_txtCompanyName");
   var phone=document.getElementById("ctl00_container_txtContactPhone");
   var zip=document.getElementById("ctl00_container_txtZipCode");
   var address=document.getElementById("ctl00_container_txtStreet");
   var city=document.getElementById("ctl00_container_txtSuburb");
   var state=document.getElementById("ctl00_container_ddlState");
   var otherstate=document.getElementById("ctl00_container_txtotherstate");
   var country=document.getElementById("ctl00_container_ddlCountry");
   //var password=document.getElementById("ctl00_container_txtpassword");
   //var mobile=document.getElementById("ctl00_container_txtmobile");
   
     if(IsLeftBlank(FullName))
   			{
   				alert("Please Enter Full Name");
   				FullName.focus();
   				return false;
   			}
   	 else if(!FirstInteger(FullName.value))
   		    {
   		       alert("Name can have only Character at first place");  
   		       FullName.value = '';	    
   		       FullName.focus();
   		       return false;
   		    }	
 
    
    if(IsLeftBlank(address))
    {
    alert("Enter Your Address");
    address.focus();
    return false;
    }
    
    if(IsLeftBlank(city))
    {
    alert("Enter Your City");
    city.focus();
    return false;
    }
    
      if(country.value=="-Select Country-")
      {
      alert("Please Select Your Country");
      country.focus();
      return false;
      }
  
  if(state.value=="-Select State-")
    {    
    alert("Please Select Your State");
    state.focus();
    return false;
   
    }
    
   if(IsLeftBlank(zip))
   {
   alert("Please Enter Zip/Postal Code");
   zip.focus();
   return false;
   }
   else if(!zip.value.match(num_char))
   {
   alert("Zip/Postal Code is not valid");
   zip.value='';
   zip.focus();
   return false;
   }
    if(IsLeftBlank(phone))
    {
    alert("Enter Your Phone No");
    phone.focus();
    return false;
    }
   else if(!phone.value.match(numonly))
   {
   alert("Phone Should be in Numerical");
   phone.value='';
   phone.focus();
   return false;
   }
   
}

function FirstInteger(str)
    {
        var str_length=str.length; 
        var i=0;
        if(str.charAt(i)>=0 || str.charAt(i)<=9) 
        {
            return false; 
        }//there is atleast one character that is not space
        else
        {		
            return true; 
        }
    }        
            
function clickButton(e, buttonid)
{ 
    var evt = e ? e : window.event;
    var bt = document.getElementById(buttonid);
    if (bt)
    { 
        if (evt.keyCode == 13)
        { 
            bt.click(); 
            return false; 
        } 
    } 
}

var ccErrorNo = 0;
var selectedName;
var ccErrors = new Array ()

ccErrors [0] = "Unknown card type";
ccErrors [1] = "No card number provided";
ccErrors [2] = "Credit card number is in invalid format";
ccErrors [3] = "Credit card number is invalid";
ccErrors [4] = "Credit card number has an inappropriate number of digits";

function checkCreditCard (cardnumber, cardname) {
  var Pre = new Array();
  var cards = new Array();
  
  cards [0] = {name: "Visa", 
               length: "13,16", 
               prefixes: "4",
               checkdigit: true};
  cards [1] = {name: "MasterCard", 
               length: "16", 
               prefixes: "51,52,53,54,55",
               checkdigit: true};

  cards [2] = {name: "American Express", 
               length: "15", 
               prefixes: "34,37",
               checkdigit: true};
  cards [3] = {name: "Discover", 
               length: "16", 
               prefixes: "6011,622,64,65",
               checkdigit: true};
               
  Pre [0] = {name: "Visa", 
               length: "13,16", 
               prefixes: "4",
               checkdigit: true};
  Pre [1] = {name: "MasterCard", 
               length: "16", 
               prefixes: "5",
               checkdigit: true};

  Pre [2] = {name: "American Express", 
               length: "15", 
               prefixes: "3",
               checkdigit: true};
  Pre [3] = {name: "Discover", 
               length: "16", 
               prefixes: "6",
               checkdigit: true};
               
  // Establish card type
  var cardType = -1;
  for (var i=0; i<cards.length; i++) {

    // See if it is this card (ignoring the case of the string)
    if (cardname.toLowerCase () == cards[i].name.toLowerCase()) {
      cardType = i;
      break;
    }
  }
  
  // If card type not found, report an error
  if (cardType == -1) {
     ccErrorNo = 0;
     return false; 
  }
   
  // Ensure that the user has provided a credit card number
  if (cardnumber.length == 0)  {
     ccErrorNo = 1;
     return false; 
  }
    
  // Now remove any spaces from the credit card number
  cardnumber = cardnumber.replace (/\s/g, "");
  
  // Check that the number is numeric
  var cardNo = cardnumber
  var cardexp = /^[0-9]{13,19}$/;
  if (!cardexp.exec(cardNo))  {
     ccErrorNo = 2;
     return false; 
  }
       
  // Now check the modulus 10 check digit - if required
  if (cards[cardType].checkdigit) {
    var checksum = 0;                                  // running checksum total
    var mychar = "";                                   // next char to process
    var j = 1;                                         // takes value of 1 or 2
  
    // Process each digit one by one starting at the right
    var calc;
    for (i = cardNo.length - 1; i >= 0; i--) {
    
      // Extract the next digit and multiply by 1 or 2 on alternative digits.
      calc = Number(cardNo.charAt(i)) * j;
    
      // If the result is in two digits add 1 to the checksum total
      if (calc > 9) {
        checksum = checksum + 1;
        calc = calc - 10;
      }
    
      // Add the units element to the checksum total
      checksum = checksum + calc;
    
      // Switch the value of j
      if (j ==1) {j = 2} else {j = 1};
    } 
  
    // All done - if checksum is divisible by 10, it is a valid modulus 10.
    // If not, report an error.
    if (checksum % 10 != 0)  {
     ccErrorNo = 3;
     return false; 
    }
  }  

  // The following are the card-specific checks we undertake.
  var LengthValid = false;
  var PrefixValid = false; 
  var undefined; 

  // We use these for holding the valid lengths and prefixes of a card type
  var prefix = new Array ();
  var lengths = new Array ();
    
  // Load an array with the valid prefixes for this card
  prefix = cards[cardType].prefixes.split(",");
     // Now see if any of them match what we have in the card number
  for (i=0; i<prefix.length; i++) {
    var exp = new RegExp ("^" + prefix[i]);
    if (exp.test (cardNo)) PrefixValid = true;
  }
      
  // If it isn't a valid prefix there's no point at looking at the length
  if (!PrefixValid) {
  var Fd= cardNo.substring(0,1);
   for (j=0; j<4; j++)
   {      
       if(Fd==Pre[j].prefixes)
       {        
         alert("You entered a "+Pre[j].name+" credit card number but chose "+cardname+" from the drop down menu. Please select the correct card type and re-submit.");
         ccErrorNo = 5;
         return false; 
       }
  
   }
  
    
  }
  
  // See if the length is valid for this card
  lengths = cards[cardType].length.split(",");
  for (j=0; j<lengths.length; j++) {
    if (cardNo.length == lengths[j]) LengthValid = true;
  }
  
  // See if all is OK by seeing if the length was valid. We only check the 
  // length if all else was hunky dory.
  if (!LengthValid) {
     ccErrorNo = 4;
     return false; 
  };   
  
  // The credit card is in the required format.
  return true;
}

function checkstory()
{
  var title=document.getElementById('ctl00_ContentPlaceHolder1_txttitle') ;
  var date=document.getElementById('ctl00_ContentPlaceHolder1_txtdate') ;
  if(title.value=="")
    {
       alert("Please Enter Story Title");
       title.focus();
       return false;
    }
  	if(IsLeftBlank(title))
    {
       alert("Please Enter Story Title");
       title.focus();
       return false;
    }
   	if(date.text=="")
    {
       alert("Please Enter Date");
       story.focus();
       return false;
    }	   
   		    
    if(IsLeftBlank(date))
    {
       alert("Please Enter Date");
       date.focus();
       return false;
    }
   
    return true;
   
}

/*============================================================================*/
function checkOutAuthrizeAdmin()
{
    var Total =document.getElementById('ctl00_ContentPlaceHolder1_HiddenField1');
    // var Total=document.getElementById('<%=lblamountpaid.ClientID%>');
    if( Total.value>0)
    { 
        var Card_Type=document.getElementById('ctl00_ContentPlaceHolder1_DropDownList1');
        var NameOnCard = document.getElementById('ctl00_ContentPlaceHolder1_txtNameOnCard');
        var CardNumber = document.getElementById('ctl00_ContentPlaceHolder1_txtCardNumber');             
        var txtCCV = document.getElementById('ctl00_ContentPlaceHolder1_txtCCV');		
        var select_month=document.getElementById('ctl00_ContentPlaceHolder1_ddlExpMonth');
        var select_year=document.getElementById('ctl00_ContentPlaceHolder1_ddlExpYear');
        var select_mth=select_month.options[select_month.options.selectedIndex].value;              
        var select_yr=select_year.options[select_year.options.selectedIndex].value;
        var dt_current=new Date();        
        var current_month=dt_current.getMonth()+1;
        var CardType=Card_Type.options[Card_Type.options.selectedIndex].text;
      
        var current_year=dt_current.getFullYear(); 
        
        if(Card_Type.options[Card_Type.options.selectedIndex].value=="Select")
        {
            alert("Please select credit card type.");
            Card_Type.focus();
            return false;
        } 

        if(IsLeftBlank(NameOnCard))
        {
            alert("Please enter the name of the credit card.");
            NameOnCard.focus();
            return false;
        }
        if(IsLeftBlank(CardNumber))
        {
            alert("Please enter your credit card number.");
            CardNumber.focus();
            return false;
        } 
       if (checkCreditCard (CardNumber.value, CardType))
        {  }
        else 
        {
            if(ccErrorNo=="5")
            {
                CardNumber.focus();
                return false;
            }
            else
            {
                alert (ccErrors[ccErrorNo]);
                CardNumber.focus();
                return false;
            }
        }       

        if(select_yr<current_year)
        { 
         alert("Please re-enter your expiration date as the one you entered occurs in the past.");
            select_yr.focus();
            return false;   		    
       
        }
        if(select_yr==current_year)
         {
          if(select_mth<current_month)
           {
            alert("Please re-enter your expiration date as the one you entered occurs in the past.");
            select_month.focus();
            return false;   		    
           }
         }       
        if(IsLeftBlank(txtCCV))
        {
            alert("Please enter your credit cards CCV/AMEX number.");
            txtCCV.focus();
            return false;
        }   
        if(txtCCV.value.length <  3)
        {
            alert("Your Credit Card CCV/AMEX number appears to be invalid.");
            txtCCV.focus();
            return false;
        }

        if (!IsNumberOnly(txtCCV))
        {
            alert("Credit Card CCV/AMEX  should be a number");
            txtCCV.focus();
            return false;
        }
         
        if(txtCCV.value.length > 4)
        {
            alert("Your Credit Card CCV/AMEX number appears to be invalid.");
            txtCCV.focus();
            return false;
        }
    }
    var ChkAuthorisation = document.getElementById('ctl00_container_chkAuthorisation');
    if(ChkAuthorisation.checked == false)
    {
        alert("You must agree to make this payment by checking the Authorisation checkbox.");
        ChkAuthorisation.focus();
        return false;
    }
    if (submitcount == 0) 
    {
        submitcount++;
        return true;
    } 
    else 
    {
        alert("Payment is already in progress.\n\nClick OK now and please wait for a response.");
        return false;
    }	
}//end function