<!--

 //***************** general variables

	var currentPlace=1;
	var theLimit=0;
	var holdVar=1;
	var btimer=1;
	var boatTimer;
	var theDate;
	var menuPlace="";
	var menuTimer;
	var scrollTimer;
	var scrollTimer2;
	var release=0;

 //***************** browser sniffing code

	var agt=navigator.userAgent.toLowerCase();
	var is_major = parseInt(navigator.appVersion);
    	var is_minor = parseFloat(navigator.appVersion);
    	var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
	var is_nav4 = (is_nav && (is_major == 4));
	var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var is_ie4up  = (is_ie && (is_major >= 4));
	var is_gecko = (agt.indexOf('gecko') != -1);

 //***************** browser specific variables

	if (is_gecko) {
		visibleVar="visible";
		hideVar="hidden";
	} else if (is_nav4) {
		visibleVar="show";
		hideVar="hide";
   	} else if (is_ie4up) {
		visibleVar="visible";
		hideVar="hidden";
   	} else {
		alert("You are using an unsupported browser!");
	}

 //***************** use this code if separate netscape and ie style sheets are needed

	// currently not being used

	//if (is_ie4up) {
		//document.write ("<LINK REL=STYLESHEET TYPE='text/css' HREF='style_ie.css'>")
	//} else {
		//document.write ("<LINK REL=STYLESHEET TYPE='text/css' HREF='style_net.css'>")
	//}


 //***************** use this code to open email message window

function emailwindow(who) {

	if (is_gecko) {
		lvar = "net";
   	} else if (is_nav4) {
		lvar = "net";
   	} else if (is_ie4up) {
		lvar = "ie";
	}

        if (who == "jr") {
                lvar = "jr";
        }
        if (who == "bt") {
                lvar = "bt";
        }
  
        winHandle = window.open("email_" + lvar + ".html", "emailwindow", "scrollbars=yes,width=600,height=460,resizable=yes");
        winHandle.focus();
}


function openWhatsNewWindow() {
	
	winHandle = window.open("whatsnew.html", "whatsnewwindow", "width=300,height=450,resizable=no");
        winHandle.focus();

}

function openNews( input ) {
	
        winHandle = window.open("news/" + input + ".htm", "_main", "width=300,height=450,resizable=yes");
        winHandle.focus();

}

function flip(win, url)
{
    win.location.replace( url );
}

function openstart() {


	if (is_gecko || is_nav4) {
		winHandle = window.open('start.html', 'browsewindow', 'toolbar=yes,menubar=yes,scrollbars=yes,location=yes,status=yes,width=758,height=454,resizable=yes');
		winHandle.focus();
   	} else if (is_ie4up) {
		winHandle = window.open('start.html', 'browsewindow', 'toolbar=yes,menubar=yes,scrollbars=yes,location=yes,status=yes,width=758,height=430,resizable=yes');
		winHandle.focus();
	}

}

function checkmail(emailForm) {

	if (emailForm.fname.value=="" || emailForm.fname.value==" " || emailForm.lname.value=="" || emailForm.lname.value==" " ||emailForm.emailAddress.value=="" || emailForm.emailAddress.value==" " || emailForm.subject.value=="" || emailForm.subject.value==" " || emailForm.message.value=="" || emailForm.message.value==" ") {
		alert("Please fill out all fields on the email form!");
		return false;
	}

	var Temp = emailForm.emailAddress;
	var AtSym = Temp.value.indexOf('@');
	var Period = Temp.value.lastIndexOf('.');
	var Space = Temp.value.indexOf(' ');
	var Length  = Temp.value.length - 1;
	if ((AtSym < 1) || (Period <= AtSym+1) || (Period == Length ) ||  (Space != -1))
	{  
		alert('Please enter a valid e-mail address!');
		return false;
	}
	document.emailForm.submit();
	
}

function closemail() {

	window.close();

}


 //***************** use this code if separate netscape and ie style sheets are needed


 //***************** browser specific code to change images

