//functions added by Forward Function, Inc.

function presentFlash(flashSource, bgColor, width, height, wmode, flashVars) {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+ width +'" height="'+ height +'" id="'+ flashSource +'" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain">');
	document.write('<param name="movie" value="/images/'+ flashSource +'.swf">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="bgcolor" value="'+ bgColor +'">');
	document.write('<param name="menu" value="false">');
	document.write('<param name="wmode" value="'+ wmode +'">');
	document.write('<param name="flashvars" value="'+ flashVars +'">');
	document.write('<embed src="/images/'+ flashSource +'.swf" flashvars="'+ flashVars +'" menu="false" wmode="'+ wmode +'" quality="high" bgcolor="'+ bgColor +'" width="'+ width +'" height="'+ height +'" name="'+ flashSource +'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">');
	document.write('</object>');
}

var t = new Array();
var direction = new Array();
var maxHeight = new Array();
var timer = new Array();

function toggleContent(content) {
	if (document.getElementById(content)){
		t[content] = 0;
		if (document.getElementById(content).style.display == 'none') {
			direction[content] = 'down';
			document.getElementById(content).style.display = 'block';
			maxHeight[content] = document.getElementById(content).offsetHeight;
			document.getElementById(content).style.height = '1px';
			document.images[content+'Arrow'].src = '/images/arrowOpen.gif';
			timer[content] = setInterval('slideTick("'+content+'" ,"'+maxHeight[content]+'", "'+direction[content]+'");', 5);
		} else {
			direction[content] = 'up';
			document.images[content+'Arrow'].src = '/images/arrowClosed.gif';
			timer[content] = setInterval('slideTick("'+content+'");', 5);
		}
	}
}

function slideTick(content) {
	t[content] ++;
	if (t[content] > 20) {
		t[content] = 0;
		clearInterval(timer[content]);
		if (direction[content] == 'up') {
			document.getElementById(content).style.display = 'none';
			document.getElementById(content).style.height = maxHeight[content]+'px';
		}
	} else {
		if (direction[content] == 'down') {
			document.getElementById(content).style.height = Math.round(parseInt(t[content])/20*parseInt(maxHeight[content]))+'px';
		} else {
			document.getElementById(content).style.height = Math.round((20-parseInt(t[content]))/20*parseInt(maxHeight[content]))+'px';
		}
	}
}

window.onload = function() {
	if (window.location.hash.replace(/#/g,'') != '') {
		toggleContent(window.location.hash.replace(/#/g,''));
	}
}

function clearFormText(formField){
if (formField.defaultValue==formField.value)
formField.value = "";
}

//begin CIC functions -----

//function called by all pages body onLoad event
function bodyOnLoad() {
	if (window.location.hash.replace(/#/g,'') != '') {
		toggleContent(window.location.hash.replace(/#/g,''));
	}
//add statements
}

function agentLocatorOnSubmit() {
	var form = document.getElementById('agentLocatorForm');
    
	//if( form.locatorState.selectedIndex == 0){
	//	alert("Please select a state.");
	//	return false;
	//} else {
		return true;
	//}
	
}

function dealerAppraiserLocatorOnSubmit() {
	var form = document.getElementById('dealerAppraiserLocatorForm');
	
}


//left navigation functions
function onClickHeader(elementId) {
	var linkElement = document.getElementById(elementId);
	var linkValue = linkElement.getAttribute('link');
	window.location = linkValue;
}
	
function onOverHeader(elementId) {
	var currentElement = document.getElementById(elementId);
	currentElement.style.textDecoration = "underline";
}
	
function onOutHeader(elementId) {
	var currentElement = document.getElementById(elementId);
	currentElement.style.textDecoration = "none";
}
	
function onClickSection(elementId) {
	var linkElement = document.getElementById(elementId);
	var linkValue = linkElement.getAttribute('link');
	window.location = linkValue;
}
	
function onOverSection(elementId) {
	var currentElement = document.getElementById(elementId);
	currentElement.style.textDecoration = "underline";
}
	
function onOutSection(elementId) {
	var currentElement = document.getElementById(elementId);
	currentElement.style.textDecoration = "none";
}
	
function onClickPage(elementId) {
	var linkElement = document.getElementById(elementId);
	var linkValue = linkElement.getAttribute('link');
	window.location = linkValue;
}
	
 function onOverPage(elementId) {
 	var currentElement = document.getElementById(elementId);
	currentElement.style.textDecoration = "underline";
 }
	 
 function onOutPage(elementId) {
 	var currentElement = document.getElementById(elementId);
	currentElement.style.textDecoration = "none";
 }

function popitup(url)
{
	newwindow=window.open(url,'name','height=600,width=710, scrollbars=yes');
	if (window.focus) {newwindow.focus()}
	return false;
}
function popitupclaims(url)
{
	newwindow=window.open(url,'name','height=600,width=960, scrollbars=yes');
	if (window.focus) {newwindow.focus() }
	//return false;
}
