function decodeURLWithAmp(str) {
str = str.replace(/&amp;/g, "&");          
return str;
}

function decodeChars(str) {
str = str.replace(/&lt;/g, "<");          
str = str.replace(/&gt;/g, ">");


return str;
}

function helloWorld() {
	alert("hello world");

}


function toggle_trigger(e) {


		// toggle image

		imgnode = e.firstChild;
 
	
	
	
	while (imgnode) {
			
			if(imgnode.nodeName == "IMG") {

				if(imgnode.src.indexOf("down") > -1) {

					imgnode.src = imgnode.src.replace(/down/, "right");

				} else {

					imgnode.src = imgnode.src.replace(/right/, "down");

				}

			}

		

			imgnode = imgnode.nextSibling;

		}


		

		// toggle content
 

			node = e.nextSibling;
			while(node.nextSibling) {
			   node = node.nextSibling;
   
		   
			   
			   if ((node.className=="visible")&&(node.nodeName=="UL")){
				   node.className="invisible";
			   }	
			   else {
				   node.className="visible";
			   }
			  			
		}

		


		
}





function show(id)
{
	document.getElementById(id).style.display = 'block';
}

function hide(id)
{
	document.getElementById(id).style.display = 'none';
	document.getElementById(id).innerHTML = '';
}
 
function toggleLeftNav(id)
{
	/* query the classname as an initial test, then change it*/
	e = document.getElementById(id);
	
	/* append proper content details to string */
	id_header = id + "Header"; 
	id_list = id + "List"; 
	
	
	/* header and list */
	e_header = document.getElementById(id_header);
	e_list = document.getElementById(id_list);
	
	if (e_list.className == "categoryListINACTIVE")
	{
		//alert("going into Active state");
		
		e_header.className="categoryHeadingNav";
		e_list.className="categoryList";

	}
	else 
	{
		e_header.className="categoryHeadingNavINACTIVE";
		e_list.className="categoryListINACTIVE";
		
	}
	
}




//var textSize=0;

function textSizeInit()
{
	/* bring back the textResizer */
	document.getElementById('textSize').style.display='block';
	
	

	
	// read the cookie, find out the text-size
	var ts = readCookie('textSize');

	if (ts) 
	{
		textSizeChange(parseInt(ts));
	}
	else {
			textSizeChange(2);		
	}	
	
}


function textSizeChange(n)
{
	
	//e = document.getElementById("body"); // deprecated
	
	e = document.body; // gets the BODY tag from the DOM
	
	if (e == null) return;

	// set cookie (expires in one day)
	
	createCookie('textSize',n,1);


/* reset all the styles */
resetTextResizeStyles();

/* just changing style on the switcher */

		if (n == 1) document.getElementById("smallText").style.backgroundColor='#bb0000'; else document.getElementById("smallText").style.backgroundColor='#999999';
		if (n == 2) document.getElementById("normalText").style.backgroundColor='#bb0000'; else document.getElementById("normalText").style.backgroundColor='#999999';
		if (n == 3) document.getElementById("largeText").style.backgroundColor='#bb0000'; else document.getElementById("largeText").style.backgroundColor='#999999';
		if (n == 4) document.getElementById("largerText").style.backgroundColor='#bb0000'; else document.getElementById("largerText").style.backgroundColor='#999999';
 
 
	 if (n == 1)
		 n = 76;
	 else if (n==2)
	 	n = 86;
	 else if (n==3)
	 	n = 100;
	 else if (n==4)
	 	n = 110;	
	 else 
	 	n = 76 /* default */
	 	//alert("font resizing script error, please contact web@queensu.ca");
 

	
/* size body text (base) */	
	e.style.fontSize = n + "%";


}


function resetTextResizeStyles() {

	document.getElementById("smallText").className='textResizeDefaultPosition';
	document.getElementById("normalText").className='textResizeDefaultPosition';
	document.getElementById("largeText").className='textResizeDefaultPosition';
	document.getElementById("largerText").className='textResizeDefaultPosition';

}



function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i<ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
//	document.cookie = name+"="+value+expires+"; path=/; domain=queensu.ca;";
	document.cookie = name+"="+value+expires+"; path=/;";
}


//utility function that returns true is a string contains only 
// whitespace characters

function isblank(s) {
	for (var i=0; i< s.length; i++) {
		var c = s.charAt(i);
		if ((c != ' ') && (c != '\n') && ( c != '')) return false;
	}
	return true;
}



// this is the function that performs form verification. It is invoked
// from the onsubmit event handler. The handler should return whatever
// value this function returns

function verify(f) {



}



