// JavaScript Document
	function isNull(val){return(val==null);}
	function isUndefined(val){return(val===undefined);}
	
	function isset(val){return !isUndefined(val);}
	function empty(val){return (isNull(val) || isUndefined(val) || val=='')? true : false;}
	
	function LTrim(str){
		if (str==null){return null;}
		for(var i=0;str.charAt(i)==" ";i++);
		return str.substring(i,str.length);
	}
	function RTrim(str){
		if (str==null){return null;}
		for(var i=str.length-1;str.charAt(i)==" ";i--);
		return str.substring(0,i+1);
	}
	function Trim(str){return LTrim(RTrim(str));}
	
	function in_array(needle, haystack, argStrict) {
		// http://kevin.vanzonneveld.net
		// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
		// *     example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']);
		// *     returns 1: true
	 
		var found = false, key, strict = !!argStrict;
	 
		for (key in haystack) {
			if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
				found = true;
				break;
			}
		}
	 
		return found;
	}
	
	function is_numeric(value){  
		return !!isNaN(value);  
	} 



//Compatable with both browsers
// myObj = MM_findObj("object");
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;
}

//Changes visibility of a form element from an onclick event
//ex:  showElement(this, "specialChars", this.src.indexOf("_dn.gif") != -1);
function showElement(obj, obj_To_Change, modifier) { 
	var chng_Obj = MM_findObj(obj_To_Change);
	if(eval(modifier)){ eval("chng_Obj.style.visibility = 'visible'"); eval("chng_Obj.style.display = 'block'"); }
	else{ eval("chng_Obj.style.visibility = 'hidden'"); eval("chng_Obj.style.display = 'none'"); }
}

function rowEffect(object) { 
  if (object.className.indexOf('Over') == -1) object.className = object.className+'Over';
  else object.className = object.className.substring(0, object.className.lastIndexOf('Over'));
}

function rowOverEffect(object) {
  if (object.className.indexOf('Over') == -1) object.className = object.className+'Over';
}

function rowOutEffect(object) {
  if (object.className.indexOf('Over') != -1) object.className = object.className.substring(0, object.className.lastIndexOf('Over'));
}

//Disables the submit buttons on a form
//  ex: <form onSubmit="disableSubmit(this)">
function disableSubmit(theform) {
	if (document.all || document.getElementById) {
	  for (i = 0; i < theform.length; i++) {
		var tempobj = theform.elements[i];
		if (tempobj.type != null)  if (tempobj.type.toLowerCase() == "submit")	tempobj.disabled = true;
	  }
	}
}

function update_and_close(){
	//window.opener.location.href = window.opener.location.href;
	window.opener.location.reload(true);
	if (window.opener.progressWindow){ window.opener.progressWindow.close(); } 
	parent.window.close();	
}

function open_popup(url, window_name, width, height){	
  window.open(url,window_name,'width='+width+',height='+height+',resizable=1, scrollbars=1');
}


//returns GET varibales
function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
}


function set_input(e, v){
	var obj;
	obj = MM_findObj(e);
	obj.value = v;
}

function toggle_input(e){
	var obj;
	obj = MM_findObj(e);
	if(obj.checked) obj.checked = false;
	else obj.checked = true;
}



//Protect against frames
function unframe_page(){	
	if(window.top.location.href != window.location.href){ 
		window.top.location.href = window.location.href;
	}
}


//============================================
function show_photo(id, total){
	var x, obj, cur_id;
	for(x=0;x<total;x++){
		obj = MM_findObj('photo'+x);
		//alert(obj.id);
		if(id == x){ 
			obj.style.visibility = "visible";
			obj.style.display = "block";
		}else{ 
			obj.style.visibility = "hidden";
			obj.style.display = "none";
			//alert(obj.id);
		}
	}
	nudgeFirefox(); 
}


function nudgeFirefox(){ 
    /* sort out a height problem in firefox */ 
    document.getElementsByTagName('body')[0].style.width='99%'; 
    document.getElementsByTagName('body')[0].style.width='auto'; 
}


function movie_DoFSCommand(command, args) { 
  if (command == "display_text") { 
    obj = MM_findObj(args);
	//alert(obj.style.display);
	obj.style.display = 'block';
  }
}

function hideMe(id){
  myobj = MM_findObj(id);
  myobj.style.display = 'none';
}


//Detect the Media Object for flash, WMV, etc...
function getMovieObject(movieName){
  if (window.document[movieName]){
      return window.document[movieName];
  }
  
  if (navigator.appName.indexOf("Microsoft Internet")==-1){
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
	  
  }else{ // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
    return document.getElementById(movieName);
  }
}

//=============================================





//Open new window for directions with Google Maps
function getDirections(start, end){
	//replace spaces with +s on start 
	s = new String(start);
	start = s.replace(/ /,"+");

	//replace spaces with +s on end
	e = new String(end);
	end = e.replace(/ /,"+");
	
	window.open("http://maps.google.com/maps?f=d&hl=en&saddr="+ start +"&daddr="+ end +"&z=13&om=1", "googlemapsdirections");
}

/*===============================================*/
/*		HEX to RGB and RGB to HEX Functions		 */
/*===============================================*/

function NumToHex(strNum) {
	var result;

	base = strNum / 16;
	rem = strNum % 16;
	base = base - (rem / 16);
	baseS = MakeHex(base);
	remS = MakeHex(rem);
	result=baseS + '' + remS;
	
	return result;
}


function MakeHex(x) {
	if((x >= 0) && (x <= 9)){
		return x;
	}else{
		switch(x) {
			case 10: return "A"; 
			case 11: return "B";  
			case 12: return "C";  
			case 13: return "D";  
			case 14: return "E";  
			case 15: return "F";  
		}
	}
}

<!-- Begin		 start, end 
function HexToNum(numberS) {
	var result;
	
	tens = MakeNum(numberS.substring(0,1));
	ones = 0;
	if(numberS.length > 1){ // means two characters entered
		ones=MakeNum(numberS.substring(1,2));
	}
	result = (tens * 16) + (ones * 1);

	return result;
}

function MakeNum(str) {
	if((str >= 0) && (str <= 9))
		return str;
	switch(str.toUpperCase()) {
		case "A": return 10;
		case "B": return 11;
		case "C": return 12;
		case "D": return 13;
		case "E": return 14;
		case "F": return 15;
		default:  alert('You must choose a number between 0 and 9 or a letter between A and F!');
		return 'X';
	}
}


/*===============================================*/

// This will remove all whitespace from a string
if (!String.prototype.removeAllWhitespace) {
    String.prototype.removeAllWhitespace = function() { return this.replace(/\s+/g, ''); }
}
