
//This method handles click event of 
//main menu link is clicked
function MainMenuLink_Click()
{
	return confirm("Are you sure you want to navigate away from page? \r\n\r\n Changes have not been saved. \r\n\r\n Press OK to continue, or Cancel to stay on current page.");
}
//This function is called on body onload event in ProjectDetails.aspx
//It disables Asia and Europe option for project area,
//South America option for project geography
//and Weather Sealing option for project application
function DisableOption()
{
	if(ProjectDetails.AreaRadioButtonList!=null && ProjectDetails.AreaRadioButtonList!=undefined && ProjectDetails.AreaRadioButtonList.length>0)
	{
		for (i=0; i<ProjectDetails.AreaRadioButtonList.length; i++)
		{
			if(ProjectDetails.AreaRadioButtonList[i].value!='11')
				ProjectDetails.AreaRadioButtonList[i].disabled=true
		}
	}
	
	if(ProjectDetails.ApplicationRadioButtonList!=null && ProjectDetails.ApplicationRadioButtonList!=undefined && ProjectDetails.ApplicationRadioButtonList.length>0)
	{
		for (i=0; i<ProjectDetails.ApplicationRadioButtonList.length; i++)
		{
			if(ProjectDetails.ApplicationRadioButtonList[i].value!='STRUCTURAL')
				ProjectDetails.ApplicationRadioButtonList[i].disabled=true
		}
	}
	
	if(ProjectDetails.RegionRadioButtonList!=null && ProjectDetails.RegionRadioButtonList!=undefined && ProjectDetails.RegionRadioButtonList.length>0)
	{
		for (i=0; i<ProjectDetails.RegionRadioButtonList.length; i++)
		{
			if(ProjectDetails.RegionRadioButtonList[i].value!='NA')
				ProjectDetails.RegionRadioButtonList[i].disabled=true
		}
	}
}
//This function is called on body onload event in DrawingDetails.aspx
//It binds HideWeightDiv() method to onclick event of 'deadload' radio button list 
//and HideSlopeDiv() method to onclick event of 'is sloped glazing 
//application' on DrawingDetails.aspx 
function AddOnClickHandlerForIsDeadLoadOption()
{
	
	//if(DrawingDetails.DeadloadRadiobuttonList!=null && DrawingDetails.DeadloadRadiobuttonList!=undefined && DrawingDetails.DeadloadRadiobuttonList.length>0)
	//{		
	//	for (i=0; i<DrawingDetails.DeadloadRadiobuttonList.length; i++)
	//	{
	//		DrawingDetails.DeadloadRadiobuttonList[i].onclick=HideWeightDiv
	//	}
	//}
	if(DrawingDetails.SlopedGlazingAppRadioButtonList!=null && DrawingDetails.SlopedGlazingAppRadioButtonList!=undefined && DrawingDetails.SlopedGlazingAppRadioButtonList.length>0)
	{
		for (i=0; i<DrawingDetails.SlopedGlazingAppRadioButtonList.length; i++)
		{
			DrawingDetails.SlopedGlazingAppRadioButtonList[i].onclick=HideSlopeDiv
		}
	}
}

