<!--
	function ButtonHover(item) {
		item.className = "Button_hover";
		if (item.alt !=null) {
			window.status=item.alt;
		}
	}
	
	function ButtonLink(item) {
	item.className = "Button_link";
	window.status='Crew Management Information System - http://www.cfsharp.com/cmis';
	}

	//secured page
	function CMISPopUp(url,iWidth,iHeight) {
		var CMISPopUp=window.open(url,'CMISPopUp','width='+iWidth+',height='+iHeight+',status=0,scrollbars=1,resizable=1,left=0,top=0')
		if (CMISPopUp.opener==null)
			CMISPopUp.opener=self
		if (CMISPopUp.focus)
			CMISPopUp.focus()
	}

	function validatesignin(){
		if (document.frmSignon.username.value=="") {
		alert("Please enter your username.")
		document.frmSignon.username.focus()
		return false
	}
	if (document.frmSignon.passwd.value=="") {
		alert("Please enter your password.")
		document.frmSignon.passwd.focus()
		return false
	}		
		return true
	}
	
	function ProcessID() {
		return parseInt(Math.random() * 65535)
	}

	function CheckAllApp()
	{for (var i=0;i<document.myform.elements.length;i++) { var e = document.myform.elements[i]; if (e.name != 'allbox') e.checked = document.myform.allbox.checked;}}

	function FlagApplicantSel(action){
		for (var f, n=0, DL=document.myform, i=0; i<DL.elements.length; i++) {if ((DL.elements[i].name.indexOf('ID')> -1)) {if (DL.elements[i].checked){n=n+1; }}}
		if (n>0) {
			document.myform.action=action;
			document.myform.submit();
			}
		else {
			alert("Please select at least one applicant!")
		}
	}
	
	function ConfirmAcceptSel(action) {
		for (var f, n=0, DL=document.myform, i=0; i<DL.elements.length; i++) {if ((DL.elements[i].name.indexOf('ID')> -1)) {if (DL.elements[i].checked){n=n+1; }}}
		if (n>0) 
		{
			if(confirm("You are about to accept all selected Applicants. Are you sure?"))
			{
				var Msg=prompt('Please enter comment.', ' ');
				if ( (Msg==' ') || (Msg==null) ) 
				{ 
					alert("Invalid action! Comment is required.")
				}
				else
				{
					document.myform.Comments.value=Msg;
					document.myform.action=action;	
					document.myform.submit();
				}
			}
		}
		else 
		{
			alert("Please select at least one applicant!")
		}
	}
	
	function ConfirmNotAcceptSel(action) 
	{
		for (var f, n=0, DL=document.myform, i=0; i<DL.elements.length; i++) {if ((DL.elements[i].name.indexOf('ID')> -1)) {if (DL.elements[i].checked){n=n+1; }}}
		if (n>0) 
		{
			if(confirm("You are about to reject all selected applicants. Are you sure?"))
			{
				var Msg=prompt('Please enter comment.', ' ');
				if ( (Msg==' ') || (Msg==null) ) 
				{ 
					alert("Invalid action! Comment is required.")
				}
				else
				{
					document.myform.Comments.value=Msg;
					document.myform.action=action;	
					document.myform.submit();}
				}
			}
		else 
		{
			alert("Please select at least one applicant!")
		}
	}
	
	function FlagApplicant(action)
	{
		document.myform.action=action;
		document.myform.submit();
	}
	
	function ConfirmAccept(action,appname) 
	{
		if(confirm("You are about to accept the application of " + appname + ".\n\nPlease click OK to confirm."))
		{
		document.myform.action=action;	
		document.myform.submit();
		}
	}
	
	function ConfirmNotAccept(action,appname) 
	{
		if(confirm("You are about to reject the application of " + appname + ".\n\nPlease click OK to confirm."))
		{
		document.myform.action=action;	
		document.myform.submit();
		}
	}
	
	function CMISLoginNow(thisForm) {
		if (thisForm.username.value=='') {
			alert ("Please enter your Username.")
			thisForm.username.focus()
			return
		}
		if (thisForm.passwd.value=='') {
			alert ("Please enter your Password.")
			thisForm.passwd.focus()
			return 
		}
		thisForm.TargetPage.value='signon.asp?'+parseInt(Math.random() * 65535)
		thisForm.action='signon.asp?a=login&id='+parseInt(Math.random() * 65535)
		CMISPopUp('',790,530)
		thisForm.target='CMISPopUp'
		setTimeout('document.frmSignon.submit()', 1500)
		setTimeout('document.frmSignon.username.value=""',3000)
		setTimeout('document.frmSignon.passwd.value=""',3000)	
	}

	function ResetAll() {
		document.frmSignon.username.value=''
		document.frmSignon.passwd.value=''
	}
	//end secured page
	
// validate date
// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("The date format should be : mm/dd/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter a valid date")
		return false
	}	
