
/*=======================================================
mew_writePlaylist(p, pname)
Cette fonction affiche dans le document la playlist p
=========================================================*/
function mew_writePlaylist(p, pname){

//Test World news
if ( (strInText(p.titre, "Actualité")) || (strInText(p.titre, "News")) || (p.titre=="World news") || (strInText(p.titre, "Actualités")))
pic ="../pic/playlist2-off.gif";
else
pic ="../pic/playlist1-off.gif";

var str="<td class='playlistFont1'><a href='javascript:parent.frames[0].mew_showP("+ pname +")' class='playlistFont1'> <img id='"+ pname +"' src='"+pic+"' class='noborder' onmouseover='javascript:onPic(this)' onmouseout='javascript:offPic(this)'><br>"+ p.titre +"</a></td>";
document.write(str);
}

/*=======================================================
mew_writeModulePlaylist(p, pname)
Cette fonction affiche dans le document la playlist p
=========================================================*/
function mew_writeModulePlaylist(p, pname){

//Test World news
if ( (strInText(p.titre, "Actualité")) || (strInText(p.titre, "News")) || (p.titre=="World news") || (strInText(p.titre, "Actualités")))
pic ="../pic/playlist2-off.gif";
else
pic ="../pic/playlist1-off.gif";

var str="<td class='playlistFont1'><a href='f_playlist.php?mewmod=worldnews&wpls="+pname+"' class='playlistFont1'> <img id='"+ pname +"' src='"+pic+"' class='noborder' onmouseover='javascript:onPic(this)' onmouseout='javascript:offPic(this)'><br>"+ p.titre +"</a></td>";
document.write(str);
}




 /* ====================================================
 =======================================================*/
 function onPic(obj){
    var chaine=obj.src;
    var reg=new RegExp("(-off)", "g");
    obj.src=chaine.replace(reg,"-on");
    }


 /* ====================================================
 =======================================================*/    
function offPic(obj){
    var chaine=obj.src;
    var reg=new RegExp("(-on)", "g");
    obj.src=chaine.replace(reg,"-off");
    }  
    
     /* ====================================================
 =======================================================*/    
function changePic(obj){
	var chaine=obj.src;
	var reg=new RegExp("(-on)", "g");
    var reg2=new RegExp("(-off)", "g");
   
   if (reg.test(chaine)) 
    obj.src=chaine.replace(reg,"-off");
    else
    obj.src=chaine.replace(reg2,"-on");
    
	}  


 /* ====================================================
 Cette fonction retourne le nom de la page contenu dans une url
 =======================================================*/
 function givename(Linkstr){
     reg=new RegExp("[.]+", "g");
		 tableau=Linkstr.split(reg);
		
		if(tableau.length  > 2)
			name= tableau [1];
		else
			if(tableau.length == 2)
				name= tableau [0];
			else
				name= link;	
		//alert(name);		
		return name;
 }

    
       /* ====================================================
 =======================================================*/    
function changeBackPic(obj){
	
   if (Math.random() < 0.5)
    obj.style.backgroundImage="url('../pic/slidehome1-off.jpg')";
    else
    obj.style.backgroundImage="url('../pic/slidehome1-on.jpg')";
    
	}  
	
 /*=======================================================
mew_refresh(frameName)
Recharge une frame
=========================================================*/
function mew_refresh(frameName){

}
 

/*=======================================================
mew_selectplaylistOn()
Affiche les cases à cocher des pages d une playlist avant son envoi 
=========================================================*/
function mew_selectplaylistOn(){
i=0;
while (document.getElementById("pageisok"+i) !=undefined )
{
	document.getElementById("pageisok"+i).style.display="";
	i++;
}
} 

function mew_selectplaylistOff(){
i=0;
while (document.getElementById("pageisok"+i) !=undefined )
{
	document.getElementById("pageisok"+i).style.display="none";
	i++;
}
} 

/*=======================================================
mew_friendselectoption(user)
Cette fonction liste les amis du user dans un texte conteant les options pour le formulaire "select"
=========================================================*/
function mew_friendselectoption(user){
resultat="";
for (x in user.amis) {
resultat=resultat+"<option>"+user.amis[x].login+"</option>";	
}
return resultat;
} 


/*=======================================================
setcolor(obj)
cette fonction permet de changer la couleur d arrière plan d'un obj
=========================================================*/
function setcolor2(obj) {
	obj.style.backgroundColor = "#e5e5e5";
	obj.style.borderSize = "1";
}



/*=======================================================
mew_setsendsource(p)
Cette fonction génère la source javascript de la playlist à envoyer par mail 
=========================================================*/
function mew_setsendsource(p){
i=0;
c=0;
result=" var mew_sendplaylist = new Playlist('"+document.send_playlistform.send_titre.value.replace("'","\\'")+" ',new Array(),'Yes'); mew_sendplaylist.owner='"+one.mew_user.login+"';  ";
lespages="";        

//On vérifie si autoplaykey est positionné
if (document.getElementById("autoplaykey").checked==true)
result+="one.mew_autoplay=true;"

for (i in p.pages){
	//SI la page est séléctionnée
	//alert(document.getElementById("pageisok"+i).checked);
	//On ne peut envoyer que 100 pages
	if ((document.getElementById("pageisok"+i).checked==true) & (c<100))
	{
	//alert(p.pages[i].url);
	result +="paux=new Page("+c+",'"+p.pages[i].titre.replace("'","\\'")+"','"+p.pages[i].url.replace("'","\\'")+"') ; paux.tags='"+p.pages[i].tags.replace("'","\\'")+"'; paux.kid='"+p.pages[i].kid.replace("'","\\'")+"'; paux.categories='"+p.pages[i].categories.replace("'","\\'")+"'; paux.externe='"+p.pages[i].externe+"'; paux.type='"+p.pages[i].type+"' ; paux.kids='"+p.pages[i].kids+"' ; paux.langue='"+p.pages[i].langue+"' ; paux.globalscore='"+p.pages[i].globalscore+"' ; paux.proprietaire='"+p.pages[i].proprietaire+"' ; paux.description='"+p.pages[i].description.replace("'","\\'")+"' ; mew_sendplaylist.pages["+c+"]=paux; ";
	lespages +=p.pages[i].url+";";        

	c++;
	}
}

// On copie la source dans le formulaire s il ya au moins une page dans la Playlist
if (c>0){
	document.getElementById("send_playlist_source").value=result;
	document.getElementById("listpage").value=lespages;
}

//alert(result);
} 

