//functions added by Forward Function, Inc.

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;
}
