
var globalPath = 'http://dts.utah.gov/' //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


/* ------------------------------------------------   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('index.html', 'common/images/mainNav/01home.gif', 'Home');
	mainNavArray[1] = new Array('services/index.html', 'common/images/mainNav/02services.gif', 'Services');
	mainNavArray[2] = new Array('news/index.html', 'common/images/mainNav/03news.gif', 'News');
	mainNavArray[3] = new Array('security/index.html', 'common/images/mainNav/04security.gif', 'Security');
	mainNavArray[4] = new Array('billing/index.html', 'common/images/mainNav/05billing.gif', 'Billing and Rates');
	mainNavArray[5] = new Array('servicedesk/index.html', 'common/images/mainNav/06servicedesk.gif', 'Service Desk');
	mainNavArray[6] = new Array('contact/index.php', 'common/images/mainNav/07contact.gif', 'Contact Us');

var servicesMainArray = new Array();
	//servicesMainArray[0] = new Array('services/enterprise/categories.html', 'imageHere', 'Product Categories');
	servicesMainArray[0] = new Array('services/agency/index.html', 'imageHere', 'Agency Services');
	servicesMainArray[1] = new Array('services/business/index.html', 'imageHere', 'Business Services');
	servicesMainArray[2] = new Array('services/enterprise/index.html', 'imageHere', 'Categories');
	servicesMainArray[3] = new Array('services/agency/metrics/index.html', 'imageHere', 'Metrics');
	servicesMainArray[4] = new Array('services/serviceorders.html', 'imageHere', 'Online Forms');
	servicesMainArray[5] = new Array('http://www.utahta.wikispaces.net/', 'imageHere', 'Technical Architecture');


	
	
var servicesSecondaryArray = new Array();
	servicesSecondaryArray[0] = new Array('services/resources/dtsPurchaseRequisition.xls', 'imageHere', 'DTS Purchase Requisition Form (Excel)');
	servicesSecondaryArray[1] = new Array('services/entprojects/remedy/index.html', 'imageHere', 'Remedy ITSM');
	servicesSecondaryArray[2] = new Array('services/appprojects/index.html', 'imageHere', 'Project Management');
	//servicesSecondaryArray[2] = new Array('http://statephone.utah.gov', 'imageHere', 'State Phone Directory');
	

var servicesTertiaryArray = new Array();
	servicesTertiaryArray[0] = new Array('contact/crm.html', 'imageHere', 'Customer Relationship Managers');
	servicesTertiaryArray[1] = new Array('contact/directors.html', 'imageHere', 'Agency IT Service Directors');

var helpArray = new Array();
	helpArray[0] = new Array('#', 'imageHere', 'Help00');
	helpArray[1] = new Array('#', 'imageHere', 'Help01');
	helpArray[2] = new Array('#', 'imageHere', 'Help02');
	helpArray[3] = new Array('#', 'imageHere', 'Help03');

var contactArray = new Array();
	contactArray[0] = new Array('contact/cio.html', 'imageHere', 'CIOs Office');
	contactArray[1] = new Array('contact/enterprise.html', 'imageHere', 'Enterprise Technology');	
	contactArray[2] = new Array('contact/directors.html', 'imageHere', 'IT Service Directors');
	contactArray[3] = new Array('contact/crm.html', 'imageHere', 'Customer Relationship Manangers');
	
var newsArray = new Array();
	newsArray[0] = new Array('#', 'imageHere', 'news00');
	newsArray[1] = new Array('#', 'imageHere', 'news01');
	newsArray[2] = new Array('#', 'imageHere', 'news02');
	newsArray[3] = new Array('#', 'imageHere', 'news03');

var billingArray = new Array();
	billingArray[0] = new Array('#', 'imageHere', 'billing00');
	billingArray[1] = new Array('#', 'imageHere', 'billing01');
	billingArray[2] = new Array('#', 'imageHere', 'billing02');

var researchArray = new Array();
	researchArray[0] = new Array('techresearch/customsearch/index.html', 'imageHere', 'Custom Search Engine');
	researchArray[1] = new Array('techresearch/researchservices/index.html', 'imageHere', 'Research Services');
	researchArray[2] = new Array('http://www.utahta.wikispaces.net/', 'imageHere', 'Technical Architecture');
	researchArray[3] = new Array('techresearch/techreports/index.html', 'imageHere', 'Technology Reports');

var eGovArray = new Array();
	eGovArray[0] = new Array('egov/index.html', 'imageHere', 'e-Government');
	eGovArray[1] = new Array('egov/wiki/index.html', 'imageHere', 'e-Government Wiki');
	eGovArray[2] = new Array('egov/strategicplan/index.html', 'imageHere', 'Strategic Plan');
	eGovArray[3] = new Array('egov/webstandards/index.html', 'imageHere', 'Web Standards');
	
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');
	footerArray[2] = new Array('index.html', 'imageHere', 'Home');
	footerArray[3] = new Array('services/index.html', 'imageHere', 'Services');
	footerArray[4] = new Array('news/index.html', 'imageHere', 'News');
	footerArray[5] = new Array('security/index.html', 'imageHere', 'Security');	
	footerArray[6] = new Array('servicedesk/index.html', 'imageHere', 'Service Desk');
	footerArray[7] = new Array('contact/index.php', 'imageHere', 'Contact DTS');
	footerArray[8] = new Array('about/index.html', 'imageHere', 'About DTS');		

	
/* ------------------------------------------------   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 ){ //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 contactMainMenu() {
	var htmlCode = '';

	htmlCode += '<h1>Contact DTS</h1>';
	htmlCode += '<hr />';
	htmlCode += '<h3>Department of Technology Services</h3>';
	htmlCode += '<p>1 State Office Building Floor 6 <br /> Salt Lake City, UT 84114 </p>';
	htmlCode += '<p>Telephone: 801 537-9000 <br /> FAX: 801 538-3622 </p>';
	htmlCode += '<p><a href="../about/index.html"">Find out more about DTS...</a></p>';	
	htmlCode += '<img src="' + globalPath + 'contact/images/stateofficebldg.jpg" alt="Utah State Office Building" title="Utah State Office Building" />';
	
	buildTextMenu(contactArray, 'no', 'yes');
	document.write(htmlCode);
}





function servicesMainMenu() {
	document.write('<h3>Enterprise Services</h3>');
	buildTextMenu(servicesMainArray, 'no', 'yes');
}


function servicesSecondaryMenu() {
	document.write('<br />');
	document.write('<h2>Additional Resources </h2>');
	document.write('<hr />');
	//document.write('<h3>Full Product Index:</h3>');
	buildTextMenu(servicesSecondaryArray, 'no', 'yes');
	document.write('<br />');
	
	document.write('<h3>Service Contacts:</h3>');
	buildTextMenu(servicesTertiaryArray, 'no', 'yes');
	document.write('<hr />');
	document.write('<p>&nbsp;</p>');
}



/* ------------------------------------------------   Highslide Videos   ------------------------------------------------ */
var videoArray = new Array(); //this menu is created in reverse order so newest items go at the bottom, but display on the page at the top. 
	// ustreamArray[] = new Array('http://www.ustream.tv/flash/video/', '', '');
	//<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/CW_wGSFavTc&hl=en&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/CW_wGSFavTc&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>
	videoArray[0] =  new Array('http://www.youtube.com/v/CW_wGSFavTc&hl=en&fs=1&', 'Making a Gantt Chart with Excel 2003');
	videoArray[1] =  new Array('http://www.youtube.com/v/HQwE0Xv1lAA&hl=en&fs=1&', 'Making a Gantt Chart with Excel 2007');

