function wichF($file){
    $posDot = $file.lastIndexOf(".")+1;
    //alert($posDot);
    $rExt=$file.substring($posDot);
    //alert($rExt);
    affPlayer($rExt,$file);
}


function affPlayer($ext,$source){
    switch($ext){
    case "wmv": $lecteur = '<object id=\"video1\" width=\"300px\" height=\"250\" classid=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\"\ncodebase=\"http://activex.microsoft.com/activex/controls/\nmplayer/en/nsmp2inf.cab#Version=6,4,5,715\"\nstandby=\"Chargement...\"\ntype=\"application/x-oleobject\">\n<param name=\"FileName\" value=\"'+$source+'\" />\n<param name=\"AutoStart\" value=\"false\" />\n<embed type=\"application/x-mplayer2\"\npluginspage = \"http://www.microsoft.com/Windows/MediaPlayer/\"\nsrc=\"'+$source+'\"\nname=\"video1\" width=\"300px\" height=\"250\" AutoStart=\"false\">\n</embed>\n</object><br />\n<a href=\"\" onclick=\"document.getElementById(\'zevideo\').innerHTML=\'\'\; return false;\" style=\"display:block;width:2em;margin-left:auto;margin-right: auto;margin-bottom:2em;\">fermer</a>';


/*'<object id=\"video1\" width=300px height=250\n classid=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\"\ncodebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715\"\nstandby=\"Loading...\"\ntype=\"application/x-oleobject\">\n<param name=\"video\" value=\"'+$source+'\">\n<param name=\"AutoStart\" value=\"true\">\n<embed type=\"application/x-mplayer2\"\npluginspage = \"http://www.microsoft.com/Windows/MediaPlayer/\"\nsrc=\"'+$source+'"\nname=\"video1\"\nwidth=300px\nheight=250\nAutoStart=true>\n</embed>\n</object><br />\n<a href=\"\" onclick=\"document.getElementById(\'zevideo\').innerHTML=\'\'\; return false;\" style=\"display:block;width:2em;margin-left:auto;margin-right: auto;margin-bottom:2em;\">fermer</a>';*/
	
	new Insertion.Before('news', "<div id=\"zevideo\" style=\"width: 300px;margin-left: auto; margin-right: auto;\"></div>");
	document.getElementById('zevideo').innerHTML=$lecteur;
	break;

    case "avi":$lecteur = '<object id=\"video1\" width=\"300px\" height=\"250\" classid=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\"\ncodebase=\"http://activex.microsoft.com/activex/controls/\nmplayer/en/nsmp2inf.cab#Version=6,4,5,715\"\nstandby=\"Chargement...\"\ntype=\"application/x-oleobject\">\n<param name=\"FileName\" value=\"'+$source+'\" />\n<param name=\"AutoStart\" value=\"false\" />\n<embed type=\"application/x-mplayer2\"\npluginspage = \"http://www.microsoft.com/Windows/MediaPlayer/\"\nsrc=\"'+$source+'\"\nname=\"video1\" width=\"300px\" height=\"250\" AutoStart=\"false\">\n</embed>\n</object><br />\n<a href=\"\" onclick=\"document.getElementById(\'zevideo\').innerHTML=\'\'\; return false;\" style=\"display:block;width:2em;margin-left:auto;margin-right: auto;margin-bottom:2em;\">fermer</a>';

/*'<object id=\"video1\" width=300px height=250\n classid=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\"\ncodebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715\"\nstandby=\"Loading...\"\ntype=\"application/x-oleobject\">\n<param name=\"video\" value=\"'+$source+'\">\n<param name=\"AutoStart\" value=\"false\">\n<embed type=\"application/x-mplayer2\"\npluginspage = \"http://www.microsoft.com/Windows/MediaPlayer/\"\nsrc=\"'+$source+'"\nname=\"video1\"\nwidth=300px0\nheight=250\nAutoStart=false>\n</embed>\n</object><br /><a href=\"\" onclick=\"document.getElementById(\'zevideo\').innerHTML=\'\'\; return false;\" style=\"display:block;width:2em;margin-left:auto;margin-right: auto;margin-bottom:2em;\">fermer</a>';*/
	//document.write($lecteur);
	new Insertion.Before('news', "<div id=\"zevideo\" style=\"width: 300px;margin-left: auto; margin-right: auto;\"></div>");
	document.getElementById('zevideo').innerHTML=$lecteur;
	break;

    case"mov":$lecteur = '<object id=\"video1\" width=\"300px\" height=\"250\" classid=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\"\ncodebase=\"http://activex.microsoft.com/activex/controls/\nmplayer/en/nsmp2inf.cab#Version=6,4,5,715\"\nstandby=\"Chargement...\"\ntype=\"application/x-oleobject\">\n<param name=\"FileName\" value=\"'+$source+'\" />\n<param name=\"AutoStart\" value=\"false\" />\n<embed type=\"application/x-mplayer2\"\npluginspage = \"http://www.microsoft.com/Windows/MediaPlayer/\"\nsrc=\"'+$source+'\"\nname=\"video1\" width=\"300px\" height=\"250\" AutoStart=\"false\">\n</embed>\n</object><br />\n<a href=\"\" onclick=\"document.getElementById(\'zevideo\').innerHTML=\'\'\; return false;\" style=\"display:block;width:2em;margin-left:auto;margin-right: auto;margin-bottom:2em;\">fermer</a>';

/*'<object id=\"video1\" width=350 height=250\n classid=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\"\ncodebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715\"\nstandby=\"Loading...\"\ntype=\"application/x-oleobject\">\n<param name=\"video\" value=\"'+$source+'\">\n<param name=\"AutoStart\" value=\"false\">\n<embed type=\"application/x-mplayer2\"\npluginspage = \"http://www.microsoft.com/Windows/MediaPlayer/\"\nsrc=\"'+$source+'"\nname=\"video1\"\nwidth=350\nheight=250\nAutoStart=false>\n</embed>\n</object><br /><a href=\"\" onclick=\"document.getElementById(\'zevideo\').innerHTML=\'\'\; return false;\" style=\"display:block;width:2em;margin-left:auto;margin-right: auto;margin-bottom:2em;\">fermer</a>';*/
	//document.write($lecteur);
	new Insertion.Before('news', "<div id=\"zevideo\" style=\"width: 300px;margin-left: auto; margin-right: auto;\"></div>");
	document.getElementById('zevideo').innerHTML=$lecteur;
	break;

    case "flv": $lecteur = '<object type=\"application/x-shockwave-flash\" data=\"player_flv.swf\" width=\"400\" height=\"250\">\n<param name=\"movie\" value=\"player_flv.swf\" />\n<param name=\"FlashVars\" value=\"flv='+$source+'\" />\n<param name=\"wmode\" value=\"transparent\" />\n</object><br /><a href=\"\" onclick=\"document.getElementById(\'zevideo\').innerHTML=\'\'\; return false;\" style=\"display:block;width:2em;margin-left:auto;margin-right: auto;margin-bottom:2em;\">fermer</a>';
	new Insertion.Before('news', "<div id=\"zevideo\" style=\"width: 400px;margin-left: auto; margin-right: auto;\"></div>");
	document.getElementById('zevideo').innerHTML=$lecteur;
	break;

    case "swf": $lecteur = '<object width=\"400\" height=\"250\" >\n<param name=\"movie\" value=\"'+$source+'\">\n<embed src=\"'+$source+'\" width=\"400\" height=\"250\">\n</embed>\n</object><br /><a href=\"\" onclick=\"document.getElementById(\'zevideo\').innerHTML=\'\'\; return false;\" style=\"display:block;width:2em;margin-left:auto;margin-right: auto;margin-bottom:2em;\">fermer</a>';
new Insertion.Before('news', "<div id=\"zevideo\" style=\"width: 400px;margin-left: auto; margin-right: auto;\"></div>");
	document.getElementById('zevideo').innerHTML=$lecteur;
	break;

    case "mp3":$lecteur = '<object type=\"application/x-shockwave-flash\" data=\"player_mp3_0.9.4.swf\" width=\"400\" height=\"20\">\n<param name=\"movie\" value=\"player_mp3_0.9.4.swf\" />\n<param name=\"FlashVars\" value=\"mp3='+$source+'&amp;showstop=1&amp;showinfo=1\" />\n</object><br /><a href=\"\" onclick=\"document.getElementById(\'zevideo\').innerHTML=\'\'\; return false;\" style=\"display:block;width:2em;margin-left:auto;margin-right: auto;margin-bottom:2em;\">fermer</a>';
	new Insertion.Before('news', "<div id=\"zevideo\" style=\"width: 400px;margin-left: auto; margin-right: auto;\"></div>");
	document.getElementById('zevideo').innerHTML=$lecteur;
	break;
    default: window.open($source);
	break;
    }
}



