

// VARIABLES
// **************
var playerlittle = "";
var myWidth = 0, myHeight = 0, myX = 0, myY = 0;


// OUVERTURE DU PLAYER EN POPUP
// ******************************
function popup(url, titre, largeur, hauteur) {
	playerlittle = window.open (url,titre, config='height='+hauteur+', width='+largeur+', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no')
}

function minimize(nom_radio) {

	/*if(id!="_") {
		popup('index.php?&standalone=true&idStation=' + id, 'playerlittle', 700, 216);
		window.location="index.php?&minimize=true&idStation=" + id;
		
	} else {
		popup('index.php?&standalone=true', 'playerlittle', 700, 216);
		window.location="index.php?&minimize=true";
	}*/

	popup('index.php?&standalone=true&radio=' + nom_radio, 'playerlittle', 710, 216);
	window.location="index.php?&standalone=done&radio=" + nom_radio;
	//window.location="index.php?&minimize=true&radio=" + nom_radio;
	
}

// OUVERTURE DU PLAYER DANS LA PAGE
// *********************************
function maximize(id) {
	
	popup('index.php&standalone=true', 'playerlittle', 700, 216);
   
    if (playerlittle) {
     	playerlittle.close();
    	playerlittle = null;
    }
	
	//if(id!="_") window.location="index.php?&idStation=" + id;
	//else window.location="index.php";
	
	if(id=='radio-flu') id=''; 
	window.location="http://radio.fluctuat.net/"+id;
	
}

// SHOW/HIDE LES VISUELS 
// *********************
function showOrHide(baliseId){

	if(document.getElementById(baliseId).style.display=='none') {
		document.getElementById(baliseId).style.visibility='visible';
		document.getElementById(baliseId).style.display = 'block';
		
		document.getElementById("openvisuel").style.visibility='hidden';
		document.getElementById("openvisuel").style.display = 'none';
	} else {
		document.getElementById(baliseId).style.display='none';
		document.getElementById(baliseId).style.visibility='hidden';
		
		document.getElementById("openvisuel").style.visibility='visible';
		document.getElementById("openvisuel").style.display = 'block';
	}

}


// OUVERTURE DES VISUELS EN PLEIN ECRAN
// *************************************
function showhide_visuelbig(){ 

	baliseId = 'visuel_large';
	
	if(document.getElementById(baliseId).style.display=='none') {
	
		window.moveTo(0,0);
		window.resizeTo(screen.width,screen.height);
		
		document.getElementById(baliseId).style.visibility='visible';
		document.getElementById(baliseId).style.display = 'block';
		
		document.getElementById("openvisuel").style.visibility='hidden';
		document.getElementById("openvisuel").style.display = 'none';
		
		document.getElementById("zoneimage").style.visibility='hidden';
		document.getElementById("zoneimage").style.display = 'none';
		
	} else {
	
		window.resizeTo(myWidth,myHeight);
		window.moveTo(myX,myY);
		
		document.getElementById(baliseId).style.display='none';
		document.getElementById(baliseId).style.visibility='hidden';
		
		document.getElementById("zoneimage").style.visibility='visible';
		document.getElementById("zoneimage").style.display = 'block';
		
	}
	
}


// ON RECUPERE LES PARAMETRES DE LA FENETRE (TAILLE ET POSITION)
// *************************************************************
// Browser Window Size and Position
// copyright Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
function pageWidth() {return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?       document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;} 
function pageHeight() {return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;} 
function posLeft() {return typeof window.pageXOffset != 'undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;} 
function posTop() {return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;} 
function posRight() {return posLeft()+pageWidth();} 
function posBottom() {return posTop()+pageHeight();}
    
myWidth = pageWidth();
myHeight = pageHeight();
myX = window.screenX;
myY = window.screenY;


// TUNING SUR STATION QUAND ON EST SUR LA PAGE TOP25 OU TITRES DIFFUSES
// ********************************************************************
function tuning_sur_radio(id){
	
	if(window.opener!=null) {  
		window.opener.location.href = id; 
		window.close();
	}
	else window.location.href = id; 

}

