


/* ------------------------------------------------   Magic Vars   ------------------------------------------------ */
var globalPath = 'http://ci.heber.ut.us/' //this is the path to root that we can use for building common elements

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

/*___________________________Dropdown Menu Include ________________________________________*/

function heberDropDown() {

	var htmlCode = '';

	/*htmlCode += '<div id="page-wrap">';*/
        htmlCode += '<ul class="dropdown">';
        /*--------------------Begin Government Menu----------------------*/
        	htmlCode += '<li><a href="'+globalPath+'government/index.html">Government</a>';
        		htmlCode += '<ul>';
        			 htmlCode += '<li><a href="'+globalPath+'government/mayor/index.html">Mayor</a></li>';
        			 htmlCode += '<li>';
        				htmlCode += '<a href="'+globalPath+'government/citycouncil/index.html">City Council</a>';
        			 htmlCode += '</li>';
        			 htmlCode += '<li><a href="'+globalPath+'government/planningcommission/index.html">Planning Commission</a></li>';
        			 htmlCode += '<li><a href="'+globalPath+'government/boardofadjustment/index.html">Board of Adjustment</a></li>';
        			 htmlCode += '<li><a href="'+globalPath+'government/financeandbudget/index.html">Finance and Budget</a></li>';
        			 htmlCode += '<li><a href="'+globalPath+'government/treeadvisoryboard/index.html">Tree Advisory Board</a>';
					    htmlCode += '<ul>';
        					htmlCode += '<li><a href="'+globalPath+'government/treeadvisoryboard/documents/arborDayCelebration.pdf">Arbor Day Celebration</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'government/treeadvisoryboard/streettrees/index.html">Street Trees</a></li>';
        				htmlCode += '</ul>';
        			 htmlCode += '</li>';
        			 htmlCode += '<li><a href="'+globalPath+'government/documents/heberCityCode.pdf">Municipal Code</a></li>';
        			 htmlCode += '<li><a href="'+globalPath+'government/documents/heberCityDirectory.pdf">Directory</a></li>';
        			 htmlCode += '<li><a href="http://www.co.wasatch.ut.us/departments/development_services/housing_authority.aspx">Wasatch County<br />Housing Authority</a></li>';
        			 htmlCode += '<li><a href="'+globalPath+'government/animalcontrolboard/index.html">Animal Control Board</a></li>';
        		htmlCode += '</ul>';
        		htmlCode += '</li>';
		/*-------------------------End Government Menu------------------------*/
        /*----------------------Begin Departments Menu-------------------*/
        	htmlCode += '<li><a href="'+globalPath+'departments/index.html">Departments</a>';
        		htmlCode += '<ul>';
        			htmlCode += '<li><a href="'+globalPath+'departments/citymanager/index.html">City Manager</a></li>';
        			 htmlCode += '<li><a href="'+globalPath+'departments/airport/index.html">Airport</a>';
					    htmlCode += '<ul>';
        					htmlCode += '<li><a href="'+globalPath+'departments/airport/airportboard/index.html">Airport Board</a></li>';
        					htmlCode += '<li><a href="http://www.russmcdonaldfield.com/">Russ McDonald Field</a></li>';
        					htmlCode += '<li><a href="http://www.airnav.com/airport/36U/OK3_AIR">OK3 Air</a></li>';
        					htmlCode += '<li><a href="http://www.russmcdonaldfield.com/Airport_Info.html">Airport Information</a></li>';
        				htmlCode += '</ul>';
        			 htmlCode += '</li>';
        			htmlCode += '<li><a href="'+globalPath+'departments/building/index.html">Building</a></li>';
        			 htmlCode += '<li><a href="'+globalPath+'departments/businesslicensing/index.html">Business Licensing</a>';
					    htmlCode += '<ul>';
        					htmlCode += '<li><a href="'+globalPath+'departments/businesslicensing/applications/index.html">Applications</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'departments/businesslicensing/links/index.html">Links</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'departments/businesslicensing/faqs/index.html">FAQs</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'departments/businesslicensing/documents/Title5BusinessLicensingCode.pdf">Code</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'departments/businesslicensing/documents/BusinessLicensingFees.pdf">Fees</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'community/events/farmersmarket/index.html">Farmer\'s Market</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'departments/businesslicensing/documents/Business_License_List.pdf">Business License List</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'departments/businesslicensing/contactus.html">Contact Us</a></li>';
        				htmlCode += '</ul>';
        			 htmlCode += '</li>';
        			htmlCode += '<li><a href="'+globalPath+'departments/engineering/index.html">Engineering</a></li>';
        			 htmlCode += '<li><a href="'+globalPath+'departments/justicecourt/index.html">Justice Court</a>';
        				htmlCode += '<ul>';
        					htmlCode += '<li><a href="https://courtapps.utcourts.gov/ePayments/EPayment.jsp">Pay Court Fine Online</a></li>';
        				htmlCode += '</ul>';
        			 htmlCode += '</li>';
        			 htmlCode += '<li><a href="'+globalPath+'departments/parkandcemetery/index.html">Park and Cemetery</a>';
        				htmlCode += '<ul>';
        					htmlCode += '<li><a href="http://www.namesinstone.com/">Cemetery Records</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'departments/parkandcemetery/documents/heber_park_pavillion_application.pdf">Pavilion Reservations</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'departments/parkandcemetery/documents/heberPolicyandWaiverforuseofCityProperty.pdf">Park Events</a></li>';
        				htmlCode += '</ul>';
        			 htmlCode += '</li>';
        				htmlCode += '<li><a href="'+globalPath+'departments/planning/index.html">Planning</a>';
        				htmlCode += '<ul>';
        					htmlCode += '<li><a href="'+globalPath+'departments/planning/planningapplications/index.html">Planning Applications</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'departments/planning/codeenforcement/index.html">Code Enforcement</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'departments/planning/codesandpolicies/index.html">Codes and Policies</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'departments/planning/maps/index.html">Maps</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'departments/planning/planningfaqs/index.html">Planning FAQs</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'departments/planning/relatedsites/index.html">Related Sites</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'departments/planning/contactus/index.html">Contact Us</a></li>';
        				htmlCode += '</ul>';
        			 htmlCode += '</li>';
        				htmlCode += '<li><a href="'+globalPath+'departments/publicworks/index.html">Public Works</a></li>';
        				htmlCode += '<li><a href="'+globalPath+'departments/police/index.html">Police</a>';
        				htmlCode += '<ul>';
        					htmlCode += '<li><a href="'+globalPath+'departments/police/animalcontrol/index.html">Animal Control</a></li>';
        				htmlCode += '</ul>';
        			 htmlCode += '</li>';
        				htmlCode += '<li><a href="'+globalPath+'departments/treasurer/index.html">Treasurer</a>';
        					htmlCode += '<ul>';
        					htmlCode += '<li><a href="#">Utilities</a>';
        						htmlCode += '<ul>';
        						htmlCode += '<li><a href="https://secureinstantpayments.com/sip/?ID=12166">Pay Water / Sewer Bill Online</a></li>';
        						htmlCode += '</ul>';
	        				htmlCode += '</ul>';
						htmlCode += '</li>';
        				htmlCode += '<li><a href="'+globalPath+'departments/volunteeropportunities/index.html">Volunteer Opportunities</a></li>';
        		htmlCode += '</ul>';
        	htmlCode += '</li>';
		/*-----------------------End Departments Menu-----------------------*/
		/*-----------------------Begin Community Menu-----------------------*/
        	htmlCode += '<li><a href="#">Community</a>';
        		htmlCode += '<ul>';
        			 htmlCode += '<li><a href="'+globalPath+'community/events/index.html">Events</a>';
        				htmlCode += '<ul>';
        					htmlCode += '<li><a href="http://www.co.wasatch.ut.us/fair/">Wasatch County<br />Fair Days</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'community/events/farmersmarket/index.html">Farmer\'s Market</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'community/events/concertsinthepark/index.html">Concerts in the Park</a></li>';
        					htmlCode += '<li><a href="http://www.hebercitycowboypoetry.com">Cowboy Poetry</a></li>';
        					htmlCode += '<li><a href="http://www.midwayswissdays.com/">Swiss Days</a></li>';
        					htmlCode += '<li><a href="http://www.gohebervalley.com/Special-Events">Go Heber Valley<br />Calendar</a></li>';
        				htmlCode += '</ul>';
        			 htmlCode += '</li>';
        			htmlCode += '<li><a href="'+globalPath+'community/documents/heberDemographics.pdf">Demographics</a></li>';
        			htmlCode += '<li><a href="'+globalPath+'community/documents/heberCityClimate.pdf">Climate</a></li>';
        			htmlCode += '<li><a href="'+globalPath+'community/aboutheber/history/index.html">History</a></li>';
        		htmlCode += '</ul>';
        	htmlCode += '</li>';
		/*----------------------------End Community Menu-------------------------*/
	/*---------------------------Begin Popular Documents Menu----------------------*/
        	htmlCode += '<li><a href="#">Popular Documents</a>';
        		htmlCode += '<ul>';
        			 htmlCode += '<li><a href="'+globalPath+'documents/budget.pdf">City Budget</a></li>';
        			 htmlCode += '<li><a href="'+globalPath+'documents/audit.pdf">Audited<br />Financial Results</a></li>';
					 htmlCode += '<li><a href="'+globalPath+'departments/businesslicensing/documents/Business_License_List.pdf">Business License List</a></li>';
        			 htmlCode += '<li><a href="'+globalPath+'documents/consolidatedFeeSchedule.pdf">Consolidated Fee Schedule</a></li>';
        			 htmlCode += '<li><a href="'+globalPath+'populardocuments/electioninformation/index.html">Election Information</a></li>';
        			 htmlCode += '<li><a href="#">Minutes, Agendas<br />and Recordings</a>';
        				htmlCode += '<ul>';
        					htmlCode += '<li><a href="'+globalPath+'government/animalcontrolboard/index.html">Animal Control</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'government/citycouncil/index.html">City Council</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'government/planningcommission/index.html">Planning Commission</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'government/boardofadjustment/index.html">Board of Adjustment</a></li>';
        					htmlCode += '<li><a href="'+globalPath+'departments/airport/airportboard/index.html">Airport Board</a></li>';
        					htmlCode += '<li><a href="http://www.utah.gov/pmn/index.html">Public Notice</a></li>';
        				htmlCode += '</ul>';
        			 htmlCode += '</li>';
        		htmlCode += '</ul>';
        	htmlCode += '</li>';
		/*---------------------------End Popular Documents Menu-----------------------------*/
		/*-------------------------Begin Links Menu----------------------------*/
        	htmlCode += '<li><a href="javascript:;">Links</a>';
        		htmlCode += '<ul>';
        			 htmlCode += '<li><a href="#">Government</a>';
        				htmlCode += '<ul>';
        					htmlCode += '<li><a href="#">Heber Valley<br />Chamber of<br />Commerce</a></li>';
        					htmlCode += '<li><a href="http://midwaycityut.org/">Midway City</a></li>';
        					htmlCode += '<li><a href="http://utah.gov">State of Utah</a></li>';
        					htmlCode += '<li><a href="http://www.udot.utah.gov/">Transportation Dept. (UDOT)</a></li>';
        					htmlCode += '<li><a href="http://commuterlink.utah.gov/">Traffic Link</a></li>';
        					htmlCode += '<li><a href="http://www.usa.gov/">US Government</a></li>';
        					htmlCode += '<li><a href="http://publicsafety.utah.gov/dld/">Utah Driver License Division</a></li>';
        					htmlCode += '<li><a href="http://dmv.utah.gov/">Utah Division of Motor Vehicles</a></li>';
        					htmlCode += '<li><a href="http://www.utcourts.gov/">Utah State Courts</a></li>';
        					htmlCode += '<li><a href="http://www.co.wasatch.ut.us/">Wasatch County</a></li>';
        					htmlCode += '<li><a href="http://www.wasatchcountyhd.org">Wasatch County<br />Health Dept</a></li>';
        				htmlCode += '</ul>';
        			 htmlCode += '</li>';
        			 htmlCode += '<li><a href="#">Recreation, Education, Health and<br />Entertainment</a>';
        				htmlCode += '<ul>';
        					htmlCode += '<li><a href="http://www.hebervalleyrr.org/">Heber Valley Railroad</a></li>';
        					htmlCode += '<li><a href="http://www.utah.com/stateparks/">State Parks of Utah</a></li>';
        					htmlCode += '<li><a href="http://intermountainhealthcare.org/hospitals/heber/Pages/home.aspx">Heber Valley Hospital</a></li>';
        					htmlCode += '<li><a href="http://www.fs.fed.us/r4/">Intermountain Region Forest Service</a></li>';
        					htmlCode += '<li><a href="http://www.soldierhollow.com/">Soldier Hollow</a></li>';
        					htmlCode += '<li><a href="http://wildlife.utah.gov/dwr/">Utah Dept of Wildlife Services</a></li>';
        					htmlCode += '<li><a href="http://extension.usu.edu/utah/">Utah State County Extension Office</a></li>';
        					htmlCode += '<li><a href="http://www.uvu.edu/wasatch/">Utah Valley University Wasatch Campus</a></li>';
        					htmlCode += '<li><a href="http://www.wasatch.edu/wasatchsd/site/default.asp">Wasatch County<br />School District</a></li>';
        					htmlCode += '<li><a href="http://www.hebervalleyjobs.com/jobs-Wasatch_Economic_Development-Employer-All.htm">Wasatch Economic Development</a></li>';
							htmlCode += '<li><a href="http://www.gohebervalley.com/Wasatch-County-Daughters-of-Utah-Pioneers/">Wasatch County Daughters of Utah Pioneers Museum</a><li>';
        				htmlCode += '</ul>';
        			 htmlCode += '</li>';
        			 htmlCode += '<li><a href="#">Utilites</a>';
        				htmlCode += '<ul>';
        					htmlCode += '<li><a href="http://www.allwest.net/">Allwest</a></li>';
        					htmlCode += '<li><a href="http://www.bluestakes.org/">Blue Stakes</a></li>';
        					htmlCode += '<li><a href="http://xfinity.comcast.net/">Comcast</a></li>';
        					htmlCode += '<li><a href="#">Heber City<br />Public Works</a></li>';
        					htmlCode += '<li><a href="http://www.heberpower.com/">Heber Light<br />and Power</a></li>';
        					htmlCode += '<li><a href="http://www.questargas.com/index.php">Questar Gas</a></li>';
        					htmlCode += '<li><a href="http://www.centurylink.com/">Century Link</a></li>';
        					htmlCode += '<li><a href="http://www.co.wasatch.ut.us/departments/community_services/public_works/solid_waste.aspx">Wasatch County Solid Waste</a></li>';
        				htmlCode += '</ul>';
        			 htmlCode += '</li>';
        			 htmlCode += '<li><a href="#">Media</a>';
        				htmlCode += '<ul>';
        					htmlCode += '<li><a href="http://www.abc4.com/default.aspx">ABC 4</a></li>';
        					htmlCode += '<li><a href="http://www.deseretnews.com/home/">Deseret News</a></li>';
        					htmlCode += '<li><a href="http://www.fox13now.com/">Fox 13</a></li>';
        					htmlCode += '<li><a href="﻿http://www.hebervalley.info/">Heber Valley Info</a></li>';
        					htmlCode += '<li><a href="http://www.kbyutv.org/">KBYU</a></li>';
        					htmlCode += '<li><a href="http://kpcw.org/">KPCW</a></li>';
        					htmlCode += '<li><a href="http://www.krcl.org/">KRCL</a></li>';
        					htmlCode += '<li><a href="http://www.kued.org/">KUED</a></li>';
        					htmlCode += '<li><a href="http://www.ksl.com/">KSL 5</a></li>';
        					htmlCode += '<li><a href="http://ktmpradio.com/">KTMP 1340 AM</a></li>';
        					htmlCode += '<li><a href="http://connect2utah.com/">KUTV 2</a></li>';
        					htmlCode += '<li><a href="http://www.sltrib.com/">Salt Lake Tribune</a></li>';
        					htmlCode += '<li><a href="http://www.wasatchwave.com/">Wasatch Wave</a></li>';
        				htmlCode += '</ul>';
        			 	htmlCode += '</li>';
        			htmlCode += '</ul>';
        			htmlCode += '</li>';
		/*--------------------------End Links Menu-----------------------------*/
		/*-----------------------------Begin News Menu---------------------------*/
        	htmlCode += '<li><a href="'+globalPath+'news/index.html">News</a>';
        		htmlCode += '<ul>';
        			 htmlCode += '<li><a href="'+globalPath+'news/electionresults.html">Election Results</a></li>';
        			 htmlCode += '<li><a href="'+globalPath+'news/documents/Newsletter.pdf">City Newsletter</a></li>';
        			 htmlCode += '<li><a href="'+globalPath+'news/streetandutilityinfo.html">Street and Utility<br />Work Info</a></li>';
        			 htmlCode += '<li><a href="http://www.accuweather.com/us/ut/heber-city/84032/city-weather-forecast.asp">Weather</a></li>';
        		htmlCode += '</ul>';
        	htmlCode += '</li>';
	/*---------------------------------End News Menu-------------------------------*/
	/*-----------------------------Begin Employment Menu---------------------------*/
        	htmlCode += '<li><a href="#">Employment</a>';
        		htmlCode += '<ul>';
        			 htmlCode += '<li><a href="'+globalPath+'employment/documents/employment_Application.pdf">Employment Application</a></li>';
        			 htmlCode += '<li><a href="'+globalPath+'employment/index.html">Openings</a></li>';
        		htmlCode += '</ul>';
        	htmlCode += '</li>';
	/*---------------------------------End Employment Menu-------------------------------*/
	/*-----------------------------Begin Search Menu---------------------------*/
        			htmlCode += '<li><a href="'+globalPath+'search.html">Search</a></li>';
	/*-----------------------------End Search Menu---------------------------*/
        htmlCode += '</ul>';
	/*htmlCode += '</div>';*/

	document.write(htmlCode);

}


