function getElementsByRel(rel){ 
	aElements = document.getElementsByTagName("a");		
	var relElems = new Array();
	for (i = 0; i < aElements.length; i++) {
		if (aElements[i].rel == rel) {
			relElems.push(aElements[i]);
		}
		/*if (aElements[i].hasAttribute("rel") && aElements[i].rel == rel) {
			relElems.push(aElements[i]);
		}*/
	}
	return relElems;
}

function setHeights() {
	var s = document.getElementById("sbar_right");		
	var c = document.getElementById("main_content");
	s.style.height = null;
	c.style.height = null;
	if(s.offsetHeight < c.offsetHeight) {
		s.style.height = c.offsetHeight;
	}
	else if (s.offsetHeight > c.offsetHeight) {
		c.style.height = s.offsetHeight;
	}
}

function getXmlHttpObject() {
	var xmlHttp=null;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

function getPageHeight() {
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		return window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		return document.body.scrollHeight;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		return document.body.offsetHeight;
	}
}

function getPageWidth() {
	if(window.innerHeight && window.scrollMaxY) {// Firefox
		return window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		return document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		return document.body.offsetWidth;
	}
}

function vpWidth() { return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; }

function vpHeight() { return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; }

function allImagesLoaded() {       
		// return variable
		var imagesloaded = 1;

		// All images are saved in an array called document.images. Very usefull
		var images = document.images;
		// Loop through all the images
		for (var i = 0;i<images.length;i++)
		{
				// If the image isnt loaded we set the return varible to 0
				if(images[i].complete == false) {
						imagesloaded = 0;
				}
		}

		// This will return 0 if one or more images are not loaded and 1 if all images are loaded.
		return imagesloaded;
}

function openPoll() {
	window.open( "/scripts/genPoll.php", "myWindow", "status = 1, height = 300, width = 300, resizable = 0" );
}

function test() {
	alert("test");
}
