// JavaScript Document

//Global Variables
var page_is_dirty = false;

//toggles form visibility
//Created By: Michael Sierks
function toggleVisibility(divName, imageName) {
	if(document.getElementById(divName).style.display == "none") {
		document.getElementById(divName).style.display = "";
		//document.getElementById(imageName).src = "/user/images/build/trigger-show.png";
		document.getElementById(imageName).className = "close open";
		document.getElementById(imageName).alt = "show";
		
	}
	else {
		document.getElementById(divName).style.display = "none";
		//document.getElementById(imageName).src = "/user/images/build/trigger-hide.png";
		document.getElementById(imageName).className = "close";
		document.getElementById(imageName).alt = "hide";
	}

}




/*
FUNTION NAME	: hideID
PARAMETERS		: id_passed, switch_passed
RETURN			: BOOLEAN
DESCRIPTION		: Function used to hide a passed id
*/
function hideID(id_passed, switch_passed){
	//variable declaration
	var result = false;
	var hide_element = document.getElementById(id_passed);
	
	//check to see if the element exists
	if(hide_element){
		if(switch_passed){
			hide_element.style.display = 'none';	
		}else{
			hide_element.style.display = '';	
		}
		result = true;	
	}
}





//Trim Function ULTRA FAST!
function trimString(str) {
	var	str = str.replace(/^\s\s*/, ''),
		ws = /\s/,
		i = str.length;
	while (ws.test(str.charAt(--i)));
	return str.slice(0, i + 1);
}

function trimString2(str) {
	return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}



       var MAX_DUMP_DEPTH = 10;
       function dumpObj(obj, name, indent, depth) {

              if (depth > MAX_DUMP_DEPTH) {

                     return indent + name + ": <Maximum Depth Reached>\n";

              }

              if (typeof obj == "object") {

                     var child = null;

                     var output = indent + name + "\n";

                     indent += "\t";

                     for (var item in obj)

                     {

                           try {

                                  child = obj[item];

                           } catch (e) {

                                  child = "<Unable to Evaluate>";

                           }

                           if (typeof child == "object") {

                                  output += dumpObj(child, item, indent, depth + 1);

                           } else {

                                  output += indent + item + ": " + child + "\n";

                           }

                     }

                     return output;

              } else {

                     return obj;

              }

       }
	   
	   
function gup( name ){  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  var regexS = "[\\?&]"+name+"=([^&#]*)";  var regex = new RegExp( regexS );  var results = regex.exec( window.location.href );  if( results == null )    return "";  else    return results[1];}	 



function parseXML(str){
	if(!$.support.htmlSerialize){
		var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async="false";
		xmlDoc.loadXML(str); 
		return $(xmlDoc); //<--- fix. jquery says, this is a dom, and treats it as one
	}else{
		return $(str); //<-- jquery says, i have a string that is xml to convert to a dom, and treats it as one
	}
}



function dirty_page(){
	page_is_dirty = true;	
}

function is_page_dirty(){
	return page_is_dirty;	
}
	 
	 
function exist(sFN) {
 return (typeof sFN == 'function');
}
	 
	 
