/***************************************************************************
 *       ___ _   _                    ____           _       _
 *      |  _| | | |_ __  _ _  ___    / ___|  ___ _ _(_)_ __ | |_
 *      | |_| |_| | '_ \| '_)/ _ \   \___ \ / __| '_) | '_ \| __| 
 *      |  _|  _  | |_) | | | (_) |   ___) | (__| | | | |_) | |_ 
 *      |_| |_| |_| .__/|_|  \___/   |____/ \___|_| |_| .__/ \__|
 *                |_|  www.fhpro.de                   |_|
 *
 *   Copyright            : (c) 2006 Frank Hinkel
 *   Kontakt              : info@fhpro.de
 *
 ***************************************************************************/

/*** Video ***/
function FhproVideoClient() {
    this._objVideo;
    this._myObjects;  
    this._isBigSize;                     
    this.initialize();
}
FhproVideoClient.prototype = {  
    initialize: function() 
    {
    	this._isBigSize = false;
        this._objVideo  = { autoplay : false, 
                            bufferTime : 2,
                            link : '',
        					clipId : -1,
        					md5Dummy : '' };
        this._myObjects = { videoPlayer : 'myPlayer' };         
    }, 
    playVideo: function(options)
    {   
        if (options.clipId.length < 1)
            return;
            
        this.scrollTo(0);                    
        this._objVideo = options;       
        CLweb2.getElem(this._myObjects.videoPlayer).innerHTML = this.getPlayer();        
    },
    playVideoTop: function(options)
    {   
        top.location.href = options.link;
    },    
    getPlayer: function()
    {
        var flashVars = '';
                    
        if (this._objVideo.autoplay)
            flashVars += '&autoplay=1';
        else
            flashVars += '&autoplay=0';

        if (this._objVideo.bufferTime > 0)            
            flashVars += '&bufferTime=' + this._objVideo.bufferTime;            
            
        flashVars += '&clipId=' + this._objVideo.clipId; 
        flashVars += '&md5Dummy=' + this._objVideo.md5Dummy;
        
        var player = "";
	    player += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="384" height="325" id="flashware" align="middle">';
        player += '<param name="allowScriptAccess" value="sameDomain" />';
        player += '<param name="flashvars" value="' + flashVars +'" />';
        player += '<param name="movie" value="http://extern.videocluster.de/templates/default/flash/flashware3.swf?dummy=bcidhsbcjhdb" />';
        player += '<param name="menu" value="false" />';
        player += '<param name="quality" value="high" />';
        player += '<param name="bgcolor" value="#ffffff" />';
        player += '<embed src="http://extern.videocluster.de/templates/default/flash/flashware3.swf?dummy=bcidhsbcjhdb" flashvars="' + flashVars +'" menu="false" quality="high" bgcolor="#ffffff" width="384" height="325" name="flashware" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
        player += '</object>';           
	
        return player;
    },
	scrollTo: function(pos)
	{
	    if (window.scroll)
	       window.scroll(1,pos);
        else
	       parent.window.scrollTo(1,pos);
	},
	showPreview: function(el, aniGIF)
    {
        el.src = aniGIF;    
    },
    bigSize: function()
    {
    	if (this._isBigSize)
    	{
    		this._isBigSize = false;
    		CLweb2.getElem("myPlayer").style.position = 'static';
    		CLweb2.getElem("myPlayer").style.top     = '0px';    		
    		CLweb2.getElem("myPlayer").style.left    = '0px';
    		CLweb2.getElem("myPlayer").style.width   = '384px';
    		CLweb2.getElem("myPlayer").style.height  = '325px';  
    		CLweb2.getElem("flashware").style.width  = '384px';
    		CLweb2.getElem("flashware").style.height = '325px';  
    		 		  
    	}
    	else
    	{
    		this._isBigSize = true;
    		CLweb2.getElem("myPlayer").style.position = 'absolute';
    		CLweb2.getElem("myPlayer").style.top     = '50px';
    		CLweb2.getElem("myPlayer").style.left    = '50px';
    		CLweb2.getElem("myPlayer").style.width   = '640px';
    		CLweb2.getElem("myPlayer").style.height  = '542px';
    		CLweb2.getElem("flashware").style.width  = '640px';
    		CLweb2.getElem("flashware").style.height = '542px';     		
    	}
    }
}
var CLvclient = new FhproVideoClient();
