/* In this code we create a class that holds the path of an image and the text of it's credit
*  Then we define an array called "Picures" and initialize it to the paths and credits of all photo's 
*  used on the web page that we want preloaded. The order does not really matter.  The way to use this
*  file is to copy and paste if into the <script> area of the header of the HTML file.
*
*  The idea is that when we call "preLoadImage()" the constructor for an Image object is called and when
*  the "src" property of that object is loaded with a URL of an actual image, the Web Browser downloads
*  that image from the network and saves it in it's own cache.  Then when we later want to display that
*  image it is readily available. I am assuming it does not matter that the local variable "loadImage"
*  is does not exist once the function "preLoadImage()" returns.
*
*  The procedure is to load this javascript code. Then to initialize the Pictures array in the body
*  of the "script" section of the header. And finally to call the function preLoadImage.
*/

var goldenrod
if (!goldenrod) goldenrod = {}

goldenrod.globalcontext = this;

/*Importing classes
var Animate = goldenrod.Animate;
var Dom = goldenrod.Dom;
var Utility = goldenrod.Utility
var Eventshow = goldenrod.Eventshow
*/
goldenrod.preLoad = new Object; 

goldenrod.preLoad.Export = false;

goldenrod.preLoad.ModReport = function() {
	//For working on CQ pages don't show this
	//if(!goldenrod.preLoad.Export) alert(goldenrod.preLoad.ModReport.Message);
	}
	
goldenrod.preLoad.ModReport.Message = "April 10, 2010 \n" +
				   "Mod - The Dom javascript file must be included before the Preload file\n\n" + 
				   "Mod - The preload file sets up function arrays for onLoad, onResize, and UnLoad\n" +
				   "      These are installed and will run. The Dom.DPI_Init function is run for all pages.\n" +
				   "      Global variables for ViewportHeight and ViewportWidth are created and maintained by\n" + 
				   "      initializing them in an onLoad function and keeping them up to date in an onResize function\n\n" +
				   "Mod - \n" +
				   "      \n\n" +
				   "Mod - \n" + 
				   "      \n\n" +
				   "Mod - \n" +
				   "      \n" + 
				   "      \n" + 
				   "      \n\n";


goldenrod.preLoad.image_data = function(path, credit, title) {
	this.path=path; 
	if(credit == null) credit = ""; 
	this.credit = credit;
	if(title == null) title = ""; 
	this.title = title;
	}



goldenrod.preLoad.preLoadImage  = function(Pics) {

	var i, p = Pics.length;

	var loadImage = new Array();

	for (i = 0; i < p; i++){
		loadImage[i] = new Image();
		loadImage[i].src = Pics[i].path;
	};
	
}

/**************************************************************************************************
preLoad.HTTP- This code is for dynamically communication with a server using the XMLHttpRequest object
**************************************************************************************************/
goldenrod.preLoad.HTTP = {};

//An array of functions to try for creating a XMLHttpRequest object in various browsers.
goldenrod.preLoad.HTTP._factories = [
	function() {return new XMLHttpRequest();},
	function() {return new ActiveXObject("Microsoft.XMLHTTP");},
	function() {return new ActiveXObject("MSXML2.XMLHTTP.3.0");},
	function() {return new ActiveXObject("MSXML2.XMLHTTP");}	
];

goldenrod.preLoad.HTTP._factory = null;	//When we find one we will save it here


goldenrod.preLoad.HTTP.newRequest = function() {
	if(goldenrod.preLoad.HTTP._factory != null) return goldenrod.preLoad.HTTP._factory();
	
	for(var i=0; i<goldenrod.preLoad.HTTP._factories.length; i++){
		try {
			var factory = goldenrod.preLoad.HTTP._factories[i];	//The function to try.
			var request = factory();	//This could throw an exception
			if(request != null){	//If no exception then why wouldn't we get an object?
				goldenrod.preLoad.HTTP._factory = factory;
				return request;
			}
		}
		catch(e){
			continue;
		}
	}
	//If we get here nothing worked so load a function that throws an error for the next time.
	goldenrod.preLoad.HTTP._factory = function(){
		throw new Error("XMLHttpRequest not supported");
	}
	
	goldenrod.preLoad.HTTP._factory();	//And throw that error.
}

goldenrod.preLoad.HTTP.delay = 5*1000;
goldenrod.preLoad.HTTP.pollInterval = 40;
goldenrod.preLoad.HTTP.timeoutCount = Math.round(goldenrod.preLoad.HTTP.delay / goldenrod.preLoad.HTTP.pollInterval);

