﻿//dms 07/12/2007 - modified to fit shareppoint model
    function showImage()
    {
        var theImages = new Array();
        theImages[0] = '/depts/public_works/random/215-15-interchange.gif';
        theImages[1] = '/depts/public_works/random/215-airport.jpg';
        theImages[2] = '/depts/public_works/random/215-centennial.gif';
        theImages[3] = '/depts/public_works/random/215-eastern.gif';
        theImages[4] = '/depts/public_works/random/215-hualapai.gif';
        theImages[5] = '/depts/public_works/random/215-russell.gif';
        theImages[6] = '/depts/public_works/random/215-sunset.gif';
        theImages[7] = '/depts/public_works/random/215-tropicana.gif';
        theImages[8] = '/depts/public_works/random/boulder-strip.jpg';
        theImages[9] = '/depts/public_works/random/bruce-beltway.gif';
        theImages[10] = '/depts/public_works/random/centennial.gif';
        theImages[11] = '/depts/public_works/random/charleston.gif';
        theImages[12] = '/depts/public_works/random/di-detention.gif';
        theImages[13] = '/depts/public_works/random/di-detention.jpg';
        theImages[14] = '/depts/public_works/random/duck-creek.gif';
        theImages[15] = '/depts/public_works/random/duck-detention.gif';
        theImages[16] = '/depts/public_works/random/frankie.gif';
        theImages[17] = '/depts/public_works/random/mt-charleston.gif';
        theImages[18] = '/depts/public_works/random/mthood.gif';
        theImages[19] = '/depts/public_works/random/range-wash.gif';
        theImages[20] = '/depts/public_works/random/wetlands-park.gif';

		var i = 0;	//need to locally define here - this was being used in start() by mistake
        var j = 0;
        var p = theImages.length;
        var preBuffer = new Array();

        for (i = 0; i < p; i++)
        {
            preBuffer[i] = new Image();
            preBuffer[i].src = theImages[i];
        }

        var whichImage = Math.round(Math.random()*(p-1));
        document.write('<img src="'+theImages[whichImage]+'">');
    }

//  End -->

//<!-- Date Function -->
function MakeArray(n) 
{
	this.length = n;
	return this;
}

function customDateString(oneDate) 
{
	monthNames = new MakeArray(12);
	monthNames[1] = "January";
	monthNames[2] = "February";
	monthNames[3] = "March";
	monthNames[4] = "April";
	monthNames[5] = "May";
	monthNames[6] = "June";
	monthNames[7] = "July";
	monthNames[8] = "August";
	monthNames[9] = "September";
	monthNames[10]= "October";
	monthNames[11]= "November";
	monthNames[12]= "December";
	
	dayNames = new MakeArray(7);
	dayNames[1] = "Sunday";
	dayNames[2] = "Monday";
	dayNames[3] = "Tuesday";
	dayNames[4] = "Wednesday";
	dayNames[5] = "Thursday";
	dayNames[6] = "Friday";
	dayNames[7] = "Saturday";

	var theDay = dayNames[oneDate.getDay() + 1];
	var theMonth = monthNames[oneDate.getMonth() + 1];
	var theYear = oneDate.getFullYear();
	return theDay + " -  "   +   theMonth + " " + oneDate.getDate() + ", " + theYear;
}

//  End -->