/*=======================================================
mew_testsend(p)
cette fonction permet de tester si le formulaire d envoi de playlist est ok
=========================================================*/
function mew_testsend(p){
	var msg = "";
	var atpos=-1;
    var ppos=-1;

	mew_setsendsource(p);
	//alert(document.send_playlistform.send_to_email.value);
	if ((document.send_playlistform.amis.value ==0) & (document.send_playlistform.send_to_email.value == "")){
		msg +="Please select a friend or enter an email.\n";
		document.send_playlistform.amis.backgroundColor = "#F3C200";
		document.send_playlistform.send_to_email.backgroundColor = "#F3C200";
	}
  
	if (document.send_playlistform.source.value ==" ")	{
		msg+= "Your playlist selection is empty.\n";
	}

	if (document.send_playlistform.send_titre.value =="")	{
		msg+= "Please enter your playlist title.\n";
	}

if (document.send_playlistform.send_to_email.value != ""){
	atpos = document.send_playlistform.send_to_email.value.indexOf("@");
	ppos = document.send_playlistform.send_to_email.value.indexOf(".");
	if ((ppos < 0) || (atpos < 0))		{
		document.send_playlistform.send_to_email.style.backgroundColor = "#F3C200";
		msg += "Please check your email.\n";
	}

}


	if (msg =="") {
			
		//Send request by web service. So return false
		return true;
	}
	else	{
		alert(msg);
		return false;
	}
}
   
