pageLoaded = 0;				// Prevent access to layers until they're loaded

// Set the pageLoaded variable to denote that the layers are ready to be used 
function doLoadProc() {
	pageLoaded = 1;
}

// swapImg - swaps an image for another that has already been preloaded.
function swapImg(imgName, preloadedImgName) {
	document[imgName].src = eval(preloadedImgName).src;
}

function preload(imgSrc,strAlt) {
	img = new Image();
	img.src = imgSrc;
	img.alt = strAlt;
	return img;
}

function dropdownGo(selBoxObj) {
	selectedOption = selBoxObj.options[selBoxObj.selectedIndex];
	url = selectedOption.value;
	target = "_top";

	if (selectedOption.getAttribute("target")) {
		target = selectedOption.getAttribute("target");
	}

	if (url.length > 0) {
		if (target != "_top") {
			window.open(url, target);
		} else {
			document.location = url;
		}
	}
}

function arrayFindValue(array, val) {
	var idx = null;
	for (var i = 0; i < array.length; i++) {
		if (array[i] == val) {
			idx = i;
		}
	}
	return idx;
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(";");
	for(var i = 0; i < ca.length; i++) {
		var c = ca[i];
		while (c.charAt(0) == " ") c = c.substring(1, c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
	}
	return "";
}

function createCookie(name,value,days) {
	expires = "";
	path = "; path=/";
	if (days) {
		var date = new Date();
		date.setTime(date.getTime() + (days * 86400000));
		expires = "; expires=" + date.toGMTString();
	}
	document.cookie = name+"=" + value + expires + path;
	
}

function eraseCookie(name) {
	createCookie(name, "", -1);
}

cssPath = "/templates/common/fontSizes/";

function leavingwarning(){
     alert("You are now leaving this site to link to another website location that is not maintained by the California Department of Insurance (CDI). The CDI takes no responsibility for and has no control over non-CDI sites. When you link to another site you become subject to the privacy policy of the new site.");
}