//buildPipeMenu builds a text menu that uses a text separator between links that will look like the uii footer menu. in 2011, uii was using a "pipe" character between text links. if uii changes to another character, simply replace pipeVar (below) with that character
function buildPipeMenu(theArray) { 
	var htmlCode = '';
	var pipeVar = '';

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







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

	htmlCode += '<form action="' + globalPath + 'searchresults.html" id="cse-search-box">';
	//htmlCode += '<div>';
	
	htmlCode += '<button id="sa" name="sa" type="submit" class="searchButton">Search</button>';
	htmlCode += '<input type="hidden" name="cx" value="010692228658049708725:u97sic_tejq" />';
	htmlCode += '<input type="hidden" name="cof" value="FORID:10" />';
	htmlCode += '<input type="hidden" name="ie" value="UTF-8" />';
	htmlCode += '<input type="text" name="q" />';
	//htmlCode += '<input type="submit" name="sa" value="Search" />';
	
	htmlCode += '<div class="clear"></div>';
	//htmlCode += '</div>';
	htmlCode += '</form>';
	
	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"));
}

/* ------------------------------------------------   Solutions Search   ------------------------------------------------ */
function buildSolutionSearchBox() {
	var htmlCode = '';
	
	//htmlCode+= 'search area';

	htmlCode += '<form action="' + globalPath + 'searchresults.html" id="cse-search-box">';
	//htmlCode += '<div>';
	
	htmlCode += '<button id="sa" name="sa" type="submit" class="searchButton">Search</button>';
	htmlCode += '<input type="hidden" name="cx" value="010692228658049708725:u97sic_tejq" />';
	htmlCode += '<input type="hidden" name="cof" value="FORID:10" />';
	htmlCode += '<input type="hidden" name="ie" value="UTF-8" />';
	htmlCode += '<input type="text" name="q" />';
	//htmlCode += '<input type="submit" name="sa" value="Search" />';
		htmlCode += '<div class="clear"></div>';
	//htmlCode += '</div>';
	htmlCode += '</form>';
	
	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"));
}




