﻿function CreateBookmarkLink(url,title)
    {

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
    }

/////////////////////////GESTION DES BOUTON ENTRER SUR LES FORM//////////////////
function KeyCheck(e) 
    { 
    var IE5 = false; 

    if (!e) var e = window.event; 
    if (e.keyCode) { IE5= true; code = e.keyCode;} 
    else if (e.which) code = e.which ; 

    if (code==13) 
        { 
        if(document.form1.ChampSubmit.value!='')
            {
            eval(document.form1.ChampSubmit.value);
            }
        } 
    } 

function StockInput(NameFunction)
    {
    document.form1.ChampSubmit.value=NameFunction;
    }
    
function DeStockInput()
    {            
    document.form1.ChampSubmit.value='';
    }    
////////////////////////////////////////////////////////////////////////////////////

function ViewMentionLega()
    {
    XHR_MentionLegal();
    }    

function viewLoader()
    {
    //alert(document.body.clientHeight);
    afficher('divChargement');
    }
    
function EndLoader()
    {
    cacher('divChargement');
    }

function StyleBackgroundResult()
    {
    document.body.style.background='url(/_Images/bodybgresult.jpg) no-repeat top center #000';
    document.body.style.height='100%';
    }
      
function ManageBackgroundSite()
    {
    if(document.body.style.background.indexOf('bodybgresult')>1)
        {
        document.body.style.background='url(/_Images/bodybg.jpg) no-repeat top center #000';
        document.body.style.height='100%';
        }
    }        
////////////////////////////////GESTION PLAYER FLASH A LA UNE//////////////////////////////////    
function RefreshDescriptifVideo(IdVideo,IdChaine)
    {
    XHR_ViewsDescriptifVideo(IdVideo);
    RolNavChaine(IdChaine);
    }
    
function ShowFooter()
    {
    afficher('LstBannier');
    }
    
function HideFooter()
    {
    cacher('LstBannier');
    Library.closeFooter();
    }    
    
function callOpenCarrousel(idChaine,idVideo)
    {
    getObj('UserControlPages').style.visibility='hidden';
    thisMovie("swfPlayer").openPlayer(idChaine,idVideo);
    }

function callCloseCarrousel()
    {
    thisMovie("swfPlayer").closePlayer("ClosePlayerJs");
    }
    
function ClosePlayerJs()
    {
    ShowFooter();
    getObj('UserControlPages').style.visibility='visible';
    StyleBackgroundResult();
    RewriteNavChaineInAjax();
    EndLoader()
    }
    
function thisMovie(movieName)
    {
    if (navigator.appName.indexOf("Microsoft") != -1)
        {
        return window[movieName];
        }
    else 
        {
        return document[movieName]
        }
    }
//////////////////////////////////////////////////////////////////////////////////////////////////    
    
///////////////////////////////////GESTION DES NOTES//////////////////////////////////////////////
 function ManageNote(Note,IdVdeo,DroitVote)
        {
        
        NoteTotal=5;
        HtmlNote='';
       
        if(DroitVote=="true")
            {
            for (i=1; i<=Note; i++)
                { 
                HtmlNote+='<a href="javascript:XHR_VoteVideo(\''+i+'\',\''+IdVdeo+'\');"><img border=0 src="/_Images/star.gif" width="15" height="15" class="star" id="EtoileNote'+i+'" onmouseout="DeRolNote(\''+Note+'\');" onmouseover="RolNote(\''+i+'\',\''+Note+'\')" alt="'+i+'/'+NoteTotal+'" /></a>';
                } 
            for (x=1; x<=NoteTotal-Note; x++)
                { 
                HtmlNote+='<a href="javascript:XHR_VoteVideo(\''+i+'\',\''+IdVdeo+'\');"><img border=0 src="/_Images/star_off.gif" width="15" height="15" class="star" id="EtoileNote'+i+'" onmouseout="DeRolNote(\''+Note+'\');" onmouseover="RolNote(\''+parseInt(i)+'\',\''+Note+'\')" alt="'+i+'/'+NoteTotal+'" /></a>';
                i++
                }
            }
        else
            {
            for (i=1; i<=Note; i++)
                { 
                HtmlNote+='<img src="/_Images/star.gif"  width="15" height="15" class="star" id="EtoileNote'+i+'"  alt="'+i+'/'+NoteTotal+'" />';
                } 
            for (x=1; x<=NoteTotal-Note; x++)
                { 
                HtmlNote+='<img src="/_Images/star_off.gif"  width="15" height="15" class="star" id="EtoileNote'+i+'" alt="'+i+'/'+NoteTotal+'" />';
                i++
                }
            }                
        getObj('ContenerNote').innerHTML=HtmlNote;
        
        }
        
function RolNote(NumNote,Note)
    {
    for (i=1; i<=NumNote; i++)
        {
        getObj('EtoileNote'+i).src="/_Images/star.gif";
        }
    for (x=i; x<=5; x++)
        {
        getObj('EtoileNote'+x).src="/_Images/star_off.gif";
        }
    }
    
function DeRolNote(Note)
    {
    NoteTotal=5;
    HtmlNote='';
        for (i=1; i<=Note; i++)
            { 
            getObj('EtoileNote'+i).src="/_Images/star.gif";
            } 
        for (x=i; x<=NoteTotal; x++)
            { 
            getObj('EtoileNote'+x).src="/_Images/star_off.gif";
            }            
    }    
//////////////////////////////////////////////////////////////////////////////////////////////////   


function ViewVideo(idVideo,ParamMoteurRecherche,idChaine)
    {
    getObj('BackSearchResult').innerHTML='<img src="/_Images/fleche_grise.gif" /> <a href="javascript:XHR_ResultatRecherche(\''+ParamMoteurRecherche.replace('?','')+'\');" class="txtgris11">'+BackResult+'</a>';
    getObj('BackSearchResult').style.visibility='visible';
    ManageBackgroundSite();
    callOpenCarrousel(idChaine,idVideo)
    }
    
function RolNavChaine(idChaine)
    {
    if(SiteInAjax)
        {
        RewriteNavChaineInAjax();
        getObj('NavBout'+idChaine).src=getObj('NavBout'+idChaine).src.replace('_off.','_on.');
        }
    }
        
function RewriteNavChaineInAjax()
    {
    if(SiteInAjax)
        {
        getObj('NavChannel').innerHTML=getObj('ChannelHidden').innerHTML.replace('BoutNav','NavBout').replace('BoutNav','NavBout').replace('BoutNav','NavBout').replace('BoutNav','NavBout').replace('BoutNav','NavBout').replace('BoutNav','NavBout').replace('BoutNav','NavBout').replace('BoutNav','NavBout').replace('BoutNav','NavBout');
        }
    }
    
 function RewriteTags()
    {
    if(SiteInAjax)
        {
        getObj('ContenerTags').innerHTML=getObj('ContenerTagsJavascript').innerHTML;
        }
     }