function ChangeImage(vDiv,vImg,vEnd) {

	if (is_gecko) {
		document.getElementById(vImg).src =  "images/menus/" + vImg + vEnd;
   	} else if (is_nav4) {
		eval("document." + vDiv + '.' + "document." + vImg + ".src='images/menus/" + vImg + vEnd + "'");
   	} else if (is_ie4up) {
		eval("document.all." + vDiv + '.' + "document.all." + vImg + ".src='images/menus/" + vImg + vEnd + "'");
  	} else {
		alert("You are using an unsupported browser!");
	}
}

 //***************** browser specific code to show and hide content

function ChangeDivVisibility(vLyr, vVisible) {

	if (is_gecko) {
		document.getElementById(vLyr).style.visibility = vVisible;
   	} else if (is_nav4) {
		eval("document." + vLyr + ".visibility='" + vVisible + "'");
   	} else if (is_ie4up) {
		eval("document.all." + vLyr + ".style.visibility='" + vVisible + "'");
  	} else {
		alert("You are using an unsupported browser!");
	}

}

 //************** roll overs *********************
 // 	for rollovers to work, three variables must be passed
 //	1. vType:  0 for onMouseOver; 1 for onMouseOut.
 //	2. vImg:  id/name of image (id and name should be the same; unique per image)
 //  	3. vDiv:  the name of div image is located in

function btnOver(vType,vImg,vDiv){

	if(vType==0) { ChangeImage(vDiv, vImg, "-over.jpg"); } 
	else { ChangeImage(vDiv, vImg, ".jpg"); }

}

 //***************** handle arrow clicks

function gotonext(theDirection, theSection, theSkip, theSubNum) {

	ChangeDivVisibility(theSection + currentPlace, hideVar);
	gotonetguts(theDirection, theSection, theSkip, theSubNum);
	ChangeDivVisibility(theSection + holdVar, visibleVar);
}

 //***************** handle arrow clicks

function gotonetguts(theDirection, theSection, theSkip, theSubNum) {

	ChangeDivVisibility("pic" + theSubNum + currentPlace, hideVar);
	ChangeDivVisibility("textheader" + currentPlace, hideVar);

	if (theSkip!=0) {

		ChangeDivVisibility("leftdiv", visibleVar);
		ChangeDivVisibility("rightdiv", visibleVar);

		if (theSkip==theLimit) {
			theDirection="right";
			currentPlace=(theSkip-1);	
		} else {
			theDirection="left";
			currentPlace=(theSkip+1);
		} 
	}

	if (theDirection=="left") { holdVar = (currentPlace - 1); } 
	else { holdVar = (currentPlace + 1); }

	if (holdVar==1) { ChangeDivVisibility("leftdiv", hideVar); }

	if (holdVar==theLimit) { ChangeDivVisibility("rightdiv", hideVar); }
	
	if (currentPlace==1) { ChangeDivVisibility("leftdiv", visibleVar); }

	if (currentPlace==theLimit) { ChangeDivVisibility("rightdiv", visibleVar); }
	
	ChangeDivVisibility("pic" + theSubNum + holdVar, visibleVar);
	ChangeDivVisibility("textheader" + holdVar, visibleVar);
	currentPlace=holdVar;

}

function gotonextcontact(theDirection, theSection, theSkip, theSubNum) {

	ChangeContactDivVisibility(theSection, theSection + currentPlace, hideVar);
	ChangeDivVisibility("textcontacthead" + currentPlace, hideVar);
	gotonetguts(theDirection, theSection, theSkip, theSubNum);

	vLyr = "textcontact" + currentPlace;
	vParentLyr = "textcontact";

	if (is_gecko) {
		document.getElementById(vLyr).style.top = 0 + "px"; 
	} else if (is_nav4) {
		eval("document."+vParentLyr+".document." + vLyr + ".top = 0"); 
	} else if (is_ie4up) {
		eval("document.all."+vParentLyr+".document.all." + vLyr + ".style.posTop = 0");
	}	

	ChangeContactDivVisibility(theSection, theSection + holdVar, visibleVar);
	ChangeDivVisibility("textcontacthead" + holdVar, visibleVar);
}

function ChangeContactDivVisibility(vParentLyr, vLyr, vVisible) {

	if (is_gecko) {
		document.getElementById(vLyr).style.visibility = vVisible;
   	} else if (is_nav4) {
		eval("document." + vParentLyr + ".document." + vLyr + ".visibility='" + vVisible + "'");
   	} else if (is_ie4up) {
		eval("document.all." + vParentLyr + ".document.all." + vLyr + ".style.visibility='" + vVisible + "'");
  	} else {
		alert("You are using an unsupported browser!");
	}

}

 //***************** called by contact pages to show or hide scroll arrows

