var gWin			= null;
var paramsEndPopup	= null;
var popupPath		= null;
var isIE6 = false;



function hideWebRadio() {
	document.getElementById("menu_web_radios").style.display = "none";
	
	if ( isIE6 == true && mini == 'mini_' )
	{
		if (document.getElementById('shSearchBox'))
			document.getElementById('shSearchBox').style.display = 'block';
		if (document.getElementById('shPodCasts'))
			document.getElementById('shPodCasts').style.display = 'block';
		if (document.getElementById('shWebRadios'))	
			document.getElementById('shWebRadios').style.marginTop = '5px';
	}
	else if ( isIE6 == true )
	{
		if (document.getElementById('searchBox'))
				document.getElementById('searchBox').style.display = 'block';
		if (document.getElementById('webRadiosHome'))
				document.getElementById('webRadiosHome').style.marginBottom = '0px';
	}
}

function showWebRadio() {
	var objDebit = document.getElementById("menu_web_radios");
	
	if (objDebit) {
		objDebit.style.display = "block";
		
		isIE6 = true;
		var strChUserAgent = navigator.userAgent;
		var intSplitStart = strChUserAgent.indexOf("(",0);
		var intSplitEnd = strChUserAgent.indexOf(")",0);
		var strChStart = strChUserAgent.substring(0,intSplitStart); 
		var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd);

		if( strChMid.indexOf("MSIE 6") != -1 )
		{
			if ( mini == 'mini_' )
			{
				if (document.getElementById('shSearchBox'))
					document.getElementById('shSearchBox').style.display = 'none';
				if (document.getElementById('shPodCasts'))
					document.getElementById('shPodCasts').style.display = 'none';
				if (document.getElementById('shWebRadios'))
					document.getElementById('shWebRadios').style.marginTop = '79px';
				
			}
			else
			{
				if (document.getElementById('searchBox'))
					document.getElementById('searchBox').style.display = 'none';
				if (document.getElementById('webRadiosHome'))
					document.getElementById('webRadiosHome').style.marginBottom = '54px';
			}
		}
		
		//window.setTimeout("hideWebRadio()",2000);
		return false;
	}
	else
		alert("Erreur navigateur");
}

function hideDebit() {
	document.getElementById("menu_debit").style.display = "none";
}

function showDebit() {
	var objDebit = document.getElementById("menu_debit");
	
	if (objDebit) {
		objDebit.style.display = "block";
		window.setTimeout("hideDebit()",5000);
	}
	else
		popupPlayer('fileadmin/player', 'h', 0);
}

function popupPlayer(path, debit, wr) {

	try {
		if (gWin && gWin.name) {
			gWin.focus();
			return false;
		}
	}
	catch (ex) {
		gWin = null;
	}
	
	if (plTimer)
		clearTimeout(plTimer);
	
	plTimer = null;
	gXhr = null;
	
	if (window.name.indexOf("player_popup", 0) == 0) {
		window.document.location = path + "/player_popup.php?debit=" + debit + "&rd=" + wr;
	}
	else {
		popupPath = path;
		
		setTimeout("Scanner()",1000);
		gWin = window.open(popupPath + "/player_popup.php?debit=" + debit + "&rd=" + wr, "player_popup", "left=0,top=0,width=367,height=240,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
	}
	
	if (gWin)
		gWin.focus();
	
	return false;
}

function Scanner(debit, wr) {
	if (gWin.closed) {
	   window.open(popupPath + "/player_popup_redirect.php", "player_popup", "left=0,top=0,width=367,height=240,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
	} else {
	   setTimeout("Scanner()",200);
	}
}