/* ------------------------------------------------   Google Analytics Stuff   ------------------------------------------------ */
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-22866456-1']);
_gaq.push(['_trackPageview']);

function addAnalytics() {
  
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

}




/* ------------------------------------------------   Content   ------------------------------------------------ */
function brandingContent() {
	var htmlCode = '';
	document.write(htmlCode);
}

/* ------------------------------------------------   Footer   ------------------------------------------------ */



function buildFooter() {
	var htmlCode = '';
	htmlCode += currentYear + ' &copy; Heber City Corporation - All Rights Reserved<br />';
	document.write(htmlCode);
}





/* ------------------------------------------------   IE Style   ------------------------------------------------ */
function ieStyle() {
	//alert('ieStyle() fired');
	var htmlCode = '';
	
	htmlCode += '\n' + '<!--[if IE 8]><link href="' + globalPath + 'common/css/ieStyle.css" rel="stylesheet" type="text/css"><![endif]-->';
	htmlCode += '\n' + '<!--[if lt IE 8]><script src="http://ie7-js.googlecode.com/svn/version/2.1(beta3)/IE8.js"></script><![endif]-->';
	htmlCode += '\n' + '<!--[if IE 7]><link href="' + globalPath + 'common/css/ie7Style.css" rel="stylesheet" type="text/css"><![endif]-->';
	htmlCode += '\n' + '<!--[if IE 6]><link href="' + globalPath + 'common/css/ieStyle.css" rel="stylesheet" type="text/css"><![endif]-->';
	
	document.write(htmlCode);
}

