
function getDateObject(dateString,dateSeperator)
{
	var dateString=dateString;
	var cDate=dateString.substr(4,2);
	var cMonth=dateString.substr(0,3);
	var cYear=dateString.substr(7,4);
	if(cMonth=='Jan')
		cMonth=1;
	else if(cMonth=='Feb')
		cMonth=2;
	else if(cMonth=='Mar')
		cMonth=3;
	else if(cMonth=='Apr')
		cMonth=4;
	else if(cMonth=='May')
		cMonth=5;
	else if(cMonth=='Jun')
		cMonth=6;
	else if(cMonth=='Jul')
		cMonth=7;
	else if(cMonth=='Aug')
		cMonth=8;
	else if(cMonth=='Sep')
		cMonth=9;
	else if(cMonth=='Oct')
		cMonth=10;
	else if(cMonth=='Nov')
		cMonth=11;
	else if(cMonth=='Dec')
		cMonth=12;
	dtObject=new Date(cYear,cMonth,cDate);
	return dtObject;	
}

function check_date()
{
	var s_date=getDateObject(document.search_form.s_date.value);
	var e_date=getDateObject(document.search_form.e_date.value);
	
	if(document.search_form.s_date.value=='')
	{
		alert("The start date cannot be blank.");
		return false;
	}
	else if(document.search_form.e_date.value=='')
	{
		alert("The end date cannot be blank.");
		return false;
	}
	else if(s_date>e_date)
	{
		alert("The end date must occur after the start date.");
		return false;
	}
}




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 check_email() 
{
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var email = document.email_form.email.value;
   if(reg.test(email) == false) 
   {
	  alert('Invalid Email Address');
      return false;
   }
   
}

function NewWindow(mypage,myname,w,h,scroll,pos)
{
	var win=null;
	if(pos=="random")
		{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center")
		{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!="center" && pos!="random") || pos==null)
		{LeftPosition=0;TopPosition=20}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
	win=window.open(mypage,myname,settings);
}

