// JavaScript Document

// desactiver les messages d'erreur
function NoError()
	{
	return true;
	}
window.onerror=NoError;

function custom_print() { // version nettement simplifiee
	window.print();
}

function goHist(a) 
{
   history.go(a);     
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function zoom(id_layer) {
	if (id_layer != '') zoomLayer(id_layer);
}

function zoomLayer(id_layer) {
	var item = null;
	if (document.getElementById) {
		item = document.getElementById(id_layer);
	} else if (document.all){
		item = document.all[id_layer];
	} else if (document.layers){
		item = document.layers[id_layer];
	}
	
	if (!item) { // stand by
	} else if (item.style) {
		if (item.style.display == "none") {
			item.style.display = "";
		} else {
			item.style.display = "none";
		}
	} else {
		item.visibility = "show";
	}
}
// ajout dans les favoris
nav = navigator.appName.substring(0,3);
ver = navigator.appVersion.substring(0,1)

function addFavFR()
{
if (nav == "Mic" && ver >= 4)
	{
	url_site="http://www.podcast-player.com/en/";
	titre_site = "podcast-player.com - Podcast Player Online";
	document.write('<a class="langue" href="#" onclick="window.external.AddFavorite(url_site, titre_site);return(false);">Add podcast-player.com into your favorites</a> | ')
	}
else
	{
	// document.write('Faites CTRL+D pour ajouter ce site à vos favoris!')
	}
}

function addFavNL()
{
if (nav == "Mic" && ver >= 4)
	{
	url_site="http://www.podcast-player.com/nl/";
	titre_site = "podcast-player.com - Thuisbezorging en prestaties";
	document.write('<a class="langue" href="#" onclick="window.external.AddFavorite(url_site, titre_site);return(false);">Voeg podcast-player.com toe aan uw favorieten</a> | ')
	}
else
	{
	// document.write('Voeg podcast-player.com toe aan uw favorieten met CTRL+D')
	}
}

function redimPlaylist(){ 
	as=document.getElementById("playlist").offsetHeight; 
	parent.document.getElementById("playlist").height=as+10; 
	as=document.getElementById("playlist").offsetWidth; 
	parent.document.getElementById("playlist").width=as; 		
} 

function redimPodcasts(){ 
	as=document.getElementById("podcasts").offsetHeight; 
	parent.document.getElementById("podcasts").height=as+10; 
	as=document.getElementById("podcasts").offsetWidth; 
	parent.document.getElementById("podcasts").width=as; 		
} 

function redimPodcast(){ 
	as=document.getElementById("podcast").offsetHeight; 
	parent.document.getElementById("podcast").height=as+10; 
} 

function redimPlayer(){ 
	as=document.getElementById("player").offsetHeight; 
	parent.document.getElementById("player").height=as+10; 
	as=document.getElementById("player").offsetWidth; 
	parent.document.getElementById("player").width=as; 		
} 

function supprimerFlux() 
{ 
	document.abonnements.method = "POST";
	document.abonnements.action = "index.cfm";
	document.abonnements.submit();
}

function nextSequence(url) {
	window.open(url,'_self');
}

//v1.0
//Copyright 2006 Serge Rappaille - All rights reserved.
function flash(url,width,height,bgcolor) {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab##version=7,0,0,0" width="'+width+'" height="'+height+'" id="flash" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="'+url+'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#'+bgcolor+'" />');
	document.write('<embed src="'+url+'" quality="high" bgcolor="#'+bgcolor+'" width="'+width+'" height="'+height+'" name="flash" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function bannertfou(url,width,height,bgcolor) {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab##version=7,0,0,0" width="'+width+'" height="'+height+'" id="bannertfou" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="'+url+'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#'+bgcolor+'" />');
	document.write('<embed src="'+url+'" quality="high" bgcolor="#'+bgcolor+'" width="'+width+'" height="'+height+'" name="bannertfou" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}


function playmov(url,width,height) {
	document.write('<embed type="video/quicktime" src="+url+" width="+width+px" height="'+height+'px" controller="true" />');
}

function poprss(theURL,winName,features) { //v2.0
	var w = window.open(theURL,winName,features);
	w.document.close();
	w.focus(); 
}


function deleteSelected() {
	liste = document.getElementById('maliste');
	valeur = liste.value;
	// alert(valeur);
	window.open('podcasts.cfm?delete='+valeur, '_self');
}


function playSelected() {
	liste = document.getElementById('maliste');
	valeur = liste.value;
	// alert(valeur);
	window.open('player.cfm?sequence='+valeur, 'player');
}

function construction(frame,langue) {
	if (parent.frames.length < 1) {
		top.location.href = location.href; 
		document.location.href = 'http://www.podcast-player.com/'+langue+'/podcast-directory.cfm?frame='+frame;
	}
}

function selectionner() { 
		document.formulaire.url.select(); 
} 

function logout(page)
{
	var ht = document.getElementsByTagName("html");
	ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
	if (confirm('Êtes-vous certain de vouloir quitter cet espace ?'))
	{
		// Supprimer cette fonction en XHTML
		// return true;
		// Fonction utile que pour le menu FLASH
		go_home(page);
	}
	else
	{
		ht[0].style.filter = "";
		document.focus();
		// Supprimer cette fonction en XHTML
		// return false;
	}
}

//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