/*=======================================================
mew_showplaylist(playlist)
Cette fonction liste les pages contenu dans "playlist"
=========================================================*/
function mew_showPlaylist(){
  var debut ="";
  var Rpages ="<div id='playlistView'>";
  var fin="";
  var index=0;
  var edit="";
  var x = new Page(-1,"","", "Mewob");
  var playlist = parent.frames[0].PlaylistToshow;
  var playlistedit="";
  var isowner=true;
  //formulaire d envoi de playlist
  
//Avec effet slidedown
 //var formsend="<div style=\"height:6px; _display:none;\"></div><DIV id=\"newformbox\" style=\"display: none; _margin-top:7px\"><img src=\"../pic/playlistformpc.gif\" style=\"margin-top:2px;margin-right:13px;float:right\"><table   cellpadding=\"0\" cellspacing=\"5\" ><tbody><tr><td class=\"fontstyle\" colspan=\"2\" align=\"right\"><form name=\"send_playlistform\" onsubmit=\"return mew_testsend(one.PlaylistToshow);\" method=\"POST\" action=\"f_playlist.php?tache=addsendplaylist\"></td></tr><tr><td class=\"fontstyle\" align=\"left\">Send to</td><td class=\"fontstyle\" align=\"left\"><select  style=\"margin-right:10px;\" class=\"inputstyle1\" name=\"amis\">   <option selected value=\"NO\">Select your friend</option>"+mew_friendselectoption(one.mew_user)+"</select>Auto play <input name="autoplaykey" id="autoplaykey" checked="checked" style="" type="checkbox"/> Or email<input style=\"margin-left:3px;\" name=\"send_to_email\" size=\"20\" value=\"\"  class=\"inputstyle1\"  onkeyup=\"javascript:setcolor2(this);\" type=\"text\"></td><td class=\"fontstyle\" align=\"center\"><a href=\"#\" Onclick=\"new Effect.SlideUp('newformbox');mew_selectplaylistOff();\"><img src=\"../pic/close.gif\" style=\"border: 0px solid #ffffff;\"></a></td></tr><tr><td class=\"fontstyle\" align=\"left\">Title</td><td class=\"fontstyle\" align=\"left\">  	<input name=\"send_titre\" size=\"50\" value=\""+playlist.titre+"\" maxlength=\"255\" class=\"inputstyle1\" onkeyup=\"javascript:setcolor2(this);\" type=\"text\"> </td>	<td class=\"fontstyle\" align=\"left\">	<input name=\"send\" value=\"Send \" class=\"keystyle1\" type=\"submit\"> <div style=\"display:none\"><input name=\"auteur\" size=\"50\" value=\""+one.mew_user.login+"\" class=\"inputstyle1\" type=\"text\"> <textarea  id=\"send_playlist_source\"name=\"source\"  value=\"\" class=\"inputstyle1\" > </textarea><textarea  id=\"listpage\"name=\"listpage\"  value=\"\" class=\"inputstyle1\" > </textarea></div> </td>	</tr><tr><td class=\"fontstyle\" align=\"left\"><BR> 	&nbsp;</td></form>	</tr>				</tbody>		</table></DIV>";
  
    var formsend="<div style=\"height:6px; _display:none;\"></div><DIV id=\"newformbox\" style=\"display: none; _margin-top:7px\"><img src=\"../pic/playlistformpc.gif\" style=\"margin-top:2px;margin-right:13px;float:right\"><table   cellpadding=\"0\" cellspacing=\"5\" ><tbody><tr><td class=\"fontstyle\" colspan=\"2\" align=\"right\"><form name=\"send_playlistform\" onsubmit=\"return mew_testsend(one.PlaylistToshow);\" method=\"POST\" action=\"f_playlist.php?tache=addsendplaylist\"></td></tr><tr><td class=\"fontstyle\" align=\"left\">Send to</td><td class=\"fontstyle\" align=\"left\"><select  style=\"margin-right:10px;\" class=\"inputstyle1\" name=\"amis\">   <option selected value=\"NO\">Select your friend</option>"+mew_friendselectoption(one.mew_user)+"</select> Or email<input style=\"margin-left:3px;margin-right:10px;\" name=\"send_to_email\" size=\"20\" value=\"\"  class=\"inputstyle1\"  onkeyup=\"javascript:setcolor2(this);\" type=\"text\">Autoplay <input name=\"autoplaykey\" id=\"autoplaykey\" checked=\"checked\"  type=\"Checkbox\"/></td><td class=\"fontstyle\" align=\"center\"><a href=\"#\" Onclick=\"document.getElementById(\'newformbox\').style.display='none';mew_selectplaylistOff();\"><img src=\"../pic/close.gif\" style=\"border: 0px solid #ffffff;\"></a></td></tr><tr><td class=\"fontstyle\" align=\"left\">Title</td><td class=\"fontstyle\" align=\"left\">  	<input name=\"send_titre\" size=\"50\" value=\""+playlist.titre+"\" maxlength=\"255\" class=\"inputstyle1\" onkeyup=\"javascript:setcolor2(this);\" type=\"text\"> </td>	<td class=\"fontstyle\" align=\"left\">	<input name=\"send\" value=\"Send \" class=\"keystyle1\" type=\"submit\"> <div style=\"display:none\"><input name=\"auteur\" size=\"50\" value=\""+one.mew_user.login+"\" class=\"inputstyle1\" type=\"text\"> <textarea  id=\"send_playlist_source\"name=\"source\"  value=\"\" class=\"inputstyle1\" > </textarea><textarea  id=\"listpage\"name=\"listpage\"  value=\"\" class=\"inputstyle1\" > </textarea></div> </td>	</tr><tr><td class=\"fontstyle\" align=\"left\"><BR> 	&nbsp;</td></form>	</tr></tbody></table></DIV>";
  
  
  //On test si le candidat n'est connecte
  if (one.mew_user.login=="user")
  {
  formsend="<div style=\"height:6px;  _display:none;\"></div><DIV id=\"newformbox\" align=\"center\" style=\"display:none; _margin-top:7px\"><a href=\"f_join.php\"><img src=\"../pic/sendformjoin-off.gif\" style=\"margin-top:20px;margin-right:13px;text-align:center;border:0px;\" align=\"center\"></a></DIV>";
 
  }
  
  //Avec l effet slidedown
  //var inconsend="<li><a href=\"#\" onclick=\"new Effect.SlideDown(\'newformbox\');mew_selectplaylistOn();\"><img title=\"Send ("+playlist.titre+" - Playlist) to friend\" src=\"../pic/iconmail-off.gif\" style=\"border:0px;margin-top:0px;margin-right:13px;float:right\"  onmouseover=\"javascript:onPic(this)\" onmouseout=\"javascript:offPic(this)\"></a></li>";
  
  var inconsend="<li><a href=\"#\" onclick=\"document.getElementById(\'newformbox\').style.display='';mew_selectplaylistOn();\"><img title=\"Send ("+playlist.titre+" - Playlist) to friend\" src=\"../pic/iconmail-off.gif\" style=\"border:0px;margin-top:0px;margin-right:13px;float:right\"  onmouseover=\"javascript:onPic(this)\" onmouseout=\"javascript:offPic(this)\"></a></li>";
  
  
  
  //Le retour à la page du candidat seulement si le candidat est un membre mewob
  if ( (playlist.owner !="users") & (playlist.owner !=undefined))
  {
  //str_backhome = "<TR><TD valign=\"middle\" class=\"Playlistbar\" style=\" text-align:right; padding-top:25px;\" colspan=\"2\"><a class=\"tagFont\" href=\"f_friendHome.php?p="+playlist.owner+"\"><img class=\"noborder\" src=\"../pic/minihouse.gif\"> "+playlist.owner+" Home </a></TD> </TR>";
  str_backhome="<li  style=\"background: #f5f5f5 url(../pic/minihome_back.gif) top left repeat-x; height:39px;-moz-border-radius: 7px; \" ></nobr><a class=\"playlistFont1\" href=\"f_friendHome.php?p="+playlist.owner+" \"><img style=\"padding-top:0px\" class=\"noborder\" src=\"../pic/miniicon-off.gif\" onMouseOver=\"javascript:onPic(this)\" onMouseOut=\"javascript:offPic(this)\" ><span style=\"position:relative;top:-12px;\">"+playlist.owner+" Home </span></nobr></a></li>";
  }
  else
 str_backhome=""; 	
  	
  


for (x in playlist.pages)
   {
   	//Initialisation de l icone de page privé
   	privatepic='';
   	
   copyfavekey='';
   /* ANCIEN FONCTIONNEMENT QUI RECHARGE TOUTE LA PAGE
   //Test si la page est celle de l'utilisateur connecté
    if (playlist.pages[index].proprietaire == one.mew_user.login){   	
    edit= "<a class=\"MenuPage2\" href=\"editPage.php?page="+playlist.pages[index].id+"\">edit</a> | <a class=\"MenuPage2\" href=\"javascript:confirmDelete(\'work.php?tache=delpage&pls="+playlist.titre+"&page="+playlist.pages[index].id+"\',\'Delete ("+playlist.pages[index].titre+") from yours favorites?\');\">delete</a> | ";
   */
   
   //Test si la page est celle de l'utilisateur connecté
    if (playlist.pages[index].proprietaire == one.mew_user.login){   	
    edit= "<a class=\"MenuPage2\" href=\"editPage.php?page="+playlist.pages[index].id+"&pls="+playlist.titre+"\">edit</a> | <a onClick=\"javascript:confirmDeleteAjax(\'../include/webservices_start.php\',\'pagebox"+index+"\',\'delpage\', \'pls="+playlist.titre+"&page="+playlist.pages[index].id+"\',\'one.mew_user.detelePage("+playlist.pages[index].id+");\',\'Delete ("+playlist.pages[index].titre+") from yours favorites?\');\" class=\"MenuPage2\" href=\"#\">delete</a> | ";
    
    
    //On test si la page est privée
    if (playlist.pages[index].share.toLowerCase() != 'yes'){ 
    	  privatepic='<img src=\'../pic/lockmini.png\' > ';
    }
      	
    
    
    //On test si la page fait partie des favoris de démarrage
    if (playlist.pages[index].domaine != 'startplaylist'){   	
    copyfavekey="<font id=\"domain_box"+playlist.pages[index].id+"\"><a href='#' onclick=\"javascript:confirmDeleteAjax(\'../include/webservices_start.php\',\'domain_box"+playlist.pages[index].id+"\',\'setdomain\', \'tsk=setparam&amp;param=domaine&amp;idp="+playlist.pages[index].id+"&amp;pval=startplaylist\',\'one.mew_user.setDomaine(\\'"+playlist.pages[index].url+"\\',\\'startplaylist\\');\',\'Add to your start playlist\');\" class=\'playlistFont1\' title=\'Add to your start playlist\'><img  src='../pic/addhome-off.png' class='noborder' onmouseover='javascript:onPic(this)' onmouseout='javascript:offPic(this)' style='float:right;padding-right:10px;'></a></font>"; 
    }
    else
    	copyfavekey="<font id=\"domain_box"+playlist.pages[index].id+"\" ><a href='#' onclick=\"javascript:confirmDeleteAjax(\'../include/webservices_start.php\',\'domain_box"+playlist.pages[index].id+"\',\'setdomain\', \'tsk=setparam&amp;param=domaine&amp;idp="+playlist.pages[index].id+"&amp;pval=initial\',\'one.mew_user.setDomaine(\\'"+playlist.pages[index].url+"\\',\\'\\');\',\'Remove this fave to your start playlist\');\" class=\'playlistFont1\' title=\'Remove this fave to your start playlist\'><img  src='../pic/addhome1-off.png' class='noborder' onmouseover='javascript:onPic(this)' onmouseout='javascript:offPic(this)' style='float:right;padding-right:10px;'></a></font>"; 
    
  
    }
    else 
    	{
      edit="";
      isowner= false;
      
      //On affiche le bouton d'ajout dans le cas ou l utilisateur n est pas le proprietaire
 			copyfavekey="<a href='#' onclick='one.favetosave=one.PlaylistToshow.pages["+index+"];surf(\"addUrl.php\");' class='playlistFont1' title='Copy this fave in your bookmarks'><img  src='../pic/add3-off.png' class='noborder' onmouseover='javascript:onPic(this)' onmouseout='javascript:offPic(this)' style='float:right;padding-right:10px;'></a>"; 
     	
    	}
    
    //Les liens d'ouverture
    taga="<a href=\"javascript:one.mew_PlayP_i("+index+");\" class=\"MenuPage2\">";
    tagapic="<a href=\"javascript:one.mew_PlayP_i("+index+");\" class=\"apercupic\">";
    
    
    Rpages+="<div id='pagebox"+index+"'><TABLE class=\"cadrePlaylist2\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><TR><TD class=\"playlistNum\" rowspan=\"2\">"+(index+1)+"<INPUT TYPE=\"checkbox\"  NAME=\"pageisok"+index+"\" id=\"pageisok"+index+"\" checked  style=\"display:none;\" /> </div></TD><TD class=\"playlistapercu\"  rowspan=\"2\">"+tagapic+"<img src=\"http://open.thumbshots.org/image.pxf?url="+playlist.pages[index].url+"\" alt=\""+printer(playlist.pages[index].titre,40)+"\" border=\"0\"></a></TD></TR><TR><TD class=\"Titlepage\" >"+privatepic+taga+"<font color=\"#848589\" size=\"4\">"+printer(playlist.pages[index].titre,40)+"</font></a> "+copyfavekey+"<HR size=\"1\" class=\"Row1\">Tags:"+one.mew_listTags(playlist.pages[index].tags)+"<div class=\"cadreurl\"><font class=\"FloatRight\" >"+edit+"<a href=\""+tourl(playlist.pages[index].url)+"\" TARGET='_blank' class=\"MenuPage2\" > more</a> | "+taga+"open</a> </font>"+taga+""+printer(playlist.pages[index].url,50)+"</a></div></font></TD><TR></TABLE></div>";
   index++;
   }

Rpages+="</div>";



 fin="</TD></TR></TABLE>";

 //On affiche les options sur la playlist si la playlist appartient au connecté
 if ((isowner)& (index >0 ) & (playlist.titre != "My start playlist") & (playlist.titre.search(one.mew_user.login+" links")<0 ) ) 
 playlistedit="<TR><TD style=\"margin-top:5px;background-color:#f5f5f5; padding:5px; border: double #cecece; -moz-border-radius:20px;\" align=\"right\"> <a class=\"playlistFont3\" href=\"f_playlist.php?tache=publicplaylist&pls="+playlist.titre+"\">Public All</a> | <a class=\"playlistFont3\" href=\"f_playlist.php?tache=publicplaylist&private=1&pls="+playlist.titre+"\">Private All</a> | <a class=\"playlistFont3\" href=\"#\" onClick=\"confirmDelete('f_playlist.php?tache=delplaylist&pls="+playlist.titre+"','Delete all links of the playlist ("+playlist.titre+")?')\">Delete All</a></TD></TR>";
 
 //On affiche l ajout d un lien si le candidat est propriétaire de la playlist ou si la playlist est vide
 addlinkoption="";
 //alert(playlist.titre);
 //On ne peut pas ajouter de lien dans une playlist générée automatiquement comme all_link...
 if (( isowner || (index ==0 )) & (playlist.titre != "My start playlist") & (playlist.titre.search(one.mew_user.login+" links")<0 ) ) 
 addlinkoption="<TR><TD align=\"right\" style='padding-top:1px;_padding-bottom:1px;'><div><a href='#' onclick=\"showbox('addpagebox');\"> <img src='../pic/newfave-off.gif' onmouseover='javascript:onPic(this)' onmouseout='javascript:offPic(this)' border='0' /></a></div><div id='addpageboxresult'></div><div style=\"display:none\" id='addpagebox'><form name='addLink' onsubmit='return testformjoin();' action='' method='GET'><TABLE class=\"cadrePlaylist2\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><TR><TD class=\"playlistNum\" rowspan=\"2\">+</TD><TD class=\"playlistapercu\"  rowspan=\"2\"> <img src=\"http://open.thumbshots.org/image.pxf?url=http://www.mewob.com\"  border=\"0\"></TD></TR><TR><TD class=\"Titlepage\" ><font color=\"#848589\" size=\"3\">Link </font><input name='url' size='80' value='http://www.' class='inputstyle5' onkeyup='javascript:setcolor(this);' type='text'><HR size=\"1\" class=\"Row1\">Tags  <input name='tags' maxlength='150' size='60' value='' class='inputstyle5' onkeyup='javascript:setcolor(this);' type='text'> <input class='inputkey10' value='confirm' onmouseover='javascript:onPic(this)' onmouseout='javascript:offPic(this)' type='submit' border='0'><div class=\"cadreur2\"><font class=\"FloatRight\" ><input name='privatetag0' value='Private' type='checkbox'>Private | <input name='kidstag0' value='For kids' checked='checked' type='Checkbox'>Safe for kids | <input name='externaltag0' value='No' type='Checkbox'>Open in external window </div></font></TD><TR></TABLE></form></div></TD></TR>";
 
 
  
  //Creation de la partie du haut
  //debut =" <TABLE class=\"cadrePlaylist\" cellpadding=\"0\" cellspacing=\"0\" width=\"800px\"><TR><TD class=\"fontstyle\" rowspan=\"2\" width=\"100px\"> <a href=\"javascript:mew_PlayP()\"><img id=\"mew_peoplePlaylist\"src=\"../pic/playlistBig-off.png\" class =\"noborder\" onMouseOver=\"javascript:onPic(this)\" onMouseOut=\"javascript:offPic(this)\" /></a></TD><TD class=\"fontstyle\" style=\"padding-top:15px;\" ><a href=\"javascript:mew_PlayP()\"><img id=\"mew_peoplePlaylist\"src=\"../pic/playBig1-off.png\" class =\"noborder\" onMouseOver=\"javascript:onPic(this)\" onMouseOut=\"javascript:offPic(this)\" /></a></TD> </TR><TR><TD class=\"titlePlaylist\">"+printer(playlist.titre,20)+"</TD> </TR><TR><TD class=\"Playlistbar\" colspan=\"2\">Created by "+playlist.owner+"</TD> </TR><TR><TD id=\"sendformplaylist\" colspan=\"2\">"+formsend+inconsend+"</TD> </TR>"+str_backhome+"<TR><TD class=\"PlaylistTitle2\" colspan=\"2\"><div id=\"autoplaydiv\" style=\"display:none\">Autoplay in <BR></div>Playlist : "+printer(playlist.titre,30)+"</TD> </TR><TR><TD  colspan=\"2\"><form id=\"playlistform\"  name=\"playlistform\"  action=\"#\"> ";

	debut =" <TABLE class=\"cadrePlaylist\" cellpadding=\"0\" cellspacing=\"0\" width=\"800px\"><TR><TD class=\"fontstyle\" colspan=\"2\"  id=\"playlistpicbox\"> <div id=\"boxdiv\" onclick=\"javascript:mew_PlayP()\"><BR><BR><BR><BR><BR><BR><BR>"+printer(playlist.titre,50)+"</div></TD><TD class=\"fontstyle\" ></TD> </TR><TR><TD class=\"Playlistbar\" colspan=\"2\">Created by "+playlist.owner+"</TD> </TR><TR><TD valign=\"center\" id=\"sendformplaylist\" colspan=\"2\" style=\"display: yes;\" >"+formsend+"<ul id=\"playlistoption\" >"+str_backhome+inconsend+"</ul></TD> </TR><TR><TD class=\"PlaylistTitle2\" colspan=\"2\"><div id=\"autoplaydiv\" style=\"border:double #d4e8ff; display:none; text-align:center; color:#7694b8; padding:5px;\">Autoplay in <BR></div>Playlist : "+printer(playlist.titre,30)+"</TD> </TR><TR>"+playlistedit+"<TR><TR>"+addlinkoption+"<TR><TD  colspan=\"2\"><form id=\"playlistform\"  name=\"playlistform\"  action=\"#\"> ";
	
  


document.write(debut+Rpages+fin);

}

