var init=0;   //are we scrolling?  no.								
function disableselect(e)   {return false}  				  //turn text selection on or off
function reEnable(e)  {return true}
selectdisabled="disabled";
	
function disableselect(e)   {return false}  				  //turn text selection on or off
function reEnable(e)  {return true}
selectdisabled="disabled";

function setopacity(target,value) {
	thediv=document.getElementById(target);
	thediv.style.opacity = value/10;
	thediv.style.filter = 'alpha(opacity=' + value*10 + ')';
}


//function fadethat(target,speed, inout)  {
//
//	if((pods[target].opas == 0)&&(inout=='out')){
//		pods[target].opas=10;
//	}else if (pods[target].opas=0){
//		pods[target].opas=0;
//	}
		
//	if(inout=="out"){pods[target].opas-=2;}else{pods[target].opas+=2;}

//alert(opas+" "+((opas>=-1)&&(opas<=11)));
//	if ((opas>=-1)&&(opas<=11)){
//		setopacity(target,opas);
//		targ2=target;opas2=opas;speed2=speed;inout2=inout;
//		setTimeout ("fadethat(targ2,speed2,inout2,opas2)",speed2);
//	}else{
//		//this would be a grat place to have a callback function...
//	}
//	
//}

function fadethat (target, inout) {
	if (inout=='in'){
		pods[target].inout='in';
		pods[target].fade++;
	} else {
		pods[target].inout='out';
		pods[target].fade--;
	}
	setopacity(target,pods[target].fade);
	
	debug(pods[target].fade);
	if ((pods[target].fade<=10 )||(pods[target].fade>=0 )){
		fadethat(pods[target].name,pods[target].inout);
		debug('dsdsd');
	
	} else {
		pods[target].inout='off' ;
	}
}


function setselect(onoff) {  
	if (onoff=="off") {
		if (window.sidebar) {
			selectdisabled="disabled";
			document.onmousedown=disableselect;
			document.onclick=reEnable;
		}else{
			selectdisabled="disabled";
			window.document.ondrag=disableselect;
			window.document.onselectstart=disableselect;
		}
	}else{
		if (window.sidebar) {
			selectdisabled="enabled";
			document.onmousedown=reEnable;
			document.onclick=disableselect;
		}else{
			selectdisabled="enabled";
			window.document.ondrag=reEnable;
			window.document.onselectstart=reEnable;
		}
	}
}

function setinitiallocation(){     			
	center=window.innerWidth;
	center=document.body.clientWidth;
	if (center==0){center=1200}

	center=Math.round(6000-(center/2));
	window.scrollTo(center,3000);	
}

function setselect(onoff) {  
	if (onoff=="off") {
		if (window.sidebar) {
			selectdisabled="disabled";
			document.onmousedown=disableselect;
			document.onclick=reEnable;
		}else{
			selectdisabled="disabled";
			window.document.ondrag=disableselect;
			window.document.onselectstart=disableselect;
		}
	}else{
		if (window.sidebar) {
			selectdisabled="enabled";
			document.onmousedown=reEnable;
			document.onclick=disableselect;
		}else{
			selectdisabled="enabled";
			window.document.ondrag=reEnable;
			window.document.onselectstart=reEnable;
		}
	}
}

function checkscroll(event) {
	if (document.all) {
		x = window.event.screenX;
		y = window.event.screenY;
	}else{
		x=event.screenX;
		y=event.screenY;
	}
	if (init==1) {init=0;xold=x;yold=y;}
	ymove= yold-y;
	xmove= xold-x;
	xold=x;yold=y;
	window.scrollBy(xmove*2,ymove*3);
}

function endscroll(event)  {        
	document.onmouseup=null;
	document.onmousemove=null;
}
	
function startscroll(event) {		
	if (selectdisabled == "disabled"){
   		 document.onmousemove=checkscroll;
   		 document.onmouseup=endscroll;
   		 init=1;
	}
	scrolling='no';  //I'm talking about the autoscroll.  Excuse my poor naming system
}