/* ------------------------------------------------   Banner Rotator   ------------------------------------------------ */


/**
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

	--------------------------------------------------------------------
	
	Simple banner rotator. Version: 1.4.0
	Download and support: http://www.spyka.net 
	(c) Copyright 2008, 2009 spyka Web Group
	

	For full documentation:  http://www.spyka.net/docs/simple-banner-rotator
	For support:			 http://www.spyka.net/forums


**/

//								EDIT FROM HERE
///////////////////////////////////////////////////////////////////////////////////

/**
		Script settings
**/

var settings = {
	
	'force_size':			0,         		// 	if set to 1 all banners will be resized to the width and height in the next to settings
	'img_width':			468,			//	width to resize all banners to, only takes effect if above is 1
	'img_height':			60, 			// 	height to resize all banners to, only takes effect if above is 1
	
	'refresh_time':			12000,			//	the seconds between refreshs of the banners - use 0 to disable
	'refresh_max':			100,				//	maximum number of refreshs on each page load
	
	'duplicate_banners':	0,				//	keep as 0 to make sure the same banner won't show on the same page. will only take effect
											//  if show_banners(); is used more than once. You must make sure you have enough banners to fill
											//  all the slots else the browser may freeze or give a stack overflow error
	
	'location_prefix': 		'adLocation-',	//	The prefix of the IDs of the <div> which wraps the banners - this div is generated dynamically.
											//  a number will be added on the end of this string. adLocation- was used by default before version 1.4.x
											
	'location_class':		'swb',			//  A class to add to all of the <div>s which wrap the banners, ideal to use for styling banners - use .swb img in your CSS	
	
	'window': 				'_self',		//	Window to open links in, _self = current, _blank = new. Use _top if in a frame!		
	
	'default_ad_loc':		'default'		//	The default adLocation. This is assigned to any banners not given an adLocation in the below banner list
											//  There is no real reason to need to change this
}


