/* (c) 2001,2008 SWG-FR.COM | index.php | V 6.2 | 09/11/2008 12:00 */

function PopUp(url, name, width, height) {
	
		if ((parseInt (navigator.appVersion) >= 4 )) {
		
		 width  = (screen.width*85)/100;
		 height = (screen.height*75)/100;
		
		  X = (screen.width  - width ) / 2;
		  Y = (screen.height - height) / 2;
		}
	
		var Win = window.open( url, name, 'width='+width+',height='+height+',top='+Y+',left='+X+',resizable=1,scrollbars=1,location=no,directories=no,status=no,menubar=no,toolbar=no');
}

function PopUpFix(url, name, width, height) {

		if ((parseInt (navigator.appVersion) >= 4 )) {
			
		  X = (screen.width  - width ) / 2;
		  Y = (screen.height - height) / 2;
		}

		var Win = window.open( url, name, 'width='+width+',height='+height+',top='+Y+',left='+X+',resizable=1,scrollbars=1,location=no,directories=no,status=no,menubar=no,toolbar=no');
}

function showDiv(divid) {
   if (document.layers) document.layers[divid].visibility="show";
   else document.getElementById(divid).style.visibility="visible";
}

function hideDiv(divid) {
	if (document.layers) document.layers[divid].visibility="hide";
	else document.getElementById(divid).style.visibility="hidden";
}

function showDivNews(divid) {
   if (document.layers) document.layers[divid].visibility="show";
   else document.getElementById(divid).style.display = "";
}

function hideDivNews(divid) {
	if (document.layers) document.layers[divid].visibility="hide";
	else document.getElementById(divid).style.display = "none";
}

startList = function() {

	//code only for IE
	if(!document.body.currentStyle) return;
	var subs = document.getElementsByName('submenu');
	for(var i=0; i<subs.length; i++) {
		var li = subs[i].parentNode;
		if(li && li.lastChild.style) {
			li.onmouseover = function() {
				this.lastChild.style.visibility = 'visible';
			}
			li.onmouseout = function() {
				this.lastChild.style.visibility = 'hidden';
			}
		}
	}
}
window.onload=startList;


//==========================================
// Show / Hide Actu Pan
//==========================================

var ipb_var_cookieid = "swgfr";
var ipb_var_cookie_domain = "";
var ipb_var_cookie_path   = "/";
 
//==========================================
// Get cookie
//==========================================

function my_getcookie( name )
{
	cname = ipb_var_cookieid + name + '=';
	cpos  = document.cookie.indexOf( cname );
	
	if ( cpos != -1 )
	{
		cstart = cpos + cname.length;
		cend   = document.cookie.indexOf(";", cstart);
		
		if (cend == -1)
		{
			cend = document.cookie.length;
		}
		
		return unescape( document.cookie.substring(cstart, cend) );
	}
	
	return null;
}

//==========================================
// Set cookie
//==========================================

function my_setcookie( name, value, sticky )
{
	expire = "";
	domain = "";
	path   = "/";
	
	if ( sticky )
	{
		expire = "; expires=Wed, 1 Jan 2020 00:00:00 GMT";
	}
	
	if ( ipb_var_cookie_domain )
	{
		domain = '; domain=' + ipb_var_cookie_domain;
	}
	
	if ( ipb_var_cookie_path )
	{
		path = ipb_var_cookie_path;
	}
	
	document.cookie = ipb_var_cookieid + name + "=" + value + "; path=" + path + expire + domain + ';';
}
//==========================================
// Set DIV ID to show
//==========================================

function my_show_div(itm)
{
	if ( ! itm ) return;
	
	itm.style.display = "";
}

//==========================================
// Set DIV ID to hide
//==========================================

function my_hide_div(itm)
{
	if ( ! itm ) return;
	
	itm.style.display = "none";
}

//==========================================
// Get element by id
//==========================================

function my_getbyid(id)
{
	itm = null;
	
	if (document.getElementById)
	{
		itm = document.getElementById(id);
	}
	else if (document.all)
	{
		itm = document.all[id];
	}
	else if (document.layers)
	{
		itm = document.layers[id];
	}
	
	return itm;
}

//==========================================
// Toggle category
//==========================================

function togglecategory()
{
	
	//-----------------------------------
	// Get any saved info
	//-----------------------------------
	tmp = my_getcookie('newspan');
	
	//-----------------------------------
	// show / hide panel
	//-----------------------------------
	
	if (tmp == 0)
	{
		tmp = 1;
		my_show_div( my_getbyid( 'newspan' ) );
		my_show_div( my_getbyid( 'focuspan' ) );
	}
	else
	{
		tmp = 0;
		my_hide_div( my_getbyid( 'newspan' ) );
		my_hide_div( my_getbyid( 'focuspan' ) );
	}
	
	my_setcookie( 'newspan', tmp, 1 );
}

//==========================================
// Screen resolution
//==========================================

writeCookie();

function writeCookie()
{
var today = new Date();
var the_date = new Date("December 31, 2023");
var the_cookie_date = the_date.toGMTString();
var the_cookie = "users_resolution="+ screen.width +"x"+ screen.height;
var the_cookie = the_cookie + ";expires=" + the_cookie_date;
document.cookie=the_cookie
}