return true
}	
// end validate date
	
	function submitit(action){
	for (var f, n=0, DL=document.form, i=0; i<DL.elements.length; i++) {if ((DL.elements[i].name.indexOf('ID')> -1)) {if (DL.elements[i].checked){n=n+1; }}}
	if (n>0) {
		document.form.action=action;
		document.form.submit();
		}
	else {
		alert(NoItemsMsg)
	}}
	
	function submitprocess()
	{
		//var IID=document.myform.ID[document.myform.ID.selectedIndex].value;
		//document.myform.AppID.value=document.myform.ID[document.myform.ID.selectedIndex].value;
		//document.myform.action=action;
		//document.myform.submit();
	}

	function submitform(action){
		document.myform.action=action;
		document.myform.submit();
	}
		
	function submitform2(action){
		document.filterscannedform.action=action;
		document.filterscannedform.submit();
	}	
	
	function submitform3(action){
		document.myform2.action=action;
		document.myform2.submit();
	}	
		
	function submitstcwform(action){
		document.mystcwform.action=action;
		document.mystcwform.submit();
	}	

	function submitcertform(action){
		document.mycertform.action=action;
		document.mycertform.submit();
	}
	
	function ConfirmAction(msg,action){
		if (confirm(msg)) {
		document.myform.action=action;
		document.myform.submit();}
	}
	
	function openBiodataPopup(url) {
		myPopup = window.open(url,Math.floor(Math.random() * 99999),'width=790,height=530,status=0,scrollbars=1,resizable=1,left=0,top=0');
		myPopup.focus();
	}	
	
	function openImagePopup(url) {
		myPopup = window.open(url,Math.floor(Math.random() * 99999),'width=790,height=530,status=0,scrollbars=1,resizable=1,left=0,top=0');
		myPopup.focus();
	}
	
	function doPrint() { 
	if (! IS_IE4) window.print(); 
	else vbPrintPage(); 
	}
	
	function confirmLogout(logoutUrl) {
	if (confirm("Are you sure that you want to logout?")) {
		document.location = logoutUrl;
		}
	}
	
	function openSmallPopup(url) {
		myPopup = window.open(url,Math.floor(Math.random() * 99999),'width=400,height=350,top=20,left=100,resizable=yes,scrollbars=yes,toolbars=no,statusbar=yes,titlebar=no');
		myPopup.focus();
	}
	
	function openCommentPopup(url) {
		myPopup = window.open(url,Math.floor(Math.random() * 99999),'width=600,height=350,top=20,left=100,resizable=yes,scrollbars=yes,toolbars=no,statusbar=yes,titlebar=no');
		myPopup.focus();
	}
	
	function openLargePopup(url) {
		myPopup = window.open(url,Math.floor(Math.random() * 99999),'width=550,height=350,top=20,left=100,resizable=yes,scrollbars=yes,toolbars=no,statusbar=yes,titlebar=no');
		myPopup.focus();
	}
	
	function ConfirmAction(msg,action) {
		if (confirm(msg)) {
			document.myform.action=action;
			document.myform.submit()
			}
	}	
	
	function getTarget(url){
		if (self.name == "Popup") {
			window.close();
		}
		else	{
			window.location = url;
			//history.go(-1);
		}
	}
	
	function openviewwindow(url){
		myPopup = window.open(url,'Popup','fullscreen=yes,scrollbars=yes');
		myPopup.focus();
	}	
	
	function CheckAll2()
	{for (var i=0;i<document.myform.elements.length;i++) { var e = document.myform.elements[i]; if (e.name != 'allbox') e.checked = document.myform.allbox.checked;}}
	

	function ButtonOver(item) {
		item.className = "Button_sel";
		if (item.alt !=null) {
			window.status=item.alt;
		}
	}

	function ButtonOff(item) {
		item.className = "Button_unsel";
		window.status='Corporate Portal - http://www.cfsharp.com/cmis';
	}
	
	function RotateOriginal(){
		this.document.images['image'].style.filter='progid:DXImageTransform.Microsoft.BasicImage("")';
	}

	function RotateLeft(){
		this.document.images['image'].style.filter='progid:DXImageTransform.Microsoft.BasicImage(rotation=3)';
	}

	function RotateRight(){
		this.document.images['image'].style.filter='progid:DXImageTransform.Microsoft.BasicImage(rotation=1)';
	}

	function zoomImages(factor){
		for (var n=0, Img=document.images, i=0; i<Img.length; i++) {
			if ((Img[i].name.indexOf('image')> -1)) {
				if (((Img[i].width>=32) | (factor>1)) && ((Img[i].width<10000) | (factor<1))) {Img[i].width=Img[i].width*factor;}
			}
		}
	}
			
	function openviewwindow(url) {
		myPopup = window.open(url,'Popup','width=850,height=700,top=10,left=10,resizable=yes,scrollbars=yes,toolbars=no,statusbar=yes,titlebar=no');
		//if (!myPopup.opener)
		//myPopup.opener = self;
		myPopup.focus();
	}
	
	//<a href="javascript:openPopup('biodata.asp','biodata','100','100','fullscreen',false)"></a>
	function openPopup(url,name,w,h,props,center){
		l=18;t=18
		if(center){l=(screen.availWidth-w)/2;t=(screen.availHeight-h)/2}
		url=url.replace(/[ ]/g,'%20')
		popup=window.open(url,name,'left='+l+',top='+t+',width='+w+',height='+h+',scrollbars=1'+((props)?','+props:''))
		props=props||''
		if(props.indexOf('fullscreen')!=-1){popup.moveTo(0,0);popup.resizeTo(screen.width,screen.height)}
		popup.focus()
	}	
						
	function submitjo(action){
	if (document.frmNewHires.selPosition.value=="") {
		alert("Please select position")
		document.frmNewHires.selPosition.focus()
	return false
	}
	//if (document.frmNewHires.AgeCriteria.value=="") {
	//	alert("Please select age criteria")
	//	document.frmNewHires.AgeCriteria.focus()
	//return false
	//}
	//if (document.frmNewHires.Age.value=="") {
	//	alert("Please select age")
	//	document.frmNewHires.Age.focus()
	//return false
	//}	
	document.frmNewHires.action=action;
	document.frmNewHires.submit();	
	return true
	}
	
	function submitretform(action){
	var fd=document.retform.fromdate
	var td=document.retform.todate
	
	if (document.retform.fromdate.value=="") {
		alert("Please enter date from")
		document.retform.fromdate.focus()
		return false
	}
	if (isDate(fd.value)==false){
		//dt.focus()
		return false
	}
	if (document.retform.todate.value=="") {
		alert("Please enter date to")
		document.retform.todate.focus()
		return false
	}
	if (isDate(td.value)==false){
		//dt.focus()
		return false
	}	
	document.retform.action=action;
	document.retform.submit();	
	return true
	}
	
	function submitfilterscanned(action){
		var fd=document.filterscannedform.fromdate
		var td=document.filterscannedform.todate
	
		if (document.filterscannedform.principalcode.value=="") {
			alert("Please select principal")
			document.filterscannedform.principalcode.focus()
			return false
		}
		if (document.filterscannedform.seamanid.value=="") {
			alert("Please select seafarer")
			document.filterscannedform.seamanid.focus()
			return false
		}			
		if (document.filterscannedform.fromdate.value=="") {
			alert("Please enter date from")
			document.filterscannedform.fromdate.focus()
			return false
		}
		if (isDate(fd.value)==false){
			//dt.focus()
			return false
		}
		if (document.filterscannedform.todate.value=="") {
			alert("Please enter date to")
			document.filterscannedform.todate.focus()
			return false
		}
		if (isDate(td.value)==false){
			//dt.focus()
			return false
		}	
	document.filterscannedform.action=action;
	document.filterscannedform.submit();	
	return true
	}	

	
	//start
	var selectedrange	
	selectedrange = ""

	function ChooseItem(id){
	var tempstr
		if(navigator.appName == "Netscape") {
			var myDivs = document.getElementsByTagName("td")
				if(selectedrange == ""){
					tempstr = "sells" + id + 2;
					myDivs[tempstr].style.background ="#aaaaaa";
					tempstr = "sells" + id + 3;
					myDivs[tempstr].style.background ="#aaaaaa";
					tempstr = "sells" + id + 4;
					myDivs[tempstr].style.background ="#aaaaaa";
					tempstr = "sells" + id + 5;
					myDivs[tempstr].style.background ="#aaaaaa";
					selectedrange = id;
				}else{
					tempstr = "sells" + selectedrange + 2;
					myDivs[tempstr].style.background ="#ffffff";
					tempstr = "sells" + selectedrange + 3;
					myDivs[tempstr].style.background ="#ffffff";
					tempstr = "sells" + selectedrange + 4;
					myDivs[tempstr].style.background ="#ffffff";
					tempstr = "sells" + selectedrange + 5;
					myDivs[tempstr].style.background ="#ffffff";
					selectedrange = id;
					tempstr = "sells" + id + 2;
					myDivs[tempstr].style.background ="#aaaaaa";
					tempstr = "sells" + id + 3;
					myDivs[tempstr].style.background ="#aaaaaa";
					tempstr = "sells" + id + 4;
					myDivs[tempstr].style.background ="#aaaaaa";
					tempstr = "sells" + id + 5;
					myDivs[tempstr].style.background ="#aaaaaa";
				}
		}
		if(navigator.appName == "Microsoft Internet Explorer") {
			if(selectedrange == ""){
				tempstr = "whatever" + id;
				document.all[tempstr].style.background ="#aaaaaa";
				selectedrange = tempstr;
			}else{
				document.all[selectedrange].style.background ="#ffffff";
				tempstr = "whatever" + id;
				document.all[tempstr].style.background ="#aaaaaa";
				selectedrange = tempstr;
			}
		}
		//end
}

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
}