<!-- Begin
/*----------------------------------------------------------------------------------------
|
|        Menu Script by Josh Miller
|        written for City of Elmira Website
|        @ http://www.cityofelmira.net
|
-------------------------------------------------------------------------------------------*/ 

links=new Array();
title=new Array();
check=new Array();
x=0;

title[x]="Back to City Homepage"
links[x]="../index/index.html"
check[x]="elmira"
x++;

title[x]="Police Homepage"
links[x]="index.html"
check[x]="department"
x++;

title[x]="Accreditation"
links[x]="accreditation.html"
check[x]="accreditation"
x++;

title[x]="Administration"
links[x]="administration.html"
check[x]="administration"
x++;

title[x]="Child Safety Tips"
links[x]="child_safety_tips.html"
check[x]="tips"
x++;

title[x]="Citizen Complaints"
links[x]="citizen_complaints.html"
check[x]="complaints"
x++;

title[x]="Crime Statistics"
links[x]="statistics.html"
check[x]="statistics"
x++;

title[x]="Customer Service Survey"
links[x]="survey.html"
check[x]="survey"
x++;

title[x]="Daily Activity Logs"
links[x]="blotter.html"
check[x]="logs"
x++;

title[x]="Department Directory"
links[x]="directory.html"
check[x]="directory"
x++;

title[x]="Detective Bureau"
links[x]="detective.html"
check[x]="bureau"
x++;

title[x]="Domestic Violence"
links[x]="vsu_domestic_violence.html"
check[x]="violence"
x++;

title[x]="Drug Enforcement Unit"
links[x]="deu.html"
check[x]="unit"
x++;

title[x]="EPD Press Room"
links[x]="pressroom.html"
check[x]="room"
x++;

title[x]="Join the Force"
links[x]="employment.html"
check[x]="force"
x++;

title[x]="Law Enforcement Links"
links[x]="links.html"
check[x]="links"
x++;

title[x]="Open Cases"
links[x]="cases.html"
check[x]="cases"
x++;

title[x]="Operation Halt"
links[x]="../halt/index.html"
check[x]="271-HALT"
x++;

title[x]="Parking Regulations"
links[x]="parking.html"
check[x]="parking"
x++;

title[x]="Patrol Division"
links[x]="patrol.html"
check[x]="division"
x++;

title[x]="Police Officer Honors"
links[x]="honors.html"
check[x]="honors"
x++;

title[x]="Records Bureau"
links[x]="records.html"
check[x]="bureau-"
x++;

title[x]="Sex Offender Registry"
links[x]="sex_offender_registry.html"
check[x]="registry"
x++;

title[x]="SWAT Team"
links[x]="swat.html"
check[x]="team"
x++;

title[x]="Traffic Bureau"
links[x]="traffic.html"
check[x]="bureau--"
x++;

title[x]="Victim Services"
links[x]="vsu_index.html"
check[x]="program"
x++;

title[x]="Warrants"
links[x]="warrants.html"
check[x]=""
x++;

title[x]="Welfare Fraud"
links[x]="welfare.html"
check[x]=""
x++;

title[x]="Youth Services"
links[x]="ys_index.html"
check[x]="services"
x++;

//Get the title to determine what page the user is viewing
x=document.title;                                                       	//get the title and store as a string in x
x=x.toLowerCase();                                                        	//make the whole title lower case
y=x.lastIndexOf(' ');                                                		//find the last space in the title and store in y
y=y+1;                                                                      //add 1 to y to find the letter after the last space
z=x.length;                                                                 //get the length of the whole string and store in z
page=x.substring(y,z);                                                		//store in page the last word of the html page's title

function mainnav(){
	document.write("<img src='../police/pics/index_left_top.jpg'>");
	document.write("<table border='0' cellpadding='0' cellspacing='4' width='154'>														");
	document.write("<tr><td><img src='pics/dot.gif' width='5' height='16' border='0'></td></tr>											");
    for (i=1; i<title.length; i++){
		if(page==check[i]){
			document.write("<tr><td align='left'><span class='navhilite'>"+title[i]+"</span></td></tr>									");
        }
        else{
			document.write("<tr><td align='left'><a href='../police/"+links[i]+"' class='leftmenu'>"+title[i]+"</a></td></tr>						");
		}   
	}

		document.write("<tr><td align='left'><br><a href='"+links[0]+"' class='leftmenu'>"+title[0]+"</a></td></tr>						");
	
	document.write("</table>");
}