/*=======================================================
mew_playlistView_todelete(playlist, div)
Cette fonction retourne la grille des pages contenu dans "playlist"
=========================================================*/
function mew_playlistView_todelete(playlist,div){
  var debut ="";
  var Rpages ="<div id='"+div+"'>";
  var fin="";
  var index=0;
  var edit="";
  var x = new Page(-1,"","", "Mewob");
  var playlistedit="";
  var isowner=true;
  //formulaire d envoi de playlist
	
for (x in playlist.pages)
   {
   
   /* ANCIEN FONCTIONNEMENT QUI RECHARGE TOUTE LA PAGE
   //Test si la page est celle de l'utilisateur connecté
    if (playlist.pages[index].proprietaire == one.mew_user.login){   	
    edit= "<a class=\"MenuPage2\" href=\"editPage.php?page="+playlist.pages[index].id+"\">edit</a> | <a class=\"MenuPage2\" href=\"javascript:confirmDelete(\'work.php?tache=delpage&pls="+playlist.titre+"&page="+playlist.pages[index].id+"\',\'Delete ("+playlist.pages[index].titre+") from yours favorites?\');\">delete</a> | ";
   */
   
   //Test si la page est celle de l'utilisateur connecté
    if (playlist.pages[index].proprietaire == one.mew_user.login){   	
    edit= "<a class=\"MenuPage2\" href=\"editPage.php?page="+playlist.pages[index].id+"&pls="+playlist.titre+"\">edit</a> | <a onClick=\"javascript:confirmDeleteAjax(\'../include/webservices_start.php\',\'pagebox"+index+"\',\'delpage\', \'pls="+playlist.titre+"&page="+playlist.pages[index].id+"\',\'one.mew_user.detelePage("+playlist.pages[index].id+");\',\'Delete ("+playlist.pages[index].titre+") from yours favorites?\');\" class=\"MenuPage2\" href=\"#\">delete</a> | ";
   
  
    }
    else 
    	{
      edit="";
      isowner= false;    	
    	}
    
    //Les liens d'ouverture
    taga="<a href=\"javascript:one.mew_PlayP_i("+index+");\" class=\"MenuPage2\">";
    tagapic="<a href=\"javascript:one.mew_PlayP_i("+index+");\" class=\"apercupic\">";
    
    
    Rpages+="<div id='pagebox"+index+"'><TABLE class=\"cadrePlaylist2\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><TR><TD class=\"playlistNum\" rowspan=\"2\">"+(index+1)+"<INPUT TYPE=\"checkbox\"  NAME=\"pageisok"+index+"\" id=\"pageisok"+index+"\" checked  style=\"display:none;\" /> </div></TD><TD class=\"playlistapercu\"  rowspan=\"2\">"+tagapic+"<img src=\"http://open.thumbshots.org/image.pxf?url="+playlist.pages[index].url+"\" alt=\""+printer(playlist.pages[index].titre,40)+"\" border=\"0\"></a></TD></TR><TR><TD class=\"Titlepage\" >"+taga+"<font color=\"#848589\" size=\"4\">"+printer(playlist.pages[index].titre,40)+"</font></a><HR size=\"1\" class=\"Row1\">Tags:"+mew_listTags(playlist.pages[index].tags)+"<div class=\"cadreurl\"><font class=\"FloatRight\" >"+edit+"<a href=\""+tourl(playlist.pages[index].url)+"\" TARGET='_blank' class=\"MenuPage2\" > more</a> | "+taga+"open</a> </font>"+taga+""+printer(playlist.pages[index].url,50)+"</a></div></font></TD><TR></TABLE></div>";
   index++;
   }

Rpages+="</div>";

return Rpages;

}
  
