/* Global MOOD Blog Web Functions */

images_path = "/web/jsp/img/";
imagesMax = 4;
imagesCount = 0;
imageStore = new Array();

function MenuOn(strid) {
   document[strid].src = images_path + strid + "_a.gif";
}


function MenuOff(strid) {
   document[strid].src = images_path + strid + "_n.gif";
}

function MenuPreload(strid) {
  if (imagesCount<imagesMax) {
    var index = imagesCount;
    imageStore[index] = new Image();
    imageStore[index].src = images_path + strid + "_a.gif";
    imagesCount++;
  }
}


function launchRadioTemplate() {
			var win1 = window.open("http://player.nrj.fr/V4/nrj/nrj_launch_V3.html","NRJ","width=650,height=352,toolbar=no,menubar=no,resizable=no,location=no,directories=no,status=no,scrollbars=no,copyhistory=no");
}


function nRand(maxval) {
	today=new Date();
	seed=today.getTime();
    seed = (seed*9301+49297) % 233280;
    seed = seed /(233280.0);
	return Math.ceil(seed*maxval);
}


function popUp(path, w, h) {
	var t=(screen.height/2)-(h/2)-50;
	var l=(screen.width/2)-(w/2);
	var windowprops = "location=no,scrollbars=no,menubars=no,toolbars=no,resizable=no, left=" + l + ",top=" + t + ",width=" + w + ",height=" + h;
	popwin = window.open(path,"pop"+nRand(100),windowprops);
	popwin.focus();
}


function popUpScroll(path, w, h) {
	var t=(screen.height/2)-(h/2)-50;
	var l=(screen.width/2)-(w/2);
	var windowprops = "location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=no, left=" + l + ",top=" + t + ",width=" + w + ",height=" + h;
	popwin = window.open(path,"pop"+nRand(100),windowprops);
	popwin.focus();
}


function refreshParent() {
       if (window.opener) window.opener.location.reload();
}


function confirmationMessage(cMessage, cPathOK, cPathCancel) {
	isConfirmed = window.confirm(cMessage);

	if (isConfirmed) {
		if (cPathOK == "") {
			return;
		}
		else {
			window.location.href = cPathOK;
			return;
		}
	}
	else {
		if (cPathCancel == "") {
			return;
		}
		else {
			window.location.href = cPathCancel;
			return;
		}
	}
}

function openImageWindow(imageID) {
    popup_url = "pop_image.jsp?imageID=" + imageID;
    var t=20;
    var l=20;
	var windowprops = "location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes, left=" + l + ",top=" + t + ",width=320,height=200";
	popwin = window.open(popup_url,"pop"+nRand(100),windowprops);
	popwin.focus();
}


var jsDartKeyword = 'Mood/Blogs';
var jsDartRandom = Math.random();

function addBanner(){
	dart(jsDartKeyword);
}

function dart(rubrique){
       sz=";tile=2;sz=160x320;";
        var str = '<script language="Javascript" src="http://ad.fr.doubleclick.net/adj/ts.mood.com/';
        str+=rubrique;
        str+=sz;
        str+='ord='+jsDartRandom+'?"></script>';
        document.write(str);
}
