


/* JavaScript Validations in Network Module */

/*  Submitted by-  "Mohit Saxena"     */ 

var display=""; 
var flag=true;
function contactUsValidation()
{
	display="";
	flag=true;
	if(document.getElementById('UcSiteFeedback1:txtFullName').value=="")
	{
	var Val=document.getElementById('UcSiteFeedback1:txtFullName').value;
	Msg="Full Name is required!";
	flag=required(Val,Msg);	
	Val="";
	}
	if(document.getElementById('UcSiteFeedback1:txtEmailID').value=="")
	{
	var Val=document.getElementById('UcSiteFeedback1:txtEmailID').value;
	Msg="E-Mail Address is required!";
	flag=required(Val,Msg);
	Val="";
	}
	if(document.getElementById('UcSiteFeedback1:txtEmailID').value!="")
	{
		var str=document.getElementById('UcSiteFeedback1:txtEmailID').value;
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false;
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false;
		 }
	}
	if(display.length>0)
	{
		alert(display);
		return false;
	}
	else 
	{
		return true;
	}
}
function required(Val,Msg)
{
   if(Val==null || Val.length==0  )
	{
		display=display+"\n"+Msg;
		flag=false;
		return false;
	}
	else 
	{ 
		return true;
	}
}

function enableText1()
{
	if(document.getElementById('UcSiteFeedback1_Div1').style.display == 'none')
		{
		}
		else
		{
			document.getElementById('UcSiteFeedback1_Div1').style.display = 'none';
		}
}

function enableText2()
{
	if(document.getElementById('UcSiteFeedback1_Div1').style.display == 'none')
		{
			document.getElementById('UcSiteFeedback1_Div1').style.display = 'Block';
		}
		else
		{
			document.getElementById('UcSiteFeedback1_Div1').style.display = 'none';
		}
}
function enableText3()
{
	if(document.getElementById('UcFiredBoilersEnquiryForm1_Div1').style.display == 'none')
		{
		}
		else
		{
			document.getElementById('UcFiredBoilersEnquiryForm1_Div1').style.display = 'none';
		}
}

function enableText4()
{
	if(document.getElementById('UcFiredBoilersEnquiryForm1_Div1').style.display == 'none')
		{
			document.getElementById('UcFiredBoilersEnquiryForm1_Div1').style.display = 'Block';
		}
		else
		{
			document.getElementById('UcSiteFeedback1_Div1').style.display = 'none';
		}
}