goldenrod.preLoad.HTTP.wait = true;

goldenrod.preLoad.HTTP.setDelay = function(msDelay){
	goldenrod.preLoad.HTTP.delay = msDelay;
	goldenrod.preLoad.HTTP.timeoutCount = Math.round(msDelay / goldenrod.preLoad.HTTP.pollInterval);
}

/*--------------------------------------------------------------------------------------------
queryArray:	An array of strings. Each string has the form: name=value; where both name and value
			are themselves strings. These get appended to the url so that we end up With
			url?name1=value1&name2=value2&name3=value3....
			
			The problem is - the string value may include one of the special character such as '=' or
			'&' or '/'. That is why these strings are escaped with %HH - So this current version
			of this routine does not escape anything!  That is fine as long as the name/value pairs
			do not contain any special characters. Initially we use this routine to pass volume and issue
			numbers (for CQ) and peoples names.
			
			I can fix this if we adhere to the convention that name will only contain ascii characters
			and numbers. The following characters are also OK: - _ . ! ~ * ' ( ).
----------------------------------------------------------------------------------------------*/
goldenrod.preLoad.HTTP.getText = function(url, queryArray, myCallback) {
	var request = goldenrod.preLoad.HTTP.newRequest();
	var intervalId = null;
	var onreadystateflag = 0, readyStatePollflag = true;
	var pollCount = 0;
	var warningText = "The GET request through an XMLHttpRequest Object for file:\n" + url + 
			"\nis taking longer than " + (goldenrod.preLoad.HTTP.delay/1000) + 
			" seconds to load.\nHit OK to continue trying or Cancel to abort";

	function my_clearInterval(){
		if(intervalId !== null){
			window.clearInterval(intervalId);
			intervalId = null;
		}
	}
	/*------------------------------------------------------------------------------------------
		Note: it is not possible to manually call request.onreadystatchange so I have created
		my own function that is a property of the request Object.
		
		This function is guaranteed to be called every .04 secs.
		
		It is recursively protected (in case that is necessary?) and furthermore myCallback is
		protected from being called twice.
		
	------------------------------------------------------------------------------------------*/
	request.my_onreadystatechange = function(){
		if(onreadystateflag == 0){
			onreadystateflag = 1;
			if(this.readyState == 4){
				my_clearInterval();
				if(this.status == 200){
					onreadystateflag = -1;
					myCallback(this.responseText);
				}
				else{
					alert("The GET request through an XMLHttpRequest Object for file:\n" + url + 
					"\nhas return a status code: " + this.status +
					"\n\nRequest abhorted");
					this.abhort();
				}
			}
			if(onreadystateflag == 1) onreadystateflag = 0;
		}
	}
	
	request.onreadystatechange = function(){
		this.my_onreadystatechange();
	}

	
	function readyStatePoll() {
		if(readyStatePollflag){
			readyStatePollflag = false;
			request.my_onreadystatechange();
			
			pollCount++;
			if(pollCount >= goldenrod.preLoad.HTTP.timeoutCount){
				pollCount = 0;
				my_clearInterval();
				
				if( confirm(warningText) ){
					goldenrod.preLoad.HTTP.wait = true;
					intervalId = 
						setInterval(readyStatePoll, goldenrod.preLoad.HTTP.pollInterval);
				}
				else {
					request.abort();	//Cancel the request and end all communication with the server.
				}
			}
			readyStatePollflag = true;
		}
	}
	
	var query = '', pos, name, value, pattern = /%20/g;
	for(var i=0; i<queryArray.length; i++) {
		if(!i) url += "?"; else url += "&";
		query = queryArray[i];
		pos = query.indexOf('=');
		name = query.slice(0,pos+1);	//This will be 'name=''
		value = query.slice(pos+1)
		value = encodeURIComponent(value).replace(pattern, '+');
		query = name + value;
		url += query;
	}
	request.open("GET", url);
	request.send(null);
	/*------------------------------------------------------------------------------------------
	I think because of the line of code below in which the nested function - readyStatePoller 
	is being passed as a parameter to a global function and so the call object of this function 
	stays alive until we call clearInterval for the appropriate id - and exit. 
	Then the call object can be destroyed.
	------------------------------------------------------------------------------------------*/
	intervalId = setInterval(readyStatePoll, goldenrod.preLoad.HTTP.pollInterval);
	
}

