function ge (id) {
	return document.getElementById (id);
}

var flafindex;
var styleObj;

function fader(now){
	for(f in flafar){
		if(flafar[f].id != now){
			flafar[f].style.filter = 'alpha(opacity=10)';
			flafar[f].style.opacity = '0.10';
		}
	}
}
function fadeback(){
	for(f in flafar){
		flafar[f].style.filter = 'alpha(opacity=100)';
		flafar[f].style.opacity = '1';
	}
}

function get_left (e) {
	x		= e.offsetLeft;
	pe	= e.offsetParent;
	while (pe != null) {
		x  += pe.offsetLeft;
		pe	= pe.offsetParent;
	}
	return x;
}

function get_top (e) {
	y	= e.offsetTop;
	pe	= e.offsetParent;
	while (pe != null) {
		y  += pe.offsetTop;
		pe	= pe.offsetParent;
	}
	return y;
}
function AjaxReq (url,handler){
	var client = null;
	try	{	// Firefox, Opera 8.0+, Safari
		client=new XMLHttpRequest ();
	} catch (e) {  // Internet Explorer
		try {
			client=new ActiveXObject("Msxml2.XMLHTTP");    
		} catch (e) {
			try {
				client=new ActiveXObject("Microsoft.XMLHTTP");      
			} catch (e) {      
				return false;
			}    
		}  
	}
	client.onreadystatechange = function () {  
		if (client.readyState == 4 && client.status == 200 && handler){
			handler(client.responseText); 
		}else{
			handler('loading, plz wait ...'); 
		}
	}
	
	client.open("GET", url);
	client.send(null);
	return true;
}
function popToolTip (txt){
	ge ('tooltip').innerHTML = 'loading...'
	ge ('tooltip').innerHTML = txt;
}

function add_tt (element, text, cls,side) {
	var e			= ge (element);
	e.onmouseover	= function () { show_tt (element, text, cls,side); }
	e.onmouseout	= function () { hide_tt (); }
}

function show_tt (element, text, sceneID,side) {
	var e	= ge (element);
	var tt	= ge ('tooltip');
	var cont = ge('content');
	var scrtp = parseInt(cont.scrollTop);
	
	if (e && tt) {
		tt.style.display	= 'none';
		if(text == 'modelDetails'){
			AjaxReq('index.php?x=process&action=getSceneDetails&sceneID='+sceneID+'&r='+Math.random(), popToolTip );
		}else if(text == 'showModel'){
			AjaxReq('index.php?x=process&action=getFrontpic&serieID='+sceneID+'&r='+Math.random(), popToolTip );
		}else{
			tt.innerHTML		= text;	
			tt.className = sceneID;
			tt.style.zIndex = 154;
		}
		if(side == 'r'){
			tt.style.left = get_left (e) + e.offsetWidth + 3 + 'px';
		}else{
			tt.style.left = get_left (e) - e.offsetWidth + 'px';
		}
		
		tt.style.top		= (get_top (e) - scrtp) + 'px';
		tt.style.display	= 'block';
	}
}

function hide_tt () {
	e = ge ('tooltip');
	if (e) e.style.display = 'none';
}

function addHover(id){
	ge(id).className = 'topbtn hoverFloffer';
}
function removeHover(id){
	ge(id).className = 'topbtn';
}
function addHoverSlice(id){
	ge(id).className = 'moviemenu_wmv_sliced hoverS';
}
function removeHoverSlice(id){
	ge(id).className = 'moviemenu_wmv_sliced';
}

function goto(url){
	if(navigator.userAgent.indexOf('MSIE') >= 0){
		var referLink = document.createElement('a');
		referLink.href = url;
		document.body.appendChild(referLink);
		referLink.click();
	}else{
		location.href=url;
	}
}

function showDaily(nr,url){
	if(ge('updatecontainer_retro').style.display == 'none'){
		ge('updatecontainer_retro').style.display = 'block';
		ge('movDiv').style.display = 'none';
	}else{
		autoPlayUrl = url;
		ge('updatecontainer_retro').style.display = 'none';
		ge('movDiv').style.display = 'block';
		ge('sbID').value = nr;
	}
}

function gotomodel(){
	var sbID = ge('sbID').value;
	goto('?i=details&sbID='+sbID);
}

function addHc(Fid,classN){
	ge(Fid).className = classN + ' h';
}
function removeHc(Fid,classN){
	ge(Fid).className = classN;
}

function addH(Fid){
	Fid.className = 'costumizebtns h';
}
function removeH(Fid){
	Fid.className = 'costumizebtns';
}

function showLostForm(){
	if(ge('lostPreDiv').style.display == 'none'){
		ge('lostPreDiv').style.display = 'block';
		ge('lostPostDiv').style.display = 'none';
	}else{
		ge('lostPreDiv').style.display = 'none';
		ge('lostPostDiv').style.display = 'block';
	}
}