/*=======================================================
getMyPlaylists(playlist)
Cette fonction affiche dans le formulaire les playlists du membre
=========================================================*/
function formMyPlaylists(){
  var table = one.mew_user.tabPlaylist;
  
  for (x in table){
    if (table[x] !=""){
    if (table[x].length >20)
    document.write("<option value='"+table[x]+"'>"+table[x].substring(0,20)+"...</option>"); 
    else
    document.write("<option value='"+table[x]+"'>"+table[x]+"</option>"); 
    }
  }

}


/*=======================================================
printer(text,max)
Cette fonction retourne les maxiemes lettre de text et ajoute "..." si le text est plus grand
=========================================================*/
function printer(text,max){
    
    if (text.length >max)
      return text.substring(0,max)+"..."; 
    else
      return text; 
}

/*=======================================================
autoplaystart(int xsecs)
Cette fonction lance automatiquement une playlist apres "x" secs
=========================================================*/
function autoplaystart(){
    //Temps avant la lecture de la playlist
    document.getElementById('autoplaydiv').style.display="";
    //Temps de rafraichissement du chrono (toutes les secondes)
    irefresh=1000;
    one.autoplaysecstmp-=1;
    // On décrémente le chorno
    document.getElementById("autoplaydiv").innerHTML="Autoplay in "+one.autoplaysecstmp+". <a style=\"color:#848484;\" href=\"javascript:one.mew_autoplay=false;exit(1);\">Click here to stop</a> ";
   
   // on test si on arrete l auto play
   if (!one.mew_autoplay)
   {
   one.autoplaysecstmp=one.autoplaysecs+1;
   document.getElementById("autoplaydiv").style.display="none";
   }
   else
   	if(one.autoplaysecstmp >0)
   setTimeout('autoplaystart()',irefresh); 
   else 
   {
   	//On lance la lecture de la playlist
   document.getElementById("autoplaydiv").style.display="none";
   	one.mew_autoplay=false;
   	one.autoplaysecstmp=one.autoplaysecs+1;
    one.mew_PlayP();
  }
}


