function img_fx(img){
	if(img && img.filters && img.filters[0]){
		img.filters[0].apply();
		img.filters[0].play();


	}
}

sfHover = function() {

	var sfEls = document.getElementById("containerMenu").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


function imprimePage(impDocId)	{ 

	var printDoc = document.all[impDocId.id];
 	w = window.open('',impDocId.id,'width=300px,height=100px,resizable=yes scrollbars=yes toolbar=yes');
	w.document.write( "<html><head><title>Impression</title>\n" );
	w.document.write( "<script language='JavaScript'>\n");
	w.document.write( "function format() {\n");
	w.document.write("document.all['"+impDocId.id+"'].style.overflow='visible';\n");
	w.document.write("document.all['"+impDocId.id+"'].style.position='relative';\n");
  	w.document.write("document.all['"+impDocId.id+"'].style.top='5px';\n");
  	w.document.write("document.all['"+impDocId.id+"'].style.left='0px';\n");
  	w.document.write("document.all['"+impDocId.id+"'].style.width='700px';\n");
  	w.document.write("document.all['"+impDocId.id+"'].style.height='100%';\n");
  	w.document.write( "self.resizeTo(775,700);\n");
  	w.document.write( "self.focus();\n");
  	w.document.write( "}\n</scri");
	w.document.write( "pt>\n");
	w.document.write( "</head><body leftmargin=20 topmargin=20 marginwidth=0 marginheight=0 onLoad='javascript:format();'> " );
	w.document.write("<font face='Verdana' size='1'>[ F5 pour ouvrir ]</font>&nbsp;&nbsp;&nbsp;<button onclick='JavaScript:window.print();'>Imprimer</button> <br><hr>");
	w.document.write(printDoc.outerHTML);
	w.document.write( "</body></html>" );
	}



function resizePopUp(monImage, monTitre)
    {
	w = window.open('','chargement','width=10px,height=10px');
	w.moveTo(20,20);
	w.document.write( "<html><head><title>"+monTitre+"</title>\n" );
	w.document.write( "<script language='JavaScript'>\n");
	w.document.write( "IE5=NN4=NN6=false;\n");
	w.document.write( "if(document.all)IE5=true;\n");
	w.document.write( "else if(document.getElementById)NN6=true;\n");
	w.document.write( "else if(document.layers)NN4=true;\n");
	w.document.write( "function autoSize() {\n");
	w.document.write( "if(IE5) self.resizeTo(document.images[0].width+9,document.images[0].height+59);\n");
	w.document.write( "else if(NN6) self.sizeToContent();\n");
	w.document.write( "else window.resizeTo(document.images[0].width,document.images[0].height+20);\n");
	w.document.write( "self.focus();\n");
	w.document.write( "}\n</scri");
	w.document.write( "pt>\n");
	w.document.write( "</head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad='javascript:autoSize();'>" );
	w.document.write( "<center><a href='javascript:window.close();'><img src='"+monImage+"' border=0 alt='"+monTitre+"'></a></center>" );
	w.document.write( "</body></html>" );
	w.document.close();
		}


	var volumeSetting = new Array();
	var currentVolume = 1;
	var mediaPlayer ;


function init_media() {

	var mediaCollection = document.getElementsByTagName('MEDIA'); 	//  MEDIA VIDEO

	for(i=0; i<mediaCollection.length; i++) {
	
	var oAttrObj = mediaCollection[i];
	var oAttr = oAttrObj.attributes;
	var oMediaId = oAttr.getNamedItem("id");
	var MediaId = oMediaId.value;

	if (	document.all[MediaId].currTimeState.isActive) {
	oMedia = MediaId ;
	} else {
	return false;
 	}
	}
}

function volumeArray(vol,visible,id,color) {
	
		this.vol = vol;
		this.visible = visible;
		this.id = id;
		this.color = color;

	}
		

	volumeSetting[0] = new volumeArray('0','visible','led_00','yellow');
	volumeSetting[1] = new volumeArray('10','visible','led_01','yellow');
	volumeSetting[2] = new volumeArray('20','visible','led_02','yellow');
	volumeSetting[3] = new volumeArray('30','visible','led_03','yellow');
	volumeSetting[4] = new volumeArray('40','visible','led_04','lime');
	volumeSetting[5] = new volumeArray('50','visible','led_05','lime');
	volumeSetting[6] = new volumeArray('60','visible','led_06','lime');
	volumeSetting[7] = new volumeArray('70','visible','led_07','red');
	volumeSetting[8] = new volumeArray('80','visible','led_08','red');
	volumeSetting[9] = new volumeArray('100','visible','led_09','red');
	
	
function volumeControl(change,idm) {

	
	if ((change == "decrease") && (currentVolume > 0)) {
				
	document.all[idm].volume = volumeSetting[currentVolume].vol;
	document.all[volumeSetting[currentVolume].id].fillcolor= "#F5F5F5";
	currentVolume = currentVolume-1;
	}

	if ((change == "increase") && (currentVolume < 9)) {
	currentVolume = currentVolume+1;

	document.all[idm].volume = volumeSetting[currentVolume].vol;
	document.all[volumeSetting[currentVolume].id].fillcolor= volumeSetting[currentVolume].color;
	}
	
}

	var bPlayListMade = false;
	

function fnCreatePlayList(oMedia)	{ 

    if(bPlayListMade == false)
    {
        var playCollection = document.all[oMedia].playList;
        for(i=0;i<playCollection.length;i++)
        {
		
            var sElement = "<SPAN onclick='"+"fnGoToTrack(\""+oMedia+"\")'" +	
		" CLASS = 'trackDisplay'>" + playCollection(i).title + "</SPAN>";
		var oDisplaySpan = document.createElement(sElement);
            oDisplaySpan.innerText = playCollection(i).title;
            oShowPlayList.insertBefore(oDisplaySpan);
            var oBr = document.createElement("BR");
            oShowPlayList.insertBefore(oBr);
		
        }
        bPlayListMade = true;
		}
	}

function fnGoToTrack(oMedia) { 

    var playCollection = document.all[oMedia].playList;
    for(i=0;i<playCollection.length;i++)
    {
        if(event.srcElement.innerText == playCollection(i).title)
        {
            playCollection(i).setActive();
        }
    }	
}

function updateFields(oMedia) {

    var aSpans = oShowPlayList.childNodes;
    
    for (i=0; i<aSpans.length; i++)
    {
        aSpans(i).style.color = "black";
		aSpans(i).style.fontWeight = "normal";
        if(aSpans(i).innerText == document.all[oMedia].playList.activeTrack.title)
        {
            aSpans(i).style.color = "red";
			aSpans(i).style.fontWeight = "bold";
        }
    }
   
    oTitle.innerText = document.all[oMedia].playList.activeTrack.title;
    oAuthor.innerText = document.all[oMedia].playList.activeTrack.author;
    oAbstract.innerText = document.all[oMedia].playList.activeTrack.abstract;
    oCopyright.innerText = document.all[oMedia].playList.activeTrack.copyright;
    // oFilename.innerText =  document.all[oMedia].playList.activeTrack.src;
	
}

function clearFields(){
    oTitle.innerText = " ";
    oAuthor.innerText = " ";
    oAbstract.innerText = " ";
    oCopyright.innerText = " ";
    // oFilename.innerText = "";
}



