var live = new live()

function live(  )
{
   this.click = function( sUrl )
   {
        document.getElementById( "htmlcontent" ).style.display = 'none';
        document.getElementById( "htmlplayer" ).style.display = 'block';
        document.getElementById('htmlplayer').innerHTML = '<iframe src="/player_eredivisie/player.php?live=' + sUrl + '" width="576" frameborder="0" SCROLLING="no" border="0" scrollborder="0" marginheight="0" marginwidth="0" height="324"></iframe>';
   }
   
   this.showcontent= function( )
   {
        if ( document.getElementById( "htmlcontent" ).style.display == 'none' )
        {
            document.getElementById('htmlplayer').innerHTML = "";
            document.getElementById( "htmlplayer" ).style.display = 'none';
            document.getElementById( "htmlcontent" ).style.display = 'block';
        }
        
   }
}

var rating = new rating()

function rating(  )
{   
   
   this.stars = 0;
   this.vote = false;
   
   this.hover= function( iStar )
   {
        
        if ( this.vote == "false" )
        {
            
            for( var i=1; i<=5; i++)
            {
                if ( i <= iStar )
                    document.getElementById( "rating" + i ).className = 'star_hover';
                else
                    document.getElementById( "rating" + i ).className = 'star';
            }
        }
         
   }
   
   this.reset= function( )
   {
        if ( this.vote == "false")
        {
            for( var i=1; i<=5; i++)
            {
                if ( i <= this.stars )
                    document.getElementById( "rating" + i ).className = 'star_active';
                else
                    document.getElementById( "rating" + i ).className = 'star';
            }
        }
   }
}

var search = new search()

function search( )
{
    this.changepage = function( iValue )
    {
        document.getElementById('pageno').value = iValue;
        document.getElementById("searchext").submit();
    }
}

var banner = new banner()
banner.init();
function banner( )
{
    this.init = function( )
    {
        if ( document.getElementById("adframe") )
        {
            var iframe = document.getElementById("adframe");
            iframe.src = pageTracker._getLinkerUrl("http://bannermanager.sport2media.com/abmw.aspx?z=28&amp;isframe=true");  
        }
    }
}

var livebutton = new livebutton()

function livebutton( )
{
    this.start = function( )
    {
        if ( document.getElementById('live') )
        {
            this.flashup();
        }
    }

    this.flashup = function( )
    {
        var myRSS = new Fx.Tween('live');
            
        myRSS.start('color','#ffffff').chain(
            function()
            {
                livebutton.flashdown();
            }
        );

        var slideOut = function()
        { 
            myRSS.start('color','#ffffff').chain(
                function()
                {
                    livebutton.flashdown();
                }
            );
        };
    }

    this.flashdown = function( )
    {
        var myRSS = new Fx.Tween('live');
            
        myRSS.start('color','#36f231').chain(
            function()
            {
                livebutton.flashup();
            }
        );

    }

}

function createResponse()
{
  document.getElementById( 'response' ).value = hex_sha1( hex_sha1( document.getElementById( 'password' ).value ) + ":" + document.getElementById( 'challenge' ).value );
  document.getElementById( 'password' ).value = "";
  document.getElementById( 'challenge' ).value = "";
  return true;
}

function redirectnorm( sLoc, newwindow )
{
    var newwindow = ( newwindow == null) ? "0" : "1";
    
    if ( newwindow == "1" )
    {
        window.open(sLoc);
    }
    else
    {
        document.location.href = sLoc;
    }
}

function goalhidegoaldivs()
{
    document.getElementById('goalPlayer').style.display='block';
    document.getElementById('backtomain').style.display='block';
    
    document.getElementById('goalelectioncontainer').style.display='none';
    document.getElementById('period').style.display='none';
    document.getElementById('nextgoals').style.display='none';
}

function goalshowgoaldivs()
{
    document.getElementById('goalPlayer').innerHTML = '';
    document.getElementById('goalPlayer').style.display='none';
    document.getElementById('backtomain').style.display='none';
    
    document.getElementById('goalelectioncontainer').style.display='block';
    document.getElementById('period').style.display='block';
    document.getElementById('nextgoals').style.display='block';
}

function hidemonthgoal()
{
    document.getElementById('goalPlayerMonth').innerHTML='';
}