function buildVideoList(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>';
		listClose = '</ul>';
		listItemBegin = '<li>';
		listItemEnd = '</li>';
	}
	
	htmlCode += listOpen;
	
	for(i=theArray.length-1; i>=0; 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][1] + '" title="' + theArray[i][1] + '" onclick="return hs.htmlExpand(this, { objectType: \'swf\', width: 400, objectWidth: 400, objectHeight: 320, maincontentText: \'You need to upgrade your Flash player\', swfOptions: { version: \'7\' }  } )" class="highslide" />' + theArray[i][1] + '</a>' + listItemEnd + hardReturnEnd;
			//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);
}


//<a href="http://www.ustream.tv/flash/video/1572491" onclick="return hs.htmlExpand(this, { objectType: \'swf\', width: 400, objectWidth: 400, objectHeight: 320, maincontentText: \'You need to upgrade your Flash player\', swfOptions: { version: '7' }  } )" class="highslide">May 28, 2009</a> - Martha Wunderli UIDAN






/* ------------------------------------------------   Content   ------------------------------------------------ */
function uiiCustom() {
	var htmlCode = '';
	htmlCode += '<a href="http://utah.gov"><img src="' + globalPath + 'common/images/uii/00Logo.gif" alt="Utah.gov" title="Utah.gov" width="70" height="31" /></a>';
	//htmlCode += '<a href="http://www.utah.gov/services/index.html"><img src="' + globalPath + 'common/images/uii/01OnlineServices.gif" alt="Online Services" title="Online Services" width="140" height="31" /></a>';
	//htmlCode += '<a href="http://www.utah.gov/government/agencylist.html"><img src="' + globalPath + 'common/images/uii/02AgencyList.gif" alt="Agency List" title="Agency List" width="122" height="31" /></a>';
	//htmlCode += '<a href="http://business.utah.gov/business/"><img src="' + globalPath + 'common/images/uii/03Business.gif" alt="Business" title="Business" width="92" height="31" /></a>';
	
	document.write(htmlCode);
}