/*--------------------------------------------------------------------------------------------
postArray:	This is an array of pairs. Each pair is itself an array with two elements. The
			first element is the name and the second element is the value.
----------------------------------------------------------------------------------------------*/
goldenrod.preLoad.HTTP.postText = function(url, postArray, myCallback) {
	var request = goldenrod.preLoad.HTTP.newRequest();
	var intervalId = null;
	var onreadystateflag = 0, readyStatePollflag = true;
	var pollCount = 0;
	var warningText = "The POST request through an XMLHttpRequest Object for file:\n" + url + 
			"\nis taking longer than " + (goldenrod.preLoad.HTTP.delay/1000) + 
			" seconds to load.\nHit OK to continue trying or Cancel to abort";

	function my_clearInterval(){
		if(intervalId !== null){
			window.clearInterval(intervalId);
			intervalId = null;
		}
	}
	/*------------------------------------------------------------------------------------------
		Note: it is not possible to manually call request.onreadystatchange so I have created
		my own function that is a property of the request Object.
		
		This function is guaranteed to be called every .04 secs.
		
		It is recursively protected (in case that is necessary?) and furthermore myCallback is
		protected from being called twice.
		
	------------------------------------------------------------------------------------------*/
	request.my_onreadystatechange = function(){
		if(onreadystateflag == 0){
			onreadystateflag = 1;
			if(this.readyState == 4){
				my_clearInterval();
				if(this.status == 200){
					onreadystateflag = -1;
					myCallback(this.responseText);
				}
				else{
					alert("The POST request through an XMLHttpRequest Object for file:\n" + url + 
					"\nhas return a status code: " + this.status +
					"\n\nRequest abhorted");
					this.abhort();
				}
			}
			if(onreadystateflag == 1) onreadystateflag = 0;
		}
	}
	
	request.onreadystatechange = function(){
		this.my_onreadystatechange();
	}

	
	function readyStatePoll() {
		if(readyStatePollflag){
			readyStatePollflag = false;
			request.my_onreadystatechange();
			
			pollCount++;
			if(pollCount >= goldenrod.preLoad.HTTP.timeoutCount){
				pollCount = 0;
				my_clearInterval();
				
				if( confirm(warningText) ){
					goldenrod.preLoad.HTTP.wait = true;
					intervalId = 
						setInterval(readyStatePoll, goldenrod.preLoad.HTTP.pollInterval);
				}
				else {
					request.abort();	//Cancel the request and end all communication with the server.
				}
			}
			readyStatePollflag = true;
		}
	}
	
	var postPairs = [], postData, name, value, pattern=/%20/g;
	for(var i=0; i<postArray.length; i++) {
		name = encodeURIComponent(postArray[i][0]).replace(pattern, '+');
		value = encodeURIComponent(postArray[i][1]).replace(pattern, '+');
		postPairs.push(name + '=' + value);
	}
	postData = postPairs.join('&');
	request.open("POST", url);
	request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	request.send(postData);
	/*------------------------------------------------------------------------------------------
	I think because of the line of code below in which the nested function - readyStatePoller 
	is being passed as a parameter to a global function and so the call object of this function 
	stays alive until we call clearInterval for the appropriate id - and exit. 
	Then the call object can be destroyed.
	------------------------------------------------------------------------------------------*/
	intervalId = setInterval(readyStatePoll, goldenrod.preLoad.HTTP.pollInterval);
	
}


/**************************************************************************************************
preLoad.HTTPScript- This code is for dynamically loading Javascripts
**************************************************************************************************/
goldenrod.preLoad.HTTPScript = {};
goldenrod.preLoad.HTTPScript.delay = 5*1000;
goldenrod.preLoad.HTTPScript.wait = true;
goldenrod.preLoad.HTTPScript.clearTimer = null;

goldenrod.preLoad.HTTPScript.setDelay = function(msDelay){
	goldenrod.preLoad.HTTPScript.delay = msDelay;
}

	/*This function GetHTML does not work!!!!!!!!!!! - It is an attempt to insert HTML using a 
	script tag - see the section of my JavaScript book - on page - 499 -500*/
