//-----------------------------------------------------------------------
function checkText(text){
var result;
if(text == "")result = 0;
else result=1;
return result;
}
//---------------------------------------------------------
function validateVATReturnProfileForm()
{
var errMsgPName ="# Period of return not mentioned";
var errMsgPeriodEndDate = "# Period End Date not selected";
var errMsgPeriodEndMonth = "# Period End Month not selected";
var errMsgPeriodEndYear="# Period End Year not selected"; 
var errMsgAssessmentYear="#Assessment Year -Not selected";
var errMsgReturnType ="# Return Category: ReturnCategory not selected";
 
var pnameflag=checkText(document.forms.VATReturnProfileForm.SelPeriodName.value);
var ReturnCategoryflag     = document.forms.VATReturnProfileForm.SelReturnCategory.value.selectedIndex;
var AssessmentYearflag=checkText(document.forms.VATReturnProfileForm.SelAssessmentYear.value);
var indDateflag     = document.forms.VATReturnProfileForm.SelTextPeriodEndDay.options.selectedIndex;
var pEndDateflag   = checkText(document.forms.VATReturnProfileForm.SelTextPeriodEndDay.options[indDateflag].value);
var indMonthflag   =  document.forms.VATReturnProfileForm.SelTextPeriodEndMonth.options.selectedIndex;
var pEndMonthflag = checkText(document.forms.VATReturnProfileForm.SelTextPeriodEndMonth.options[indMonthflag].value);
var indYearflag      = document.forms.VATReturnProfileForm.SelTextPeriodEndYear.options.selectedIndex;
var pEndYearflag   = checkText(document.forms.VATReturnProfileForm.SelTextPeriodEndYear.options[indYearflag].value);


if (pnameflag==0 || AssessmentYearflag==0 || pEndDateflag==0 || pEndMonthflag==0 || pEndYearflag==0 || ReturnCategoryflag==0)
{
s = "<html><head><script language='javascript' src='ValidateVATReturnProfile.js'></script></head></body>" +
    "<table width=50% align=center" +
    "<tr><td Style='font-family:Verdana;font-size:12;color:#ff0000'>" +
    "We can not receive your return because of the following reason(s):<br><br>";

if(pnameflag==0) s += "<BR>"+ errMsgPName;
if(pEndDateflag==0) s += "<BR>"+ errMsgPeriodEndDate;
if(pEndMonthflag==0) s += "<BR>"+ errMsgPeriodEndMonth;
if(pEndYearflag==0) s += "<BR>"+ errMsgPeriodEndYear;
if(AssessmentYearflag==0) s +="<BR>"+errMsgAssessmentYear;
if(ReturnCategoryflag==0) s+="<BR>"+errMsgReturnType;
s += "<br><Input Type=Button onClick='history.back();' Value='Please click here to complete or correct the required information'/> </td>" +
     "<tr></table></body></html>";
document.write(s);
}
else 
 document.forms.VATReturnProfileForm.submit();

//return;
}

//----------------------------------------------

function setbg(colorVal) {
	   var count =  window.event.srcElement.all.length;
  	window.event.srcElement.style.background = colorVal;
	for(var i=0;i<count;i++){
	 window.event.srcElement.all[i].style.background = colorVal;
	}
	}

//------------------------------------------------------------------------------------------- 
function ForwardVars(){
document.forms[0].submit();
}











