var addthis_pub="filigranes";function VideoDetail(a){this.DivID=a;this.RootUrl="http://www.filigranes.be/";this.wymEditor;var e=document.getElementsByTagName("head")[0];if(e){var b=e.getElementsByTagName("script");var j=e.getElementsByTagName("link");var c=false;var g=false;for(var d=0;d<b.length;d++){var f=b[d];if(f.src.indexOf("date.js")>0){c=true}if(f.src.indexOf("common.js")>0){g=true}if(g==true&&c==true){break}}if(c==false){var h=document.createElement("script");h.type="text/javascript";h.src=this.RootUrl+"js/methods/date.js";e.appendChild(h)}if(g==false){var h=document.createElement("script");h.type="text/javascript";h.src=this.RootUrl+"js/methods/common.js";e.appendChild(h)}}this.VideoID=GetParam("clip")}GetVideoDetail=function(c){if(c.VideoID&&c.VideoID!=""){if(c.DivID&&document.getElementById(c.DivID)){imgLoad=document.createElement("div");imgLoad.id="loading_"+c.DivID;imgLoad.className="ImageLoading";document.getElementById(c.DivID).appendChild(imgLoad)}var g=document.getElementsByTagName("head")[0];if(g){var d=g.getElementsByTagName("script");var e=false;for(var f=0;f<d.length;f++){var j=d[f];if(j.src=="http://s7.addthis.com/js/200/addthis_widget.js"){e=true;break}}if(e==false){var k=document.createElement("script");k.type="text/javascript";k.src="http://s7.addthis.com/js/200/addthis_widget.js";g.appendChild(k)}var d=g.getElementsByTagName("script");var l=g.getElementsByTagName("link");var e=false;var a=false;for(var f=0;f<d.length;f++){var j=d[f];if(j.src.indexOf("rating.js")>0){e=true;break}}for(var f=0;f<l.length;f++){var h=l[f];if(h.href.indexOf("rating.css")>0){a=true;break}}if(e==false){var k=document.createElement("script");k.type="text/javascript";k.src=c.RootUrl+"js/rating.js";g.appendChild(k)}if(a==false){var b=document.createElement("link");b.type="text/css";b.href=c.RootUrl+"css/rating.css";b.rel="stylesheet";g.appendChild(b)}}new Ajax.Request(c.RootUrl+"VimeoWidget.ashx",{method:"get",onSuccess:function(i){c.OnGetVideoDetailData(i)},onFailure:function(){c.OnGetVideoDetailData()},parameters:{ms:new Date().getTime(),ID:c.VideoID,type:"detail"}})}};VideoDetail.prototype.OnGetVideoDetailData=function(v){var A=this;if(v&&v.responseXML){var w=v.responseXML.getElementsByTagName("clip");if(w&&w.length){var e=w[0];var q="";if(e.getElementsByTagName("clip_id")&&e.getElementsByTagName("clip_id").length>0&&e.getElementsByTagName("clip_id")[0].firstChild){q=e.getElementsByTagName("clip_id")[0].firstChild.nodeValue}var u="";if(e.getElementsByTagName("title")&&e.getElementsByTagName("title").length>0&&e.getElementsByTagName("title")[0].firstChild){u=e.getElementsByTagName("title")[0].firstChild.nodeValue}var c="";if(e.getElementsByTagName("url")&&e.getElementsByTagName("url").length>0&&e.getElementsByTagName("url")[0].firstChild){c=e.getElementsByTagName("url")[0].firstChild.nodeValue}var r="";if(e.getElementsByTagName("caption")&&e.getElementsByTagName("caption").length>0&&e.getElementsByTagName("caption")[0].firstChild){r=e.getElementsByTagName("caption")[0].firstChild.nodeValue}var p="300";if(e.getElementsByTagName("width")&&e.getElementsByTagName("width").length>0&&e.getElementsByTagName("width")[0].firstChild){p=e.getElementsByTagName("width")[0].firstChild.nodeValue}var l="";if(e.getElementsByTagName("tags")&&e.getElementsByTagName("tags").length>0&&e.getElementsByTagName("tags")[0].firstChild){l=e.getElementsByTagName("tags")[0].firstChild.nodeValue}var a=new Array();var z=l.toLowerCase().split(",");for(var s=0;s<z.length;s++){if(z[s].indexOf("ean=")>=0){a.push(z[s].substr(5,z[s].length-5))}}document.title=u.replace(/filiGranes.tv,/i,"");if(document.getElementById(this.DivID)){var n=document.getElementById(this.DivID);divDetail=document.createElement("div");divBooks=document.createElement("div");divBooks.id="DivBooks";booksTitle=document.createElement("h1");booksTitle.innerHTML="Les livres liés à cette vidéo !";divBooks.appendChild(booksTitle);imgLoadBooks=document.createElement("div");imgLoadBooks.id="loading_"+A.DivID+"_Books";imgLoadBooks.className="ImageLoading";divBooks.appendChild(imgLoadBooks);divFiligranautesComment=document.createElement("div");divFiligranautesComment.id="DivFiligranaute";filigranautesCommentTitle=document.createElement("h1");filigranautesCommentTitle.appendChild(document.createTextNode("Les avis des filigranautes !"));divFiligranautesComment.appendChild(filigranautesCommentTitle);imgLoadFiligranaute=document.createElement("div");imgLoadFiligranaute.id="loading_"+A.DivID+"_Filigranaute";imgLoadFiligranaute.className="ImageLoading";divFiligranautesComment.appendChild(imgLoadFiligranaute);divYourComment=document.createElement("div");divYourComment.id="DivYourComment";var h=document.createElement("div");h.id="DivYourCommentArea";yourCommentTitle=document.createElement("h1");yourCommentTitle.appendChild(document.createTextNode("Votre avis nous intéresse !"));divYourComment.appendChild(yourCommentTitle);divYourComment.appendChild(h);var t=false;if(GetCookie("Mail")){t=true;textArea=document.createElement("textarea");textArea.id="txtYourComment";textArea.setAttribute("rows","1");h.appendChild(textArea);setTimeout(function(){jQuery(function(){jQuery("#txtYourComment").wymeditor({toolsItems:[{name:"Bold",title:"Strong",css:"wym_tools_strong"},{name:"Italic",title:"Emphasis",css:"wym_tools_emphasis"},{name:"InsertOrderedList",title:"Ordered_List",css:"wym_tools_ordered_list"},{name:"InsertUnorderedList",title:"Unordered_List",css:"wym_tools_unordered_list"},{name:"Indent",title:"Indent",css:"wym_tools_indent"},{name:"Outdent",title:"Outdent",css:"wym_tools_outdent"},{name:"CreateLink",title:"Link",css:"wym_tools_link"},{name:"Unlink",title:"Unlink",css:"wym_tools_unlink"}],boxHtml:"<div class='wym_box'><div class='wym_area_top'>"+WYMeditor.TOOLS+"</div><div class='wym_area_left'></div><div class='wym_area_right'></div><div class='wym_area_main'>"+WYMeditor.HTML+WYMeditor.IFRAME+WYMeditor.STATUS+"</div><div class='wym_area_bottom'></div></div>",postInit:function(B){A.wymEditor=B;var i="<li class='wym_tools_newbutton'><a name='Save' href='#' alt='Envoyer' style='background-image: url(http://www.filigranes.be/Images/WymEditor/envoyer.gif);width:78px;'>Sauvegarder votre commentaire</a></li>";jQuery(B._box).find(B._options.toolsSelector+B._options.toolsListSelector).append(i);jQuery(B._box).find("li.wym_tools_newbutton a").click(function(){A.SaveComment();return(false)})}})})},500)}else{h.appendChild(document.createTextNode("Veuillez vous connecter afin de saisir votre commentaire"))}var m=document.createElement("div");m.id="HeaderDetailTitle";var d=document.createElement("div");d.className="DivHeader";d.appendChild(document.createTextNode(u.replace(/filiGranes.tv,/i,"")));m.appendChild(d);divDetail.appendChild(m);divActions=document.createElement("div");divActions.id="Actions";m.appendChild(divActions);aFavorite=document.createElement("a");aFavorite.setAttribute("href","#VideoFavorite");imgFavorite=document.createElement("img");aFavorite.id="BookMark";imgFavorite.src=this.RootUrl+"Images/BookDetail/bookmark.png";imgFavorite.style.border="none";aFavorite.appendChild(imgFavorite);divActions.appendChild(aFavorite);var j=document.createElement("a");j.href="#AddThis";j.onmouseover=function(){return addthis_open(this,"",document.url,document.title)};j.onmouseout=function(){addthis_close()};j.onclick=function(){return addthis_sendto()};imgAddThis=document.createElement("img");imgAddThis.src="http://s7.addthis.com/static/btn/sm-plus.gif";imgAddThis.style.border="0";imgAddThis.style.width="16";imgAddThis.style.heigth="16";j.appendChild(imgAddThis);divActions.appendChild(j);var y=document.createElement("div");y.id="clip_"+q;y.className="DivVideo";var f=document.createElement("div");f.id="loading_"+videoDetail.DivID+"_clip";f.className="ImageLoading";y.appendChild(f);divDetail.appendChild(y);var o=document.createElement("span");o.appendChild(document.createTextNode("Vos votes : "));divDetail.appendChild(o);divRating=document.createElement("div");divRating.id="ratingDetail"+q;divDetail.appendChild(divRating);var g=new Rating("ratingDetail"+q,q,"Video",5,true,false);g.Init();var b=document.createElement("div");b.innerHTML=r;divDetail.appendChild(b);n.appendChild(divDetail);if(a.length>0){n.appendChild(divBooks)}n.appendChild(divFiligranautesComment);n.appendChild(divYourComment);addBookmarkObj.convert("BookMark");A.GetVideoVimeoData(q,p);A.GetBookFiligranautesComment();A.GetBooksTitle(a);if(t==false){var x=document.createElement("div");x.id="login_videodetail";document.getElementById("DivYourCommentArea").appendChild(x);var k=new Login("login_videodetail");k.Init();k.OnLoginSucceedEvent=OnLoginSucceedVideo;k.LoginParentModule=A}}}}if(this.DivID){if(document.getElementById("loading_"+this.DivID)){document.getElementById("loading_"+this.DivID).style.display="none"}}};OnLoginSucceedVideo=function(b){if(document.getElementById("DivYourCommentArea")){var a=document.getElementById("DivYourCommentArea");if(GetCookie("Mail")){while(a.childNodes.length>=1){a.removeChild(a.firstChild)}isLogged=true;textArea=document.createElement("textarea");textArea.id="txtYourComment";textArea.setAttribute("rows","1");a.appendChild(textArea);setTimeout(function(){jQuery(function(){jQuery("#txtYourComment").wymeditor({toolsItems:[{name:"Bold",title:"Strong",css:"wym_tools_strong"},{name:"Italic",title:"Emphasis",css:"wym_tools_emphasis"},{name:"InsertOrderedList",title:"Ordered_List",css:"wym_tools_ordered_list"},{name:"InsertUnorderedList",title:"Unordered_List",css:"wym_tools_unordered_list"},{name:"Indent",title:"Indent",css:"wym_tools_indent"},{name:"Outdent",title:"Outdent",css:"wym_tools_outdent"},{name:"CreateLink",title:"Link",css:"wym_tools_link"},{name:"Unlink",title:"Unlink",css:"wym_tools_unlink"}],boxHtml:"<div class='wym_box'><div class='wym_area_top'>"+WYMeditor.TOOLS+"</div><div class='wym_area_left'></div><div class='wym_area_right'></div><div class='wym_area_main'>"+WYMeditor.HTML+WYMeditor.IFRAME+WYMeditor.STATUS+"</div><div class='wym_area_bottom'></div></div>",postInit:function(d){b.wymEditor=d;var c="<li class='wym_tools_newbutton'><a name='Save' href='#' alt='Envoyer' style='background-image: url(http://www.filigranes.be/Images/WymEditor/envoyer.gif);width:78px'>Sauvegarder votre commentaire</a></li>";jQuery(d._box).find(d._options.toolsSelector+d._options.toolsListSelector).append(c);jQuery(d._box).find("li.wym_tools_newbutton a").click(function(){b.SaveComment();return(false)})}})})},500)}}};VideoDetail.prototype.GetBooksTitle=function(d){var b=this;for(var a=0;a<d.length;a++){var c=d[a];new Ajax.Request(b.RootUrl+"BookDetail.ashx",{method:"get",onSuccess:function(e){b.GetBooksTitleSucceed(e)},onFailure:function(){b.GetBooksTitleFailed()},parameters:{ms:new Date().getTime(),ean:c,type:"detail"}})}};VideoDetail.prototype.GetBooksTitleSucceed=function(g){if(g&&g.responseXML){if(document.getElementById("DivBooks")){var e="";var b="";var f="";if(g.responseXML.getElementsByTagName("recordreference")&&g.responseXML.getElementsByTagName("recordreference").length>0&&g.responseXML.getElementsByTagName("recordreference")[0].firstChild){f=g.responseXML.getElementsByTagName("recordreference")[0].firstChild.nodeValue}if(g.responseXML.getElementsByTagName("title")&&g.responseXML.getElementsByTagName("title").length>0){var d=g.responseXML.getElementsByTagName("title")[0];if(d.getElementsByTagName("titletext")&&d.getElementsByTagName("titletext").length>0&&d.getElementsByTagName("titletext")[0].firstChild){e=d.getElementsByTagName("titletext")[0].firstChild.nodeValue}if(d.getElementsByTagName("subtitle")&&d.getElementsByTagName("subtitle").length>0&&d.getElementsByTagName("subtitle")[0].firstChild){b=d.getElementsByTagName("subtitle")[0].firstChild.nodeValue}}if(b&&b!=""){e=e+" ("+b+")"}var c=document.createElement("div");c.className="BookUrl";var a=document.createElement("a");a.href=this.RootUrl+"fr/details-livre/index.htm?book="+f;a.target="_self";a.appendChild(document.createTextNode(e));c.appendChild(a);document.getElementById("DivBooks").appendChild(c)}}if(document.getElementById("loading_"+this.DivID+"_Books")){document.getElementById("loading_"+this.DivID+"_Books").style.display="none"}};VideoDetail.prototype.GetBooksTitleFailed=function(){if(document.getElementById("loading_"+this.DivID+"_Books")){document.getElementById("loading_"+this.DivID+"_Books").style.display="none"}};VideoDetail.prototype.GetVideoVimeoData=function(c,a){var b=this;new Ajax.Request(this.RootUrl+"VimeoWidget.ashx",{method:"get",onSuccess:function(d){b.OnGetVideoData(d,c)},onFailure:function(){videoDetail.OnGetVideoDetailData()},parameters:{ms:new Date().getTime(),id:c,width:a}})};VideoDetail.prototype.OnGetVideoData=function(h,g){if(h&&h.responseXML){var f=h.responseXML;var b=h.responseXML.getElementsByTagName("oembed");if(b&&b.length>0){var c=b[0].getElementsByTagName("html");if(c&&c.length>0){try{if(document.getElementById("clip_"+g)){var a=c[0].firstChild.nodeValue;if(a.indexOf("</object>")>0){a=a.substr(0,a.indexOf("</object>"))+'<param name="wmode" value="transparent" />'+a.substr(a.indexOf("</object>"))}document.getElementById("clip_"+g).innerHTML=a;if(document.getElementById("loading_"+videoDetail.DivID+"_clip")){document.getElementById("loading_"+videoDetail.DivID+"_clip").style.display="none"}}}catch(d){alert(d)}}}}else{}};VideoDetail.prototype.GetBookFiligranautesComment=function(){var a=this;new Ajax.Request(this.RootUrl+"FiligranauteComment.ashx",{method:"get",onSuccess:function(b){a.OnGetBookFiligranautesComment(b)},onFailure:function(){a.OnGetBookFiligranautesCommentFailed(transport)},parameters:{ms:new Date().getTime(),Reference:a.VideoID,MediaType:"Video",Validated:"true"}})};VideoDetail.prototype.OnGetBookFiligranautesComment=function(d){if(document.getElementById("DivFiligranaute")){var j=document.getElementById("DivFiligranaute");if(d&&d.responseXML){var g=d.responseXML;var k=g.getElementsByTagName("Comment");for(var f=0;f<k.length;f++){var a=k[f];var h="";var c=new Date();var e="";var m="";if(a.attributes.getNamedItem("Date")){var b=a.attributes.getNamedItem("Date").nodeValue;year=b.substr(0,4);month=b.substr(5,2);if(month.indexOf("0")=="0"){month=month.substr(1,1)}day=b.substr(8,2);if(day.indexOf("0")=="0"){day=day.substr(1,1)}hour=b.substr(11,2);if(hour.indexOf("0")=="0"){hour=hour.substr(1,1)}minute=b.substr(14,2);if(minute.indexOf("0")=="0"){minute=minute.substr(1,1)}c=new Date(parseInt(year),parseInt(month)-1,parseInt(day),parseInt(hour),parseInt(minute),0,0)}if(a.attributes.getNamedItem("Comment")){h=a.attributes.getNamedItem("Comment").nodeValue}var l=a.getElementsByTagName("User");if(l.length>0){if(l[0].attributes.getNamedItem("Avatar")){m=l[0].attributes.getNamedItem("Avatar").nodeValue}if(l[0].attributes.getNamedItem("Pseudo")){e=l[0].attributes.getNamedItem("Pseudo").nodeValue}}if(e!=""){divCommentContent=document.createElement("div");divCommentContent.className="CommentContainer";divUser=document.createElement("div");divComment=document.createElement("div");if(m!=""){imgAvatar=document.createElement("img");imgAvatar.src=m;divUser.appendChild(imgAvatar)}c.format("");divUser.appendChild(document.createTextNode("Posté par "+htmlToAccent(e)+", le "+c.format("dd/mm/yyyy")+" à "+c.format("HH:MM")));divComment.innerHTML=h;divCommentContent.appendChild(divUser);divCommentContent.appendChild(divComment);j.appendChild(divCommentContent)}}}}if(document.getElementById("loading_"+this.DivID+"_Filigranaute")){document.getElementById("loading_"+this.DivID+"_Filigranaute").style.display="none"}};VideoDetail.prototype.OnGetBookFiligranautesCommentFailed=function(a){if(document.getElementById("loading_"+this.DivID+"_Filigranaute")){document.getElementById("loading_"+this.DivID+"_Filigranaute").style.display="none"}};VideoDetail.prototype.SaveComment=function(){var c=this;if(GetCookie("Mail")){var g=removeHTMLTags(this.wymEditor.html());g=g.split(" ").join("").split("&nbsp;").join("").split("\r\n").join("");if(g.length>0){var e="<CommentParam>";e+="<Reference>"+this.VideoID+"</Reference>";e+="<MediaType>Video</MediaType>";e+="<Mail>"+GetCookie("Mail")+"</Mail>";var f=this.wymEditor.xhtml();e+="<Comment>"+Base64.encode(accentToHTML(this.wymEditor.html()))+"</Comment>";e+="</CommentParam>";e=Base64.encode(e);var f=accentToHTML(this.wymEditor.html());new Ajax.Request(this.RootUrl+"SaveComment.ashx",{method:"POST",onSuccess:function(h){c.OnSaveCommentSucceed(h)},onFailure:function(h){c.OnSaveCommentError(h)},postBody:e})}else{this.wymEditor.status("Veuillez saisir votre commentaire !")}}else{var b=document.getElementById("DivYourCommentArea");if(b.hasChildNodes()){while(b.childNodes.length>=1){b.removeChild(b.firstChild)}}var d=document.createElement("div");d.id="login_videodetail";document.getElementById("DivYourCommentArea").appendChild(d);var a=new Login("login_videodetail");a.Init();a.OnLoginSucceedEvent=c.OnLoginSucceed}};VideoDetail.prototype.OnSaveCommentSucceed=function(a){this.wymEditor.html("");this.wymEditor.status("Votre commentaire a été enregistré et doit être validé par un modérateur")};VideoDetail.prototype.OnSaveCommentError=function(a){this.wymEditor.status(a.responseText)};