function showscroll(thePage) {

	if (thePage==1) {
		if (currentPlace>2) {		
			ChangeDivVisibility("updiv", visibleVar);
			ChangeDivVisibility("downdiv", visibleVar);
		} else {
			ChangeDivVisibility("updiv", hideVar);
			ChangeDivVisibility("downdiv", hideVar);
		}
	} else if (thePage==2) {
		if (currentPlace<3) {		
			ChangeDivVisibility("updiv", visibleVar);
			ChangeDivVisibility("downdiv", visibleVar);
		} else {
			ChangeDivVisibility("updiv", hideVar);
			ChangeDivVisibility("downdiv", hideVar);
		}
	}
}

 //***************** This scrolls the text area

function dotheScroll(vDir,vParentLyr, vLyr) {

	if(release==0)	{
		if(vDir==0) {
			if (is_gecko) {
				if (parseInt(document.getElementById(vLyr).style.top)<0) {document.getElementById(vLyr).style.top = parseInt(document.getElementById(vLyr).style.top) + 15 + "px"; }
			} else if (is_nav4) {
				if ( eval("document."+vParentLyr+".document." + vLyr + ".top") <0) { eval("document."+vParentLyr+".document." + vLyr + ".top +=15"); }
			} else if (is_ie4up) {
				if ( eval("document.all."+vParentLyr+".document.all." + vLyr + ".style.posTop")<0) { eval("document.all."+vParentLyr+".document.all." + vLyr + ".style.posTop +=15"); }	
			}	
			scrollTimer = setTimeout("dotheScroll(0,"+"'"+vParentLyr+"'"+","+"'"+vLyr+"'"+")",100);
		}
		
		if(vDir==1) {
			if (is_gecko) {
				if (parseInt(document.getElementById(vLyr).style.top)>-650) {document.getElementById(vLyr).style.top = parseInt(document.getElementById(vLyr).style.top) - 15 + "px"; }
			} else if (is_nav4) {
				if ( eval("document."+vParentLyr+".document." + vLyr + ".top") >-650) { eval("document."+vParentLyr+".document." + vLyr + ".top -=15"); }
			} else if (is_ie4up) {
				if ( eval("document.all."+vParentLyr+".document.all." + vLyr + ".style.posTop")>-650) { eval("document.all."+vParentLyr+".document.all." + vLyr + ".style.posTop -=15"); }
			}
			scrollTimer = setTimeout("dotheScroll(1,"+"'"+vParentLyr+"'"+","+"'"+vLyr+"'"+")",100);
		}
	}
}

 //***************** This is the function called on the mouseup of the arrows on the screen

function setRelease(val) {
	release=val;
	scrollTimer = setTimeout("release=0",200);
}

 //***************** boat animation

function moveLayer(vLyr, numValue, theDirection) {

	if (is_gecko) {

		if (theDirection=="left") {
			numValue = (parseInt(document.getElementById(vLyr).style.left) + numValue);
			document.getElementById(vLyr).style.left = numValue + "px";
		} else if (theDirection=="top") { 
			numValue = (parseInt(document.getElementById(vLyr).style.top) + numValue);
			document.getElementById(vLyr).style.top = numValue + "px"; 
		} 

   	} else if (is_nav4) {

		eval("numValue = document." + vLyr + "." + theDirection + " + " +  numValue);
		eval("document." + vLyr + "." + theDirection + "='" + numValue + "'");

   	} else if (is_ie4up) {

		if (theDirection=="left") {
			theDirection = "posLeft";
		} else if (theDirection=="top") {
			theDirection = "posTop";
		}

		eval("numValue = document.all." + vLyr + ".style." + theDirection + " + " +  numValue);
		eval("document.all." + vLyr + ".style." + theDirection + "='" + numValue + "'");

  	} else {
		alert("You are using an unsupported browser!");
	}

}

