

/* ------------------------------------------------   Magic Vars   ------------------------------------------------ */
//var globalPath = '';
var globalPath = 'http://utahddc.org/' //this is the path to root that we can use for building common elements
var uiiOverride = false; //false allows the uii banner to load. true turns it off. used with the loadUII() function below

// !! Note: Media loader global vars are listed with the media loader func below. 

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


//google analytics stuff
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));


/* ------------------------------------------------   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.
var mainNavArray = new Array();
	mainNavArray[0] = new Array('calendar/index.html', 'common/images/mainNav/calendarNav.jpg', 'Calendar');
	mainNavArray[1] = new Array('council/index.html', 'common/images/mainNav/councilNav.jpg', 'Council');
	mainNavArray[2] = new Array('committees/index.html', 'common/images/mainNav/committeesNav.jpg', 'Committees');
	mainNavArray[3] = new Array('grants/index.html', 'common/images/mainNav/grantsNav.jpg', 'Grants');
	mainNavArray[4] = new Array('legislation/index.html', 'common/images/mainNav/legislationNav.jpg', 'Legislative Issues');
	mainNavArray[5] = new Array('people/index.html', 'common/images/mainNav/peopleFirstNav.jpg', 'People First');
	mainNavArray[6] = new Array('other/index.html', 'common/images/mainNav/otherNav.jpg', 'Other Links');
	mainNavArray[7] = new Array('media/index.html', 'common/images/mainNav/mediaNav.jpg', 'Media Room');
	
	

var committeesNavArray = new Array();
	committeesNavArray[0] = new Array('committees/index.html', 'graphicHere', 'Committees Home');
	committeesNavArray[1] = new Array('committees/executive/index.html', 'graphicHere', 'Executive Committee');
	committeesNavArray[2] = new Array('committees/housing/index.html', 'graphicHere', 'Housing Committee');
	committeesNavArray[3] = new Array('committees/transportation/index.html', 'graphicHere', 'Transportation Committee');
	committeesNavArray[4] = new Array('committees/community/index.html', 'graphicHere', 'Community Supports Committee');
	committeesNavArray[5] = new Array('committees/employment/index.html', 'graphicHere', 'Employment Committee');
	committeesNavArray[6] = new Array('committees/quality/index.html', 'graphicHere', 'Leadership Development Committee (Quality Assurance)');


var pfNavArray = new Array();
	pfNavArray[0]  = new Array('people/index.html', 'graphicHere', 'People First Home');
	pfNavArray[1]  = new Array('people/groups/americanfork/index.html', 'graphicHere', 'American Fork');
	pfNavArray[2]  = new Array('people/groups/blanding/index.html', 'graphicHere', 'Blanding/Bluff');
	pfNavArray[3]  = new Array('people/groups/brigham/index.html', 'graphicHere', 'Brigham City');
	pfNavArray[4]  = new Array('people/groups/cedar/index.html', 'graphicHere', 'Cedar City');
	pfNavArray[5]  = new Array('people/groups/clearfield/index.html', 'graphicHere', 'Clearfield/Kaysville/Layton/PARC');
	pfNavArray[6]  = new Array('people/groups/davis/index.html', 'graphicHere', 'Davis');
	pfNavArray[7]  = new Array('people/groups/heber/index.html', 'graphicHere', 'Heber City');
	pfNavArray[8]  = new Array('people/groups/logan/index.html', 'graphicHere', 'Logan (Cache County)');
	pfNavArray[9]  = new Array('people/groups/moab/index.html', 'graphicHere', 'Moab');
	pfNavArray[10] = new Array('people/groups/montezuma/index.html', 'graphicHere', 'Montezuma Creek');
	pfNavArray[11] = new Array('people/groups/monument/index.html', 'graphicHere', 'Monument Valley');
	pfNavArray[12] = new Array('people/groups/nephi/index.html', 'graphicHere', 'Nephi');
	pfNavArray[13] = new Array('people/groups/ogden/index.html', 'graphicHere', 'Ogden');
	pfNavArray[14] = new Array('people/groups/parkcity/index.html', 'graphicHere', 'Park City');
	pfNavArray[15] = new Array('people/groups/price/index.html', 'graphicHere', 'Price');
	pfNavArray[16] = new Array('people/groups/provo/index.html', 'graphicHere', 'Provo/Orem');
	pfNavArray[17] = new Array('people/groups/richfield/index.html', 'graphicHere', 'Richfield');
	pfNavArray[18] = new Array('people/groups/slc/index.html', 'graphicHere', 'Salt Lake City');
	pfNavArray[19] = new Array('people/groups/southvalley/index.html', 'graphicHere', 'South Valley');
	pfNavArray[20] = new Array('people/groups/stgeorge/index.html', 'graphicHere', 'St. George');
	pfNavArray[21] = new Array('people/groups/usdc/index.html', 'graphicHere', 'USDC/Spanish Fork');
	pfNavArray[22] = new Array('people/groups/vernal/index.html', 'graphicHere', 'Vernal/Roosevelt');
	pfNavArray[23] = new Array('people/groups/westjordan/index.html', 'graphicHere', 'West Jordan');
	


var footerArray = new Array();
	footerArray[0] = new Array('http://www.utah.gov/privacypolicy.html', 'imageHere', 'Privacy Policy');
	footerArray[1] = new Array('http://www.utah.gov/disclaimer.html', 'imageHere', 'Terms of Use');

/* ------------------------------------------------   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][0].indexOf('http://') != -1 || theArray[i][0].indexOf('https://') != -1){ //check for absolute url
			htmlCode += hardReturnBegin + listItemBegin + '<a href="' + theArray[i][0] + '" alt="' + theArray[i][2] + '" title="' + theArray[i][2] + '" />' + theArray[i][2] + '</a>' + listItemEnd + hardReturnEnd;
		} else { //if url is not absolute, then add the global path
			htmlCode += hardReturnBegin + listItemBegin + '<a href="' + globalPath + theArray[i][0] + '" alt="' + theArray[i][2] + '" title="' + theArray[i][2] + '">' + theArray[i][2] + '</a>' + listItemEnd + hardReturnEnd;
		}
	}
	
	htmlCode += listClose;
	//alert(htmlCode);
	
	document.write(htmlCode);
}


//buildGraphicMenu(mainNavArray);
function buildGraphicMenu(theArray) { // !! 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. 
	var htmlCode = '';

	for(i=0; i<theArray.length; i++) {
		if( theArray[i][0].indexOf('http://') != -1 ){ //check for absolute url
			htmlCode += '<a href="' + theArray[i][0] + '"><img src="' + globalPath + theArray[i][1] + '" alt="' + theArray[i][2] + '" title="' + theArray[i][2] + '" /></a>';
		} else { //if url is not absolute, then add the global path
			htmlCode += '<a href="' + globalPath + theArray[i][0] + '"><img src="' + globalPath + theArray[i][1] + '" alt="' + theArray[i][2] + '" title="' + theArray[i][2] + '" /></a>';
		}
	}
	
	document.write(htmlCode);
}


function buildTextWithGraphicMenu(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][0].indexOf('http://') != -1 || theArray[i][0].indexOf('https://') != -1){ //check for absolute url
			htmlCode += hardReturnBegin + listItemBegin + '<a href="' + theArray[i][0] + '" alt="' + theArray[i][2] + '" title="' + theArray[i][2] + '"><img src="' + globalPath + theArray[i][1] + '" alt="' + theArray[i][2] + '" title="' + theArray[i][2] + '" /><br />' + theArray[i][2] + '</a>' + listItemEnd + hardReturnEnd;
		} else { //if url is not absolute, then add the global path
			htmlCode += hardReturnBegin + listItemBegin + '<a href="' + globalPath + theArray[i][0] + '" alt="' + theArray[i][2] + '" title="' + theArray[i][2] + '"><img src="' + globalPath + theArray[i][1] + '" alt="' + theArray[i][2] + '" title="' + theArray[i][2] + '" /><br />' + theArray[i][2] + '</a>' + listItemEnd + hardReturnEnd;
		}
	}
	
	htmlCode += listClose;
	//alert(htmlCode);
	
	document.write(htmlCode);
}




function mainNav() {
	var htmlCode = '';
	htmlCode += '<img src="' + globalPath + 'common/images/mainNav/hotTopics.jpg" alt="Hot Topics" title="Hot Topics" />';
	document.write(htmlCode);
	buildTextWithGraphicMenu(mainNavArray, 'no', 'yes');
	htmlCode = '<div class="clear">&nbsp;</div>';
	document.write(htmlCode);
}




function addAnalytics() { //adds google anayltics

	try {
		var pageTracker = _gat._getTracker("UA-8901218-1");
		pageTracker._trackPageview();
		} 
		catch(err) {}
}





function footer() {
	var htmlCode = '';
	
	htmlCode +='<address>';
	htmlCode += currentYear + ' &copy; Utah Developmental Disabilities Council<br />';
	htmlCode +='155 S. 300 W. Suite 100 Salt Lake City UT 84101<br />';
	htmlCode +='Phone: (801) 533-3965 | Fax: (801) 533-3968 | Toll Free in Utah: (800) 333-8824<br />';
	htmlCode +='Language Line: (801) 533-4636 | TDD: 711';
	htmlCode +='</address>';
	htmlCode +='<br />';
	document.write(htmlCode);
	
	buildTextMenu(mainNavArray, 'no', 'no');
	document.write('<br />');
	buildTextMenu(footerArray, 'no', 'no');
	
	addAnalytics();
}





/* ------------------------------------------------   Content   ------------------------------------------------ */
function printBanner() {
	var htmlCode = '';
	htmlCode += '<img src="' + globalPath + 'common/images/branding/bannerPrint.jpg" title="UDDC Print Banner" alt="UDDC Print Banner" />'; 
	document.write(htmlCode);
}