function rightPoliceDirectory(){
		document.write("        <table border='0' cellpadding='0' cellspacing='0' width='150'>        						");
		now=new Date();hours=now.getHours();
		if (hours > 22 || hours < 5){
			document.write("        <tr><td class='rightbar'>&nbsp;CURFEW ALERT</td></tr>        						");
			document.write("        <tr><td class='righttext'>It is past 11:00pm:  Do you know where your children are?  Curfew is in effect in the City of Elmira until 5:00am.</td></tr>					");
		}
        document.write("        <tr><td class='rightbar' >&nbsp;Police Directory</td></tr>");
		document.write("        <tr><td class='emergency'>EMERGENCY -Dial 911</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;A crime is taking place</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;You feel threatened</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;A life is in danger</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;Report an accident</td></tr>");

		document.write("        <tr><td class='righttext'><a href='../police/patrol.html'><b>Communications Center</b></a></td></tr>");
		document.write("        <tr><td class='righttext'><b>(607) 735-8600</b></td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;You need Police assistance</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;File a complaint</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;You are witness to a crime</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;You require Animal Control</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;Report an accident w/o injury</td></tr>");

		document.write("        <tr><td class='righttext'><a href='../police/deu.html'><b>Drug Enforcement Hotline</b></a></td></tr>");
		document.write("        <tr><td class='righttext'><b>(607) 737-5603</b></td></tr>");

		document.write("        <tr><td class='righttext'><a href='../police/vsu_index.html'><b>Domestic Violence Hotline</b></a></td></tr>");
		document.write("        <tr><td class='righttext'><b>(607) 732-1979</b></td></tr>");

		document.write("        <tr><td class='righttext'><a href='../police/records.html'><b>Records Bureau</b></a></td></tr>");
		document.write("        <tr><td class='righttext'><b>(607) 737-5633</b></td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;Police reports</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;Property recovery</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;Criminal background checks</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;Warrants</td></tr>");

		document.write("        <tr><td class='righttext'><a href='../police/traffic.html'><b>Traffic Bureau</b></a></td></tr>");
		document.write("        <tr><td class='righttext'><b>(607) 737-5641</b></td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;Traffic accident reports</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;Vehicle Impound Release</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;Special event planning</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;Request street signage</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;School Crossing Guards</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;Parking regulations</td></tr>");

		document.write("        <tr><td class='righttext'><a href='../police/patrol.html'><b>Patrol Supervisors</b></a></td></tr>");
		document.write("        <tr><td class='righttext'><b>(607) 737-5623</b></td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;General Information</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;Concern about an incident</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;Commend an officer</td></tr>");

		document.write("        <tr><td class='righttext'><a href='../police/administration.html'><b>DC/Administration</b></a></td></tr>");
		document.write("        <tr><td class='righttext'><b>(607) 737-5631</b></td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;Employment Information</td></tr>");

	    document.write("        <tr><td class='rightbar' >&nbsp;Sex Offenders Search</td></tr>");
		document.write("        <tr><td align='center'><br><a href='http://www.sheriffalerts.com/ny/chemung' target='_blank'><img src='pics/offenderbutton.jpg' border=0></a><br><br></td></tr>");

	    document.write("        <tr><td class='rightbar' >&nbsp;Citizen's Guides and Laws</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;<a href='javascript:download(165)'>Noise Complaints</a></td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;<a href='javascript:download(164)'>Traffic Stops</a></td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;<a href='../police/parking.html'>Parking Regulations</a></td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;<a href='../dps/snow.html'>Snow Removal</a></td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;<a href='javascript:download(36)'>Curfew Ordinance</a></td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;<a href='javascript:download(38)'>Noise Ordinance</a></td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;<a href='javascript:download(41)'>Odd-Even Parking</a></td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;<a href='javascript:download(42)'>Truck Route Ordinance</a></td></tr>");
		document.write("        <tr><td class='rightbar' >&nbsp;Annual Reports</td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;<a href='javascript:download(248)'>2008 Annual Report</a></td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;<a href='javascript:download(235)'>2007 Annual Report</a></td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;<a href='javascript:download(206)'>2006 Annual Report</a></td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;<a href='javascript:download(205)'>2005 Annual Report</a></td></tr>");
		document.write("        <tr><td class='righttext'>•&nbsp;<a href='javascript:download(204)'>2004 Annual Report</a></td></tr>");
		document.write("        </table>");	
		rightWarrantList();
}