/*=======================================================
pasteValue(obj, destination, exp)
Cette fonction rajoute la valeur de obj à celle de destination separée par une virgule si l'objet si obj est different de exp
=========================================================*/
function pasteValue(obj, destination, exp){
   
   if ((obj.value !=exp) & (destination.value.indexOf(obj.value)==-1)){
      if (destination.value !="")
        destination.value=destination.value+"; "+obj.value;
      else
        destination.value=obj.value;
      
   }

}

/*=======================================================
strInText(texte, champ)
cette fonction test si une champ appartient au texte
=========================================================*/
function strInText(texte, champ){
    var reg1=new RegExp(champ,"g");
    return (reg1.test(texte))
}


// Cette fonction permet de vérifier la validité d'une date au format jj/mm/aa ou jj/mm/aaaa
function isDate(d) {
    
     if (d == "") // si la variable est vide on retourne faux
     return false;
    
    
    
     //e = new RegExp("^[0-9]{1,2}\/[0-9]{1,2}\/([0-9]{2}|[0-9]{4})$");
    e = new RegExp("^([0-9]{2}|[0-9]{4})-[0-9]{1,2}-[0-9]{1,2}$");
    
     if (!e.test(d)) // On teste l'expression régulière pour valider la forme de la date
     return false; // Si pas bon, retourne faux
    
     // On sépare la date en 3 variables pour vérification, parseInt() converti du texte en entier
     j = parseInt(d.split("-")[2], 10); // jour
     m = parseInt(d.split("-")[1], 10); // mois
     a = parseInt(d.split("-")[0], 10); // année
     //alert ( j+"-"+m+"-"+a);
    
     // Si l'année n'est composée que de 2 chiffres on complète automatiquement
     if (a < 1000) {
     if (a < 89) a+=2000; // Si a < 89 alors on ajoute 2000 sinon on ajoute 1900
     else a+=1900;
     }
    
     // Définition du dernier jour de février
     // Année bissextile si annnée divisible par 4 et que ce n'est pas un siècle, ou bien si divisible par 400
     if (a%4 == 0 && a%100 !=0 || a%400 == 0) fev = 29;
     else fev = 28;
    
     // Nombre de jours pour chaque mois
     nbJours = new Array(31,fev,31,30,31,30,31,31,30,31,30,31);
    
     // Enfin, retourne vrai si le jour est bien entre 1 et le bon nombre de jours, idem pour les mois, sinon retourn faux
     return ( m >= 1 && m <=12 && j >= 1 && j <= nbJours[m-1] );
     }
     

