
	function setOpacity(obj, val){
		try{
			if(obj.filters){
				obj.filters.alpha.opacity				= val * 100
			}else if(obj.style.MozOpacity){
				obj.style.MozOpacity					= val
			}else {
				obj.style.opacity						= val
			}
		}catch(e){}
	}
	
	function getPageDimensions(){
		var xScroll, yScroll
		
		if (window.innerHeight && window.scrollMaxY) {
			xScroll = document.body.scrollWidth
			yScroll = window.innerHeight + window.scrollMaxY
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth
			yScroll = document.body.scrollHeight
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth
			yScroll = document.body.offsetHeight
		}
		
		var windowWidth, windowHeight
		if (self.innerHeight) {	// all except Explorer
			windowWidth = self.innerWidth
			windowHeight = self.innerHeight
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth
			windowHeight = document.documentElement.clientHeight
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth
			windowHeight = document.body.clientHeight
		}
		
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight
		} else {
			pageHeight = yScroll
		}
		
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){
			pageWidth = windowWidth
		} else {
			pageWidth = xScroll
		}
		return new Array(windowWidth,windowHeight,pageWidth,pageHeight)
	}
	
	function dumpInWin(arr,level){
		var win = window.open("", "win"); // a window object
		win.document.open("text/html", "replace");
		win.document.write("<HTML><HEAD><TITLE></TITLE></HEAD><BODY><pre>"+dump(arr,level)+"</pre></BODY></HTML>");
		win.document.close();
	}
	
	function dump(arr,level) {
		var dumped_text = ''
		if(!level) level = 0
		
		//The padding given at the beginning of the line.
		var level_padding = ''
		for(var j=0;j<level+1;j++) level_padding += '    '
		
		if(typeof(arr) == 'object') { //Array/Hashes/Objects 
			for(var item in arr) {
				var value = arr[item]
				
				if(typeof(value) == 'object') { //If it is an array,
					dumped_text += level_padding + "'" + item + "' ...\n"
					dumped_text += dump(value,level+1)
				} else {
					dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n"
				}
			}
		} else { //Stings/Chars/Numbers etc.
			dumped_text = "===>"+arr+"<===("+typeof(arr)+")"
		}
		return dumped_text
	}
	
	function fadeObj(id, duration, from, to){
		effect = new Spry.Effect['Fade'](id, {duration: duration, from: from, to: to, toggle: false})
		effect.start()
		return effect
	}
	
	function debugMsg(id, msg){
		document.getElementById(id).innerHTML = msg+"<br />"+document.getElementById(id).innerHTML
	}
	
	

