//Check Height Weight Height Weight
function heightWeight()
{
	var ErrMsg = ""
	document.Form1.mdlHtWt_txtweight.backgroundColor=ChooseColor("");

	if(document.Form1.mdlHtWt_txtweight.value=="")	{
			ErrMsg = "Please enter your weight(in pounds)";
			document.Form1.mdlHtWt_txtweight.focus();
			ShowError(ErrMsg);
			document.Form1.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("Err");
			return false;
	}
	//
	if(CheckString(document.Form1.mdlHtWt_txtweight.value)==false)	{
			ErrMsg = "Please enter a valid numerical value for your weight";
			document.Form1.mdlHtWt_txtweight.focus();
			ShowError(ErrMsg);
			document.Form1.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("Err");
			return false;
	}
	return true;
}

// Calculate Sleeve Length
function CalculateSleeves(){
        //alert(isNaN(document.Form1.txtLeftHalfShoulder.value));
        //alert(isNaN(document.Form1.txtLeftSleeve.value));
        if ((isNaN(document.Form1.txtLeftHalfShoulder.value)==false) && (isNaN(document.Form1.txtLeftSleeve.value)==false) && document.Form1.txtLeftHalfShoulder.value!='' && document.Form1.txtLeftSleeve.value!=''){
                //alert(number(document.Form1.txtLeftHalfShoulder.value));
                document.Form1.txtLeftSleeveLength.value = eval(document.Form1.txtLeftHalfShoulder.value) + eval(document.Form1.txtLeftSleeve.value)
        }
        if ((isNaN(document.Form1.txtRightHalfShoulder.value)==false) && (isNaN(document.Form1.txtRightSleeve.value)==false) && document.Form1.txtRightHalfShoulder.value!='' && document.Form1.txtRightSleeve.value!=''){
                document.Form1.txtRightSleeveLength.value = eval(document.Form1.txtRightHalfShoulder.value) + eval(document.Form1.txtRightSleeve.value)
        }
        if ((isNaN(document.Form1.txtNeckSkinSize.value)==false) && document.Form1.txtNeckSkinSize.value!=''){
                if(document.Form1.divneck != null){
                document.Form1.divneck.value=eval(document.Form1.txtNeckSkinSize.value)+1;}
        }
ShowShoulderLength();
}

// calculate sleeve size  
// Created by Antony 

function ShowShoulderLength()
{
        var iRightShoulder = document.Form1.txtRightHalfShoulder.value;
        var iLeftShoulder = document.Form1.txtLeftHalfShoulder.value;
        if(isNaN(parseFloat(iLeftShoulder))==true){
                iLeftShoulder="0";
        }
        if(isNaN(parseFloat(iRightShoulder))==true){
                iRightShoulder="0";
        }
        if(iLeftShoulder > iRightShoulder){
                document.Form1.txtShoulder.value = round1(parseFloat(iLeftShoulder)*2);
                }
        if(iRightShoulder > iLeftShoulder){
                document.Form1.txtShoulder.value = round1(parseFloat(iRightShoulder)*2);
                }
        if(iRightShoulder == iLeftShoulder){
                document.Form1.txtShoulder.value = parseFloat(iRightShoulder)*2;
                }
}