/**
		Banners
**/
// banner list syntax: new banner(website_name, website_url, banner_url, show_until_date, adlocation),  DATE FORMAT: dd/mm/yyyy
// if you're not using adlocations just leave it empty like '' as in the last example here
// to make sure a banner is always rotating, just set the date far into the future, i.e. year 3000

var banners = [
	new banner('Beautiful Vistas Just Minutes Away...',			'http://www.ci.heber.ut.us/', 			globalPath + 'common/images/banners/banner01.jpg', 	'30/04/3030',	''),
	new banner('Golf in a Beautiful Setting',	'http://www.ci.heber.ut.us/', 		globalPath + 'common/images/banners/banner02.jpg',		'10/04/3030',	''),
	new banner('A Beautiful City Set in Magnificent Scenery...', 				'http://www.ci.heber.ut.us/', 	globalPath + 'common/images/banners/banner03.jpg',		'30/04/3030',	''),
	new banner('This Beautiful Pastoral Setting is Our Backyard...', 			'http://www.ci.heber.ut.us/', 	globalPath + 'common/images/banners/banner04.jpg', 	'10/04/3030',	''),
	new banner('Magnificent Mountains Just Around the Corner...', 			'http://www.ci.heber.ut.us/', 	globalPath + 'common/images/banners/banner05.jpg', 	'10/04/3030',	''),
	new banner('A Beautiful City Nestled in Magnificent Mountains...', 			'http://www.ci.heber.ut.us/', 	globalPath + 'common/images/banners/banner06.jpg', 	'10/04/3030',	'')
]

