    function isValidDate(theField)
{
	var s1, s2, sDate, sMonth, sYear;
	var inDate = theField;
	if (inDate.substring(1,2)=="-" || inDate.substring(1,2)=="/")
	{ s1 = 1 }
	else if (inDate.substring(2,3)=="-" || inDate.substring(2,3)=="/") 
	        { s1 = 2 }
	if (inDate.substring(3,4)=="-" || inDate.substring(3,4)=="/")
	{ s2 = 3 }
	else
	
	{
		if (inDate.substring(4,5)=="-" || inDate.substring(4,5)=="/")
		{ s2 = 4 }
		else
		{ s2 = 5 }
	}
	sMonth = inDate.substring(0,s1);
	sDate = inDate.substring(s1+1,s2);
	sYear = inDate.substring(s2+1,inDate.length);
	if (sMonth==1 || sMonth==3 || sMonth==5 || sMonth==7 || sMonth==8 || sMonth==10 || sMonth==12)
	{
		if (sDate>=1 && sDate<=31) { return true; }
		else {alert("Invalid date!");}
	}
	if (sMonth==4 || sMonth==6 || sMonth==9 || sMonth==11)
	{
		if (sDate>=1 && sDate<=30) { return true; }
		else{ alert("Invalid date!"); }
		
	}
	if (sMonth==2)
	{
		if (sYear%4 == 0)
		{ if (sDate>=1 && sDate <= 29) { return true; }
		  else {return false;alert("Invalid date!");}
	    }
		else
		{ if (sDate>=1 && sDate <= 28) { return true; }
		   else{alert("Invalid date!");}
		 }
	}
  
	
}



function isValidDate1(theField)
{
	var s1, s2, sDate, sMonth, sYear;
	var inDate = theField;
	if (inDate.substring(1,2)=="-" || inDate.substring(1,2)=="/")
	{ s1 = 1 }
	else 
	{ s1 = 2 }
	if (inDate.substring(3,4)=="-" || inDate.substring(3,4)=="/")
	{ s2 = 3 }
	else
	{
		if (inDate.substring(4,5)=="-" || inDate.substring(4,5)=="/")
		{ s2 = 4 }
		else
		{ s2 = 5 }
	}
	sMonth = inDate.substring(0,s1);
	sDate = inDate.substring(s1+1,s2);
	sYear = inDate.substring(s2+1,inDate.length);
	if (sMonth==1 || sMonth==3 || sMonth==5 || sMonth==7 || sMonth==8 || sMonth==10 || sMonth==12)
	{
		if (sDate>=1 && sDate<=31) { return true; }
	}
	if (sMonth==4 || sMonth==6 || sMonth==9 || sMonth==11)
	{
		if (sDate>=1 && sDate<=30) { return true; }
		{ return true; }
	}
	if (sMonth==2)
	{
		if (sYear%4 == 0)
		{ if (sDate>=1 && sDate <= 29) { return true; } }
		else
		{ if (sDate>=1 && sDate <= 28) { return true; } }
	}
	return false;
}
	

function isValidDecimal(theField)
{
	var inStr=theField;
	var inLen=inStr.length;

	if (inLen == 0)
		return true;
	if (inLen == 1 && inStr==" ")
		return true;
	for(var i=0; i< inLen; i++) 
	{
		var ch = inStr.substring(i,i+1)
        if ((ch<"0" || ch>"9") && ch!="." && ch!="-")
		{
			if (ch != "")
				return false;
		}
    }
	return true;
}

function isValidInt(theField)
{
	var inStr=theField;
	var inLen=inStr.length;

	if (inLen == 0)
		return true;
	if (inLen == 1 && inStr==" ")
		return true;
	for(var i=0; i< inLen; i++) 
	{
		var ch = inStr.substring(i,i+1)
        if (ch < "0" || ch > "9")
		{
			if (ch != "")
				return false;
		}
    }
	return true;
}

function isFieldBlank(theField) 
{
	if(theField == "" || theField == " ")
		return true;
    else
		return false;
}


function openWin(name, url, top, left, width, height, resize, scroll, menu) {
	args = 'top=' + top + 
			'screenX=' + top +
			',left=' + left +
			'screenY=' + left +
			',width=' + width +
			',height=' + height +
			',resizable=' + resize +
			',scrollbars=' + scroll +
			',menubar=' + menu;
	newWin = window.open(url, name, args)
}


function openfixWin(name, url) {

	args = 'top=50' + 
			'screenX=50' +
			',left=100' +
			'screenY=100' +
			',width=800' +
			',height=600' +
			',resizable=1' +
			',scrollbars=1' +
			',menubar=0';
	newWin = window.open(url, name, args)
}

function openToolbox(name, url, left, top, width, height) {
  
    
/*	args = 'top=' + top + 
			'screenX=' + top +
			',left=' + left +
			'screenY=' + left +
			',width=' + width +
			',height=' + height +
			',resizable=1' +
			',scrollbars=1' +
			',menubar=0';
*/
   if (screen.width==800)
   
     {
     args = 'top=60'+ 
			'screenX=60'+
			',left=120'+
			'screenY=120'+
			',width=580'+
			',height=480'+
			',resizable=1' +
			',scrollbars=1' +
			',menubar=0';   
    
     }
    
    else
    {
     args = 'top=130' + 
			'screenX=130'+
			',left=150'+
			'screenY=150'+
			',width=700'+
			',height=500'+
			',resizable=1' +
			',scrollbars=1' +
			',menubar=0';   
    
    }
			
	newWin = window.open(url, name, args)
}

/*funciton CompareTwodateJava(Min,Max)
  {
      var date1,date2;
      var Two=false;
    if (min==""||max=="") 
      { Two=true;
        return Two;}
    else
     { date1= new date(Min);
       date2= new date(Max);
       if (date1.getYear()<=date2.getYear())
          { if (date1.getYear()<date2.getYear())
               { return true;} 
            else if (date1.getMonth()<=date2.getMonth())
               { 
                     if (date1.getMonth()<date2.getMonth())
                        {
                           return true;
                        }
                     else if (date1.getDay()<=date2.getDay())
                           { return true;}
                          else
                           { return false;}

                }

               else {return false;}
          }
        else {return false;}
        }
                          
*/      
          
	function doAlert(msg)
	{	
		return showModalDialog('/Include/alertdialog.htm', msg,'dialogHeight:150px;dialogWidth:350px;status:no;help:no;');
	}

	function doConfirm(msg)
	{	
		return showModalDialog('/Include/confirmdialog.htm', msg,'dialogHeight:150px;dialogWidth:350px;status:no;help:no;');
	}


        function doDisplayRead(strPath)
         {
                
                eval(strPath & ";")
                return true
         }