function MoveBoat() {

	if (btimer==1) { 
		ChangeDivVisibility("boat", visibleVar); 
		ChangeDivVisibility("sun", visibleVar); 
	}

	if (btimer < 243) {
		moveLayer("boat", -2, "left");
		btimer++;
		if (btimer>173 && btimer <220) { moveLayer("sun", -1, "top"); }
		var mdelay = movedelay();
		boatTimer = setTimeout(MoveBoat, mdelay);
	} else {

		ChangeDivVisibility("boatfinal", visibleVar);
		ChangeDivVisibility("boat", hideVar);
		//clearTimeout(boatTimer);
		//SetBoatTimer();

	}
}


function SetBoatTimer() {
	var rdelay = restartdelay();
	boatTimer = setTimeout(DoAnimation, rdelay);
}


function DoAnimation() {

	btimer=1;
	ChangeDivVisibility("boatfinal", hideVar);
	ChangeDivVisibility("boat", hideVar);
	ChangeDivVisibility("boat", hideVar);
	moveLayer("boat", 475, "left");
	moveLayer("sun", 47, "top");
	MoveBoat();

}

function movedelay() {

	if (navigator.userAgent.indexOf("Win") > 0) { retval=60; }
	else if (navigator.userAgent.indexOf("Mac") > 0) { retval=80; }
	else { retval=15; }

	return retval;

}

function restartdelay() {

	if (navigator.userAgent.indexOf("Win") > 0) { retval=25000; }
	else if (navigator.userAgent.indexOf("Mac") > 0) { retval=65000; }
	else { retval=90000; }

	return retval;

}

 //***************** show sub menus

function showmenu(theSection, lvar) {

	if (menuPlace==theSection) { clearTimeout(menuTimer); }

	if (lvar>0) { ChangeDivVisibility(theSection + "menuhigh" + lvar, visibleVar); }

	ChangeDivVisibility(theSection + "back", visibleVar);
	ChangeDivVisibility(theSection + "menu", visibleVar);

	wipeOthers(theSection, lvar);
	
}

function wipeOthers(theKeeper, lvar) {

	var SectionList = new Array();
	var HighList = new Array();

	SectionList = ["about", "products", "claims", "form", "contact", "links"];
	HighList = [4,2,2,3,3,1];

	for (c=0 ; c < SectionList.length ; c++) {
		if (theKeeper!=SectionList[c]) { 
			ChangeDivVisibility(SectionList[c] + "back", hideVar);
			ChangeDivVisibility(SectionList[c] + "menu", hideVar);
		}
	}

	for (c=0 ; c < SectionList.length ; c++) {
		for (x=1 ; x <= HighList[c] ; x++) {
			if (theKeeper!=SectionList[c] || lvar!=x) { 
				ChangeDivVisibility(SectionList[c] + "menuhigh" + x, hideVar);
			}
		}
	}

	

}

 //***************** hide sub menus

function hidemenu(theSection) {

	menuPlace = theSection;
	theDate = new Date();
	var hdelay = hidedelay();
	menuTimer = setTimeout(reallyhidemenu, hdelay);
	
}

function hidedelay() {

	if (navigator.userAgent.indexOf("Win") > 0) { retval=100; }
	else if (navigator.userAgent.indexOf("Mac") > 0) { retval=400; }
	else { retval=600; }

	return retval;

}

function reallyhidemenu() {

	var elapsed = new Date() - theDate;
	var hdelay = hidedelay();
	if (elapsed < hdelay) {
		menuTimer = setTimeout(reallyhidemenu, hdelay-elapsed);
		return;
	}

	var SectionList = new Array();
	var HighList = new Array();

	SectionList = ["about", "products", "claims", "form", "contact", "links"];
	HighList = [4,2,2,3,3,1];

	if (menuPlace!="") {
		ChangeDivVisibility(menuPlace + "back", hideVar);
		ChangeDivVisibility(menuPlace + "menu", hideVar);
		
		for (c=0 ; c < SectionList.length ; c++) {
			if (menuPlace==SectionList[c]) {
				for (x=1 ; x <= HighList[c] ; x++) {
					ChangeDivVisibility(SectionList[c] + "menuhigh" + x, hideVar);
				}
			}
		}
		
		menuPlace="";
		clearTimeout(menuTimer);
	}

}


 //***************** call in onload of each page this sets theLimit counter & starts boat animation