goldenrod.preLoad.HTTPScript.GetHTML = function(url, queryArray, id) {

	function timeout() {
		var text = "The script file: " + url + "\nis taking longer than " + (goldenrod.preLoad.HTTPScript.delay/1000) + " seconds to load." + 
			"\n\nHit OK to continue trying or Cancel to abhort";
		goldenrod.preLoad.HTTPScript.callBack();	
		
		if( confirm(text) ){
			goldenrod.preLoad.HTTPScript.wait = true;
			goldenrod.preLoad.HTTPScript.clearTimer = setTimeout(timeout, goldenrod.preLoad.HTTPScript.delay);
		}
		else {
			elt.removeChild(aScript);
			goldenrod.preLoad.HTTPScript.wait = false;
		}
		
		
	}
	
	var aScript = document.createElement('script');
	aScript.type = 'text/html';
	for(var i=0; i<queryArray.length; i++) {
		var query = queryArray[i];
		if(!i) url += "?"; else url += "&";
		url += query;
	}
	if(id) {
		var oldScript = document.getElementById(id);
		if(oldScript) oldScript.removeChild(oldScript);
		aScript.id = id;
	}
	aScript.src = url;
	elt.appendChild(aScript);
	goldenrod.preLoad.HTTPScript.clearTimer = setTimeout(timeout, goldenrod.preLoad.HTTPScript.delay);
	
	
	return;
}


goldenrod.preLoad.HTTPScript.GetJavaScript = function(url, queryArray, id) {

	function timeout() {
		var text = "A script file: " + url + "\nis taking longer than " + (goldenrod.preLoad.HTTPScript.delay/1000) + " seconds to load." + 
			"\nHit OK to continue trying or Cancel to abhort";
		goldenrod.preLoad.HTTPScript.callBack();	
		
		if( confirm(text) ){
			goldenrod.preLoad.HTTPScript.wait = true;
			goldenrod.preLoad.HTTPScript.clearTimer = setTimeout(timeout, goldenrod.preLoad.HTTPScript.delay);
		}
		else {
			theHead.removeChild(aScript);
			goldenrod.preLoad.HTTPScript.wait = false;
		}
		
		
	}
	
	var theHead = document.getElementsByTagName('head')[0];
	
	
	
	var aScript = document.createElement('script');
	aScript.type = 'text/javascript';
	for(var i=0; i<queryArray.length; i++) {
		var query = queryArray[i];
		if(!i) url += "?"; else url += "&";
		url += query;
	}
	if(id) {
		var oldScript = document.getElementById(id);
		if(oldScript) theHead.removeChild(oldScript);
		aScript.id = id;
	}
	aScript.src = url;
	goldenrod.preLoad.HTTPScript.clearTimer = setTimeout(timeout, goldenrod.preLoad.HTTPScript.delay);
	theHead.appendChild(aScript);	//If the line above came after this line it may never get executed because
									//	the Script thread might jump to the the new script.
	
	
	return;
}
goldenrod.preLoad.HTTPScript.callBack = function(){

	if(goldenrod.preLoad.HTTPScript.clearTimer !== null){
		clearTimeout(goldenrod.preLoad.HTTPScript.clearTimer);
		goldenrod.preLoad.HTTPScript.clearTimer = null;
	}
	
	
}
/**************************************************************************************************
preLoad.Message - This code is for standardized shroud messages
**************************************************************************************************/

goldenrod.preLoad.Message = {};

goldenrod.preLoad.Message.shroud  = null;
goldenrod.preLoad.Message.msg_board = null;
goldenrod.preLoad.Message.opacity = 65;
goldenrod.preLoad.Message.upTo100 = new goldenrod.Animate.State(null, null, null, null, 100);
goldenrod.preLoad.Message.Faded  = new goldenrod.Animate.State(null, null, null, null, goldenrod.preLoad.Message.opacity);
goldenrod.preLoad.Message.Off  = new goldenrod.Animate.State(null, null, null, null, 0);

goldenrod.preLoad.Message.Shroud_on = new goldenrod.Animate.Event("shroud", goldenrod.preLoad.Message.Off, goldenrod.preLoad.Message.Faded, 1000, null, null );
goldenrod.preLoad.Message.Msg_board_up  = new goldenrod.Animate.Event("msg_board", goldenrod.preLoad.Message.Off, goldenrod.preLoad.Message.upTo100, 100, null, null );

goldenrod.preLoad.Message.eventlist = [new goldenrod.Animate.Occurence(goldenrod.preLoad.Message.Msg_board_up, 0), 
	   						 new goldenrod.Animate.Occurence(goldenrod.preLoad.Message.Shroud_on, 0)];
	
goldenrod.preLoad.Message.Reveal = new goldenrod.Eventshow("goldenrod.preLoad.Message.Reveal", goldenrod.preLoad.Message.eventlist, 0, 0, 1);