function brandingContent() {
	var htmlCode = '';
	
	htmlCode += '<a href="' + globalPath + '"index.html"><img src="' + globalPath + 'common/images/logos/logoDTS.gif" alt="Department of Technology Services" title="Utah Department of Technology Services" /></a>';
	//htmlCode += '<div id="brandingGraphic">';
	//htmlCode += '<img src="' + globalPath + 'common/images/branding/worker02.jpg" alt="DTS Technician" title="DTS Technician" />';
	//htmlCode += '</div>';
	//htmlCode += '<div id="uii">';
	//htmlCode += '<a href="http://utah.gov"><img src="' + globalPath + 'common/images/logos/utahGov.gif" alt="Utah.gov" title="Utah.gov" /></a>';
	//htmlCode += '</div>';        
	htmlCode += '<div id="searchBox">';

	htmlCode += '<form action="' + globalPath + 'searchresults.html" id="cse-search-box">';
	//htmlCode += '<div>';
	htmlCode += '<input type="hidden" name="cx" value="015797132617248936942:0hheqol6z3s" />';
	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="31" />';
	//htmlCode += '<input type="submit" name="sa" value="Search" />';
	htmlCode += '<button id="sa" name="sa" type="submit" class="searchButton">Search</button>';
	
	document.write(htmlCode);
	document.write(unescape("%3Cscript src='http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en' type='text/javascript'%3E%3C/script%3E"));
	
	htmlCode = '';
	
	htmlCode += '<a href="' + globalPath + 'index.html">Home</a>|<a href="' + globalPath + 'sitemap.html">Site Map</a>|<a href="' + globalPath + 'emp/index.html">Employees</a>'; 
	//htmlCode += '</div>';
	htmlCode += '</form>';
	htmlCode += '</div>';
	htmlCode += '<div class="clear"></div>';
	
	document.write(htmlCode);
}



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

function lastmod() {
	var months = new Array(13);
	months[1] = "January";
	months[2] = "February";
	months[3] = "March";
	months[4] = "April";
	months[5] = "May";
	months[6] = "June";
	months[7] = "July";
	months[8] = "August";
	months[9] = "September";
	months[10] = "October";
	months[11] = "November";
	months[12] = "December";

	var dateObj = new Date(document.lastModified)
	var lmonth = months[dateObj.getMonth() + 1]
	var fyear = dateObj.getYear()
	var date = dateObj.getDate()
	
	htmlCode = '<p>&nbsp</p>';
	htmlCode += '<p align="right">';
	htmlCode += ' This page last modified: ';
	htmlCode += lmonth;
	htmlCode += ' ';
	htmlCode += date;
	htmlCode += ', ';
	htmlCode += fyear;
	htmlCode += '</p>';
	
	document.write(htmlCode);
}





/* ------------------------------------------------   Footer and Analytics  ------------------------------------------------ */

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"));

function addAnalytics() { //adds google anayltics
	var pageTracker = _gat._getTracker("UA-6206838-1"); 
	pageTracker._trackPageview(); 
}




function footer() {
	var htmlCode = '';
	htmlCode += currentYear + ' &copy; Department of Technology Services (DTS)<br />';
	document.write(htmlCode);
	buildTextMenu(footerArray, 'no', 'no');
	
	addAnalytics();
}





/* ------------------------------------------------   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]-->';
	
	document.write(htmlCode);
}





/* ------------------------------------------------   UII Loader   ------------------------------------------------ */
function checkUIIblock() {
	if (uiiOverride == true) {
		document.getElementById('uiiStage').innerHTML = '<img src="common/images/uii/uiiLeft.gif" alt="Utah.gov" title="Utah.gov" />';
	}
}

function loadUII(pleaseLoad) {
	var htmlCode =  '';

	if (pleaseLoad == true && uiiOverride == false) {
		//alert("pleaseLoad = true");
		document.getElementById('uiiBanner').innerHTML = document.getElementById('uiiStage').innerHTML;
		document.getElementById('uiiStage').innerHTML = '&nbsp;';
	}
}
/*<script language="javascript" src="http://www.utah.gov/nav/fluidheader.js" type="text/javascript"></script>*/





/* ------------------------------------------------   iFrame Height   ------------------------------------------------ */
function loadIframe(theURL) {
	document.getElementById("kineticForm").src=theURL;
}

function resize() {
	docHeight = kineticForm.document.body.scrollHeight;
	document.getElementById("kineticForm").style.height = docHeight + 16 + 'px';
}

function frameSize(newSize) {
	document.getElementById("kineticForm").style.height = newSize + 16 + 'px';
}

function debug() {
	alert('debug() triggered');
}


