function rightWarrantList(){
		store=new Array();counter=0;		
		for (a=0; a<warrant.length;a++){
			if(warrant[a][wbook]!=""){
				store[counter]=a
				counter++;
			}	
		}
		id=[Math.round(Math.random()*(store.length-1))]
		document.write("        <table border='0' cellpadding='0' cellspacing='0' width='150'>        ");
	    document.write("        <img src='../police/pics/dot.gif' width='5' height='5' border='0' alt=''><br>   ");
        document.write("        <tr><td class='rightbar'>&nbsp;Wanted by the EPD</td></tr>        ");
        document.write("        <tr><td align='center'><a href='../police/warrants.html?id="+store[id]+"' border='0'><img src='../warrants/"+warrant[store[id]][wbook]+".jpg' width='100' height='125' border='0' alt='Click here for more information on this individual'><br>        ");
        document.write("        <tr><td class='righttext' align='center'><a href='../police/warrants.html?id="+store[id]+"'>"+warrant[store[id]][fname]+" "+warrant[store[id]][lname]+"</a></td></tr>        ");
		document.write("		<tr><td class='righttext'><p class='justify'>The individual above has a warrant held by the EPD.  If you have information about this person, click on the picture and follow the directions.</p></td></tr>")
		document.write("		<tr><td class='righttext'><a href='../police/warrants.html'><b>-Complete Warrant List</b></a></td></tr>")
        document.write("        </table>");

}

function rightAccreditation(){
		document.write("        <table border='0' cellpadding='0' cellspacing='0' width='150'>        ");
        document.write("        <tr><td class='rightbar'>&nbsp;Accrediation</td></tr>        ");
        document.write("        <tr><td><a href='http://www.calea.org'>        ");
        document.write("        <img src='../police/pics/index_calea.jpg' alt='Click for Elmira, New York Forecast' border='0'></a></td></tr>        ");
		document.write("        <tr><td class='righttext' align='center'>The Elmira Police Department is accredited by New York State Law Enforcement Accreditation Program (LEAP) and the National Commission on Accreditation for Law Enforcement Agencies (CALEA).</td></tr>");
		document.write("        </table>");
}

function rightSafetyTips(){
}

function printChief(){
	document.write("		<a href='../police/administration.html' class='rightheader'>W. Scott Drake III</a><br>");
	document.write("		<span class='rightheader'>Chief of Police</span>");
}

function runBlotter(numberofdays,offset){
	today=new Date();
	Day=today.getDate();
	Month=today.getMonth();
	Year=today.getYear();
	num=numberofdays;
	delay=offset
	for (i=offset;i<num+2;i++){
		BlotterDate=new Date(Year, Month, Day-i)
		document.write("<a href='http://apps.cityofelmira.net/public/blotters/"+getShortDate(BlotterDate)+".pdf' target='_blank'>"+getFullDate(BlotterDate)+"</a><br>")
	}
}

function runBlotterMsg(){
	maintenance=false;
	if(maintenance){
		document.write("<font color='#990000'><b>NOTICE:</b><br>This system will undergo maintenance on Friday May 1, 2009 from 1:00pm to 5:00pm.  During this time, the links below may not work properly.  Please check back later.<br><br></font>");
	}
}

function getFullDate(date){
	day=date.getDate();
	month=date.getMonth();
	currentYear=date.getYear();
	if (navigator.appName == "Netscape"){
		currentYear=currentYear+3800;
	}
	fullDate=getMonth(month)+" "+day+", "+currentYear;
	return fullDate;
}

function getShortDate(meeting,type){
	day=meeting.getDate();
	month=1+meeting.getMonth();
	currentYear=meeting.getYear();
	if (navigator.appName == "Netscape"){
		currentYear=currentYear+3800;
	}
	if (day < 10)
		day="0"+day;
	if (month < 10)
		month="0"+month;
	shortDate=currentYear+ "-" +month+ "-" +day;
	return shortDate;
}

function getMonth(month){switch (month){case 0: return "January";case 1:return "February";case 2:return "March";case 3:return "April";case 4:return "May";case 5:return "June";case 6:return "July";case 7:return "August";case 8:return "September";case 9:return "October";	case 10:return "November";case 11:return "December";default:return "Error";}}

flag=0;
function rotateMainImage()
{
	stack= new Array(1,2,3,4,5,6,7,8)
	document.write("<img src='pics/main"+addZero(popIt())+".jpg' width='424' height='275' border='1' name='policemain'>");
	setTimeout("updatePhotos()",10000);
}

function updatePhotos(){
	stack= new Array(1,2,3,4,5,6,7,8)
	document.policemain.src="pics/main"+addZero(popIt())+".jpg"

	if (flag==0){
		setTimeout("updatePhotos()",10000);
	}
}