// Check for is empty
function ValidateForm(sol)
{
	
	var ErrMsg =""
	if (sol==1){ErrMsg+="Login to access your order history.<br>"; }
	var Err = false
	document.Form1.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("");
	document.Form1.mdlHtWt_ddlJacketSize.style.backgroundColor=ChooseColor("");
	document.Form1.mdlHtWt_ddlSlacksize.style.backgroundColor=ChooseColor("");
	document.Form1.txtNeckSkinSize.style.backgroundColor=ChooseColor("");
	document.Form1.txtLeftHalfShoulder.style.backgroundColor=ChooseColor("");
	document.Form1.txtLeftSleeve.style.backgroundColor=ChooseColor("");
	document.Form1.txtRightHalfShoulder.style.backgroundColor=ChooseColor("");
	document.Form1.txtRightSleeve.style.backgroundColor=ChooseColor("");
	document.Form1.txtChest.style.backgroundColor=ChooseColor("");
	document.Form1.txtWaist.style.backgroundColor=ChooseColor("");
	document.Form1.txtHips.style.backgroundColor=ChooseColor("");
	document.Form1.txtLength.style.backgroundColor=ChooseColor("");
	document.Form1.txtLeftCuff.style.backgroundColor=ChooseColor("");
	document.Form1.txtRightCuff.style.backgroundColor=ChooseColor("");
	document.Form1.mdlMeasurementImages_txtMeasurementComments.style.backgroundColor=ChooseColor("");
	//
	if(isBlank(document.Form1.mdlHtWt_txtweight.value))	{
		Err = true
		document.Form1.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(document.Form1.mdlHtWt_ddlJacketSize.selectedIndex==0){
		Err = true
		document.Form1.mdlHtWt_ddlJacketSize.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(document.Form1.mdlHtWt_ddlSlacksize.selectedIndex==0){
		Err = true
		document.Form1.mdlHtWt_ddlSlacksize.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(isBlank(document.Form1.txtNeckSkinSize.value)){
		Err = true
		document.Form1.txtNeckSkinSize.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(isBlank(document.Form1.txtLeftHalfShoulder.value)){
		Err = true
		document.Form1.txtLeftHalfShoulder.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(isBlank(document.Form1.txtLeftSleeve.value)){
		Err = true
		document.Form1.txtLeftSleeve.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(isBlank(document.Form1.txtRightHalfShoulder.value)){
		Err = true
		document.Form1.txtRightHalfShoulder.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(isBlank(document.Form1.txtRightSleeve.value)){
		Err = true
		document.Form1.txtRightSleeve.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(isBlank(document.Form1.txtChest.value)){
		Err = true
		document.Form1.txtChest.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(isBlank(document.Form1.txtWaist.value)){
		Err = true
		document.Form1.txtWaist.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(isBlank(document.Form1.txtHips.value)){
		Err = true
		document.Form1.txtHips.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(isBlank(document.Form1.txtLength.value)){
		Err = true
		document.Form1.txtLength.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(isBlank(document.Form1.txtLeftCuff.value)){
		Err = true
		document.Form1.txtLeftCuff.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(isBlank(document.Form1.txtRightCuff.value)){
		Err = true
		document.Form1.txtRightCuff.style.backgroundColor=ChooseColor("Err");
	}
	//
	
	if (Err == true)
	{
		ErrMsg += "The fields marked with * are required. ";
		ShowError(ErrMsg);
		return false;
	}
	
	//
	if(CheckString(document.Form1.mdlHtWt_txtweight.value)==false)	{
		Err = true
		document.Form1.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("Err");
	}
	
	if (Err == true)
	{
		ErrMsg += "Please enter a proper weight. ";
		ShowError(ErrMsg);
		return false;
	}
	//
	if(CheckString(document.Form1.txtNeckSkinSize.value)==false){
		Err = true
		document.Form1.txtNeckSkinSize.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(CheckString(document.Form1.txtLeftHalfShoulder.value)==false){
		Err = true
		document.Form1.txtLeftHalfShoulder.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(CheckString(document.Form1.txtLeftSleeve.value)==false){
		Err = true
		document.Form1.txtLeftSleeve.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(CheckString(document.Form1.txtRightHalfShoulder.value)==false){
		Err = true
		document.Form1.txtRightHalfShoulder.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(CheckString(document.Form1.txtRightSleeve.value)==false){
		Err = true
		document.Form1.txtRightSleeve.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(CheckString(document.Form1.txtChest.value)==false){
		Err = true
		document.Form1.txtChest.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(CheckString(document.Form1.txtWaist.value)==false){
		Err = true
		document.Form1.txtWaist.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(CheckString(document.Form1.txtHips.value)==false){
		Err = true
		document.Form1.txtHips.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(CheckString(document.Form1.txtLength.value)==false){
		Err = true
		document.Form1.txtLength.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(CheckString(document.Form1.txtLeftCuff.value)==false){
		Err = true
		document.Form1.txtLeftCuff.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(CheckString(document.Form1.txtRightCuff.value)==false){
		Err = true
		document.Form1.txtRightCuff.style.backgroundColor=ChooseColor("Err");
	}
			
	if (Err == true)
	{
		ErrMsg += "Please enter a proper size for highlighted fields. ";
		ShowError(ErrMsg);
		return false;
	}
	if((document.Form1.mdlMeasurementImages_txtMeasurementComments.value).length > 250){
		ErrMsg += "Please enter your comments within 250 characters.";
		ShowError(ErrMsg);
		document.Form1.mdlMeasurementImages_txtMeasurementComments.style.backgroundColor=ChooseColor("Err");
		return false;
	}
	if((document.getElementById('mdlMeasurementImages_rbtnAtHome').checked == false) && (document.getElementById('mdlMeasurementImages_rbtnCommLaundry').checked == false) && (document.getElementById('mdlMeasurementImages_rbtnboth').checked == false))	{
		ErrMsg += "Please select your laundry type. <a href='#Laundry' class='errorMessageLink'>go there</a>";
		ShowError(ErrMsg);
		return false;
	}
	
	document.Form1.hdCheck.value="1";
	return true;
}

//newly added by satty for validating mail my slacks
function ValidateMailSlacks()
{
	var ErrMsg =""
	var Err = false
	document.Form1.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("");
	document.Form1.txtMeasurementComments.style.backgroundColor=ChooseColor("");
	//
	if(isBlank(document.Form1.mdlHtWt_txtweight.value)==true)	{
		Err = true
		document.Form1.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("Err");
	}
	if (Err == true)
	{
		ErrMsg = "The fields marked with * are required.";
		ShowError(ErrMsg);
		return false;
	}
	//
	if(CheckString(document.Form1.mdlHtWt_txtweight.value)==false){
		Err = true
		document.Form1.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("Err");
	}
	//
	if (Err == true)
	{
		ErrMsg = "Please enter your proper weight. ";
		ShowError(ErrMsg);
		return false;
	}
	//
	if((document.Form1.txtMeasurementComments.value).length > 250){
		ErrMsg = "Please enter your comments within 250 characters.";
		ShowError(ErrMsg);
		document.Form1.txtMeasurementComments.style.backgroundColor=ChooseColor("Err");
		return false;
	}
	
	return true;
}

function ValidateMailShirt()
{
	var ErrMsg =""
	var Err = false
	document.Form1.txtweight.style.backgroundColor=ChooseColor("");
	document.Form1.txtFirstName.style.backgroundColor=ChooseColor("");
	document.Form1.txtLastName.style.backgroundColor=ChooseColor("");
	document.Form1.txtEmail.style.backgroundColor=ChooseColor("");
	document.Form1.txtMeasurementComments.style.backgroundColor=ChooseColor("");
	//
	if(isBlank(document.Form1.txtweight.value)==true)	{
		Err = true
		document.Form1.txtweight.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(isBlank(document.Form1.txtFirstName.value)==true){
		Err = true
		document.Form1.txtFirstName.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(isBlank(document.Form1.txtLastName.value)==true){
		Err = true
		document.Form1.txtLastName.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(isBlank(document.Form1.txtEmail.value)==true){
		Err = true
		document.Form1.txtEmail.style.backgroundColor=ChooseColor("Err");
	}
	//
	if (Err == true)
	{
		ErrMsg = "The fields marked with * are required.";
		ShowError(ErrMsg);
		return false;
	}
	//
	if(CheckString(document.Form1.txtweight.value)==false){
		Err = true
		document.Form1.txtweight.style.backgroundColor=ChooseColor("Err");
	}
	//
	if (Err == true)
	{
		ErrMsg = "Please enter your proper weight. ";
		ShowError(ErrMsg);
		return false;
	}
	//
	if(ValEmail(document.Form1.txtEmail.value)==false){
		Err = true
		document.Form1.txtEmail.style.backgroundColor=ChooseColor("Err");
	}
	//
	if (Err == true)
	{
		ErrMsg = "Please enter a valid Email.";
		ShowError(ErrMsg);
		return false;
	}
	//
	if((document.Form1.txtMeasurementComments.value).length > 250){
		ErrMsg = "Please enter your comments within 250 characters.";
		ShowError(ErrMsg);
		document.Form1.txtMeasurementComments.style.backgroundColor=ChooseColor("Err");
		return false;
	}
	
	return true;
}
//newly added by satty for slack validation best of both measuremnt
function BestofBothValidation()
{
//alert('hai');return false;
var ErrMsg=""
ErrMsg += "The fields marked with * are required. ";
//ErrMsg+="The entered datas will be retrieved once you login.<br>"; 
var Err = false
document.Form2.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("");
document.Form2.mdlHtWt_ddlJacketSize.style.backgroundColor=ChooseColor("");
document.Form2.ddlsizeInseamLeft.style.backgroundColor=ChooseColor("");
document.Form2.ddlsizeInseamRight.style.backgroundColor=ChooseColor("");
document.Form2.ddlsizeOutseamLeft.style.backgroundColor=ChooseColor("");
document.Form2.ddlsizeOutseamRight.style.backgroundColor=ChooseColor("");
document.Form2.ddlBottomsize.style.backgroundColor=ChooseColor("");
document.Form2.ddlWaistSize.style.backgroundColor=ChooseColor("");
document.Form2.txtComments.style.backgroundColor=ChooseColor("");
document.Form2.txtHipSize.style.backgroundColor=ChooseColor("");
document.Form2.ddlCountryCode.style.backgroundColor=ChooseColor("");
document.Form2.txtFinishSize.style.backgroundColor=ChooseColor("");
document.Form2.txtSkinSize.style.backgroundColor=ChooseColor("");

document.Form2.rb_baggy.style.backgroundColor=ChooseColor("");	
document.Form2.rb_good.style.backgroundColor=ChooseColor("");	
document.Form2.rb_tight.style.backgroundColor=ChooseColor("");
document.Form2.rbtgood.style.backgroundColor=ChooseColor("");	
document.Form2.rbtbaggy.style.backgroundColor=ChooseColor("");	
document.Form2.rbttight.style.backgroundColor=ChooseColor("");

//
		if(isBlank(document.Form2.txtHipSize.value))
		{
		Err = true
		document.Form2.txtHipSize.style.backgroundColor=ChooseColor("Err");
		}
//
		if(document.Form2.ddlCountryCode.selectedIndex==0)
		{
		Err = true
		document.Form2.ddlCountryCode.style.backgroundColor=ChooseColor("Err");
		}
		
		if(document.Form2.ddlBottomsize.selectedIndex==0)
		{
		Err = true
		document.Form2.ddlBottomsize.style.backgroundColor=ChooseColor("Err");
		}
		
//
		if(isBlank(document.Form2.mdlHtWt_txtweight.value))
		{
		Err = true		
		document.Form2.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("Err");
		}
		
		if(document.Form2.mdlHtWt_ddlJacketSize.selectedIndex==0)
		{
		Err = true
		document.Form2.mdlHtWt_ddlJacketSize.style.backgroundColor=ChooseColor("Err");
	}

//
		if(document.Form2.ddlsizeInseamLeft.selectedIndex==0)
		{
		Err = true
		document.Form2.ddlsizeInseamLeft.style.backgroundColor=ChooseColor("Err");
		}
		
		if(document.Form2.ddlsizeInseamRight.selectedIndex==0)
		{
		Err = true
		document.Form2.ddlsizeInseamRight.style.backgroundColor=ChooseColor("Err");
		}
//
		if(document.Form2.ddlBottomsize.selectedIndex==0)
		{
		Err = true
		document.Form2.ddlBottomsize.style.backgroundColor=ChooseColor("Err");
		}
		
//
		if(document.Form2.ddlsizeOutseamLeft.selectedIndex==0)
		{
		Err = true
		document.Form2.ddlsizeOutseamLeft.style.backgroundColor=ChooseColor("Err");
		}
		
		if(document.Form2.ddlsizeOutseamRight.selectedIndex==0)
		{
		Err = true
		document.Form2.ddlsizeOutseamRight.style.backgroundColor=ChooseColor("Err");
		}
//
		if (document.Form2.ddlWaistSize.selectedIndex==0 && document.Form2.rbtnLabelSize.checked==true)
		{
			Err = true
			document.Form2.ddlWaistSize.style.backgroundColor=ChooseColor("Err");
		}
		
		if (isBlank(document.Form2.txtSkinSize.value) && document.Form2.rbtnSkinsize.checked==true)
		{
			Err = true;
			document.Form2.txtSkinSize.style.backgroundColor=ChooseColor("Err");
		}
		
			if (isBlank(document.Form2.txtFinishSize.value) && document.Form2.rbtnFinishSlack.checked==true)
		{
			Err = true;
			document.Form2.txtFinishSize.style.backgroundColor=ChooseColor("Err");
		}
		
		
		if((document.getElementById('rb_good').checked == false) && (document.getElementById('rb_baggy').checked == false) && (document.getElementById('rb_tight').checked == false))
		{
			Err = true
			document.Form2.rb_baggy.style.backgroundColor=ChooseColor("Err");	
			document.Form2.rb_good.style.backgroundColor=ChooseColor("Err");	
			document.Form2.rb_tight.style.backgroundColor=ChooseColor("Err");	
					
		}
		if((document.getElementById('rbtgood').checked == false) && (document.getElementById('rbtbaggy').checked == false) && (document.getElementById('rbttight').checked == false))	
		{
			Err = true			
			document.Form2.rbtgood.style.backgroundColor=ChooseColor("Err");	
			document.Form2.rbtbaggy.style.backgroundColor=ChooseColor("Err");	
			document.Form2.rbttight.style.backgroundColor=ChooseColor("Err");	
		}		 
		if (Err == true)
		{
		
		ShowError(ErrMsg);
		return false;
		}
	
////
		
	if(CheckString(document.Form2.mdlHtWt_txtweight.value)==false)	
		{
		Err = true
		document.Form2.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("Err");
		}
		
		
		if (Err == true)
		{
		ErrMsg += "Please enter a proper weight. ";
		ShowError(ErrMsg);
		return false;
		}
		if((document.Form2.txtComments.value).length > 250)
		{
		ErrMsg += "Please enter the comments within 250 characters.";
		ShowError(ErrMsg);
		document.Form2.txtComments.style.backgroundColor=ChooseColor("Err");
		return false;
		}
		
		if(document.Form2.txtHipSize.value == 0)
		{
		
		ErrMsg += " Hip size cannot be zero ";
		ShowError(ErrMsg);
		document.Form2.txtHipSize.style.backgroundColor=ChooseColor("Err");
		return false;
		}		
}





//newly added by satty for slack validation standard measuremnt
function StandardSlackhValidation()
{

var ErrMsg=""
//ErrMsg+="The entered datas will be retrieved once you login.<br>"; 
var Err = false
document.Form2.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("");
document.Form2.mdlHtWt_ddlJacketSize.style.backgroundColor=ChooseColor("");
document.Form2.ddlsizeInseamLeft.style.backgroundColor=ChooseColor("");
document.Form2.ddlsizeInseamRight.style.backgroundColor=ChooseColor("");
document.Form2.ddlWaistSize.style.backgroundColor=ChooseColor("");
document.Form2.ddlWaistSkinSize.style.backgroundColor=ChooseColor("");
document.Form2.ddlWaistFinishedSize.style.backgroundColor=ChooseColor("");
document.Form2.txtComments.style.backgroundColor=ChooseColor("");
document.Form2.ddlCountryCode.style.backgroundColor=ChooseColor("");
document.Form2.rb_baggy.style.backgroundColor=ChooseColor("");	
document.Form2.rb_good.style.backgroundColor=ChooseColor("");	
document.Form2.rb_tight.style.backgroundColor=ChooseColor("");
document.Form2.rbtgood.style.backgroundColor=ChooseColor("");	
document.Form2.rbtbaggy.style.backgroundColor=ChooseColor("");	
document.Form2.rbttight.style.backgroundColor=ChooseColor("");

if(document.Form2.mdlHtWt_ddlJacketSize.selectedIndex==0){
		Err = true
		document.Form2.mdlHtWt_ddlJacketSize.style.backgroundColor=ChooseColor("Err");
	}
	
//
		if(document.Form2.ddlCountryCode.selectedIndex==0)
		{
		Err = true
		document.Form2.ddlCountryCode.style.backgroundColor=ChooseColor("Err");
		}
//
		if(isBlank(document.Form2.mdlHtWt_txtweight.value))
		{
		Err = true
		document.Form2.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("Err");
		}

//
		if(document.Form2.ddlsizeInseamLeft.selectedIndex==0)
		{
		Err = true
		document.Form2.ddlsizeInseamLeft.style.backgroundColor=ChooseColor("Err");
		}
		
		if(document.Form2.ddlsizeInseamRight.selectedIndex==0)
		{
		Err = true
		document.Form2.ddlsizeInseamRight.style.backgroundColor=ChooseColor("Err");
		}
//
		if (document.Form2.ddlWaistSize.selectedIndex==0 && document.Form2.rbtnLabelSize.checked==true)
		{
			Err = true
			document.Form2.ddlWaistSize.style.backgroundColor=ChooseColor("Err");
		}
		
		if (document.Form2.ddlWaistSkinSize.selectedIndex==0 && document.Form2.rbtnSkinsize.checked==true)
		{
			Err = true;
			document.Form2.ddlWaistSkinSize.style.backgroundColor=ChooseColor("Err");
		}
		
			if (document.Form2.ddlWaistFinishedSize.selectedIndex==0 && document.Form2.rbtnFinishSlack.checked==true)
		{
			Err = true;
			document.Form2.ddlWaistFinishedSize.style.backgroundColor=ChooseColor("Err");
		}
		
		if((document.getElementById('rb_good').checked == false) && (document.getElementById('rb_baggy').checked == false) && (document.getElementById('rb_tight').checked == false))
		{
			Err = true
			document.Form2.rb_baggy.style.backgroundColor=ChooseColor("Err");	
			document.Form2.rb_good.style.backgroundColor=ChooseColor("Err");	
			document.Form2.rb_tight.style.backgroundColor=ChooseColor("Err");	
					
		}
		if((document.getElementById('rbtgood').checked == false) && (document.getElementById('rbtbaggy').checked == false) && (document.getElementById('rbttight').checked == false))	
		{
			Err = true
			document.Form2.rbtgood.style.backgroundColor=ChooseColor("Err");	
			document.Form2.rbtbaggy.style.backgroundColor=ChooseColor("Err");	
			document.Form2.rbttight.style.backgroundColor=ChooseColor("Err");	
		}		 
		 
		if (Err == true)
		{
		ErrMsg += "The fields marked with * are required. ";
		ShowError(ErrMsg);
		return false;
		}
	
////
	if(CheckString(document.Form2.mdlHtWt_txtweight.value)==false)	
		{
		Err = true
		document.Form2.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("Err");
		}
		
		
	if (Err == true)
		{
		ErrMsg += "Please enter a proper weight. ";
		ShowError(ErrMsg);
		return false;
		}
		if((document.Form2.txtComments.value).length > 250)
		{
		ErrMsg += "Please enter the comments within 250 characters.";
		ShowError(ErrMsg);
		document.Form2.txtComments.style.backgroundColor=ChooseColor("Err");
		return false;
		}		
	
}
function stdvalid(val)
{
	
	var ErrMsg =""
	if (val==1){ErrMsg+="The entered datas will be retrieved once you login.<br>"; }
	var Err = false
	document.frm.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("");
	document.frm.mdlHtWt_ddlJacketSize.style.backgroundColor=ChooseColor("");
	document.frm.mdlHtWt_ddlSlacksize.style.backgroundColor=ChooseColor("");
	document.frm.ddlNeckSize.style.backgroundColor=ChooseColor("");
	document.frm.ddlSleeves.style.backgroundColor=ChooseColor("");
	document.frm.mdlMeasurementImages_txtMeasurementComments.style.backgroundColor=ChooseColor("");
	//
	if(isBlank(document.frm.mdlHtWt_txtweight.value))	{
		Err = true
		document.frm.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("Err");
	}
	
	//
	if(document.frm.mdlHtWt_ddlJacketSize.selectedIndex==0){
		Err = true
		document.frm.mdlHtWt_ddlJacketSize.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(document.frm.mdlHtWt_ddlSlacksize.selectedIndex==0){
		Err = true
		document.frm.mdlHtWt_ddlSlacksize.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(document.frm.ddlNeckSize.selectedIndex==0){
		Err = true
		document.frm.ddlNeckSize.style.backgroundColor=ChooseColor("Err");
	}
	//
	if(document.frm.ddlSleeves.selectedIndex==0){
		Err = true
		document.frm.ddlSleeves.style.backgroundColor=ChooseColor("Err");
	}
		
	if (Err == true)
	{
		ErrMsg += "The fields marked with * are required. ";
		ShowError(ErrMsg);
		return false;
	}
	
	//
	if(CheckString(document.frm.mdlHtWt_txtweight.value)==false)	{
		Err = true
		document.frm.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("Err");
	}
		
	if (Err == true)
	{
		ErrMsg += "Please enter a proper weight. ";
		ShowError(ErrMsg);
		return false;
	}
	
	if((document.frm.mdlMeasurementImages_txtMeasurementComments.value).length > 250){
		ErrMsg += "Please enter the comments within 250 characters.";
		ShowError(ErrMsg);
		document.frm.mdlMeasurementImages_txtMeasurementComments.style.backgroundColor=ChooseColor("Err");
		return false;
	}
	//alert('');
	if((document.getElementById('mdlMeasurementImages_rbtnAtHome').checked == false) && (document.getElementById('mdlMeasurementImages_rbtnCommLaundry').checked == false) && (document.getElementById('mdlMeasurementImages_rbtnboth').checked == false))	{
		ErrMsg += "Please select your laundry type.  <a href='#Laundry' class='errorMessageLink'>go there</a>";
		ShowError(ErrMsg);
		return false;
	}
	
	return true;
}

function ValidateBeltMeasurement()
{
	var ErrMsg
	document.frm.txtBestFitting.style.backgroundColor=ChooseColor("");
	document.frm.ddlStandard.style.backgroundColor=ChooseColor("");
	
	if(document.frm.rbBestFitting.checked == false && document.frm.rbStandard.checked == false && document.frm.rbPreviousSize.checked == false)
	{
		ErrMsg = "Please select any one method of measurement.";
		ShowError(ErrMsg);
		return false;
	}
	if(document.frm.rbBestFitting.checked == true && CheckString(document.frm.txtBestFitting.value) == false)
	{
		ErrMsg = "Please enter a valid input for size field.";
		ShowError(ErrMsg);
		document.frm.txtBestFitting.style.backgroundColor=ChooseColor("Err");
		return false;
	}
	if(document.frm.rbStandard.checked == true && document.frm.ddlStandard.selectedIndex==0)
	{
		ErrMsg = "Please select your size from the standard sizes.";
		ShowError(ErrMsg);
		document.frm.ddlStandard.style.backgroundColor=ChooseColor("Err");
		return false;
	}
}

function EnableControl()
{
 
 if (document.frm.rbBestFitting.checked==true)
		{
		document.frm.ddlStandard.selectedIndex=0;
		document.frm.ddlStandard.disabled=true;
		document.frm.txtBestFitting.disabled=false;
		
		}
	else if	(document.frm.rbStandard.checked == true)
		{
		
		document.frm.txtBestFitting.disabled=true;
		document.frm.txtBestFitting.value=""
		document.frm.ddlStandard.disabled=false;
		}
	else if(document.frm.rbPreviousSize.checked == true)	
			{
		
		document.frm.txtBestFitting.disabled=true;
		document.frm.ddlStandard.disabled=true;
		document.frm.ddlStandard.selectedIndex=0
		document.frm.txtBestFitting.value=""
			}
	
}

function ValidateLastSizeWithChange()
{
var ErrMsg =""
        
        var Err = false
        document.Form1.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("");
        document.Form1.mdlHtWt_ddlJacketSize.style.backgroundColor=ChooseColor("");
        document.Form1.mdlHtWt_ddlSlacksize.style.backgroundColor=ChooseColor("");
                //
        if(isBlank(document.Form1.mdlHtWt_txtweight.value))     {
                Err = true
                document.Form1.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("Err");
        }
        
        //
        if(document.Form1.mdlHtWt_ddlJacketSize.selectedIndex==0){
                Err = true
                document.Form1.mdlHtWt_ddlJacketSize.style.backgroundColor=ChooseColor("Err");
        }
        //
        if(document.Form1.mdlHtWt_ddlSlacksize.selectedIndex==0){
                Err = true
                document.Form1.mdlHtWt_ddlSlacksize.style.backgroundColor=ChooseColor("Err");
        }
        if (Err == true)
        {
                ErrMsg += "The fields marked with * are required. ";
                ShowError(ErrMsg);
                return false;
        }
        
        //
        if(CheckString(document.Form1.mdlHtWt_txtweight.value)==false)  {
                Err = true
                document.Form1.mdlHtWt_txtweight.style.backgroundColor=ChooseColor("Err");
        }
                
        if (Err == true)
        {
                ErrMsg += "Please enter a proper weight. ";
                ShowError(ErrMsg);
                return false;
        }
        
        return true;
}


	function chkRadio()
	{
       if(document.getElementById("rbtnLabelSize").checked==true)
		{		
		document.getElementById("ddlWaistSize").disabled=false;
		document.getElementById("txtFinishSize").disabled=true;		
		document.getElementById("txtSkinSize").disabled=true;		
		
		document.getElementById("txtFinishSize").value="";
		document.getElementById("txtSkinSize").value="";
		document.getElementById("ddlWaistSize").focus();
		}			
		else if(document.getElementById("rbtnSkinsize").checked==true)
		{
		
		document.getElementById("txtFinishSize").value="";
		
		document.getElementById("txtSkinSize").disabled=false;		
		document.getElementById("txtFinishSize").disabled=true;		
		document.getElementById("ddlWaistSize").disabled=true;
		
		document.getElementById("txtSkinSize").focus();
		
		}	
		
		else if(document.getElementById("rbtnFinishSlack").checked==true)
		{
		document.getElementById("txtFinishSize").disabled=false;
		document.getElementById("txtSkinSize").disabled=true;
		document.getElementById("ddlWaistSize").disabled=true;
		
		
		document.getElementById("txtSkinSize").value="";
		document.getElementById("txtFinishSize").focus();
		
		
		}		
		 
	}
	
		function chkRadioStandard()
	{
       if(document.getElementById("rbtnLabelSize").checked==true)
		{		
		document.getElementById("ddlWaistSize").disabled=false;
		document.getElementById("ddlWaistSkinSize").disabled=true;		
		document.getElementById("ddlWaistFinishedSize").disabled=true;		
		document.getElementById("ddlWaistSize").focus();
		}			
		else if(document.getElementById("rbtnSkinsize").checked==true)
		{
		document.getElementById("ddlWaistSkinSize").disabled=false;		
		document.getElementById("ddlWaistFinishedSize").disabled=true;		
		document.getElementById("ddlWaistSize").disabled=true;
		document.getElementById("ddlWaistSkinSize").focus();
		}	
		else if(document.getElementById("rbtnFinishSlack").checked==true)
		{
		document.getElementById("ddlWaistFinishedSize").disabled=false;
		document.getElementById("ddlWaistSkinSize").disabled=true;
		document.getElementById("ddlWaistSize").disabled=true;
		document.getElementById("ddlWaistFinishedSize").focus();
		}		
		 
	}
	
	function SetWaist(ctrl)
	{
	
		if (ctrl == "ddlWaistSize")
		{
				document.getElementById("ddlWaistFinishedSize").selectedIndex = document.getElementById("ddlWaistSize").selectedIndex;
				document.getElementById("ddlWaistSkinSize").selectedIndex = document.getElementById("ddlWaistSize").selectedIndex;
		}
		else if (ctrl == "ddlWaistSkinSize")
		{
				document.getElementById("ddlWaistFinishedSize").selectedIndex = document.getElementById("ddlWaistSkinSize").selectedIndex;
				document.getElementById("ddlWaistSize").selectedIndex = document.getElementById("ddlWaistSkinSize").selectedIndex;
		}
		else if (ctrl == "ddlWaistFinishedSize")
		{
				document.getElementById("ddlWaistSize").selectedIndex = document.getElementById("ddlWaistFinishedSize").selectedIndex;
				document.getElementById("ddlWaistSkinSize").selectedIndex = document.getElementById("ddlWaistFinishedSize").selectedIndex;
		}
	
	}
	
	function CalculateFinishedSize()
	{
		if (document.getElementById("rbtnLabelSize").checked==true)
		{
			var v = document.getElementById("ddlWaistSize").value
			document.getElementById("txtFinishSize").value = eval(v) + 1.5
		} 
		
		if(document.getElementById("rbtnSkinsize").checked==true)
		{
			document.getElementById("txtFinishSize").value = document.getElementById("txtSkinSize").value;
		}
	}