function open_close_category(subcat_id) {
	var divNodeId = "sub_cat_text_"+subcat_id;
	var divNode = document.getElementById(divNodeId);
	if(divNode.style.display == 'none' || divNode.style.display == "")
		divNode.style.display = 'block';
	else
		divNode.style.display = "none";
}

function display_loading() {
	document.body.style.cursor = "wait";
	//set status div width = width of the window
	document.getElementById('status').style.width = (document.getElementById('content').offsetWidth+10)+'px';
	
	//set status div width = height of the content 
	document.getElementById('status').style.height = (document.getElementById('content').offsetHeight)+'px';
	
	var Yscroll = (document.all)?document.documentElement.scrollTop:window.pageYOffset;
	
	//move loading message depending on scroll  
	document.getElementById('status_message').style.marginTop = Yscroll+"px";
	
	hide_select();
	
	//display status content
	document.getElementById("status").style.display = "block";
}

function hide_loading() {
	display_select();
	document.getElementById("status").style.display = "none";
	document.body.style.cursor = "auto";
}


function hide_select() {
	//IE hack : hide select element
	var elem=document.getElementsByTagName('select');
	for(var i=0;i<elem.length;i++)
		elem[i].style.visibility = "hidden";
}

function display_select() {
	var elem=document.getElementsByTagName('select');
	for(var i=0;i<elem.length;i++)
		elem[i].style.visibility = "visible";
}


function open_url(param) {
	var sep_pos = param.indexOf(',', 0);
	var url = param.substring(0, sep_pos);
	var win = param.substr(sep_pos+1, param.length);
	if(win=='self') {
		document.location.href = url;
	} else {
		var c_date = new Date();
		window.open(url, "popup"+c_date.getTime(), "directories=no, location=no, menubar=no, resizable= yes, scrollbars=yes, status=yes, toolbar=no, width=900, height=500");
	}
}

function callback_reload_page(z) {
	document.location.reload();
}

function callback_redirect(url_dest) {
	document.location.href = url_dest;
}

//COOKIE FUNCTION

function createCookie(name,value,days){	if (days)	{		var date = new Date();		date.setTime(date.getTime()+(days*24*60*60*1000));		var expires = "; expires="+date.toGMTString();	}	else var expires = "";	document.cookie = name+"="+value+expires+"; path=/";}function readCookie(name){	var nameEQ = name + "=";	var ca = document.cookie.split(';');	for(var i=0;i < ca.length;i++)	{		var c = ca[i];		while (c.charAt(0)==' ') c = c.substring(1,c.length);		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);	}	return null;}function eraseCookie(name){	createCookie(name,"",-1);}