function validateWarrants(theForm){
	status=theForm.status.value;
	caseNum=theForm.caseNum.value;
	if (caseNum == ""){
		alert("You must provide a case Number to submit this suspect for the Online Warrants Directory.");
		theForm.caseNum.focus();
		return (false);
	}
	suspectl=theForm.suspectl.value;
	if (suspectl == ""){
		alert("You must provide a last name to submit this suspect for the Online Warrants Directory.");
		theForm.suspectl.focus();
		return (false);
	}	
	suspectf=theForm.suspectf.value;
	if (suspectf == ""){
		alert("You must provide a first name to submit this suspect for the Online Warrants Directory.");
		theForm.suspectf.focus();
		return (false);
	}
	if (status == "1"){
		dob=theForm.dob.value;
		if (dob == ""){
			alert("You must provide a date of birth to submit this suspect for the Online Warrants Directory.");
			theForm.dob.focus();
			return (false);
		}
		else{
			MonthFlag=0
			if	(dob.indexOf("January") 	>-1 ){MonthFlag++}
			if	(dob.indexOf("February") 	>-1 ){MonthFlag++}
			if	(dob.indexOf("March") 		>-1 ){MonthFlag++}
			if	(dob.indexOf("April") 		>-1 ){MonthFlag++}
			if	(dob.indexOf("May") 		>-1 ){MonthFlag++}
			if	(dob.indexOf("June") 		>-1 ){MonthFlag++}
			if	(dob.indexOf("July") 		>-1 ){MonthFlag++}
			if	(dob.indexOf("August") 		>-1 ){MonthFlag++}
			if	(dob.indexOf("September") 	>-1 ){MonthFlag++}
			if	(dob.indexOf("October") 	>-1 ){MonthFlag++}
			if	(dob.indexOf("November") 	>-1 ){MonthFlag++}
			if	(dob.indexOf("December") 	>-1 ){MonthFlag++}
			if  (MonthFlag==0){
				alert("The date of birth is in the wrong format- correct the format or click select to find the date.")		
				theForm.dob.focus();
				return (false);
			}
		}
	
		race=theForm.race.value;
		otherRace=theForm.otherRace.value;
		if ((race == "")&& (otherRace == "")){
			alert("You must provide the race of the suspect to submit this suspect for the Online Warrants Directory.");
			theForm.race.focus();
			return (false);
		}
		sex=theForm.sex.value;
		if (sex == ""){
			alert("You must provide the sex of the suspect to submit this suspect for the Online Warrants Directory.");
			theForm.sex.focus();
			return (false);
		}		
		issueDate=theForm.issueDate.value;
		if (issueDate == ""){
			alert("You must provide the issue date of the warrant to submit this suspect for the Online Warrants Directory.");
			theForm.issueDate.focus();
			return (false);
		}
		else{
			MonthFlag=0
			if	(issueDate.indexOf("January") 	>-1 ){MonthFlag++}
			if	(issueDate.indexOf("February") 	>-1 ){MonthFlag++}
			if	(issueDate.indexOf("March") 	>-1 ){MonthFlag++}
			if	(issueDate.indexOf("April") 	>-1 ){MonthFlag++}
			if	(issueDate.indexOf("May") 		>-1 ){MonthFlag++}
			if	(issueDate.indexOf("June") 		>-1 ){MonthFlag++}
			if	(issueDate.indexOf("July") 		>-1 ){MonthFlag++}
			if	(issueDate.indexOf("August") 	>-1 ){MonthFlag++}
			if	(issueDate.indexOf("September") >-1 ){MonthFlag++}
			if	(issueDate.indexOf("October") 	>-1 ){MonthFlag++}
			if	(issueDate.indexOf("November") 	>-1 ){MonthFlag++}
			if	(issueDate.indexOf("December") 	>-1 ){MonthFlag++}
			if  (MonthFlag==0){
				alert("The issue date is in the wrong format- correct the format or click select to find the date.")		
				theForm.issueDate.focus();
				return (false);
			}
		}		
		charges=theForm.charges.value;
		if (charges == ""){
			alert("You must provide the charges to submit this suspect for the Online Warrants Directory.");
			theForm.charges.focus();
			return (false);
		}		
	}
	from=theForm.from.value;
	if (from == ""){
		alert("You must provide your name to submit this suspect for the Online Warrants Directory.");
		theForm.from.focus();
		return (false);
	}
	return (true);
}


//------------------- Stack Functions------->

function stackShuffle(n) {
  var i, j, k;
  var temp;
  // Shuffle the stack 'n' times.
  for (i = 0; i < n; i++)
    for (j = 0; j < this.stack.length; j++) {
      k = Math.floor(Math.random() * this.stack.length);
      temp = this.stack[j];
      this.stack[j] = this.stack[k];
      this.stack[k] = temp;
    }
}

function stackPop() {
  if (this.stack.length > 0)
    return this.stack.shift();
  else
    return null;
}

function popIt(){
	stackShuffle(10)
	popped=stackPop()
	return popped
}

function addZero(x){
	if(x<10){return "0"+x}
	else{return x}
}//end addZero function



//-->
