/* ------------------------------------------------   Magic Vars   ------------------------------------------------ */
var globalPath = 'http://insurance.utah.gov/'; //this is the path to root that we can use for building common elements

var ie7 = false; //this is set with a ie conditional statement in ieStye() (below). it's a great way to find out if the user is browsing with ie7.

var theDate = new Date();
var currentYear = theDate.getYear();
if (currentYear < 2000) {
	currentYear += 1900;
}




/* ------------------------------------------------   Menu Arrays   ------------------------------------------------ */
//in the arrays below, the first set of quotes is the url, the second is the graphical button, the third is the alt attribute and title value.

// .push({theLink:'', theImage:'imageHere', theName:''});


var  consumerMainNavArray = new Array();
	consumerMainNavArray.push({theLink:'seniors/index.html', theImage:'imageHere', theName:'Seniors'});
	consumerMainNavArray.push({theLink:'auto/index.html', theImage:'imageHere', theName:'Auto/Home'});
	consumerMainNavArray.push({theLink:'health/index.html', theImage:'imageHere', theName:'Health'});
	consumerMainNavArray.push({theLink:'annuity/index.html', theImage:'imageHere', theName:'Life/Annuity'});
	consumerMainNavArray.push({theLink:'insureu/index.html', theImage:'imageHere', theName:'Insure U'});
	consumerMainNavArray.push({theLink:'hiputah/index.html', theImage:'imageHere', theName:'HIPUtah'});
	consumerMainNavArray.push({theLink:'aboutus/index.html', theImage:'imageHere', theName:'About Us'});
	consumerMainNavArray.push({theLink:'other/index.html', theImage:'imageHere', theName:'Other'});
	//consumerMainNavArray.push({theLink:'', theImage:'imageHere', theName:''});
	
var  agentMainNavArray = new Array();
	agentMainNavArray.push({theLink:'producers/index.html', theImage:'imageHere', theName:'Producers'});
	agentMainNavArray.push({theLink:'insurers/index.html', theImage:'imageHere', theName:'Insurers'});
	agentMainNavArray.push({theLink:'captives/index.html', theImage:'imageHere', theName:'Captives'});
	agentMainNavArray.push({theLink:'title/index.html', theImage:'imageHere', theName:'Title/Escrow'});
	agentMainNavArray.push({theLink:'rate/index.html', theImage:'imageHere', theName:'Rate/Forms'});
	agentMainNavArray.push({theLink:'fraud/index.html', theImage:'imageHere', theName:'Fraud'});
	agentMainNavArray.push({theLink:'aboutus2/index.html', theImage:'imageHere', theName:'About Us'});
	agentMainNavArray.push({theLink:'other2/index.html', theImage:'imageHere', theName:'Other'});
	//agentMainNavArray.push({theLink:'', theImage:'imageHere', theName:''});
	
	
	
	
	
/* ------------------------------------------------   Menu Functions   ------------------------------------------------ */
// !! this uses an array to build menu items. it relies on the global variable called globalPath (defined at top of page) to point to the current domain.
// Provide the array you want to build.
// Answer 'yes' to hardReturn if you want the menu organized as paragraphs
// Answer 'yes' to listItem if you want the menu organized as a list
function buildTextMenu(theArray, hardReturn, listItem) { 
	var htmlCode = '';
	
	var listOpen = '';
	var listClose = '';
	var listItemBegin = '';
	var listItemEnd = '';
	var hardReturnBegin = '';
	var hardReturnEnd = '';
	
	if (hardReturn == 'yes') {
		hardReturnBegin = '<p>';
		hardReturnEnd = '</p>';
	}
	
	if (listItem == 'yes') {
		listOpen = '<ul class="menuList">';
		listClose = '</ul>';
		listItemBegin = '<li>';
		listItemEnd = '</li>';
	}
	
	htmlCode += listOpen;
	
	for(i=0; i<theArray.length; i++) {
		if( theArray[i].theLink.indexOf('http://') != -1 || theArray[i].theLink.indexOf('https://') != -1){ //check for absolute url
			htmlCode += '\n' + hardReturnBegin + listItemBegin + '<a href="' + theArray[i].theLink + '" alt="' + theArray[i].theName + '" title="' + theArray[i].theName + '" />' + theArray[i].theName + '</a>' + listItemEnd + hardReturnEnd;
		} else { //if url is not absolute, then add the global path
			htmlCode += '\n' + hardReturnBegin + listItemBegin + '<a href="' + globalPath + theArray[i].theLink + '" alt="' + theArray[i].theName + '" title="' + theArray[i].theName + '">' + theArray[i].theName + '</a>' + listItemEnd + hardReturnEnd;
		}
	}
	
	htmlCode += listClose;
	//alert(htmlCode);
	
	document.write(htmlCode);
}






/* ------------------------------------------------   Content   ------------------------------------------------ */
function buildFooter() {
	var htmlCode = '';
	
	htmlCode += '<div id="left">' + currentYear + ' &copy; Utah Utah Insurance Department</div><!-- end left -->';
	htmlCode += '<div id="right"><a href="' + globalPath + 'sitemap.html">Site Map</a> | <a href="' + globalPath + 'feedback.html">Feedback</a></div><!-- end right -->';
	htmlCode += '<div class="clr"></div>';
	document.write(htmlCode);
}




/* ------------------------------------------------   IE Style   ------------------------------------------------ */
function ieStyle() {
	//alert('ieStyle() fired');
	var htmlCode = '';
	
	htmlCode += '\n' + '<!--[if IE 7]><link href="' + globalPath + 'css/ie.css" rel="stylesheet" type="text/css"><script type="text/javascript">ie7 = true;</script><![endif]-->';
	document.write(htmlCode);
}










/* ------------------------------------------------   Original Stuff from UII   ------------------------------------------------ */
$(document).ready(function(){
  // Reset Font Size
  var originalFontSize = $('#subcontent').css('font-size');
  $(".resetFont").click(function(){
  $('#subcontent').css('font-size', originalFontSize);
  });
  // Increase Font Size
  $(".increaseFont").click(function(){
  	var currentFontSize = $('#subcontent').css('font-size');
 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*1.2;
	$('#subcontent').css('font-size', newFontSize);
	return false;
  });
  // Decrease Font Size
  $(".decreaseFont").click(function(){
  	var currentFontSize = $('#subcontent').css('font-size');
 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*0.8;
	$('#subcontent').css('font-size', newFontSize);
	return false;
  });
});

			$(document).ready( function(){
				autoFill($("#q"), "Search UID Site");
			});


			//Auto-Fill function accepts id of input and fills it with the given value.
			//Written by Joe Sak http://www.joesak.com/2008/11/19/a-jquery-function-to-auto-fill-input-fields-and-clear-them-on-click/
			function autoFill(id, v){
				$(id).css({ color: "#adadad" }).attr({ value: v }).focus(function(){
					if($(this).val()==v){
						$(this).val("").css({ color: "#333" });
					}
				}).blur(function(){
					if($(this).val()==""){
						$(this).css({ color: "#b2adad" }).val(v);
					}
				});
				
			}
			
$(document).ready(function(){
$(".stripeMe tr").mouseover(function() {$(this).addClass("over");}).mouseout(function() {$(this).removeClass("over");});
$(".stripeMe tr:even").addClass("alt");
});