function initializepage(theNum, theSection) {

	theLimit = theNum;
	if (theLimit > 0) { ChangeDivVisibility("rightdiv", visibleVar); }
	if (parent.globalSkip!=0) {
		gotonext("right", "textmain", parent.globalSkip, parent.globalSection);
		parent.globalSkip=0;
		parent.globalSection=0;
	} else {
		ChangeDivVisibility("textmain1", visibleVar);
		ChangeDivVisibility("textheader1", visibleVar);
	}

	startscrollandboat();

}

function initializecontactpage(theNum, theSection) {

	theLimit = theNum;
	if (theLimit > 0) { ChangeDivVisibility("rightdiv", visibleVar); }
	if (parent.globalSkip!=0) {
		gotonextcontact("right", "textcontact", parent.globalSkip, parent.globalSection);
		parent.globalSkip=0;
		parent.globalSection=0;
	} else {
		ChangeContactDivVisibility("textcontact", "textcontact1", visibleVar);
		ChangeDivVisibility("textheader1", visibleVar);
	}
	
	startscrollandboat();

}

function startscrollandboat() {

	window.config=new mkcfg(1);
	window.config.list[1]="We treat our Insureds and Producers as Clients, Not Adversaries!";
	window.config.type[1]=1;
	window.config.timer=window.setTimeout('sbprint()',window.config.delay);

	MoveBoat();

}

 //***************** functions to allow for links from one page to internal text sections on differnt page

function gotoskip(theSkip, theSection, thePage) {

		parent.globalSkip=theSkip;
		parent.globalSection=theSection;
		document.location = thePage;

}

 //***************** functions to control text scroll at the bottom of the page

function browserdelay() {

	if (navigator.userAgent.indexOf("Mac") > 0) { retval=400; }
	else if (navigator.userAgent.indexOf("X11") > 0) { retval=600; }
	else { retval=100; }

	return retval;

}

function mklist(n) {

	this.length=n;
	for (var c=1 ; c <= n ; c++) { this[c]=0; }
	return this;

}

function mkcfg(n) {

	this.num=1;				/* Which message we're on */
	this.seed=0;				/* Used for scrolling types */
	this.list=new mklist(n);		/* List of messages to display */
	this.type=new mklist(n);		/* Display method indicators */
	this.delay=browserdelay();		/* Browser platform specific delay */
	this.timer=0;				/* System event timer */
	this.showurl=(5 * 1000);		/* Timeout for urlfix functionality */

	this.looping=true;			/* Continuously rotate messages? */
	this.msgdisp=(5 * 1000);		/* How long to display non-scrolling messages */
	this.barwidth=125;			/* How many character to size the status bar */
	return this;

}

function scrollit_r2l() {

	var out=" ";
	var c=0;

	if (window.config.seed <= window.config.barwidth && window.config.seed > 0) {
		for (c=0 ; c < window.config.seed ; c++) {
			out+=" ";
		}
		out+=window.config.list[window.config.num];
		window.config.seed--;
		window.status=out;
		window.config.timer=window.setTimeout("scrollit_r2l()",window.config.delay);
	}
	else if (window.config.seed <= 0) {
		if (-window.config.seed < window.config.list[window.config.num].length) {
			out+=window.config.list[window.config.num].substring(-window.config.seed,window.config.list[window.config.num].length);
			window.config.seed--;
			window.status=out;
			window.config.timer=window.setTimeout("scrollit_r2l()",window.config.delay);
		}
		else {
			window.status=" ";
			window.config.num++;
			window.config.timer=window.setTimeout("sbprint()",window.config.msgdisp);
		}
	}
}

function sbprint() {

	if (window.config.num <= window.config.list.length) {
		if (window.config.type[window.config.num] == 0) {
			window.status=window.config.list[window.config.num];
			window.config.num++;
			window.clearTimeout(window.config.timer);
			window.config.timer=window.setTimeout('sbprint()',window.config.msgdisp);
		}
		else if (window.config.type[window.config.num] == 1) {
			window.config.seed=window.config.barwidth;
			scrollit_r2l();
		}

	}
	else if (window.config.looping) {
		window.config.num=1;
		window.clearTimeout(window.config.timer);
		window.config.timer=window.setTimeout('sbprint()',window.config.delay);
	}
}

// -->

