//
// Various commonly used routines
//


var viztime = 0;
var viztime2 = 0;

function MyFunctionL()
{
	var my_mber = "";
	var my_mberpss = "";
	
	my_mber = window.document.logfrm.usename.value;
	my_mberpss = window.document.logfrm.uspass.value;
	
	if(viztime == 0)
	{
		alert('The unauthorized use of this service by an Excel Towncar Inc. or non-Excel Towncar Inc. party is a violation of Excel Towncar Inc. policy and may result in disciplinary sanctions, up to and including termination of employment, as well as civil or criminal penalties.') 
		viztime = 1;
	} 
	if(my_mber.length ==0)
	{   
		alert('Please enter your username')
		window.document.logfrm.usename.focus();
		return false;
	}
	if(my_mberpss.length ==0)
	{   
		alert('Please enter your password')
		window.document.logfrm.uspass.focus();
		return false;
	}
	else
	{
		if(viztime2 == 0)
		  {
			alert('The system could not log you in, make sure your user name is correct, and then type your password again. Letters in password must be typed using the proper case.Make sure the Caps Lock is not accidentally on.') 
			viztime2 = 1;
		  }
		else
		  {
			alert('Incorrect username or password!')
		  }
	window.document.logfrm.usename.value="";
	window.document.logfrm.uspass.value="";
	}
}


function press()
{if (event.button==2) {
alert('The contents and images on this site are subject to copyright!')}}
document.onmousedown=press





// Dynamic Calendar-------------------------

var ns6=document.getElementById&&!document.all
var ie4=document.all

var Selected_Month;
var Selected_Year;
var Current_Date = new Date();
var Current_Month = Current_Date.getMonth();

var Days_in_Month = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var Month_Label = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');

var Current_Year = Current_Date.getYear();
if (Current_Year < 1000)
Current_Year+=1900


var Today = Current_Date.getDate();

function Header(Year, Month) {

   if (Month == 1) {
   Days_in_Month[1] = ((Year % 400 == 0) || ((Year % 4 == 0) && (Year % 100 !=0))) ? 29 : 28;
   }
   var Header_String = Month_Label[Month] + ' ' + Year;
   return Header_String;
}



function Make_Calendar(Year, Month) {
   var First_Date = new Date(Year, Month, 1);
   var Heading = Header(Year, Month);
   var First_Day = First_Date.getDay() + 1;
   if (((Days_in_Month[Month] == 31) && (First_Day >= 6)) ||
       ((Days_in_Month[Month] == 30) && (First_Day == 7))) {
      var Rows = 6;
   }
   else if ((Days_in_Month[Month] == 28) && (First_Day == 1)) {
      var Rows = 4;
   }
   else {
      var Rows = 5;
   }

   var HTML_String = '<center><table align="center" width="177"><tr><td valign="top"><table border="0" cellspacing="1" cellpadding="1" FRAME="box" bgcolor="#313236" bordercolorLIGHT="#808080" width="177">';

   HTML_String += '<tr><th colspan=7 bgcolor="#666666" bordercolor="000000"><font size="1" color="#313236">' + Heading + '</font></th></tr>';

   HTML_String += '<tr><th align="center" bgcolor="#666666" bordercolor="000000"><font size="1" color="#990000">Sun</font></th><th align="center" bgcolor="#666666" bordercolor="000000"><font size="1" color="#313236">Mon</font></th><th align="center" bgcolor="#666666" bordercolor="000000"><font size="1" color="#313236">Tue</font></th><th align="center" bgcolor="#666666" bordercolor="000000"><font size="1" color="#313236">Wed</font></th>';

   HTML_String += '<th align="center" bgcolor="#666666" bordercolor="000000"><font size="1" color="#313236">Thu</font></th><th align="center" bgcolor="#666666" bordercolor="000000"><font size="1" color="#313236">Fri</font></th><th align="center" bgcolor="#666666" bordercolor="000000"><font size="1" color="#990000">Sat</font></th></tr>';

   var Day_Counter = 1;
   var Loop_Counter = 1;
   for (var j = 1; j <= Rows; j++) {
      HTML_String += '<tr ALIGN="left" VALIGN="top">';
      for (var i = 1; i < 8; i++) {
         if ((Loop_Counter >= First_Day) && (Day_Counter <= Days_in_Month[Month])) {
            if ((Day_Counter == Today) && (Year == Current_Year) && (Month == Current_Month)) {
               HTML_String += '<td bgcolor="#999999" bordercolor="999999"><strong><font face="Courier New" size="1" color="#990000">' + Day_Counter + '</font></strong></td>';
            }
            else {
               HTML_String += '<td bgcolor="#666666" bordercolor="999999"><font face="Courier New" size="1">' + Day_Counter + '</font></td>';
            }
            Day_Counter++;    
         }
         else {
            HTML_String += '<td bordercolor="C0C0C0"></td>';
         }
         Loop_Counter++;
      }
      HTML_String += '</tr>';
   }
   HTML_String += '</table></td></tr></center></table>';
   cross_el=ns6? document.getElementById("Calendar") : document.all.Calendar
   cross_el.innerHTML = HTML_String;
}


function Check_Nums() {
   if ((event.keyCode < 48) || (event.keyCode > 57)) {
      return false;
   }
}



function On_Year() {
   var Year = document.when.year.value;
   if (Year.length == 4) {
      Selected_Month = document.when.month.selectedIndex;
      Selected_Year = Year;
      Make_Calendar(Selected_Year, Selected_Month);
   }
}

function On_Month() {
   var Year = document.when.year.value;
   if (Year.length == 4) {
      Selected_Month = document.when.month.selectedIndex;
      Selected_Year = Year;
      Make_Calendar(Selected_Year, Selected_Month);
   }
   else {
      alert('Please enter a valid year.');
      document.when.year.focus();
   }
}


function Defaults() {
   if (!ie4&&!ns6)
   return
   var Mid_Screen = Math.round(document.body.clientWidth / 2);
   document.when.month.selectedIndex = Current_Month;
   document.when.year.value = Current_Year;
   Selected_Month = Current_Month;
   Selected_Year = Current_Year;
   Make_Calendar(Current_Year, Current_Month);
}


function Skip(Direction) {
   if (Direction == '+') {
      if (Selected_Month == 11) {
         Selected_Month = 0;
         Selected_Year++;
      }
      else {
         Selected_Month++;
      }
   }
   else {
      if (Selected_Month == 0) {
         Selected_Month = 11;
         Selected_Year--;
      }
      else {
         Selected_Month--;
      }
   }
   Make_Calendar(Selected_Year, Selected_Month);
   document.when.month.selectedIndex = Selected_Month;
   document.when.year.value = Selected_Year;
}