function showmonthgoal( sLoc, sSL, sTitle )
{
    var sTitle = ( sTitle == null) ? "0" : sTitle;
    if ( sTitle != "0" )
    {
        pageTracker._trackEvent('Videos - Play', 'Goal', sTitle );
        pageTracker._trackPageview('/videos_play/Goal/' + sTitle );
    }
    if ( sSL == "1" )
    {
    document.getElementById('goalPlayerMonth').innerHTML='<div class="videoplaceholder" id="silverlightHostControl"><object id="silverlightobject" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="470" height="264"> '+
                                '<param name="source" value="/media/silverlight/player/VODEredivisieDoelpunt.xap"/> '+
                                '<param name="onerror" value="onSilverlightError" /> '+
                                '<param name="background" value="white" /> '+
                                '<param name="minRuntimeVersion" value="3.0.40624.0" /> '+
                                '<param name="InitParams" value="VOD='+sLoc+', autostart=1" />    '+
                                '<param name="autoUpgrade" value="true" /> '+
                                '<param name="onLoad" value="pluginLoaded" />'+
                                '<div id="noSLbg">'+
                                '    <div id="noslHeader"><i>Voor de optimale kijkbeleving van de Live wedstrijden en de Video\'s van Eredivisie is een installatie van Microsoft Silverlight nodig.</i></div>'+
                                '    <div id="noSLinfo"><i><a href="http://www.microsoft.com/silverlight/" onclick="window.open( this.href ); return false;" >Meer informatie over Silverlight</a></i></div>'+
                                '    <div id="noSLimage">'+
                                '        <a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"> '+
                                '             <img src="/media/images/Btn_SL_plugin.png" width="307" height="106" alt="Get Microsoft Silverlight" style="border-style: none"/> '+
                                '        </a> '+
                                '    </div>'+
                                '    <div id="noSLlink"><img src="/media/images/MediapllayerIcon.png" width="60" height="53" alt="Media Player" align="center" style="border-style: none"/> <a href="/doelpunt.php?f=1">Kijken met Windows Media Player</a></div>'+
                                '</div>'+
                            '</object></div>';
    }
    else
    {
        document.getElementById('goalPlayerMonth').innerHTML='<iframe src="/license_eredivisie.php?ProductID='+sLoc+'&dpvdw=1" width="470" frameborder="0" SCROLLING="no" border="0" scrollborder="0" marginheight="0" marginwidth="0" height="264"></iframe>';
    }
}

function playgoalvideo( sLoc, sSL, sTitle )
{
    var sTitle = ( sTitle == null) ? "0" : sTitle;
    if ( sTitle != "0" )
    {
        pageTracker._trackEvent('Videos - Play', 'Goal', sTitle );
        pageTracker._trackPageview('/videos_play/Goal/' + sTitle );
    }
    
    if ( sSL == "1" )
    {
    document.getElementById('goalPlayer').innerHTML='<div class="videoplaceholder" id="silverlightHostControl"><object id="silverlightobject" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="470" height="264"> '+
                                '<param name="source" value="/media/silverlight/player/VODEredivisieDoelpunt.xap"/> '+
                                '<param name="onerror" value="onSilverlightError" /> '+
                                '<param name="background" value="white" /> '+
                                '<param name="minRuntimeVersion" value="3.0.40624.0" /> '+
                                '<param name="InitParams" value="VOD='+sLoc+',autostart=1" />    '+
                                '<param name="autoUpgrade" value="true" /> '+
                                '<param name="onLoad" value="pluginLoaded" />'+
                                '<div id="noSLbg">'+
                                '    <div id="noslHeader"><i>Voor de optimale kijkbeleving van de Live wedstrijden en de Video\'s van Eredivisie is een installatie van Microsoft Silverlight nodig.</i></div>'+
                                '    <div id="noSLinfo"><i><a href="http://www.microsoft.com/silverlight/" onclick="window.open( this.href ); return false;" >Meer informatie over Silverlight</a></i></div>'+
                                '    <div id="noSLimage">'+
                                '        <a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"> '+
                                '             <img src="/media/images/Btn_SL_plugin.png" width="307" height="106" alt="Get Microsoft Silverlight" style="border-style: none"/> '+
                                '        </a> '+
                                '    </div>'+
                                '    <div id="noSLlink"><img src="/media/images/MediapllayerIcon.png" width="60" height="53" alt="Media Player" align="center" style="border-style: none"/> <a href="/live/html">Kijken met Windows Media Player</a></div>'+
                                '</div>'+
                            '</object></div>';
    }
    else
    {
        document.getElementById('goalPlayer').innerHTML='<iframe src="/license_eredivisie.php?ProductID='+sLoc+'&dpvdw=1" width="470" frameborder="0" SCROLLING="no" border="0" scrollborder="0" marginheight="0" marginwidth="0" height="264"></iframe>';
    }                       
    goalhidegoaldivs();
}

function refreshAll()
{
    window.parent.location.href = '/doelpuntvdweek.php?goal=1';
}

function redirect( sLoc, newwindow, frame )
{
    var newwindow = ( newwindow == null) ? "0" : "1";
    var frame = ( frame == null) ? "" : frame;
    if ( newwindow == "1" )
    {
        player.open(sLoc);
    }
    else
    {
        player.location.href = sLoc;
    }
}

