<!--
var myCamWin;
var myIncdWin;
var mySpeedMapWin;
var myMapWin;
       
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_openBrWindow(type, theURL,winName,features) { //v2.0
	if (type =="cam") { 
		features = features + ",top=15,left=" + (window.screen.availWidth > 800 ? 625 : (window.screen.availWidth - 365)); 
		myCamWin = window.open(theURL,winName,features);
		if(myIncdWin && !myIncdWin.closed) {
			myIncdWin.focus();
		}
		if(mySpeedMapWin && !mySpeedMapWin.closed) {
			mySpeedMapWin.focus();
		}
		myCamWin.focus();
	}	else if (type=="incd") {
		features = features + ",top=" + (window.screen.availHeight * 0.5) + ",left=" + (window.screen.availWidth > 800 ? 625 : (window.screen.availWidth - 395));
		myIncdWin = window.open(theURL,winName,features);
		if(mySpeedMapWin && !mySpeedMapWin.closed) {
			mySpeedMapWin.focus();
		}
		if(myCamWin && !myCamWin.closed) {
			myCamWin.focus();
		}	
		myIncdWin.focus();
	}	else if (type=="speedMap") {
	 	features = features + ",top=" + (window.screen.availHeight * 0.35) + ",left=" + (window.screen.availWidth > 800 ? 500 : (window.screen.availWidth * .51));   
	 	mySpeedMapWin = window.open(theURL,winName,features);
		if(myCamWin && !myCamWin.closed) {
			myCamWin.focus();
		}
		if(myIncdWin && !myIncdWin.closed) {
			myIncdWin.focus();
		}
		mySpeedMapWin.focus();	
	} else if (type=="RTP_map") { 
		var now = new Date();
	    features = features + ",top=10, left=" + (window.screen.availWidth - 600);   
	    myMapWin = window.open(theURL,winName + now.getMilliseconds(),features);
	    myMapWin.focus();
	
	}
}	

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

function MM_determineDate() {
     var dtDate = new Date();
     var sCurDate = dtDate.getFullYear();
		 return sCurDate;
}

function resizeImage(type) {
// resizes window to fit image
// SRI 7/30/2002 - original code from ODOT
// displays better in IE than NS 4.x
var extraHeight = 0;

if (type == "ldi")
{
	extraHeight=90; //two images are shown
}
else if(type =="cam")
{
	extraHeight = 55;
}

var iWidth=0; //new width of window
var iHeight=0; // new height of window
var imgCam=new Image; // image
if(document.images[0])
{
	// get the image
	imgCam=document.images[0];

	// get new width and height. 10, 30 are border space between image and window
	iWidth=imgCam.width + 10;
	
	if (type == "ldi")
	{
		iHeight=(imgCam.height*2) + extraHeight;
	}
	else if (type =="cam")
	{
		iHeight=imgCam.height + extraHeight;
	}
	else
	{
		iHeight=imgCam.height + extraHeight;
	}

	// resize window to fit image.
	window.resizeTo(iWidth,iHeight);
}
else
{
	if (type == "ldi") {
		// resize window to no image size.
		window.resizeTo(350,180);
	} else if (type =="cam") {
		// resize window to no image size.
		window.resizeTo(350,120);
	}
}
}


/* RTP map interaction and navigation code */


	//-->

/*Code for saving search cookies on the browser*/
function testCookiesEnabled()
{
	//cookies used
	//	cookieTest: used to see if cookies are enabled on the users machine.
	var cookiesEnabled = true;
	document.cookie = 'cookieTest=1';
	
	var cookies = unescape(document.cookie);
	
	if(cookies.indexOf('cookieTest=1') == -1)
	{
		cookiesEnabled = false;
	}
	
	return cookiesEnabled;
}

function saveSearch()
{
    // cookies used
	// SavedSearchCookieMsgDisplayed: used to decide if this is the first time the user has selected to 'save search'
	
	if(!testCookiesEnabled())
	{
		alert('Cookies are disabled on your browser. Please enable them, then save your search.');
		return false;
	}
	else
	{
		var cookies = unescape(document.cookie);
		var savePage = true;
		
		if(cookies.indexOf('SavedSearchCookieMsgDisplayed=1') == -1)
		{
			savePage = confirm('To implement this feature, we need to place a cookie on your computer to save a quick-link to your search for future sessions.');
		}
		if(savePage)
		{
			var expireDate = new Date();
			expireDate.setFullYear(expireDate.getFullYear() + 30);
			
			var newCookie = 'SavedSearchCookieMsgDisplayed=1; expires=' + expireDate.toGMTString() + '; path=/';
			document.cookie = newCookie;
			
			
		}
		return savePage;
	}
}