//<!-- Slider scrolling text in top left cell -->
//<!-- Begin

	var i=0;
	
	//slider's width
	var swidth=425;
		
	//slider's height
	//var sheight=140;
	//dms 07/26/2007 changed to 167 to match the height of the pictures
	var sheight=167;
		
	//slider's speed
	var sspeed=2;
		
	//messages: set up Hyperlinks to URLs as you normally do: <a target=... href="... URL ...">..message..</a>
	var singletext=new Array();
	singletext[0]='<div align="center"><font face=Arial size=2 color="#ffffff"><b>Welcome to the Clark County Public Works Website!</b><br>With a staff of 367 employees, we serve a population in the county unincorporated area of over 828,000 residents covering 7,472 square miles!</font></div>';

	singletext[1]='<div align="center"><font face=Arial size=2 color="#ffebcd"><b>E-SOQ SUBMITTAL OPENS JULY 16TH!</b><br><a href="/depts/public_works/pages/home.aspx"><font face=Arial size=2 color="#ffebcd">Qualifications lists will be effective for January 1, 2008 - June 30, 2009. Click here for more info!</font></a></font></div>';

	singletext[2]='<div align="center"><font face=Arial size=2 color="#ffffff">Accredited Public Works Agency</b><br>Clark County Public Works is accredited by the American Public Works Association and the first agency in the state of Nevada to achieve this status!</font></div>';

	singletext[3]='<div align="center"><font face=Arial size=2 color="#ffebcd"><b>PROGRESS AS PROMISED</b><br>Last year, we produced 47 completed projects for a total value over $197 million! The Bruce Woodbury Beltway projects accounted for nearly $86 million plus nearly $1.8 million of maintenance, all funded from local tax dollars!</font></div>';
	

	if (singletext.length>1)
		i=1;
	else
		i=0;


	function iemarquee(whichdiv)
	{
		iediv=eval(whichdiv);
		
		//window.alert(iediv.style.pixelTop);
		
		if (iediv.style.pixelTop>0&&iediv.style.pixelTop<=sspeed)
		{
			iediv.style.pixelTop=0;
			setTimeout("iemarquee(iediv)",100);
		}
		
		if (iediv.style.pixelTop>=sheight*-1)
		{
			iediv.style.pixelTop-=sspeed;
			setTimeout("iemarquee(iediv)",100);
		}
		else
		{
			iediv.style.pixelTop=sheight;
			iediv.innerHTML=singletext[i];
			
			if (i==singletext.length-1)
				i=0;
			else
				i++;
		}
	}
	
	function ns4marquee(whichlayer)
	{
		ns4layer=eval(whichlayer);
		
		if (ns4layer.top>0&&ns4layer.top<=sspeed)
		{
			ns4layer.top=0;
			setTimeout("ns4marquee(ns4layer)",100);
		}
		
		if (ns4layer.top>=sheight*-1)
		{
			ns4layer.top-=sspeed;
			setTimeout("ns4marquee(ns4layer)",100);
		}
		else
		{
			ns4layer.top=sheight;
			ns4layer.document.write(singletext[i]);
			ns4layer.document.close();
			
			if (i==singletext.length-1)
				i=0;
			else
				i++;
		}
	}

	function ns6marquee(whichdiv)
	{
		ns6div=eval(whichdiv);
		
		if (parseInt(ns6div.style.top)>0&&parseInt(ns6div.style.top)<=sspeed)
		{
			ns6div.style.top='0px';
			setTimeout("ns6marquee(ns6div)",100);
		}
		
		if (parseInt(ns6div.style.top)>=sheight*-1)
		{
			ns6div.style.top=parseInt(ns6div.style.top)-sspeed +'px';
			setTimeout("ns6marquee(ns6div)",100);
		}
		else
		{
			ns6div.style.top=sheight +'px';
			ns6div.innerHTML=singletext[i];
			
			if (i==singletext.length-1)
				i=0;
			else
				i++;
		}	
	}
		
	function start()
	{
		if (document.all)
		{
			ieslider1.style.top=sheight;
			iemarquee(ieslider1);
		}
		else if (document.layers)
		{
			document.ns4slider.document.ns4slider1.top=sheight;
			document.ns4slider.document.ns4slider1.visibility='show';
			ns4marquee(document.ns4slider.document.ns4slider1);
		}
		else if (document.getElementById&&!document.all)
		{
			//firefox identifies itself as netscape - add the unit
			document.getElementById('ns6slider1').style.top=sheight +'px';
			ns6marquee(document.getElementById('ns6slider1'));
		}
	}
	
//  End -->