// cette fontion retourne la date jj/mm/aaaa au format aaaa-mm-jj (base sql) 
function phpDate(d) {
     
     if (isDate(d)){
     // On sépare la date en 3 variables pour vérification, parseInt() converti du texte en entier
     j = parseInt(d.split("/")[0], 10); // jour
     m = parseInt(d.split("/")[1], 10); // mois
     a = parseInt(d.split("/")[2], 10); // année
     return a+"-"+m+"-"+j;
     }
     return "yyyy-mm-dd";
     }

/*=======================================================
Cette fonction retourne le code html des tags d'une page. Elle prend en entrée la liste des tags 
=========================================================*/
function mew_listTags(str) {
	//alert (str);
  result="";
  c=0;
  b=false;
  tag="";
  //On remplace les , par des ;
  str=str.replace(",",";");

  if(str!="")
  {  
  //On découpe les tags par le séparateur ;
  tag=str.split(";")[c];
  b=( tag !=undefined) & (tag !="");
  while( b){
  	//alert(tag);
  	if(c>0)
  	result+=", ";
  	result+="<a href=\"#\" onclick=\"javascript:mew_Search('"+tag+"'); return false;\" class=\"tagFont\">"+tag+"</a> ";
    c=c+1;
    str=str.replace(',',';');
  	tag=str.split(";")[c];
    b=( tag !=undefined) & (tag !='');
  	
  }
  }
  return result;
}

/*=======================================================
Confirmation de suppression
=========================================================*/
function confirmDelete(delUrl, message) {
    if (confirm(message)) {
		document.location = delUrl;
}
}

/*=======================================================
test javascript du minimum de connexion
=========================================================*/
function isuser() {
  
  return ( (one.mew_user.login !='user') ) 
  
}

/*=======================================================
Confirmation de suppression
=========================================================*/
function confirmDeleteAjax(urlcible, divid, actioncible, params , javaok,  message) {
	  
	  //On redirige a la page de login si le candidat n est pas connecte
	  if (!isuser()){
	  document.location="f_join.php";
	  return false;
	  }
	
    if (confirm(message)) {
   // alert ("url="+urlcible);
   // alert ("divid="+divid);
   // alert ("actioncible="+actioncible);
   // alert ("params="+params);
   // alert ("send_request("+urlcible+","+divid+","+actioncible+","+params+","+javaok);	
		
	 send_request(urlcible, divid, actioncible, params, javaok);
		//send_request(urlcible, divid, actioncible, params, "");
}
}

