function show(myId){
	if(document.getElementById(myId)){
		document.getElementById(myId).style.display='block';
	}
}
function hide(myId){
	if(document.getElementById(myId)){
		document.getElementById(myId).style.display='none';
	}
}

var scrollInterval=null;
function scrollContent(target,amount){
	var tdiv=document.getElementById(target);
	if(amount>0){
		if((tdiv.clientHeight+tdiv.scrollTop)>=tdiv.scrollHeight) return false;
		tdiv.scrollTop+=amount;
		if((tdiv.clientHeight+tdiv.scrollTop)>tdiv.scrollHeight) tdiv.scrollTop=tdiv.scrollHeight-tdiv.clientHeight;
	}
	if(amount<0){
		if(tdiv.scrollTop==0) return false;
		tdiv.scrollTop+=amount;
		if(tdiv.scrollTop<0) tdiv.scrollTop=0;
	}
	return false;
}

function startScroll(target,amount){
	scrollInterval=window.setInterval("scrollContent('"+target+"',"+amount+")",50);
}

function stopScroll(){
	window.clearInterval(scrollInterval);
}
var popup={
	interval:null,
	startTime:null,
	currHeight:0,
	targetHeight:0,
	doPopup:function(width,height,targetId){
		document.getElementById('hider').style.display='block';
		popup.currHeight=0;
		popup.targetHeight=height;
		document.getElementById('popupImg').style.height=popup.currHeight+'px';
		document.getElementById('popupImg').style.width=width+'px';
		document.getElementById('popupImg').style.marginLeft='-'+Math.round(width/2)+'px';
		document.getElementById('popupImg').style.marginTop='-'+Math.round(height/2)+'px';
		var imgTags=document.getElementById('popupImg').getElementsByTagName('img');
		for(var i=0;i<imgTags.length;i++){
			imgTags[i].style.display='none';
		}
		document.getElementById(targetId).style.display='block';
		document.getElementById('popupImg').style.display='block';
		popup.interval=window.setInterval('popup.stretch()',40);
		popup.startTime = new Date().getTime();
	},
	endPopup:function(){
		document.getElementById('hider').style.display='none';
		document.getElementById('popupImg').style.display='none';
	},
	stretch:function(){
		var timePos = new Date().getTime();
		popup.currHeight = Math.round((timePos-popup.startTime)/300*550);
		if(popup.currHeight>=popup.targetHeight){
			popup.currHeight=popup.targetHeight;
			window.clearInterval(popup.interval);
		}
		document.getElementById('popupImg').style.height=popup.currHeight+'px';
	}
	
}

Event.observe(window, 'load', function(){
if(document.getElementById('content').scrollHeight>330) show('scrollBar');
if(window.devicePixelRatio){
hide('safLb');
hide('safRb');
}
}, false);
 
