// JavaScript Document


function echeck(str) {

		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
		 }

 		 return true					
	}

function ValidateForm()
{
	var val = document.getElementById("LocationTypeID").length
	
	 if( val >= 1)
	 {
		if(document.cast_location.LocationTypeID.value=="0")
		{
			 alert("Please select sub type.");
			 document.cast_location.LocationTypeID.focus();
			 return false;
		}
	 }
	/* var val = document.getElementById("subtype2").length
	
	 if( val >= 1)
	 {
	
		if(document.cast_location.LocationTypeID_sub_1.value=="0")
		{
			 alert("Please select sub type2.");
			 document.cast_location.LocationTypeID_sub_1.focus();
			 return false;
		}
	 }
	 
	 var val = document.getElementById("subtype3").length
	
	 if( val >= 1)
	 {
	
		if(document.cast_location.LocationTypeID_sub_2.value=="0")
		{
			 alert("Please select sub type3.");
			 document.cast_location.LocationTypeID_sub_2.focus();
			 return false;
		}
	 }*/
 }

 function show(id)
{
	el = document.getElementById(id);
	if (el.style.display == 'none')
	{
		el.style.display = '';
		el = document.getElementById('upload' + id);
		el.innerHTML = 'less...';
	} else {
		el.style.display = 'none';
		el = document.getElementById('upload' + id);
		el.innerHTML = '#Popup for upload menu...';
	}
}

 function showmenu(id)
{
	e2 = document.getElementById(id);
	if (e2.style.display == 'none')
	{
		e2.style.display = '';
		e2 = document.getElementById('menu' + id);
		e2.innerHTML = 'less...';
	} else {
		e2.style.display = 'none';
		e2 = document.getElementById('menu' + id);
		e2.innerHTML = '#Popup for menu...';
	}
}

function isAllNumerics(objValue)
{
		var characters="0123456789."
		var tmp
		var lTag
		lTag = 0
		temp = (objValue.length)
		//alert(objValue);
		for (var i=0;i<temp;i++)
		{
			tmp=objValue.substring(i,i+1)
			if (characters.indexOf(tmp)==-1)
			{
				lTag = 1
			}
		}
		if(lTag == 1)
			return false
		else
		  if(objValue<=0)
		   {
			return false
		   }else{ 	
			return true
		  }
}


function change_drop(str,e1)
{
	 
	 if(str=="N")
	 { 
		// e1.value="";
		 e1.disabled=true;
	 }
	 else
	 { 
	 	 e1.disabled=false;
	 }	
}


function checkInput(obj,max)
{
var result = true;
if (obj.value.length > max)
{
	alert("Enter up to "+max+" char max.");
	obj.value = ""
	result = false;
}
if (window.event)
window.event.returnValue = result;
return result;
}

 
function viewpage()
{	
	var pdf1 = document.getElementById("uplodedpdf");
	pdf = ".."+pdf1.value
	window.open(pdf ,'mywindow','width=600,height=500,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes, resizable=yes');
}