/*=======================================================
Page de demarrage
=========================================================*/
function HomePage(obj)
	{
	obj.style.behavior='url(#default#homepage)';
	obj.setHomePage('http://localhost/mewob/');
	}

/*=======================================================
Cette fonction redirige vers la playlist news d un pays
=========================================================*/
function worldNewsgo(pays){ 
	switch (pays){
		case 'Belgique' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_0"; break;case 'Croacia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_1"; break;case 'Deutschland' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_2"; break;case 'Dinamarca' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_3"; break;case 'England' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_4"; break;case 'España' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_5"; break;case 'France' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_6"; break;case 'Grecia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_7"; break;case 'Holanda' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_8"; break;case 'Irlanda' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_9"; break;case 'Islandia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_10"; break;case 'Luxemburgo' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_11"; break;case 'Malta' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_12"; break;case 'Monaco' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_13"; break;case 'Noruega' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_14"; break;case 'Polonia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_15"; break;case 'Portugal' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_16"; break;case 'República Checa' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_17"; break;case 'Rumania' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_18"; break;case 'Rusia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_19"; break;case 'Suecia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_20"; break;case 'Switzerland' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_21"; break;case 'Turquia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_22"; break;case 'Ucrania' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_23"; break;case 'Yugoslavia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews0_24"; break;case 'Canada' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews1_0"; break;case 'USA' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews1_1"; break;case 'Argentina' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews2_0"; break;case 'Asunción' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews2_1"; break;case 'Bahamas' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews2_2"; break;case 'Brasil' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews2_3"; break;case 'Chilie' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews2_4"; break;case 'Colombia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews2_5"; break;case 'Costa Rica' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews2_6"; break;case 'Cuba' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews2_7"; break;case 'Ecuador' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews2_8"; break;case 'Jamaica' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews2_9"; break;case 'México' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews2_10"; break;case 'Panamá' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews2_11"; break;case 'Perú' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews2_12"; break;case 'Puerto Rico' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews2_13"; break;case 'Republica Dominicana' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews2_14"; break;case 'Uruguay' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews2_15"; break;case 'Algérie' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_0"; break;case 'Angola' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_1"; break;case 'Burkina Faso' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_2"; break;case 'Bénin' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_3"; break;case 'Cameroun' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_4"; break;case 'Cape Verde' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_5"; break;case 'Congo' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_6"; break;case 'Côte d Ivoire' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_7"; break;case 'Ethiopia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_8"; break;case 'Gabon' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_9"; break;case 'Gambie' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_10"; break;case 'Ghana' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_11"; break;case 'Guinée' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_12"; break;case 'Guinée Bissau' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_13"; break;case 'Guinée Equatoriale' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_14"; break;case 'Kenya' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_15"; break;case 'Liberia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_16"; break;case 'Libia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_17"; break;case 'Madagascar' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_18"; break;case 'Malawi' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_19"; break;case 'Mali' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_20"; break;case 'Maroc' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_21"; break;case 'Mauritanie' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_22"; break;case 'Mozambique' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_23"; break;case 'Namibia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_24"; break;case 'Nigeria' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_25"; break;case 'Somalia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_26"; break;case 'Soudan' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_27"; break;case 'South africa' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_28"; break;case 'Sénégal' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_29"; break;case 'Tanzania' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_30"; break;case 'Tchad' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_31"; break;case 'Togo' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_32"; break;case 'Tunisie' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_33"; break;case 'Uganda' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_34"; break;case 'Zambia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_35"; break;case 'Zimbabwe' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews3_36"; break;case 'Afghanistan' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_0"; break;case 'Australia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_1"; break;case 'Bangladesh' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_2"; break;case 'Cambodia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_3"; break;case 'China' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_4"; break;case 'Fiji' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_5"; break;case 'Hong Kong' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_6"; break;case 'India' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_7"; break;case 'Japón' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_8"; break;case 'Kazakhstan' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_9"; break;case 'Macao ' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_10"; break;case 'Malaysia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_11"; break;case 'Maldive' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_12"; break;case 'Mongolia' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_13"; break;case 'Nepal' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_14"; break;case 'New Zealand' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_15"; break;case 'North Korea' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_16"; break;case 'Pakistan' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_17"; break;case 'Papua-New-Guinea' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_18"; break;case 'Philippines' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_19"; break;case 'Vietnam' : document.location="f_playlist.php?mewmod=worldnews&wpls=mewNews4_20"; break;
		}
};

/*======================================================
strIn test si la clé est dans un text
========================================================*/
function  strIn(key,text){
textt = text.toLowerCase();
return (textt.indexOf(key.toLowerCase(),0) >= 0);
}   

/*======================================================
tourl(url)
entree: url (String)
sortie: url valide (String)
========================================================*/
function  tourl(url){
r="";

if (url !="") {


  if( (url.indexOf("http:",0)==0) || (url.indexOf("https:",0)==0) || (url.indexOf("sftp:",0)==0) || (url.indexOf("ftp:",0)==0) || (url.indexOf("smtp:",0)==0) || (url.indexOf("ssh:",0)==0) || (url.indexOf("pop:",0)==0) || (url.indexOf("ssl:",0)==0) )
  r=url;
  else
   {
    if ((url.indexOf('.',0)) < 0)
    url = url+".com"; 

    if(url.indexOf("www.")==0)
    r = "http://"+url;
    else
    r = "http://www."+url;
    }
}
return r; 
}   


function showbox(id){
	
	if (document.getElementById(id).style.display !="none")
	document.getElementById(id).style.display ='none';
	else
	document.getElementById(id).style.display ='';
}

    