//         				There is no need to edit below here
///////////////////////////////////////////////////////////////////////////////////
var used=0;var location_counter=0;var refresh_counter=1;var map=new Array();function banner(a,b,c,d,e){this.name=a;this.url=b;this.image=c;this.date=d;this.active=1;this.oid=0;if(e!=''){this.loc=e}else{this.loc=settings.default_ad_loc}}function show_banners(a){location_counter=location_counter+1;if(a!=''&&a!=undefined){map[location_counter]=a}else{map[location_counter]=settings.default_ad_loc}var b='<div id="'+settings.location_prefix+location_counter+'" class="'+settings.location_class+'"></div>';document.write(b);display_banners(location_counter)}function display_banners(a){var b=new Array();if(a==''||!a||a<0){return}var c=banners.length;if((c==used)&&settings.duplicate_banners==0){return}for(i=0;i<(banners.length);i++){banners[i].oid=i;if((banners[i].loc==map[a])&&(banners[i].active==1)){b.push(banners[i])}}var d=Math.floor(Math.random()*b.length);var e=b[d];var f=(settings.force_size==1)?' width="'+settings.img_width+'" height="'+settings.img_height+'"':'';var g='<a href="'+e.url+'" title="'+e.name+'" target="'+settings.window+'"><img border="0" src="'+e.image+'"'+f+' alt="'+e.name+'" /></a>';var h=new Date();var j=e.date;j=j.split('/',3);var k=new Date();k.setFullYear(parseInt(j[2]),parseInt(j[1])-1,parseInt(j[0]));if((h<k)&&e.active==1){var l=document.getElementById(settings.location_prefix+a);if(l==null){alert('spyka Webmaster banner rotator\nError: adLocation doesn\'t exist!')}else{l.innerHTML=g;if(settings.duplicate_banners==0){banners[e.oid].active=0;used++}return}}else{display_banners(a)}return}function refresh_banners(){if((refresh_counter==settings.refresh_max)||settings.refresh_time<1){clearInterval(banner_refresh)}used=0;for(j=0;j<(banners.length);j++){banners[j].active=1}for(j=1;j<(location_counter+1);j++){display_banners(j)}refresh_counter++}var banner_refresh=window.setInterval(refresh_banners,settings.refresh_time);















