/////////////////////////////////GENERAL PURPOSE FUNCTIONS/////////////////////////////////

function clearIntervals(){
	for(i=0; i<aIntervals.length; i++){
		clearInterval(aIntervals[i]);
	}
	aIntervals = [];
}

function getWinSize() {
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		winW	= window.innerWidth;
		winH	= window.innerHeight;
		scrollX = window.pageXOffset||0;
		scrollY = window.pageYOffset||0;
		htmlH	= window.scrollHeight || 0;
		htmlW	= window.scrollWidth || 0;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		winW 	= document.documentElement.clientWidth;
		winH 	= document.documentElement.clientHeight;
		scrollX	= document.documentElement.scrollLeft || 0;
		scrollY	= document.documentElement.scrollTop || 0;
		htmlH	= document.documentElement.scrollHeight || 0;
		htmlW	= document.documentElement.scrollWidth || 0;
 	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		winW 	= document.body.clientWidth;
		winH 	= document.body.clientHeight;
		scrollX	= document.body.scrollLeft || 0;
		scrollY	= document.body.scrollTop || 0;
		htmlH	= document.body.scrollHeight || 0;
		htmlW	= document.body.scrollWidth || 0;
	}
	//alert("winH="+winH+" winW="+winW+" htmlH="+htmlH+" htmlW="+htmlW+" scrollX="+scrollX+"  scrollY="+scrollY) ;
}

function handleResize(){
	getWinSize();
	positionallPanels('l');
	var leftArrow = document.getElementById('leftArrow');
		leftArrow.style.left = winW*0.05;
	var rightArrow = document.getElementById('rightArrow');
		rightArrow.style.left = winW*0.9;
}

if(typeof window.onresize != 'function'){
	window.onresize = handleResize;
}else{
	var oCurrent = window.onresize;
	window.onresize = function(){
		oCurrent();
		handleResize();
	}
}
if(typeof window.scroll != 'function'){
	window.scroll = handleResize;
}else{
	var oCurrent = window.scroll;
	window.scroll = function(){
		oCurrent();
		handleResize();
	}
}
	
function addLoadEvent(func){
	/* appends a function to the onload event */
	var oldonload = window.onload;
	if(typeof window.onload != 'function'){
		window.onload = func;
	}else{
		window.onload = function(){
			oldonload();
			func();
		}
	}
}
