function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		about_over = newImage("images/about_over.gif");
		filming_over = newImage("images/filming_over.gif");
		weather_over = newImage("images/weather_over.gif");
		permits_over = newImage("images/permits_over.gif");
		projects_over = newImage("images/projects_over.gif");
		locals_over = newImage("images/locals_over.gif");
		faq_over = newImage("images/faq_over.gif");
		festivals_over = newImage("images/festivals_over.gif");
		preloadFlag = true;
	}
}

function goToPage() 
{
   alert (document.location)
   var URL = document.selectType.show.options[document.selectType.show.selectedIndex].value;
//   if (URL != "!") {
//      window.location.href = document.location + '?show=' + URL;
//   }
//   else {  // ignore non-URL items
//      return;  // no link
//   }
}


// Function added by Nelson - 2001.12.20
function popup(url, name, size) {
newwin = window.open(url, '','top=50,left=40,width=500,height=400,scrollbars=yes,resizeable=yes');
if (!newwin.opener) newwin.opener = self;
}



function newPopUp(name, title) {
	newwin = window.open('popup.php' + '?subject=' + name + '&title=' + title, '','top=50,left=40,width=500,height=400,scrollbars=yes,resizeable=yes');
	if (!newwin.opener) newwin.opener = self;
}


// Function Added by Nelson 2004.05.19
// This is used in the 'spam proofing' of e-mail addresses.  This script 
// decrypts an e-mail address that has been encrypted with a PHP routine.  
// NOTE that the charoffset MUST BE THE SAME in encryption and decryption.
//      the PHP charoffset is in commoncode.php

// <A HREF="javascript:location.href=UnCrypt('qempxs>qevme1zDgm2evzehe2gs2yw')">


var a, s, n;
function UnCrypt(s) {
	charoffset = 4;  // character offset must be the SAME in encryption and decryption routines.
	r='';
	for(i=0;i<s.length;i++){
		n=s.charCodeAt(i); 
		if(n>=8364) {n = 128;} r += String.fromCharCode( n - charoffset ); 
	}
	return r;
}



// Function Added by Nelson 2004.05.19
// This is used in the 'spam proofing' of e-mail addresses.  This script 
// decrypts an e-mail address that has been encrypted with a PHP routine.  
// NOTE that the charoffset MUST BE THE SAME in encryption and decryption.
//      the PHP charoffset is in commoncode.php
var a, s, n;
function UnCrypt(s) {
	charoffset = 4;  // character offset must be the SAME in encryption and decryption routines.
	r='';
	for(i=0;i<s.length;i++){
		n=s.charCodeAt(i); 
		if(n>=8364) {n = 128;} r += String.fromCharCode( n - charoffset ); 
	}
	return r;
}


function googlemap(lng,lat,textstuff) {
  // Map Overlays
  //
  // Creates 10 random markers and a random polyline to illustrate the use of
  // map overlays.
  
  // Center the map
	var map = new GMap(document.getElementById("map"));
	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());
	map.centerAndZoom(new GPoint(lng, lat), 5);
  
	var buddhapoint = new GPoint(lng, lat);
	var buddha = new GMarker(buddhapoint);
	map.addOverlay(buddha);
  
	var goforth = new GMarker(new GPoint(-104.945435, 39.742563));
	//      map.addOverlay(goforth);
  
	var textstuff = textstuff+lng+"&nbsp;&nbsp;&nbsp;"+lat;
	GEvent.addListener(buddha, "click", function() {
		buddha.openInfoWindowHtml(textstuff) 
	});
  
}