goldenrod.preLoad.Message.Show = function(){
	this.msg_board.style.visibility = "visible";
	this.msg_board.style.display = "block";
	this.shroud.style.display = "block";
	goldenrod.Dom.setStyleOpacity(this.shroud, 0);
	this.Reveal.run();
};

goldenrod.preLoad.Message.Hide = function(){
	this.msg_board.style.visibility = "hidden";
	this.msg_board.style.display = "none";
	goldenrod.Dom.setStyleOpacity(this.msg_board, 0);
	this.shroud.style.display = "none";
	goldenrod.Dom.setStyleOpacity(this.shroud, 0);
	this.Reveal.loopCount = 0;
	this.Reveal.totalTime = 0;
}

goldenrod.preLoad.Message.Setup = function(bColor, shroudTimeup, msgTimeup){
	if(bColor) this.shroud.style.backgroundColor = bColor;
	if(shroudTimeup) this.Shroud_on.duration = shroudTimeup;
	if(msgTimeup) this.Msg_board_up.duration = msgTimeup;
}



goldenrod.preLoad.initMessage = function(){
	goldenrod.preLoad.Message.msg_board = document.getElementById('msg_board');

	goldenrod.preLoad.Message.shroud = document.createElement("div");
	goldenrod.preLoad.Message.shroud.id = "shroud";
	goldenrod.preLoad.Message.shroud.style.display = "none";
	/*----------------------------------------------------------------------------------------
		Insert Shroud immediately before the msg_board. Msg_board must be the last child of the 
		body element.
	-------------------------------------------------------------------------------------------*/
	document.body.insertBefore(goldenrod.preLoad.Message.shroud, goldenrod.preLoad.Message.msg_board);
}





/**************************************************************************************************
preLoad.funcArray - This is a class that facilitates registering a list of functions that call be 
					executed one after the other 
**************************************************************************************************/
goldenrod.preLoad.funcArray = function() {
	this.List = new Array(); 
}

/**************************************************************************************************
preLoad.funcArrayItem - This is the type of object that the funcArray Array will hold.
					It is simply a function and a possible context.
**************************************************************************************************/
goldenrod.preLoad.funcArrayItem = function(f,t,n) {
	this.function_name = f; this.this_name = t; this.function_textname = n ? n : "no name";
}

/**************************************************************************************************
preLoad.funcArray.add - This is a prototype method that adds the function and context to the
		funcArray List. It return the new length of List.
**************************************************************************************************/
goldenrod.preLoad.funcArray.prototype.add = function(f,t,n) {
	var i,x;
	if(t == null) t = goldenrod.globalcontext;	//If t is not defined then use the global context.
	for(i = 0; i<this.List.length; i++) {
				//Do not add a function that is already there
		if( (this.List[i].function_name == f) && (this.List[i].this_name == t) ) 
			return this.List.length;
	}
	
	x = new goldenrod.preLoad.funcArrayItem(f,t,n);
	return this.List.push(x);
}

/**************************************************************************************************
preLoad.funcArray.replace - This is a prototype method that replaces one function with another 
	   and alters the context as well.
	   Replace f with g.
	   Returns true if the replace was successful returns false if the item was not found.
**************************************************************************************************/
goldenrod.preLoad.funcArray.prototype.replace = function(f,g,t,n) {
	var i,x;
	if(t == null) t = goldenrod.globalcontext;	//If t is not defined then use the global context.
	for(i = 0; i<this.List.length; i++) {
		if((this.List[i].function_name == f) && (this.List[i].this_name == t) ) {
			
			x = new goldenrod.preLoad.funcArrayItem(g,t,n);
			this.List.splice(i,1,x)	;
			return true;
		}
	}
	
	return false;
}
	
/**************************************************************************************************
preLoad.funcArray.add_func - This is a prototype method that adds the function and context to the
		funcArray List. It return the new length of List.
**************************************************************************************************/
goldenrod.preLoad.funcArray.prototype.run = function() {
	var i,x
	for(i=0; i<this.List.length; i++) {
		
	
		x = this.List[i];
		//goldenrod.myAlert("preLoad is about to run the " + i + "th function named: " + 
		//	x.function_textname);
		x.function_name.call(x.this_name); //The value of "this" for the invoked function is the array!
	}
}

/**************************************************************************************************
Create standard onLoad, OnResize, and onUnLoad function arrays and install them.
**************************************************************************************************/
goldenrod.onLoad_handler = new goldenrod.preLoad.funcArray();
goldenrod.onLoad_handler.add(goldenrod.Dom.featureTEST, null, " onLoad:Dom.featureTEST");