var bannerArray = new Array();
	bannerArray[0] =  new Array('', 'common/images/branding/bannerLeftDefault.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[1] =  new Array('', 'common/images/branding/bannerLeft01.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[2] =  new Array('', 'common/images/branding/bannerLeft02.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[3] =  new Array('', 'common/images/branding/bannerLeft03.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[4] =  new Array('', 'common/images/branding/bannerLeft04.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[5] =  new Array('', 'common/images/branding/bannerLeft05.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[6] =  new Array('', 'common/images/branding/bannerLeft06.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[7] =  new Array('', 'common/images/branding/bannerLeft07.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[8] =  new Array('', 'common/images/branding/bannerLeft08.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[9] =  new Array('', 'common/images/branding/bannerLeft09.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[10] = new Array('', 'common/images/branding/bannerLeft10.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[11] = new Array('', 'common/images/branding/bannerLeft11.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[12] = new Array('', 'common/images/branding/bannerLeft12.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[13] = new Array('', 'common/images/branding/bannerLeft13.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[14] = new Array('', 'common/images/branding/bannerLeft14.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[15] = new Array('', 'common/images/branding/bannerLeft15.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[16] = new Array('', 'common/images/branding/bannerLeft16.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[17] = new Array('', 'common/images/branding/bannerLeft17.jpg', 'Utah Developmental Disabilities Council');
	bannerArray[18] = new Array('', 'common/images/branding/bannerLeft18.jpg', 'Utah Developmental Disabilities Council');


function brandingContent() {
	var htmlCode = '';
	//alert(bannerArray.length);
	
	var randomNumber = Math.floor( Math.random()*bannerArray.length );
	htmlCode += '<img src="' + globalPath + bannerArray[randomNumber][1] + '"alt="' + bannerArray[randomNumber][2] + '" title="' + bannerArray[randomNumber][2] + '" />';
	htmlCode += '<a href="' + globalPath + 'index.html"><img src="' + globalPath + 'common/images/branding/bannerLogo.jpg" alt="Utah Developmental Disabilities Council" title="Utah Developmental Disabilities Council" /></a>';
	htmlCode +='<a href="' + globalPath + 'contact/index.html"><img src="' + globalPath + 'common/images/branding/bannerRight.jpg" alt="Contact UDDC" title="Contact UDDC" /></a>';

	document.write(htmlCode);
}


function getReader() {
	var htmlCode = '';
	htmlCode += '<h3>Document Format</h3>';
	htmlCode += '<p>These links are Word, Excel, or PDF documents.</p>';
	htmlCode += '<p>The PDF documents require Adobe  Reader.</p>';
	htmlCode += '<p>If you do not currently have Adobe  Reader,  you can <a href="http://adobe.com">download it from Adobe</a> and follow the online instructions to install it.</p>';
	
	document.write(htmlCode);
}

// daParams means include parameters or don't; parameter passed here should be 'y' for yes or 'n' for no
// You can use defaults for the parameters by leaving them between empty quote marks. Example: ('http:// url', '', '', '', '', 'y')
// You can specify the parameters you want to by adding numeric values. DO NOT, however, put the numeric values in quotes.

function popup(daURL, daWidth, daHeight, daTop, daLeft, daParams) {

	var h = ''; // New window height. Defined by daHeight, but has a default if daHeight is empty.
	var w = ''; // New window width. Defined by daWidth, but has a default if daWidth is empty.
	var t = ''; // New window location from screen top. Defined by daTop, but has a default if daTop is empty.
	var l = ''; // New window location from screen left. Defined by daLeft, but has a default if daLeft is empty.

		if(daWidth == 'null' || daWidth == '') {
		  w = screen.availWidth / 2; //width default
		} else {
		  w = daWidth;
		}

		if(daHeight == 'null' || daHeight == '') {
		  h = screen.availHeight / 2; //height default
		} else {
		  h = daHeight;
		}

		if(daTop == 'null' || daTop == '') {
		  t = 75; //top default
		} else {
		  t = daTop
		}

		if(daLeft == 'null' || daLeft == '') {
		  l = screen.availWidth / 2.5; //left default
		} else {
		  l = daLeft
		}

	var params = 'toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width='+ w +',height='+ h +',top='+ t +',left='+ l +'';
	var params2 = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width='+ w +',height='+ h +',top='+ t +',left='+ l +'';
	var newWindow = '';

		if (daParams == 'y') {
		  newWindow = window.open(daURL, 'daWindow', params);
		} else {
		  newWindow = window.open(daURL, 'daWindow', params2);
		}
		
	newWindow.focus();
}


/* ------------------------------------------------   Search   ------------------------------------------------ */
function buildSearchBox() {
	var htmlCode = '';

	htmlCode += '<div id="searchBoxUDDC" name="searchBox">';
	/* htmlCode += '<form action="../common/' + globalPath + 'search.html" id="cse-search-box">'; */
	htmlCode += '<form action="' + globalPath + 'search/index.html" id="cse-search-box">';

	//htmlCode += '<div>';
	htmlCode += '<input type="hidden" name="cx" value="015797132617248936942:7ctg8sbkk2w" />';
	htmlCode += '<input type="hidden" name="cof" value="FORID:10" />';
	htmlCode += '<input type="hidden" name="ie" value="UTF-8" />';
	htmlCode += '<input type="text" name="q" size="16" />';
	//htmlCode += '<input type="submit" name="sa" value="Search" />';
	htmlCode += '<button id="sa" name="sa" type="submit" class="searchButton">Site Search</button>';
	//htmlCode += '</div>';
	htmlCode += '</form>';
	htmlCode += '</div>';
	
	document.write(htmlCode);

	document.write(unescape("%3Cscript type='text/javascript' src='http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en'%3E%3C/script%3E"));
}











/* ------------------------------------------------   IE Style   ------------------------------------------------ */
function ieStyle() {
	//alert('ieStyle() fired');
	var htmlCode = '';
	htmlCode += '<!--[if IE 5]><link href="' + globalPath + 'common/css/ieStyle.css" rel="stylesheet" type="text/css"><![endif]-->';
	htmlCode += '<!--[if IE 6]><link href="' + globalPath + 'common/css/ieStyle.css" rel="stylesheet" type="text/css"><![endif]-->';
	htmlCode += '<!--[if IE 7]><link href="' + globalPath + 'common/css/ieStyle.css" rel="stylesheet" type="text/css"><![endif]-->';
	htmlCode += '<!--[if IE 8]><link href="' + globalPath + 'common/css/ieStyle.css" rel="stylesheet" type="text/css"><![endif]-->';
	
	document.write(htmlCode);
}



/* ------------------------------------------------   UII Loader   ------------------------------------------------ */
function loadUII(pleaseLoad) {
	var htmlCode =  '';
	
	if(uiiOverride == true ) {
		document.getElementById('uiiStage').innerHTML = '&nbsp;';
	}

	if (pleaseLoad == true && uiiOverride == false) {
		//alert("pleaseLoad = true");
		document.getElementById('uiiBanner').innerHTML = document.getElementById('uiiStage').innerHTML;
		clearStage();
	}
}

function clearStage() {
	setTimeout("document.getElementById('uiiStage').innerHTML = '&nbsp;'", 300);	
}

/*<script type="text/javascript" src="http://www.utah.gov/nav/fluidheader.js" type="text/javascript"></script>*/





























