function shipTo()
{
	myForm.SHIPTO.value = event.srcElement.id;
}

function checkSession()
{
	if ( myForm.SESSID.value.length != 11 ) {
		window.alert( "You Session ID is incomplete." +
		"\nClick OK to return to to the previous page." ); 
		window.history.back();	
	}
}

	
function jump()
{
	RETURN.href = "#" + event.srcElement.id;	
}

function change()
{
	if ( !event.srcElement.value )
		eval( "myForm.DEPT" + event.srcElement.id + ".value = myForm.deptSelect.value" );
}

function clearDept()
{
	if ( !event.srcElement.value )
		eval( "myForm.DEPT" + event.srcElement.id + ".value = ''" );
}	

function writeDate()
{
	var mm = new Array( "JAN", "FEB", "MAR", "APR", "MAY", "JUN",
                            "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" );
	var current = new Date();
	var Cday = current.getDate();
	if ( parseInt( Cday ) < 10 )
		Cday = "0" + Cday;  
	var Cmonth = ( current.getMonth() + 1 );
	if ( parseInt( Cmonth ) < 10 )
		Cmonth = "0" + Cmonth;  
	var Cyear = (current.getFullYear() % 100 );
	document.myForm.DAY[ 0 ].value = document.myForm.DAY[ 0 ].text = Cday;
	//document.myForm.YEAR[ 0 ].value = document.myForm.YEAR[ 0 ].text = Cyear;
	document.myForm.MONTH[ 0 ].value = document.myForm.MONTH[ 0 ].text = Cmonth;
}	

function checkDate( date, dd, mm, yy )
{	
	if ( parseInt( date.YEAR.options[ yy ].value, 10) < parseInt( date.YEAR.options[ 0 ].value, 10 ) ) {
		window.alert( "You have entered an invalid year. Please make another selection" );
		return false;
	}

	if ( parseInt( date.YEAR.options[ yy ].value , 10) == parseInt( date.YEAR.options[ 0 ].value, 10)) {
		if ( parseInt( date.MONTH.options[ mm ].value, 10 ) < parseInt( date.MONTH.options[ 0 ].value, 10 )) {
			window.alert( "You have entered a delivery month earlier than the current month. Please make another selection" );
			return false;
		}
		if ( parseInt( date.MONTH.options[ mm ].value, 10) == parseInt( date.MONTH.options[ 0 ].value, 10))
			if ( parseInt( date.DAY.options[ dd ].value, 10) < parseInt( date.DAY.options[ 0 ].value, 10) ) {
				window.alert( "You have entered a delivery day that is earlier than the current day. Please make another selection" );
				return false;			
			} 	
	}
	return true;
}

function formvalidation(thisform) {
   if (thisform.NOTE1.value.length == 0 &&
          thisform.NOTE2.value.length == 0 &&
          thisform.NOTE3.value.length == 0 &&
          thisform.NOTE4.value.length == 0 &&
          thisform.NOTE5.value.length == 0 &&
          thisform.NOTE6.value.length == 0) {
      return true;
   }
   else {
      return window.confirm("Are the warehouse special instructions correct?");
   }
} 