//It enables or disables Add New Detail link on DrawingDetails.aspx depending on
//value of 'multiple structural detail' option
function EODAddNewLink()
{
	if(DrawingDetails.MultipleStructDetailsRadioButtonList[0].checked)
		document.getElementById('TabFooter1_AddNewButton').disabled =false;
	else
		document.getElementById('TabFooter1_AddNewButton').disabled =true;
		
	
}
//Depending on the value of 'is deadload' option on Drawingdetail.aspx it 
//hide or unhide the table row containing panel weight, window length and window width inputs
function HideWeightDiv()
{
	if(DrawingDetails.DeadloadRadiobuttonList[0].checked)
		document.getElementById('WeightDiv').style.display ="block";
	else
		document.getElementById('WeightDiv').style.display ="none";
}
//Depending on the value of 'is sloped glazing application' option on Drawingdetail.aspx 
//it hide or unhide the table row containing slope input
function HideSlopeDiv()
{
	if(DrawingDetails.SlopedGlazingAppRadioButtonList[0].checked)
		document.getElementById('SlopeDiv').style.display ="block";
	else
		document.getElementById('SlopeDiv').style.display ="none";
}
//Trims the space character present at the 
//begining and the end of the string
function Trim(str){
	var regex
	var output
	
	regex=/^\s+|\s+$/
	output=str.replace(regex,'');
	return output;
}
//Validates if Width field is entered on DrawingDetails.aspx
//(applicable for rectangular/square shape panel)
function ValidateWidth(sender,args)
{
	if(DrawingDetails.PanelRadiobuttonList[0].checked && Trim(document.getElementById('WidthInput').value)=='')
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates value of Width field entered on DrawingDetails.aspx
//(applicable for rectangular/square shape panel)
function ValidatePanelWidthValue(sender,args)
{
	
	if(document.getElementById('WidthInput')!=null && !CheckSignedDecimal(document.getElementById('WidthInput').value,5,2))
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates if Height field is entered on DrawingDetails.aspx
//(applicable for rectangular/square shape panel)
function ValidateHeight(sender,args)
{
	if(DrawingDetails.PanelRadiobuttonList[0].checked && Trim(document.getElementById('HeightInput').value)=='')
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates value of Height field entered on DrawingDetails.aspx
//(applicable for rectangular/square shape panel)
function ValidateHeightValue(sender,args)
{
	if(document.getElementById('HeightInput')!=null && !CheckSignedDecimal(document.getElementById('HeightInput').value,5,2))
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates if Thickness field is entered on DrawingDetails.aspx
//(applicable for rectangular/square shape panel)
function ValidateThickness(sender,args)
{
	if(DrawingDetails.PanelRadiobuttonList[0].checked && Trim(document.getElementById('ThicknessInput').value)=='')
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates value of Thickness field entered on DrawingDetails.aspx
//(applicable for rectangular/square shape panel)
function ValidateThicknessValue(sender,args)
{
	if(document.getElementById('ThicknessInput')!=null && !CheckSignedDecimal(document.getElementById('ThicknessInput').value,3,2))
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates if Radius field is entered on DrawingDetails.aspx
//(applicable for circular shape panel)
function ValidateRadius(sender,args)
{
	if(DrawingDetails.PanelRadiobuttonList[1].checked && Trim(document.getElementById('RadiusInput').value)=='')
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates value of Radius field entered on DrawingDetails.aspx
//(applicable for circular shape panel)
function ValidateRadiusValue(sender,args)
{
	if(document.getElementById('RadiusInput')!=null && !CheckSignedDecimal(document.getElementById('RadiusInput').value,5,2))
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates if Short Base Leg field is entered on DrawingDetails.aspx
//(applicable for triangular shape panel)
function ValidateShortBaseLeg(sender,args)
{
	if(DrawingDetails.PanelRadiobuttonList[2].checked && Trim(document.getElementById('ShortBaseLegInput').value)=='')
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates value of  Short Base Leg field entered on DrawingDetails.aspx
//(applicable for triangular shape panel)
function ValidateShortBaseLegValue(sender,args)
{
	if(document.getElementById('ShortBaseLegInput')!=null && !CheckSignedDecimal(document.getElementById('ShortBaseLegInput').value,5,2))
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates if Angle 1 field is entered on DrawingDetails.aspx
//(applicable for triangular shape panel)
function ValidateAngle1(sender,args)
{
	if(DrawingDetails.PanelRadiobuttonList[2].checked && Trim(document.getElementById('Angle1LegInput').value)=='')
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates if Proposed glueline Thickness field is entered on DrawingDetails.aspx
function ValidateGlueLineThickness(sender,args)
{
	if(!CheckSignedDecimal(document.getElementById('GluelineThickenessInput').value,3,3))
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates if Angle 2 field is entered on DrawingDetails.aspx
//(applicable for triangular shape panel)
function ValidateAngle2(sender,args)
{
	if(DrawingDetails.PanelRadiobuttonList[2].checked && Trim(document.getElementById('Angle2LegInput').value)=='')
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates value of Angle 2 field entered on DrawingDetails.aspx
//(applicable for triangular shape panel)
function ValidateAngle2Value(sender,args)
{
	if(document.getElementById('Angle2LegInput')!=null && !CheckSignedDecimal(document.getElementById('Angle2LegInput').value,3,2))
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates if Panel Weight field is entered on DrawingDetails.aspx
//(applicable if panel is in deadload)
//Required field Only if sloped glazing (for Rectangular/ciruclar/Triangular) or not deadload supported (Only Rectangular)
function ValidatePanelWeight(sender,args)
{
	if((DrawingDetails.SlopedGlazingAppRadioButtonList[0].checked ||
		 (DrawingDetails.PanelRadiobuttonList[0].checked && DrawingDetails.DeadloadRadiobuttonList!=undefined 
			&& DrawingDetails.DeadloadRadiobuttonList[1].checked))
				&& Trim(document.getElementById('PanelWeightInput').value)=='')
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates if Window Width field is entered on DrawingDetails.aspx
//(applicable if panel is in deadload)
function ValidateWindowWidth(sender,args)
{
	if(DrawingDetails.DeadloadRadiobuttonList!=undefined && DrawingDetails.DeadloadRadiobuttonList[0].checked && Trim(document.getElementById('WindowWidthInput').value)=='')
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates if Window Length field is entered on DrawingDetails.aspx
//(applicable if panel is in deadload)
function ValidateWindowLength(sender,args)
{
	if(DrawingDetails.DeadloadRadiobuttonList!=undefined && DrawingDetails.DeadloadRadiobuttonList[0].checked &&  Trim(document.getElementById('WindowLengthInput').value)=='')
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates if Slope field is entered on DrawingDetails.aspx
//(applicable if sloped glazing application)
function ValidateSlope(sender,args)
{
	if(DrawingDetails.SlopedGlazingAppRadioButtonList[0].checked && Trim(document.getElementById('SlopeInput').value)=='')
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates format of Panel Weight field entered on DrawingDetails.aspx
//(applicable if panel is in deadload)
function ValidatePanelWeightValue(sender,args)
{
	if((DrawingDetails.SlopedGlazingAppRadioButtonList[0].checked ||
		 (DrawingDetails.PanelRadiobuttonList[0].checked && DrawingDetails.DeadloadRadiobuttonList!=undefined 
			&& DrawingDetails.DeadloadRadiobuttonList[1].checked)))
	{		
		if(document.getElementById('PanelWeightInput')!=null && !CheckSignedDecimal(document.getElementById('PanelWeightInput').value,3,2))
		{
			args.IsValid=false;
			return;
		}
	}
	args.IsValid=true;
}
function ValidateWindloadValue(sender,args)
{
	if(document.getElementById('WindloadInput')!=null && !CheckSignedDecimal(document.getElementById('WindloadInput').value,5,0))
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates format of Window Length field  entered on DrawingDetails.aspx
//(applicable if panel is in deadload)
function ValidateWindowLengthValue(sender,args)
{
	if(document.getElementById('WindowLengthInput')!=null && !CheckSignedDecimal(document.getElementById('WindowLengthInput').value,3,2))
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates format of Window Width field entered on DrawingDetails.aspx
//(applicable if panel is in deadload)
function ValidateWindowWidthValue(sender,args)
{
	if(document.getElementById('WindowWidthInput')!=null && !CheckSignedDecimal(document.getElementById('WindowWidthInput').value,3,2))
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Validates format of Proposed Silicone Bite field entered on DrawingDetails.aspx
//(applicable if panel is in deadload)
function ValidateSiliconBiteDimensionValue(sender,args)
{
	if(!CheckSignedDecimal(document.getElementById('SiliconBiteDimensionInput').value,3,3))
	{
		args.IsValid=false;
		return;
	}
	else if(document.getElementById('SiliconBiteDimensionInput').value==0)
	{
		args.IsValid=false;
		return;
	}
	args.IsValid=true;
}
//Depending on precision and scale parameter passed it checks if the value 
//passed is a valid decimal value or not 
function CheckSignedDecimal(strValue, strPrecision, strScale)
{ 
	var re= new RegExp("^(\\+|)?\\d{0,"+strPrecision+"}([.]\\d{0,"+strScale+"})?$") 
	
	if(strValue.length > 0 && !(re.test(strValue)))
		return false;
	else 
		return true; 	
} 
//Enable or disable the other spacer type textbox depending on option selected in 
//spacer checkbox list. This textbox will be only enabled if other option is selected in
//checkbox list
function TypeOfSpacerCheckBoxClick()
{
	if(document.getElementById('TypeOfSpacerOtherCheckBox').checked) 
		document.getElementById('TypeOfSpacerOtherInput').disabled = false;
	else
	{
		document.getElementById('TypeOfSpacerOtherInput').value = "";
		document.getElementById('TypeOfSpacerOtherInput').disabled = true;
	}
}

/*function BindSelectorCheckBoxClick()
{
	var inputtags=document.getElementsByTagName("input");
	
	for (i=0; i<inputtags.length; i++)
	{
		if (inputtags[i].type=="checkbox" && inputtags[i].name.indexOf("TypeOfSpacerCheckBoxList") >= 0)
		{
			inputtags[i].onclick = SubstrateSelectorCheckBoxClick;
		}
	}
}*/
//Enable or disable the other substrate textbox depending on option selected in 
//substrate checkbox list. This textbox will only be enabled if other option is selected in
//checkbox list
function SubstrateSelectorCheckBoxClick()
{
	if(document.getElementById('SubstrateSelectorOtherCheckBox').checked) 
	{
		document.getElementById('SubstrateSelectorOtherInput').disabled = false;
		RemoveAll(SealantDetails.pickboxpair1_Select, SealantDetails.pickboxpair1_Selected, pickboxpair1_DataArray);
	}
	else
	{
		document.getElementById('SubstrateSelectorOtherInput').value = "";
		document.getElementById('SubstrateSelectorOtherInput').disabled = true;
	}
}
//Enable or disable the other block type textbox depending on option selected in 
//block type dropdown. This textbox will only be enabled if other option is selected in
//dropdown
function SettingBlockTypeDropDownChange()
{
	if(Trim(document.getElementById('SettingBlockTypeDropDown').value) == "OTH_BLOCK") 
		document.getElementById('SettingBlockTypeOtherInput').disabled = false;
	else
	{
		document.getElementById('SettingBlockTypeOtherInput').value = "";	
		document.getElementById('SettingBlockTypeOtherInput').disabled = true;
	}
}
//Displays alert message if user tries to delete a 
//particular detail - customer detail, drawing detail
function ondeleteclick()
{
	return confirm("Are you sure you want to delete this detail?")
}
//Validates if fax/email entered on Customer details screen 
//depending on mode of communication selected
function FinalLetterRadioButtonSelect(sender,args)
{
	for (i=0; i<CustomerDetails.FinalLetterRadioButtonList.length; i++)
	{
		if(CustomerDetails.FinalLetterRadioButtonList[i].checked)
		{
			if (CustomerDetails.FinalLetterRadioButtonList[i].value == 'E' && document.getElementById("ContactEmailInput").value == "")
			{
				args.IsValid=false;
				return;
			}
			if (CustomerDetails.FinalLetterRadioButtonList[i].value == 'F' && document.getElementById("ContactFaxInput").value == "")
			{
				args.IsValid=false;
				return;
			}
		}		
	}
	args.IsValid=true;
}
//This function is used by date selector control
//It displays date selected in the instance of textbox 
//passed to the function
function ReturnedDate(dateSelected, controlToSet)
{
	var field = document.getElementById(controlToSet);
	field.value = dateSelected;
}

//Bind SetStatus function to the onchange event all the controls of type 
//input, textarea and select
function BindOnChangeEvent()
{
	var inputtags=document.getElementsByTagName("input")
	for (i=0; i<inputtags.length; i++)
	{
		inputtags[i].onchange = SetStatus
	}
	
	var textareatags=document.getElementsByTagName("textarea")
	for (i=0; i<textareatags.length; i++)
	{
		textareatags[i].onchange = SetStatus
	}
	
	var selecttags=document.getElementsByTagName("select")
	for (i=0; i<selecttags.length; i++)
	{
		inputtags[i].onchange = SetStatus
	}
}
//BindOnChangeEvent() internally calls this method
//This method sets the DataChangedIndicatorInput field on the webform 
//if state of the any of the input field on the webform is changed 
function SetStatus()
{
	if(event.srcElement!=null)
		document.getElementById('DataChangedIndicatorInput').value='Y';
}
//Handles click event of Next button on CutomerDetails.aspx and Drawingdetails.aspx
function Next_Click()
{
	if(document.getElementById('DataChangedIndicatorInput').value=='Y')
	{
		if (confirm("Do you want save changes and navigate away from page? \r\n\r\n Click OK to Save changes and navigate. \r\n\r\n Click Cancel to navigate without Saving changes."))
		{
			EnableAllValidators();
		}
		else
		{ 	
			document.getElementById('SaveCustopmerInput').value='N';
			DisableAllValidators();
		}
	}
	else 
		DisableAllValidators();
}
//Enables all the validators on a page
function EnableAllValidators()
{
	for(var j=0;j< Page_Validators.length;j++)
	{
		ValidatorEnable(Page_Validators[j], true);
	}
}
//Disables all the validators on a page
function DisableAllValidators()
{
	for(i=0;i< Page_Validators.length;i++)
	{
		ValidatorEnable(Page_Validators[i], false);
	}
}

function CheckAdditionaladdress()
{
	if(document.getElementById("CustIDHidden").value >= 1 && document.getElementById('CompanyNameInput').value == "" && document.getElementById('CompanyAddressInput').value == "" && document.getElementById('CityInput').value == "" && document.getElementById('PostalCodeInput').value == "" && document.getElementById('ContactNameInput').value == "" && document.getElementById('ContactPhoneInput').value == "" && document.getElementById('ContactEmailInput').value == "" && document.getElementById('ContactFaxInput').value == '')
	{
		DisableAllValidators();
	}
	else
	{
		EnableAllValidators();
	}
}

function CheckAdditionalDrawing()
{
	if(DrawingDetails.PanelRadiobuttonList[0].checked)
	{
		if(document.getElementById("DrawIDHidden").value >= 1 && document.getElementById('SheetNoReviwedInput').value == "" && document.getElementById('DetailNumberReviewedInput').value == "" && document.getElementById('HeightInput').value == "" && document.getElementById('WidthInput').value == "" && document.getElementById('PanelWeightInput').value == '' && document.getElementById('PanelTypeDropdown').value == "" && document.getElementById('WindloadInput').value == "" && document.getElementById('SiliconBiteDimensionInput').value == "" && document.getElementById('GluelineThickenessInput').value == '')		
		{
			ValidatorEnable(document.all("DrawingSheetRequiredValidator"),false);	
			ValidatorEnable(document.all("RevisionDateSelector__ctl2"),false);	
			ValidatorEnable(document.all("SlopedGlazingAppIndRequiredValidator"),false);
			ValidatorEnable(document.all("SlopeRequiredValidator"),false);
			ValidatorEnable(document.all("SlopeRangeValidator"),false);
			ValidatorEnable(document.all("SheetNoReviwedRequiredValidator"),false);
			ValidatorEnable(document.all("DetailNumberReviewedRequiredValidator"),false);
			ValidatorEnable(document.all("WidthRequiredValidator"),false);
			ValidatorEnable(document.all("PanelWidthFormatValidator"),false);
			ValidatorEnable(document.all("HeightRequiredValidator"),false);
			ValidatorEnable(document.all("PanelHeightFormatValidator"),false);
			ValidatorEnable(document.all("PanelWeightRequiredValidator"),false);
			ValidatorEnable(document.all("PanelWeightFormatValidator"),false);
			ValidatorEnable(document.all("DeadloadIndicatorRequiredValidator"),false);
			ValidatorEnable(document.all("WindloadFormatValidator"),false);
			ValidatorEnable(document.all("WindloadInputRequiredValidator"),false);
			ValidatorEnable(document.all("SiliconBiteRequiredValidator"),false);
			ValidatorEnable(document.all("SiliconeBiteDimensionFormatValidator"),false);
			ValidatorEnable(document.all("SiliconBiteCompareValidator"),false);
			ValidatorEnable(document.all("GluelineThicknessRequiredValidator"),false);
			ValidatorEnable(document.all("GlueLineThicknessFormatValidator"),false);
			ValidatorEnable(document.all("GlueLineCompareValidator"),false);
			ValidatorEnable(document.all("GlueLineCompareValidatorGreater"),false);
			ValidatorEnable(document.all("PanelTypeRequiredValidator"),false);
			ValidatorEnable(document.all("RevisionDateSelectorCV"),false);
		}
		else
		{
			ValidatorEnable(document.all("DrawingSheetRequiredValidator"),true);	
			ValidatorEnable(document.all("RevisionDateSelector__ctl2"),true);
			ValidatorEnable(document.all("SlopedGlazingAppIndRequiredValidator"),true);
			ValidatorEnable(document.all("SlopeRequiredValidator"),true);
			ValidatorEnable(document.all("SlopeRangeValidator"),true);
			ValidatorEnable(document.all("SheetNoReviwedRequiredValidator"),true);
			ValidatorEnable(document.all("DetailNumberReviewedRequiredValidator"),true);
			ValidatorEnable(document.all("WidthRequiredValidator"),true);
			ValidatorEnable(document.all("PanelWidthFormatValidator"),true);
			ValidatorEnable(document.all("HeightRequiredValidator"),true);
			ValidatorEnable(document.all("PanelHeightFormatValidator"),true);
			ValidatorEnable(document.all("PanelWeightRequiredValidator"),true);
			ValidatorEnable(document.all("PanelWeightFormatValidator"),true);
			ValidatorEnable(document.all("DeadloadIndicatorRequiredValidator"),true);
			ValidatorEnable(document.all("WindloadFormatValidator"),true);
			ValidatorEnable(document.all("WindloadInputRequiredValidator"),true);
			ValidatorEnable(document.all("SiliconBiteRequiredValidator"),true);
			ValidatorEnable(document.all("SiliconeBiteDimensionFormatValidator"),true);
			ValidatorEnable(document.all("SiliconBiteCompareValidator"),true);
			ValidatorEnable(document.all("GluelineThicknessRequiredValidator"),true);
			ValidatorEnable(document.all("GlueLineThicknessFormatValidator"),true);
			ValidatorEnable(document.all("GlueLineCompareValidator"),true);
			ValidatorEnable(document.all("GlueLineCompareValidatorGreater"),true);
			ValidatorEnable(document.all("PanelTypeRequiredValidator"),true);
			ValidatorEnable(document.all("RevisionDateSelectorCV"),true);
		}		
	}

	if(DrawingDetails.PanelRadiobuttonList[1].checked)
	{
		if(document.getElementById("DrawIDHidden").value >= 1 && document.getElementById('SheetNoReviwedInput').value == "" && document.getElementById('DetailNumberReviewedInput').value == "" && document.getElementById('RadiusInput').value == "" && document.getElementById('PanelTypeDropdown').value == "" && document.getElementById('WindloadInput').value == '' && document.getElementById('SiliconBiteDimensionInput').value == "" && document.getElementById('GluelineThickenessInput').value == '' && document.getElementById('PanelWeightInput').value == '')		
		{
			ValidatorEnable(document.all("DrawingSheetRequiredValidator"),false);	
			ValidatorEnable(document.all("RevisionDateSelector__ctl2"),false);	
			ValidatorEnable(document.all("SlopedGlazingAppIndRequiredValidator"),false);
			ValidatorEnable(document.all("SlopeRequiredValidator"),false);
			ValidatorEnable(document.all("SlopeRangeValidator"),false);
			ValidatorEnable(document.all("SheetNoReviwedRequiredValidator"),false);
			ValidatorEnable(document.all("DetailNumberReviewedRequiredValidator"),false);
			ValidatorEnable(document.all("RadiusRequiredValidator"),false);
			ValidatorEnable(document.all("RadiusFormatValidator"),false);
			ValidatorEnable(document.all("WindloadFormatValidator"),false);
			ValidatorEnable(document.all("WindloadInputRequiredValidator"),false);
			ValidatorEnable(document.all("SiliconBiteRequiredValidator"),false);
			ValidatorEnable(document.all("SiliconeBiteDimensionFormatValidator"),false);
			ValidatorEnable(document.all("SiliconBiteCompareValidator"),false);
			ValidatorEnable(document.all("GluelineThicknessRequiredValidator"),false);
			ValidatorEnable(document.all("GlueLineThicknessFormatValidator"),false);
			ValidatorEnable(document.all("GlueLineCompareValidator"),false);
			ValidatorEnable(document.all("GlueLineCompareValidatorGreater"),false);
			ValidatorEnable(document.all("PanelTypeRequiredValidator"),false);
			ValidatorEnable(document.all("PanelWeightRequiredValidator"),false);
			ValidatorEnable(document.all("PanelWeightFormatValidator"),false);	
			ValidatorEnable(document.all("RevisionDateSelectorCV"),false);		
		}
		else
		{
			ValidatorEnable(document.all("DrawingSheetRequiredValidator"),true);	
			ValidatorEnable(document.all("RevisionDateSelector__ctl2"),true);	
			ValidatorEnable(document.all("SlopedGlazingAppIndRequiredValidator"),true);
			ValidatorEnable(document.all("SlopeRequiredValidator"),true);
			ValidatorEnable(document.all("SlopeRangeValidator"),true);
			ValidatorEnable(document.all("SheetNoReviwedRequiredValidator"),true);
			ValidatorEnable(document.all("DetailNumberReviewedRequiredValidator"),true);
			ValidatorEnable(document.all("RadiusRequiredValidator"),true);
			ValidatorEnable(document.all("RadiusFormatValidator"),true);
			ValidatorEnable(document.all("WindloadFormatValidator"),true);
			ValidatorEnable(document.all("WindloadInputRequiredValidator"),true);
			ValidatorEnable(document.all("SiliconBiteRequiredValidator"),true);
			ValidatorEnable(document.all("SiliconeBiteDimensionFormatValidator"),true);
			ValidatorEnable(document.all("SiliconBiteCompareValidator"),true);
			ValidatorEnable(document.all("GluelineThicknessRequiredValidator"),true);
			ValidatorEnable(document.all("GlueLineThicknessFormatValidator"),true);
			ValidatorEnable(document.all("GlueLineCompareValidator"),true);
			ValidatorEnable(document.all("GlueLineCompareValidatorGreater"),true);
			ValidatorEnable(document.all("PanelTypeRequiredValidator"),true);
			ValidatorEnable(document.all("PanelWeightRequiredValidator"),true);
			ValidatorEnable(document.all("PanelWeightFormatValidator"),true);	
			ValidatorEnable(document.all("RevisionDateSelectorCV"),true);		
		}		
	}			

	if(DrawingDetails.PanelRadiobuttonList[2].checked)
	{
		if(document.getElementById("DrawIDHidden").value >= 1 && document.getElementById('SheetNoReviwedInput').value == "" && document.getElementById('DetailNumberReviewedInput').value == "" && document.getElementById('ShortBaseLegInput').value == "" && document.getElementById('Angle1LegInput').value == "" && document.getElementById('Angle2LegInput').value == '' && document.getElementById('PanelTypeDropdown').value == "" && document.getElementById('WindloadInput').value == "" && document.getElementById('SiliconBiteDimensionInput').value == "" && document.getElementById('GluelineThickenessInput').value == '' && document.getElementById('PanelWeightInput').value == '')		
		{
			ValidatorEnable(document.all("DrawingSheetRequiredValidator"),false);	
			ValidatorEnable(document.all("RevisionDateSelector__ctl2"),false);	
			ValidatorEnable(document.all("SlopedGlazingAppIndRequiredValidator"),false);
			ValidatorEnable(document.all("SlopeRequiredValidator"),false);
			ValidatorEnable(document.all("SlopeRangeValidator"),false);
			ValidatorEnable(document.all("SheetNoReviwedRequiredValidator"),false);
			ValidatorEnable(document.all("DetailNumberReviewedRequiredValidator"),false);
			ValidatorEnable(document.all("ShortBaseLegFormatValidator"),false);
			ValidatorEnable(document.all("ShortBaseLegRequiredValidator"),false);
			ValidatorEnable(document.all("Angle1RequiredValidator"),false);
			ValidatorEnable(document.all("Angle1FormatValidator"),false);
			ValidatorEnable(document.all("Angle2RequiredValidator"),false);
			ValidatorEnable(document.all("Angle2FormatValidator"),false);
			ValidatorEnable(document.all("WindloadFormatValidator"),false);
			ValidatorEnable(document.all("WindloadInputRequiredValidator"),false);
			ValidatorEnable(document.all("SiliconBiteRequiredValidator"),false);
			ValidatorEnable(document.all("SiliconeBiteDimensionFormatValidator"),false);
			ValidatorEnable(document.all("SiliconBiteCompareValidator"),false);
			ValidatorEnable(document.all("GluelineThicknessRequiredValidator"),false);
			ValidatorEnable(document.all("GlueLineThicknessFormatValidator"),false);
			ValidatorEnable(document.all("GlueLineCompareValidator"),false);
			ValidatorEnable(document.all("GlueLineCompareValidatorGreater"),false);
			ValidatorEnable(document.all("PanelTypeRequiredValidator"),false);
			ValidatorEnable(document.all("PanelWeightRequiredValidator"),false);
			ValidatorEnable(document.all("PanelWeightFormatValidator"),false);
			ValidatorEnable(document.all("RevisionDateSelectorCV"),false);
		}
		else
		{
			ValidatorEnable(document.all("DrawingSheetRequiredValidator"),true);	
			ValidatorEnable(document.all("RevisionDateSelector__ctl2"),true);	
			ValidatorEnable(document.all("SlopedGlazingAppIndRequiredValidator"),true);
			ValidatorEnable(document.all("SlopeRequiredValidator"),true);
			ValidatorEnable(document.all("SlopeRangeValidator"),true);
			ValidatorEnable(document.all("SheetNoReviwedRequiredValidator"),true);
			ValidatorEnable(document.all("DetailNumberReviewedRequiredValidator"),true);
			ValidatorEnable(document.all("ShortBaseLegFormatValidator"),true);
			ValidatorEnable(document.all("ShortBaseLegRequiredValidator"),true);
			ValidatorEnable(document.all("Angle1RequiredValidator"),true);
			ValidatorEnable(document.all("Angle1FormatValidator"),true);
			ValidatorEnable(document.all("Angle2RequiredValidator"),true);
			ValidatorEnable(document.all("Angle2FormatValidator"),true);
			ValidatorEnable(document.all("WindloadFormatValidator"),true);
			ValidatorEnable(document.all("WindloadInputRequiredValidator"),true);
			ValidatorEnable(document.all("SiliconBiteRequiredValidator"),true);
			ValidatorEnable(document.all("SiliconeBiteDimensionFormatValidator"),true);
			ValidatorEnable(document.all("SiliconBiteCompareValidator"),true);
			ValidatorEnable(document.all("GluelineThicknessRequiredValidator"),true);
			ValidatorEnable(document.all("GlueLineThicknessFormatValidator"),true);
			ValidatorEnable(document.all("GlueLineCompareValidator"),true);
			ValidatorEnable(document.all("GlueLineCompareValidatorGreater"),true);
			ValidatorEnable(document.all("PanelTypeRequiredValidator"),true);
			ValidatorEnable(document.all("PanelWeightRequiredValidator"),true);
			ValidatorEnable(document.all("PanelWeightFormatValidator"),true);
			ValidatorEnable(document.all("RevisionDateSelectorCV"),true);			
		}		
	}
}

function ValidateLastRevDate(sender,args)
{ 
	var sDate = document.getElementById("RevisionDateSelector_DateInput").value.toUpperCase(); 
	//var RegExpformat = /^(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)\s([0-2]\d|[3][0-1])\,\s([2][0]|[1][9])\d{2}$/;	
	var RegExpformat = /^(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)\s(01|1|02|2|03|3|04|4|05|5|06|6|07|7|08|8|09|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\,\s([2][0]|[1][9])\d{2}$/;	
	var re = new RegExp(RegExpformat);
	
	if(sDate.length > 0 && !(re.test(sDate)))
	{
		args.IsValid=false;
		return;
	}
	else 
	{
		args.IsValid=true;
		return;
	}
}