// Script for Order Change of Address
function ChangeAddressvalid()
			{
				var ErrMsg ="";
				var	Err = false

				document.frm.txtCAFirstName.style.backgroundColor=ChooseColor("");
				document.frm.txtCALastName.style.backgroundColor=ChooseColor("");
				document.frm.txtCAEmail.style.backgroundColor=ChooseColor("");
				document.frm.txtCAAddress1.style.backgroundColor=ChooseColor("");
				document.frm.txtCACity.style.backgroundColor=ChooseColor("");
				if(document.frm.ddlCountry2.selectedIndex != 0)
				{
				document.frm.txtCAState.style.backgroundColor=ChooseColor("");
				}
				document.frm.txtCAZip.style.backgroundColor=ChooseColor("");
				
				if(isBlank(document.frm.txtCAFirstName.value))
				{
					document.frm.txtCAFirstName.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
					
					if(isBlank(document.frm.txtCALastName.value))
					{
		
					document.frm.txtCALastName.style.backgroundColor=ChooseColor("Err");
					Err = true
   				   }
   				
   				if(isBlank(document.frm.txtCAEmail.value))
   				{
		
					document.frm.txtCAEmail.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
   				
   				
   				if(isBlank(document.frm.txtCAAddress1.value)){
		
					document.frm.txtCAAddress1.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
				
			
			if(isBlank(document.frm.txtCACity.value)){
		
					document.frm.txtCACity.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
				
				if(document.frm.ddlCountry2.selectedIndex != 0 && isBlank(document.frm.txtCAState.value))
				{
				
				document.frm.txtCAState.style.backgroundColor=ChooseColor("Err");
					Err = true
				}
				
				if(isBlank(document.frm.txtCAZip.value)){
		
					document.frm.txtCAZip.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
				
			
				if (Err == true)
				{
					ErrMsg += "The fields marked with * are required. ";
					ShowError(ErrMsg);
					return false;
				}
					
				

		       if(ValEmail(document.frm.txtCAEmail.value) == false)
		       {
				ErrMsg += "Please enter a valid Email";
				document.frm.txtCAEmail.style.backgroundColor=ChooseColor("Err")
				document.frm.txtCAEmail.focus();
				ShowError(ErrMsg);
				return false;
				
				}
					
			return true	;
								
				
			} 

function ShowError(err)
{
	errorMsg.style.display="block";
	ermsg.innerHTML = err;
	window.scroll(0,0);
	
}

//Added by Antony 
function ChangeAddCountry()
		{
		if (document.frm.ddlCountry2.selectedIndex > 0)
			{
				
				document.frm.ddlState.disabled = true;
				document.frm.ddlState.style.backgroundColor=ChooseColor("Read");
				document.frm.txtCAState.readOnly = false;
				document.frm.txtCAState.style.backgroundColor=ChooseColor("");
			}
		else
			{
				
				document.frm.ddlState.disabled = false;
				document.frm.ddlState.style.backgroundColor=ChooseColor("");
				document.frm.txtCAState.readOnly = true;
				document.frm.txtCAState.style.backgroundColor=ChooseColor("Read");
			}
		}	

// Script for Order Change Request validation






function OrderchangeValid()
			{
				var ErrMsg ="";
			var	Err = false

				document.frm.txtOCFirstName.style.backgroundColor=ChooseColor("");
				document.frm.txtOCLastName.style.backgroundColor=ChooseColor("");
				document.frm.txtOCEmail.style.backgroundColor=ChooseColor("");
				document.frm.txtOCComments.style.backgroundColor=ChooseColor("");
				
				if(isBlank(document.frm.txtOCFirstName.value))
				{
		
					document.frm.txtOCFirstName.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
					
					if(isBlank(document.frm.txtOCLastName.value))
					{
		
					document.frm.txtOCLastName.style.backgroundColor=ChooseColor("Err");
					Err = true
   				   }
   				
   				if(isBlank(document.frm.txtOCEmail.value))
   				{
		
					document.frm.txtOCEmail.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
   				
   				
   				if(isBlank(document.frm.txtOCComments.value)){
		
					document.frm.txtOCComments.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
				
				
				if (Err == true)
				{
					ErrMsg += "The fields marked with * are required. ";
					ShowError(ErrMsg);
					return false;
				}


			if(document.frm.txtOCComments.value.length > 255)
   				{
         		ErrMsg += "Your Comments should be less than 255 characters";
				ShowError(ErrMsg);
				document.frm.txtOCComments.focus();
				return false;
   				
   				}
   				
		       if(ValEmail(document.frm.txtOCEmail.value) == false)
		       {
				ErrMsg += "Please enter a valid Email";
				document.frm.txtOCEmail.style.backgroundColor=ChooseColor("Err");
				document.frm.txtOCEmail.focus();
				ShowError(ErrMsg);
				return false;
				
				}
					
			return true	;
			}	
			
		
			
			
		//  Script for Make Appointment validation	
		
			function Appointmentvalid()
			{
				
				var ErrMsg ="";
				var	Err = false

				document.frm.txtMAFirstName.style.backgroundColor=ChooseColor("");
				document.frm.txtLMALastName3.style.backgroundColor=ChooseColor("");
				document.frm.txtMAEmail.style.backgroundColor=ChooseColor("");
				//document.frm.txtMACity.style.backgroundColor=ChooseColor("");
				document.frm.ddCity.style.backgroundColor=ChooseColor("");
				//document.frm.ddMonth.style.backgroundColor=ChooseColor("");
				document.frm.ddDate.style.backgroundColor=ChooseColor("");
				//document.frm.ddYear.style.backgroundColor=ChooseColor("");
						
			if(isBlank(document.frm.txtMAFirstName.value))
				{
		
					document.frm.txtMAFirstName.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
   				
   				if(isBlank(document.frm.txtLMALastName3.value))
				{
		
					document.frm.txtLMALastName3.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
   				
   				if(isBlank(document.frm.txtMAEmail.value))
				{
		
					document.frm.txtMAEmail.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
   				if(isBlank(document.frm.txtMAPhone.value))
   				{
   				document.frm.txtMAPhone.style.backgroundColor=ChooseColor("Err");
   				Err = true
   				}
   				/*	if(isBlank(document.frm.txtMACity.value))
				{
		
					document.frm.txtMACity.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
   				
   				
   				
   			if(document.frm.ddMonth.selectedIndex < 1)
				{
					
					document.frm.ddMonth.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
   				
   				
   				if(document.frm.ddDate.selectedIndex < 1)
				{
		
					document.frm.ddDate.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
   				
   				if(document.frm.ddYear.selectedIndex < 1)
				{
					document.frm.ddYear.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
   				*/
   			
   			if (Err == true)
				{
					ErrMsg += "The fields marked with * are required. ";
					ShowError(ErrMsg);
					return false;
				}
				
				
			if(document.frm.txtMARegarding.value.length > 255)
			{
					
					ErrMsg += "Your Comments should be less than 255 characters";
					document.frm.txtMARegarding.focus();
					ShowError(ErrMsg);
					return false;
			}
			
			/* var	ret2=ValDate();
			
			if(ret2==true)

		     {
		    
		       if(ValEmail(document.frm.txtMAEmail.value) == false)
					{
						ErrMsg += "Please enter a valid Email";
						document.frm.txtMAEmail.focus();
						document.frm.txtMAEmail.style.backgroundColor=ChooseColor("Err");
						ShowError(ErrMsg);
						return false;
					}
				else
					{
				   return true	;
					}
			  }	
			else
			{
				ErrMsg += "Select valid appointment date";
				ShowError(ErrMsg);
				return false;
				
			}
			*/					
				   				
   			return true;				
			}
			
			
function MonthArr(m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11)
{
	this[1]=m0;
	this[2]=m1;
	this[3]=m2;
	this[4]=m3;
	this[5]=m4;
	this[6]=m5;
	this[7]=m6;
	this[8]=m7;
	this[9]=m8;
	this[10]=m9;
	this[11]=m10;
	this[12]=m11;
}
// Validation for date 
    			
// Validation for date
function ValDate()
{

var today = new Date();
var SeleMnth=document.frm.ddMonth.selectedIndex+1;
var SeleDay=document.frm.ddDate.selectedIndex+1;
var SeleYear=document.frm.ddYear.options[document.frm.ddYear.selectedIndex].text;
var Mnth=today.getMonth()+1;
var TDay=today.getDate();
var Mntharr= new MonthArr(31,28,31,30,31,30,31,31,30,31,30,31)
var Year=today.getFullYear() ;
var mday=false;

if(SeleMnth!==""&&SeleDay!==""&& SeleYear!=="")
{
	
if(SeleYear==Year)
		{
			
			if(SeleMnth<Mnth)
			// checks the month selected with the current month
				{
				//var SeleDate= new date(SeleYear,SeleMnth-1,SeleDay);
					//ErrMsg +=" Please select either current month or future month";
					document.frm.ddMonth.focus();		
					return false;
				}
		//checks the day seleced with the current day
			if(SeleMnth<Mnth && SeleDay<TDay)
				{
					//ErrMsg +=" Please select either current day or future day";
					document.frm.ddDate.focus();		
					return false;
				}
		}
// checks for the current to be a leap year or not
	if(((SeleYear%4)==0 && (SeleYear%100)!==0) || (SeleYear%400)==0)
			Mntharr[2]=29;
	
		
	//checks for the correct no of days associated with the month selected
		{
					if((SeleMnth!==2 && SeleDay>29 && SeleDay>Mntharr[SeleMnth]) || (SeleMnth==2 && SeleDay>27 && SeleDay>Mntharr[SeleMnth]))
						{
					//	ErrMsg +=" Please select a valid day of the month";
						document.frm.ddDate.focus();		
						return false;
						}
					else
					mday=true;
		}	
	}


if(((SeleMnth==Mnth &&(SeleDay==TDay || SeleDay>TDay))|| SeleMnth>Mnth)&&  SeleYear==Year)
	return true;
if(mday==true && SeleYear>Year)
	return true;
}
//



    //Added by Antony 

function ChangeJMLCountry()
		{
		if (document.frm.ddlCountry.selectedIndex > 0)
			{
				
				document.frm.ddlJMLState.disabled = true;
				document.frm.ddlJMLState.style.backgroundColor=ChooseColor("Read");
				document.frm.txtJMLState.readOnly = false;
				document.frm.txtJMLState.style.backgroundColor=ChooseColor("");
			}
		else
			{
				
				document.frm.ddlJMLState.disabled = false;
				document.frm.ddlJMLState.style.backgroundColor=ChooseColor("");
				document.frm.txtJMLState.readOnly = true;
				document.frm.txtJMLState.style.backgroundColor=ChooseColor("Read");
			}
		}
			
			
			//	Script for Make Joining Mailing List Validation
			
			
			function JoinMailListvalid()
			
			{
				var ErrMsg ="";
				var	Err = false

				document.frm.txtJMLFirstName.style.backgroundColor=ChooseColor("");
				document.frm.txtJMLLastName.style.backgroundColor=ChooseColor("");
				document.frm.txtJMLEmail.style.backgroundColor=ChooseColor("");
				document.frm.txtJMLAddress1.style.backgroundColor=ChooseColor("");
				document.frm.txtJMLCity.style.backgroundColor=ChooseColor("");
				document.frm.txtJMLZip.style.backgroundColor=ChooseColor("");
				if(document.frm.ddlCountry2.selectedIndex != 0)
				{
				document.frm.txtCAState.style.backgroundColor=ChooseColor("");
				}
				
				
				if(isBlank(document.frm.txtJMLFirstName.value))
				{
		
					document.frm.txtJMLFirstName.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
				
				if(isBlank(document.frm.txtJMLLastName.value))
				{
		
					document.frm.txtJMLLastName.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
   				
   				if(isBlank(document.frm.txtJMLEmail.value))
				{
		
					document.frm.txtJMLEmail.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
   				
   				if(isBlank(document.frm.txtJMLAddress1.value))
				{
		
					document.frm.txtJMLAddress1.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
   				
   				if(isBlank(document.frm.txtJMLCity.value))
				{
		
					document.frm.txtJMLCity.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
   				
   				if(document.frm.ddlCountry.selectedIndex != 0 && isBlank(document.frm.txtJMLState.value))
					{

					document.frm.txtJMLState.style.backgroundColor=ChooseColor("Err");
					Err = true
					}
   				
   			
   				if(isBlank(document.frm.txtJMLZip.value))
				{
		
					document.frm.txtJMLZip.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
   					
				
				if (Err == true)
				{
					ErrMsg += "The fields marked with * are required. ";
					ShowError(ErrMsg);
					return false;
				}

		       if(ValEmail(document.frm.txtJMLEmail.value) == false)
		       {
				ErrMsg += "Please enter a valid Email";
				document.frm.txtJMLEmail.focus();
				document.frm.txtJMLEmail.style.backgroundColor=ChooseColor("Err");
				ShowError(ErrMsg);
				return false;
				
				}
					
			return true	;
				
			}	
			
			
			// Script for Feedback Validation
			
			function Feedbackvalid()
			{
				var ErrMsg ="";
				var	Err = false

				document.frm.txtFBFirstName.style.backgroundColor=ChooseColor("");
				document.frm.txtFBLastName.style.backgroundColor=ChooseColor("");
				document.frm.txtFBEmail.style.backgroundColor=ChooseColor("");
				
				if(isBlank(document.frm.txtFBFirstName.value))
				{
		
					document.frm.txtFBFirstName.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
				
				if(isBlank(document.frm.txtFBLastName.value))
				{
		
					document.frm.txtFBLastName.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
   				
   				if(isBlank(document.frm.txtFBEmail.value))
				{
		
					document.frm.txtFBEmail.style.backgroundColor=ChooseColor("Err");
					Err = true
   				}
   					
								
				if (Err == true)
				{
					ErrMsg += "The fields marked with * are required. ";
					ShowError(ErrMsg);
					return false;
				}
				
				
				if(document.frm.txtFBComments.value.length > 255)
   				{
   				document.frm.txtFBComments.focus();
   				ErrMsg += "Your Comments should be less than 255 characters";
				ShowError(ErrMsg);
				return false;
   				
   				}

		       if(ValEmail(document.frm.txtFBEmail.value) == false)
		       {
				ErrMsg += "Please enter a valid Email";
				document.frm.txtFBEmail.focus();
				document.frm.txtFBEmail.style.backgroundColor=ChooseColor("Err");
				ShowError(ErrMsg);
				return false;
				
				}
					
			return true	;
				
				
			}
			
			function showMytailorAddress()
			{
			document.getElementById('customerInformation').style.display="none";
			document.getElementById('mytailorAddress').style.display="block";
				
			return false
			}
			
			
			
			<!--
			function showdiv(item,lt,bg,rt,linktext,help)		
		   {	
		  
			document.getElementById('mytailorAddress').visibility="hidden";
			document.getElementById('mytailorAddress').style.display="none";
			//document.getElementById('homepageHelp').style.display="none";
			//document.getElementById('homepageHelp').style.visibility="hidden";
			
			document.getElementById('changeAddress').style.display="none";
			//document.getElementById('changeMyAddressHelp').style.display="none";
			//document.getElementById('changeMyAddressHelp').style.visibility="hidden";
			document.getElementById('td1').className="normalStatelt";
			document.getElementById('td2').className="normalStatebg";
			document.getElementById('td3').className="normalStatert";
			document.getElementById('changeAddressLink').style.color="#000000";
			
			document.getElementById('makeAppointment').style.display="none";
			//document.getElementById('makeAppointmentHelp').style.display="none";
			//document.getElementById('makeAppointmentHelp').style.visibility="hidden";
			document.getElementById('td4').className="normalStatelt";
			document.getElementById('td5').className="normalStatebg";
			document.getElementById('td6').className="normalStatert";
			document.getElementById('makeAppoinmentLink').style.color="#000000";
			
			document.getElementById('mailingList').style.display="none";
			//document.getElementById('mailingListHelp').style.display="none";
			//document.getElementById('mailingListHelp').style.visibility="hidden";
			document.getElementById('td7').className="normalStatelt";
			document.getElementById('td8').className="normalStatebg";
			document.getElementById('td9').className="normalStatert";
			document.getElementById('mailingListLink').style.color="#000000";

			
			document.getElementById('customerFeedback').style.display="none";
			//document.getElementById('CustmerFeedbackHelp').style.display="none";
			//document.getElementById('CustmerFeedbackHelp').style.visibility="hidden";
			document.getElementById('td10').className="normalStatelt";
			document.getElementById('td11').className="normalStatebg";
			document.getElementById('td12').className="normalStatert";
			document.getElementById('feedbackLink').style.color="#000000";
			
			document.getElementById('changeYourOrder').style.display="none";
			//document.getElementById('changeMyOrderHelp').style.display="none";
			//document.getElementById('changeMyOrderHelp').style.visibility="hidden";
			document.getElementById('td13').className="normalStatelt";
			document.getElementById('td14').className="normalStatebg";
			document.getElementById('td15').className="normalStatert";
			document.getElementById('changeYourOrderLink').style.color="#000000";
			
			document.getElementById('customerInformation').style.display="none";
				
			document.getElementById(item).style.display="block";
			document.getElementById(item).style.visibility="visible";
			//document.getElementById(help).style.display="block";
			//document.getElementById(help).style.visibility="visible";
			document.getElementById(lt).className="activeStatelt";
			document.getElementById(bg).className="activeStatebg";
			document.getElementById(rt).className="activeStatert";
			document.getElementById(linktext).style.color="#FFFFFF";
			document.getElementById('errorMsg').style.display="none";
			
			if(item=="changeYourOrder")
			{			
						ClearOrderChange();
			}
			else if(item=="customerFeedback")
					{
					ClearFeedBack();
					}
			else if(item=="mailingList")
					{
					ClearJoinMailingList();
					}
				else if(item=="makeAppointment")
				{			
					ClearMakeAppointment();
					
				}	
				else if(item=="changeAddress")
				{
				
				ClearAddressChange();
			
				} 
		   }
		   
		   
		   function ClearOrderChange()
				{
				document.frm.txtOCFirstName.style.backgroundColor="#ffffff";
				document.frm.txtOCLastName.style.backgroundColor="#ffffff";
				document.frm.txtOCEmail.style.backgroundColor="#ffffff";
				document.frm.txtOCComments.style.backgroundColor="#ffffff";

				}
			function  ClearFeedBack()	
				{
				document.frm.txtFBFirstName.style.backgroundColor="#ffffff";
				document.frm.txtFBLastName.style.backgroundColor="#ffffff";
				document.frm.txtFBEmail.style.backgroundColor="#ffffff";
				
				}
				
				function ClearJoinMailingList()
				{
				document.frm.txtJMLFirstName.style.backgroundColor="#ffffff";
				document.frm.txtJMLLastName.style.backgroundColor="#ffffff";
				document.frm.txtJMLEmail.style.backgroundColor="#ffffff";
				document.frm.txtJMLAddress1.style.backgroundColor="#ffffff";
				document.frm.txtJMLCity.style.backgroundColor="#ffffff";
				document.frm.txtJMLState.style.backgroundColor="#ffffff";
				document.frm.txtJMLZip.style.backgroundColor="#ffffff";
				
				}
				
			function ClearMakeAppointment()	
				{
				document.frm.txtMAFirstName.style.backgroundColor="#ffffff";
				document.frm.txtLMALastName3.style.backgroundColor="#ffffff";
				document.frm.txtMAEmail.style.backgroundColor="#ffffff";
				//document.frm.txtMACity.style.backgroundColor="#ffffff";
				document.frm.ddCity.style.backgroundColor="#ffffff";
				document.frm.txtMAPhone.style.backgroundColor="#ffffff";
				//document.frm.ddMonth.style.backgroundColor="#ffffff";
				document.frm.ddDate.style.backgroundColor="#ffffff";
				//document.frm.ddYear.style.backgroundColor="#ffffff";
				}	
				
			function ClearAddressChange()	
				{
				document.frm.txtCAFirstName.style.backgroundColor="#ffffff";
				document.frm.txtCALastName.style.backgroundColor="#ffffff";
				document.frm.txtCAEmail.style.backgroundColor="#ffffff";
				document.frm.txtCAAddress1.style.backgroundColor="#ffffff";
				document.frm.txtCACity.style.backgroundColor="#ffffff";
				document.frm.txtCAState.style.backgroundColor="#ffffff";
				document.frm.txtCAZip.style.backgroundColor="#ffffff";
				}
	function SetSession()
		{
		
		if(document.frm.ddTime.selectedIndex>1)
			{
			document.frm.ddSes.selectedIndex=1;
			}
			else
			{
			document.frm.ddSes.selectedIndex=0;
			}
			if(document.frm.ddTime.selectedIndex>=10)
			{
			document.frm.ddMin.selectedIndex=0;
			}		
		return true;
	}

				