// _____ "Template" RF transversal _____

function openMenu(id) {
	var menuEltA = 'menuEltA'+id;
	var menuSsElt = 'menuSsElt'+id;
	if (document.getElementById(menuSsElt).style.display =="none") {
		document.getElementById(menuSsElt).style.display ="block";
		document.getElementById(menuEltA).className="menuEltOpened";
	}
	else {
		document.getElementById(menuSsElt).style.display ="none";
		document.getElementById(menuEltA).className="";
	}
}
	
function openMenuBarre(menu) {
	var menuElt = 'menu'+menu;
	var menuSsElt = 'ssMenu'+menu;
	var imgElt = 'imgMenu'+menu;
	var imgOverElt = 'imgMenu'+menu+'Over';

	var menuSsEltDisplay = document.getElementById(menuSsElt).style.display;
	if(menuSsEltDisplay =="none") {
		document.getElementById(menuElt).style.backgroundColor  ="#7f7f7f";
		document.getElementById(menuSsElt).style.display ="block";
		document.getElementById(imgElt).style.display ="none";
		document.getElementById(imgOverElt).style.display ="block";
	}
	else {
		document.getElementById(menuElt).style.backgroundColor  ="#d0d0d0";
		document.getElementById(menuSsElt).style.display ="none";
		document.getElementById(imgElt).style.display ="block";
		document.getElementById(imgOverElt).style.display ="none";
	}
}

// émissions - pop up pour podcast 
function popcast (cid, chaine) {
	window.open('http://www.radiofrance.fr/_c/php/popcast.php?chaine='+chaine+'&cid='+cid,'popcast','toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=475,height=400');
}

function open_popup (url,width,height) {
	window.open(url,'popup','toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width='+width+',height='+height);
}


// _____ Vérification des formulaires _____

// Is the variable empty ?
function isEmpty(elm) {
	var elmstr = elm.value + "";
	if (elmstr.length == 0) return true;
	return false;
}

// Check for email address
function isEmail(elm) {
	if (elm.value.indexOf(" ") + "" == "-1"	&& elm.value.indexOf("@") + "" != "-1"	&& (elm.value.lastIndexOf(".") > elm.value.indexOf("@")) && elm.value != "") return true;
	else return false;
}

// message + submit
function resCheckForm(frm, ErrMsg,lenInit, InfoMsg,lenInit2) {
	if (ErrMsg.length > lenInit) alert(ErrMsg);
	else {
		if (InfoMsg.length > lenInit2) 
		{
			InfoMsg += "\nContinuez tout de même ?\n";
			if (confirm(InfoMsg)) frm.submit();
		}
		else frm.submit();
	}
}

// _____ Sondage _____

function sondageSubmit(frm) {
	var isOK = false;
	for (i = 0; i < 6; i++) 
		if (frm.reponse[i] != null) 
			if (frm.reponse[i].checked == true) {
				isOK = true;
				i = 6;
			}
	if (isOK) {
		frm.action = '/_c/php/sondage_process.php';
		frm.submit();
	}
	else alert('Veuillez choisir une réponse !');	
}

// _____ Cookies _____

function testCookie() {
	document.cookie = 'RF_TESTCOOKIE=1;';
	if (document.cookie.indexOf('RF_TESTCOOKIE=') == -1) return(false);
	else return(true);	
}

// _____ Galerie Pho/Nore _____

function RunGallery(id, w, h, uid)
{
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+w+'" height="'+h+'" id="phonore" align="middle">\n');
	document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
	document.write('<param name="movie" value="http://www.radiofrance.fr/_c/swf/phonore.swf?phonoreID='+id+'&r='+uid+'" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="bgcolor" value="#000000" />\n');
	document.write('<embed src="http://www.radiofrance.fr/_c/swf/phonore.swf?phonoreID='+id+'&r='+uid+'" quality="high" bgcolor="#000000" width="'+w+'" height="'+h+'" name="phonore" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
	document.write('</object>\n');
}

