﻿//<script>

var menuArray = new Array();
var N4, N5, IE4, IE5;


function demopop(page) {
OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no,width=650,height=530,scrollbars=no,resizable=no,screenX=50,screenY=50,left=50,top=50");
OpenWin.focus();
}

function widepop(page) {
OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no,width=850,height=530,scrollbars=yes,resizable=yes,screenX=50,screenY=50,left=50,top=50");
OpenWin.focus();
}

function imagepop(page) {
OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no,width=500,height=500,scrollbars=no,resizable=no,screenX=50,screenY=50,left=50,top=50");
OpenWin.focus();
}

function longpop(page) {

OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no,width=500,height=720,scrollbars=no,resizable=no,screenX=50,screenY=50,left=50,top=50");
OpenWin.focus();
}


function setGlobals(){
	N4=N5=IE4=IE5=false;
	if (document.getElementById){
		N5=true;
		IE5=true;
	}
	else if (document.all)
	{
		IE4=true;
	}
	else N4=true;

	if (N4) {var origWidth = window.innerWidth;var origHeight = window.innerHeight;window.onresize = reDo;}
}
function reDo() {if (window.innerWidth != origWidth || window.innerHeight != origHeight) location.reload();}


function init(){
		drawMenu();
	}

function openWindow (objSelect){
window.open( objSelect.options[objSelect.selectedIndex].value);

}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function goLink(linkStr){
	window.location = linkStr;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function menuObj(lay,nr){
	if(N4){
		this.lay = document.layers[lay];
		this.lay.parentNr = nr;
		this.lay.write = writeLay;
		this.lay.hide = hideLay;
		this.lay.show = showLay;
	}else{
		if(IE4)
			this.lay = document.all[lay];
		else
			this.lay = document.getElementById(lay);
		this.lay.parentNr = nr;
		this.lay.write = writeLayIE;
		this.lay.hide = hideLayIE;
		this.lay.show = showLayIE;
	}
	this.lay.onmouseover = menuLayOver;
	this.lay.onmouseout = menuLayOut;
	
}
function menuLayOver(){if(!N4) selVis("hidden");clipMenu(this.parentNr);hideAll();this.show();if(this.id=='drop_down1')MM_showHideLayers('iform','','hide');if(this.id=='drop_down2')MM_showHideLayers('iform','','hide')}
function menuLayOut(){this.hide();hideMarker();if(!N4) selVis("visible");MM_showHideLayers('iform','','show')}

function writeLay(txt){this.document.write(txt);this.document.close();}
function writeLayIE(txt){this.innerHTML = txt + '<div></div>';}
function hideLay(){this.visibility = "hide";}
function showLay(){this.visibility = "show";}
function hideLayIE(){this.style.visibility = "hidden";}
function showLayIE(){this.style.visibility = "visible";}

function selVis(vis){
	
}
function hideAll() {
	for(var i=0;i < menuArray.length;i++)
		menuArray[i].lay.hide();
}
function hideMenus(){hideAll();hideMarker();if(!N4) selVis("visible");}

function showMenu(nr){
	if(menuArray.length>0){ 
		if(!N4) selVis("hidden");
		clipMenu(nr);
		hideAll();
		menuArray[nr].lay.show();
	}
}

function drawMenu(){
	setGlobals();
	var menuTxt = [	
					[["About CRS", "aboutcrs.aspx"], ["Mission", "mission.aspx"], ["Map of Locations", "locations.aspx"]],[["Specialized Expertise", "specializedexpertise.aspx"],["Claims Admin.", "claims.aspx"],["Loss Control Mgmt.", "loss.aspx"], ["Forms", "wcforms.aspx"]],[["Contact Us", "contactus.aspx"],["Meet Our Staff", "staff.aspx"]],[]
				];
	for(var i=0;i<menuTxt.length;i++){
		menuArray[i] = new menuObj('drop_down'+i,i);
		var mTxt = "";
		for(var n=0;n<menuTxt[i].length;n++){
			if(document.getElementById)
				mTxt += '<tr><td height="15" bgcolor="#FFA12D" onmouseover="lOver(this)" onmouseout="lOut(this)" ';
			else
				mTxt += '<tr><td height="15" bgcolor="#FFA12D" ';
			if(!N4) 
				mTxt += 'style="cursor:hand"';
			if (IE4){
				mTxt += 'onclick="goLink(\''+ menuTxt[i][n][1] +'\');return false"><span class="drop_down_text"><A href="'+menuTxt[i][n][1]+'"><img src="im/dot.gif" width="7" border="0">'+menuTxt[i][n][0]+'<img src="im/dot.gif" width="7" border="0"></A></span></td></tr>';
			}
			else
				mTxt += 'onclick="goLink(\''+ menuTxt[i][n][1] +'\');return false"><span class="drop_down_text"><A href="'+menuTxt[i][n][1]+'">&nbsp;&nbsp;'+menuTxt[i][n][0]+'</A>&nbsp;&nbsp;</span></td></tr>';
		}
//		alert(mTxt);
		menuArray[i].lay.write('<table bgcolor="#ffffff" cellspacing=0 border=0>'+mTxt+'</table>');
	}
}
function lOver(obj){
	if(!N4){ 
		obj.style.backgroundColor = "#DD6000";
		if(obj.children)
			obj.children[0].children[0].style.color = "white";
	
	}
}
function lOut(obj){
	if(!N4){
		obj.style.backgroundColor = "#FFA12D";
		if(obj.children)
			obj.children[0].children[0].style.color = "white";
	}
}

var menuclipArea = [[0,63],[62,116],[115,185],[184,270],[100,400],[337,409],[408,468]];

function clipMenu(indx){
	if(indx < menuclipArea.length){
		if(N4)
			var mLay = document.layers['guide'];
		else if(IE4)
			var mLay = document.all['guide'];
		else
			var mLay = document.getElementById('guide');
		mLay.setClip = N4?setClip:setClipIE;
		mLay.show = N4?showLay:showLayIE;
		mLay.setClip(menuclipArea[indx][0], 0, menuclipArea[indx][1], 20);
		mLay.show();
	}
}
function hideMarker(){
	if(N4)
		var mLay = document.layers['guide'];
	else if(IE4)
		var mLay = document.all['guide'];
	else
		var mLay = document.getElementById('guide');
	mLay.hide = N4?hideLay:hideLayIE;
	mLay.hide();
}
function setClip(x, y, x2, y2){
	this.clip.left = x;
	this.clip.top = y;
	this.clip.right = x2;
	this.clip.bottom = y2;
}
function setClipIE(x, y, x2, y2){
	this.style.clip = "rect("+y+" "+x2+" "+y2+" "+x+")";
}

function goLink(linkStr){
	window.location = linkStr;
}
function resetForm(lay, formName){
	if(document.layers)
		document.layers[lay].document.forms[formName].reset();
	else if(document.getElementById)
		document.getElementById(formName).reset();
	else
		document.forms[formName].reset();
}

var remember = new Array();
var remember2 = new Array();
var checkIt;

var DHTML = (document.getElementById || document.all || document.layers);

function show(name,lvl,obj)
{
	if (!DHTML) return;
	checkUserInput();
	if (remember[lvl] && remember[lvl] == name) return;
	if (remember[lvl])
	{
		closeAll(lvl);
	}
	if (name)
	{
		var x = getObj(name);
		x.visibility = 'visible';
	}
	remember[lvl] = name;
	if (obj.parentNode) y = obj.parentNode;
	else if (obj.parentElement) y = obj.parentElement;
	else return;
	if (y.className) return;
	y.className = 'over';
	if (remember2[lvl]) remember2[lvl].className = '';
	remember2[lvl] = y;
}

function closeAll(lvl)
{
	for (i=remember.length - 1;i>=lvl;i--)
	{
		if (remember[i]) //IE4 Mac
		{
			var x = getObj(remember[i]);
			x.visibility = 'hidden';
		}
		remember[i] = null;
		if (remember2[i])
		{
			remember2[i].className = '';
			remember2[i] = null;
		}
	}

}

function checkUserInput()
{
	if (checkIt) clearTimeout(checkIt);
	checkIt = setTimeout('closeAll(1)',3000);
}

function getObj(name)
{
  if (document.getElementById)
  {
    return document.getElementById(name).style;
  }
  else if (document.all)
  {
    return document.all[name].style;
  }
  else if (document.layers)
  {
    return document.layers[name];
  }
  else return false;
}





