<!--

// NOTE: NOTHING but index.html can contain first 3 chars "ind" split by "_"

defaultStatus = "Green Light Insurance Inc. | Motorcycle Insurance Agency Inc.";

var numVeh = 4;

// LOAD MENU IMAGES
var img_about = new Image(149,28);
var img_quote = new Image(149,28);
var img_location = new Image(149,28);
var img_butt = new Image(149,28);
var img_chicago = new Image(149,28);
var img_links = new Image(149,28);
img_about.src = "/html/gli_imgs/menus/about.jpg";
img_quote.src = "/html/gli_imgs/menus/quote.jpg";
img_location.src = "/html/gli_imgs/menus/location.jpg";
img_butt.src = "/html/gli_imgs/menus/butt.jpg";
img_chicago.src = "/html/gli_imgs/menus/chicago.jpg";
img_links.src = "/html/gli_imgs/menus/links.jpg";

// LOAD MENU-OVER IMAGES
var img_about_over = new Image(149,28);
var img_quote_over = new Image(149,28);
var img_location_over = new Image(149,28);
var img_butt_over = new Image(149,28);
var img_chicago_over = new Image(149,28);
var img_links_over = new Image(149,28);
img_about_over.src = "/html/gli_imgs/menus/about_over.jpg";
img_quote_over.src = "/html/gli_imgs/menus/quote_over.jpg";
img_location_over.src = "/html/gli_imgs/menus/location_over.jpg";
img_butt_over.src = "/html/gli_imgs/menus/butt_over.jpg";
img_chicago_over.src = "/html/gli_imgs/menus/chicago_over.jpg";
img_links_over.src = "/html/gli_imgs/menus/links_over.jpg";

function getObj(ob){
	if (document.layers){
      	//Netscape 4 specific code
      	ret = 'document.' + ob;
   	}
   	if (document.getElementById){
      	//Netscape 6 specific code
      	ret = 'document.getElementById("' + ob + '")';
  	 }
   	if (document.all){
      	//IE4+ specific code
      	ret = 'document.all.' + ob;
   	}
	
	return eval(ret);
}

// FUNCTION WINDOW STATUS
function winStatus(content) {
	window.status = content;
}

// FUNCTION MENU MOUSEOVER
function imgOver(winsts,imgid) {

	isrc = "img_" + imgid + "_over.src";
	document.images[imgid].src = eval(isrc);
		
	winStatus(winsts);
}

// FUNCTION MENU MOUSEOUT
function imgOut(imgid) {

	isrc = "img_" + imgid + ".src";
	document.images[imgid].src = eval(isrc);

	winStatus(defaultStatus);
}

 //global - needed by date functions
var D_Opt = new Array() // 29..31

	//resets day form control (# of days in month) based on year and month
function MonLen(Yr, Mo, Dy, moidx) { 
  var Dol, K, DiM, NsI;
  DiM = DaysinMonth(Yr.options[Yr.selectedIndex].text, Mo.selectedIndex);
  Dol = Dy.options.length;
  if ( (NsI = Dy.selectedIndex) >= DiM ) NsI = DiM;
  for (K=Dol   ; K >DiM+1 ; K--)
    { D_Opt[K] = Dy.options[K-1] ; Dy.options[K-1] = null; } // shrink
  for (K=Dol+1 ; K<=DiM+1 ; K++)   Dy.options[K-1] = D_Opt[K]; // or grow
  Dy.selectedIndex = NsI;
}

	//returns # of days in given month of given year