function popup( sLoc, sName )
{
    newwindow=window.open( sLoc , sName,'height=700,width=650,scrollbars=yes');
    if (window.focus) {newwindow.focus()}
        return false;

}

function smallpopup( sLoc, sName )
{
    newwindow=window.open( sLoc , sName,'height=150,width=650,scrollbars=yes');
    if (window.focus) {newwindow.focus()}
        return false;

}

function redirectDelay( )
{
    setTimeout( "window.location = '/'", 5000 );
}

function navbarover( oNode )
{
    document.getElementById( oNode.id ).style.color = '#ff6748';
}

function navbarout( oNode )
{
    document.getElementById( oNode.id ).style.color = 'white';
}

function togglelogin()
{
    if( document.getElementById('loginwrapper').style.display == '' || document.getElementById('loginwrapper').style.display == 'none')
        document.getElementById('loginwrapper').style.display = 'block';
    else
        document.getElementById('loginwrapper').style.display = 'none';
}

var Login = new LoginControl()

function LoginControl(  )
{
    this.change = function ( oNode, sValue )
    {
        if ( oNode.value == '' )
            oNode.value = sValue;
    }
    
    this.focus = function ( oNode, sValue )
    {
        if ( oNode.value == sValue )
            oNode.value = '';
    }
}

function clearTAF()
{
    document.getElementById('fromname').value='';
    document.getElementById('fromemail').value='';
    document.getElementById('toname').value='';
    document.getElementById('toemail').value='';
}

function clearContactForm()
{
    document.getElementById('name').value="";
    document.getElementById('email').value="";
    document.getElementById('phone').value="";
    document.getElementById('message').value="";
}

function showVOD( sLoc, sSL, sIP, params )
{
    document.getElementById('silverlightHostControl').style.backgroundImage="";
    
 if ( sSL == "1" )
    {
        document.getElementById('silverlightHostControl').innerHTML=''+
            '<object id="silverlightobject" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="572" height="325"> '+
            '<param name="source" value="/media/silverlight/player/VODEredivisiePlayer.xap"/> '+
            '<param name="onerror" value="onSilverlightError" /> '+
            '<param name="background" value="white" /> '+
            '<param name="minRuntimeVersion" value="3.0.40624.0" /> '+
            '<param name="InitParams" value="VOD='+sLoc+',autostart=1,ip='+sIP+', session=143245456,'+params+'" />    '+
            '<param name="autoUpgrade" value="true" /> '+
            '<param name="onLoad" value="pluginLoaded" />'+
            '<div id="noSLbg">'+
            '    <div id="noslHeader"><i>Voor de optimale kijkbeleving van de Live wedstrijden en de Video\'s van Eredivisie is een installatie van Microsoft Silverlight nodig.</i></div>'+
            '    <div id="noSLinfo"><i><a href="http://www.microsoft.com/silverlight/" onclick="window.open( this.href ); return false;" >Meer informatie over Silverlight</a></i></div>'+
            '    <div id="noSLimage">'+
            '        <a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"> '+
            '             <img src="/media/images/Btn_SL_plugin.png" width="307" height="106" alt="Get Microsoft Silverlight" style="border-style: none"/> '+
            '        </a> '+
            '    </div>'+
            '    <div id="noSLlink"><img src="/media/images/MediapllayerIcon.png" width="60" height="53" alt="Media Player" align="center" style="border-style: none"/> <a href="/video.php?f=1">Kijken met Windows Media Player</a></div>'+
            '</div>'+
        '</object>';
    }
    else
    {
        document.getElementById('silverlightHostControl').innerHTML='<iframe src="/license_eredivisie.php?ProductID='+sLoc+'" width="574" frameborder="0" SCROLLING="no" border="0" scrollborder="0" marginheight="0" marginwidth="0" height="325"></iframe>';
    }      
}

   window.addEvent('domready', function(){
   
            if($('thumbs1') && $('thumbs1').getChildren().length > 0) {
	            new SlideItMoo({itemsVisible:4, 
	                            currentElement: 0, 
								width: 425, 
	                            thumbsContainer: 'thumbs1',
	                            elementScrolled: 'thumb_container1',
	                            overallContainer: 'gallery_container1'});
	            
            }
           
            if($('thumbs2') && $('thumbs2').getChildren().length > 0) {
            	new SlideItMoo({itemsVisible:6,
                            currentElement: 0, 
                            width: 662,
                            thumbsContainer: 'thumbs2',
                            elementScrolled: 'thumb_container2',
                            overallContainer: 'gallery_container2'});
            
            }
        });