if(goldenrod.listMenu && goldenrod.listMenu.setHandlers) {
	goldenrod.onLoad_handler.add(goldenrod.listMenu.setHandlers, 
								null, 
								" onLoad:listMenu.setHandlers");
}
if(goldenrod.Utility && goldenrod.Utility.setMousehandlers) {
  	goldenrod.onLoad_handler.add(goldenrod.Utility.setMousehandlers,
								null,
								" onLoad:Utility.setMousehandlers");
}

goldenrod.onResize_handler = new goldenrod.preLoad.funcArray();
goldenrod.unLoad_handler = new goldenrod.preLoad.funcArray();

/********************************************************************************************
The onLoad handler will do all its work and then will load the onresize and onunload 
handler. This is to prevent these handlers from running before all data has been initialized
**********************************************************************************************/
window.onload = function() {
	goldenrod.onLoad_handler.run();
	window.onresize = function() { goldenrod.onResize_handler.run();}
	window.onunload = function() {goldenrod.unLoad_handler.run();}
}

/**************************************************************************************************
Maintanin viewPortHeight and viewPortWidth in pixels.
**************************************************************************************************/
goldenrod.ViewportWidth = null;
goldenrod.ViewportHeight = null;


goldenrod.preLoad.initPortSize = function(){
	var shroud, msg_board;
	goldenrod.Dom.Viewport.setPointY( goldenrod.Dom.getViewportHeight() );
	goldenrod.ViewportHeight = goldenrod.Dom.Viewport.getPointY()
	goldenrod.Dom.Viewport.setPointX ( goldenrod.Dom.getViewportWidth() );
	goldenrod.ViewportWidth = goldenrod.Dom.Viewport.getPointX()
	shroud = document.getElementById("shroud");
	msg_board = document.getElementById("msg_board")
	if(shroud){
		shroud.style.width = goldenrod.ViewportWidth + "px";
		shroud.style.height = goldenrod.ViewportHeight + "px";
	}
	if(msg_board){
		goldenrod.Utility.centerElt(msg_board);
	}
}


goldenrod.onLoad_handler.add(goldenrod.preLoad.initMessage,
							null,
							" onLoad:preLoad.initMessage");
goldenrod.onLoad_handler.add(goldenrod.preLoad.initPortSize,
							null,
							" onLoad:preLoad.initPortSize");
							
goldenrod.onResize_handler.add(goldenrod.preLoad.initPortSize,
							null,
							" onResize:preLoad.initPortSize");


//myAlert = function() {}

goldenrod.myAlertCount = 0;

goldenrod.myAlert = function(msg) {
	
	var elt = document.getElementById("alert");
	if(elt == null) return;
	if (goldenrod.myAlertCount < 50 )
		{elt.innerHTML = elt.innerHTML + "<br/>" + myAlertCount +": " + msg; myAlertCount++; }
		else {elt.innerHTML = msg; myAlertCount = 0} 
	}



/*********************************************************************************
*This function dump out all the properties and their values of a particular HTML 
*element.  
*str = is a string that identifies the element whose properties we will 
*elt = is the element itself
**********************************************************************************/
goldenrod.alt_dump_properties = function(str, elt) {

	var properties = str + " properties: <br/>";
	for( var propname in elt) {
		properties += propname + ": " + elt[propname] + "<br/>"
	}

//I want to write this so that it opens a scrollable window
}

/*********************************************************************************
*This function dump out all the properties and their values of a particular HTML 
*element.  
*str = is a string that identifies the element whose properties we will 
*elt = is the element itself
**********************************************************************************/
goldenrod.dump_properties = function(str, elt) {

	var properties = str + " properties: \n";
	for( var propname in elt) {
		properties += propname + ": " + elt[propname] + "\n"
	}

	alert(properties); 
}
/*********************************************************************************
*This function sets the minimum width of the <body> element to 3/4's of the total available 
*screen width
**********************************************************************************/
goldenrod.min_width = function() {
	var X = window.screen.availWidth;
	var b = document.getElementsByTagName('body')
	b[0].style.minWidth = Math.round(X * 3/4) + "px" ;
	//alert("The min width of the <body> elt is: " + b[0].style.minWidth + ". ")
}

goldenrod.check_DOM = function() {
	var x = "does"
	if (document.addEventListener == undefined) x="doesnt"

	alert("This browser " + x + " have the addEventListener interface.")
}