function DaysinMonth (year,month) {
 	var days = new Array(31, ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0 ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
  	return days[month-1];
}
  
  // Initialiser :
function InitYMDselector(Yr, Mo, Dy, Anni, Base, SetObj) { var J

		//if values are set, leave it alone
  var Mon3 = ["Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec"];
  if (!Base) Base = new Date().getFullYear();

  Yr.options[0] = new Option("<select>"); Yr.options[0].value = "";
  Mo.options[0] = new Option("<select>"); Mo.options[0].value = "";
  Dy.options[0] = new Option("<select>"); Dy.options[0].value = "";
  
  for (J=1; J<Anni+1; J++) Yr.options[J] = new Option(Base+J-1);
  for (J=1;  J<12+1 ; J++) Mo.options[J] = new Option(Mon3[J-1]);
  for (J=1;  J<31+1 ; J++) Dy.options[J] = new Option(J);

  MonLen(Yr, Mo, Dy) ;
  Yr.selectedIndex = Mo.selectedIndex = Dy.selectedIndex = 0;
}

	//displays section with given layer id
function showLayer (layer) {
	if (document.layers){
      	//Netscape 4 specific code
      	pre = 'document.';
      	post = '';
   	}
   	if (document.getElementById){
      	//Netscape 6 specific code
      	pre = 'document.getElementById("';
      	post = '").style';
  	 }
   	if (document.all){
      	//IE4+ specific code
      	pre = 'document.all.';
      	post = '.style';
   	}
	
   	eval(pre + layer + post).visibility = 'visible';
}

	//hides section with given layer id
function hideLayer (layer) {
	if (document.layers){
      	//Netscape 4 specific code
      	pre = 'document.';
      	post = '';
   	}
   	if (document.getElementById){
      	//Netscape 6 specific code
      	pre = 'document.getElementById("';
      	post = '").style';
  	 }
   	if (document.all){
      	//IE4+ specific code
      	pre = 'document.all.';
      	post = '.style';
   	}
	eval(pre + layer + post).visibility = 'hidden';
}

	//toggles visibility of CC/Cylinders controls based on use selection
function CarOrMoto(choi,idx) {
	
	var choice = getObj(choi);
	
	if (choice.selectedIndex == 1) {	//car
		showLayer ('cyl'+'_'+idx);
		showLayer ('cyl2'+'_'+idx);
		hideLayer ('cc'+'_'+idx);
		hideLayer ('cc2'+'_'+idx);
		hideLayer ('xtra'+'_'+idx);
		hideLayer ('xtra2'+'_'+idx);
	}
	else if (choice.selectedIndex == 2) {	//motorcycle
		showLayer ('cc'+'_'+idx);
		showLayer ('cc2'+'_'+idx);
		hideLayer ('cyl'+'_'+idx);
		hideLayer ('cyl2'+'_'+idx);
		showLayer ('xtra'+'_'+idx);
		showLayer ('xtra2'+'_'+idx);
	} else if (choice.selectedIndex == 3) {	//ATV
		showLayer ('cc'+'_'+idx);
		showLayer ('cc2'+'_'+idx);
		hideLayer ('cyl'+'_'+idx);
		hideLayer ('cyl2'+'_'+idx);
		hideLayer ('xtra'+'_'+idx);
		hideLayer ('xtra2'+'_'+idx);
	} else {
		getObj('vehicle_make_'+idx).value = "";
		getObj('vehicle_model_'+idx).value = "";
		getObj('VIN_'+idx).value = "";
		getObj('vehicle_year_'+idx).value = "";
		getObj('car_cyl_'+idx).selectedIndex = 0;
		getObj('bike_cc_'+idx).value = "";
		getObj('extras_'+idx).value = "";
		
		hideLayer ('cc'+'_'+idx);
		hideLayer ('cc2'+'_'+idx);
		hideLayer ('cyl'+'_'+idx);
		hideLayer ('cyl2'+'_'+idx);
		hideLayer ('xtra'+'_'+idx);
		hideLayer ('xtra2'+'_'+idx);
	}		
}

//displays/hides ticket text area
function ticketChange(choice) {
	if (choice.selectedIndex == 2) 	{	//YES
		showLayer ('ticketwhytext');
		showLayer ('ticketwhy');
		showLayer ('tick');
		showLayer ('ticktxt');
	} else {
		hideLayer ('ticketwhytext');
		hideLayer ('ticketwhy');
		hideLayer ('tick');
		hideLayer ('ticktxt');
	}
}

function accidentChange(choice) {
	if (choice.selectedIndex == 2) 	{	//YES
		showLayer ('aftxt');
		showLayer ('af');
		showLayer ('naftxt');
		showLayer ('naf');
		showLayer ('accwhentxt');
		showLayer ('accwhen');
	} else {
		hideLayer ('aftxt');
		hideLayer ('af');
		hideLayer ('naftxt');
		hideLayer ('naf');
		hideLayer ('accwhentxt');
		hideLayer ('accwhen');
	}
}

function PrevCarrier(choice) {
	if (choice.selectedIndex == 1) {
		showLayer ('carriertxt');
		showLayer ('carrierfield');
		showLayer ('policytxt');
		showLayer ('policyfield');
		showLayer ('inceptiontxt');
		showLayer ('inceptionfield');
		showLayer ('expirationtxt');
		showLayer ('expirationfield');
	} else {
		hideLayer ('carriertxt');
		hideLayer ('carrierfield');
		hideLayer ('policytxt');
		hideLayer ('policyfield');
		hideLayer ('inceptiontxt');
		hideLayer ('inceptionfield');
		hideLayer ('expirationtxt');
		hideLayer ('expirationfield');
	}
}

// resets date controls and Car/Motorcycle section visibility
function setDefaults (quoteform) {
	Now = new Date();	//today's date
	with (quoteform) {
  		InitYMDselector(b_year, b_month, b_day, 100, Now.getFullYear()-99, Now);
		InitYMDselector(exp_year, exp_month, exp_day, 50, Now.getFullYear()-25, Now);
		InitYMDselector(incept_year, incept_month, incept_day, 50, Now.getFullYear()-49, Now);
		for(vti=1; vti<(numVeh+1); vti++){
			CarOrMoto("vehicletype_"+vti.toString(),vti.toString());
		}
		ticketChange(tickets);
		accidentChange(accidents);
		PrevCarrier(previous);
	}
}

//-->