var tab1 = new Array();
var tab2 = new Array();
var currently = 0;
var active_id=0;
var end1=0;
var timeouts = new Array();

function feat_show_2(id_in) {
	menu_clean();
	document.getElementById("level2Menu").innerHTML=document.getElementById("bef_cont_"+id_in).innerHTML;
}

function feat_show_cont(pid_in,langue,id_page) {
	if (active_id!=id_page) {
		document.getElementById('colLeftFeatures').innerHTML = '<h1>Loading...</h1><div class="blockContent"><div id="blockSpacerLego">&nbsp;</div><div style="padding:10px;height:260px;"><img src=/design/loading2.gif></div></div>';
		menu_clean();
		document.getElementById("fon1_"+pid_in).className="selected";
		document.getElementById("fon2_"+id_page).className="selected";
		for (var k=0;k<timeouts.length;k++) {
			clearTimeout(timeouts[k]);
		}
		timeouts.push(setTimeout("load_content('"+langue+"','"+id_page+"')",700));

		currently=0;
		active_id=id_page;
	}
}

function menu_clean() {
	for (var j=0;j<tab1.length;j++) {
		document.getElementById("fon1_"+tab1[j]).className="";
	}
	for (var o=0;o<tab2.length;o++) {
		document.getElementById("fon2_"+tab2[o]).className="";
	}
}

function load_content(langue,id_page) {
	ajax_do('/_includes/ajax_content.php?lg='+langue+'&id_page='+id_page);
}



url = document.location.href;
xend = url.lastIndexOf("/") - 19;
var base_url = url.substring(0, xend);

var ajax_get_error = false;

function ajax_do (url) {
	var jsel = document.createElement('SCRIPT');
	jsel.type = 'text/javascript';
	jsel.src = url;
	document.body.appendChild (jsel);
	return true;
}


function gene_ttf() {
	document.getElementById('generate').innerHTML="<img src='/_includes/ttf.php?w=250&h=55&m=%23FFFFFF&c=%23EEEEEE&t="+escape(document.getElementById('enter').value)+"&s=20&a=left&f=soopafre.ttf&b=on&bc=%230D80CD&d=15'>";
}


function getPageSize(){
	// THX to lightbox team :°)

	var xScroll, yScroll;
	if (document.body) {
	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;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

var sizes=getPageSize();

function open_light_flash (url,w,h) {
	sizes=getPageSize();
	offset=((sizes[3]-h)-40)/2;
	document.getElementById('overlay').style.height=sizes[1]+"px";
	document.getElementById('overlay').innerHTML="<div style='background:#EEEEEE;margin:auto;position:relative;z-index:3000;margin-top:"+offset+"px;padding-bottom:10px;width:"+(w+20)+"px'>\
<div style='position:relative;z-index:4000;background:#EEEEEE;padding-bottom:5px;text-align:right;height:20px;'><img onclick=\"document.getElementById('overlay').style.display='none';\" style='cursor:pointer;z-index:9000;' src='/design/close.gif'></div>\
<center>\
<div style='position:relative;'>\
<embed pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' src='/_includes/players/loader.swf?url="+url+"' width='"+w+"' height='"+h+"'>\
</div>\
</center>\
<div style='position:relative;background:#EEEEEE;padding-top:5px;padding-right:5px;text-align:right;'>Press the upper <b>x</b> to close</div>\
</div>";
	document.getElementById('overlay').style.display="block";
	return true;
}


function load_zone_2_shop (id) {
document.getElementById('zone_shop_2').innerHTML=document.getElementById('shop_'+id).innerHTML;
}