var Videobox2 = {
	init2: function (options2) {
		this.idioma=options2;
		if(this.idioma==''){this.idioma='es_ES'}
		// init default options
		this.options2 = Object.extend({
			resizeDuration: 1200,	// Duration of height and width resizing (ms)
			initialWidth: 250,		// Initial width of the box (px)
			initialHeight: 100,		// Initial height of the box (px)
			defaultWidth: 500,		// Default width of the box (px)
			defaultHeight: 200,	// Default height of the box (px)
			animateCaption: true,	// Enable/Disable caption animation
			flvplayer: 'swf/flvplayer.swf'
		}, options2 || {});
		this.anchors = [];
		$A($$('a')).each(function(el){
			if(el.rel && el.href && el.rel.test('^vidbox', 'i')) {
				el.addEvent('click', function (e) {
          								e = new Event(e);
          								e.stop();
          								this.click2(el);
								}.bind(this));
				this.anchors.push(el);
			}
    		}, this);
    		
		this.overlay2 = new Element('div').setProperty('id', 'lbOverlay2').injectInside(document.body);
		this.center2 = new Element('div').setProperty('id', 'lbCenter2').setStyles({width: this.options2.initialWidth+'px', height: this.options2.initialHeight+'px', marginLeft: '-'+(this.options2.initialWidth/2)+'px', display: 'none'}).injectInside(document.body);
		this.bottomContainer2 = new Element('div').setProperty('id', 'lbBottomContainer2').setStyle('display', 'none').injectInside(document.body);
		this.bottom2 = new Element('div').setProperty('id', 'lbBottom2').injectInside(this.bottomContainer2);
		new Element('a').setProperties({id: 'lbCloseLink2', href: '#'}).injectInside(this.bottom2).onclick = this.overlay2.onclick = this.close2.bind(this);
		this.caption2 = new Element('div').setProperty('id', 'lbCaption2').injectInside(this.bottom2);
		this.number2 = new Element('div').setProperty('id', 'lbNumber2').injectInside(this.bottom2);
		new Element('div').setStyle('clear', 'both').injectInside(this.bottom2);

		var nextEffect = this.nextEffect2.bind(this);
		this.fx = {
			overlay2: this.overlay2.effect('opacity', {duration: 500}).hide(),
			center2: this.center2.effects({duration: 500, transition: Fx.Transitions.sineInOut, onComplete: nextEffect}),
			bottom2: this.bottom2.effect('margin-top', {duration: 400})
		};
		
		this.open2('','','');

	},
	click2: function(link) {
     		return this.open2 (link.href, link.title, link.rel);
	},
	open2: function(sLinkHref, sLinkTitle, sLinkRel) {
		this.href2 = sLinkHref;
		this.title2 = sLinkTitle;
		this.rel2 = sLinkRel;
		this.position2();
		this.setup2();
		this.top = Window.getScrollTop() + (Window.getHeight() / 15);
		if(this.top == ''){this.top =50}
		this.center2.setStyles({top: this.top +'px', display: ''});
		this.fx.overlay2.start(0.4);
		this.step2 = 1;
		this.center2.setStyle('background','#fff url(loading.gif) no-repeat 10px 10px ');
		this.caption2.innerHTML = this.title;
		this.fx.center2.start({'height': [this.options2.contentsHeight]});
	},
	setup2: function(){
		var aDim2 = this.rel2.match(/[0-9]+/g);
		this.options2.contentsWidth = (aDim2 && (aDim2[0] > 0)) ? aDim2[0] : this.options2.defaultWidth;
		this.options2.contentsHeight = (aDim2 && (aDim2[1] > 0)) ? aDim2[1] : this.options2.defaultHeight;

	},
	position2: function(){
		if(navigator.appName.indexOf("Microsoft")!=-1){			
			
			
			var alto2=document.body.offsetHeight-16;
		}
		else{
			var alto2=window.innerHeight;
		}
		//{'top': window.getScrollTop()+'px', 'height': alto+'px'}
    		this.overlay2.setStyles({'top': window.getScrollTop()+'px', 'height': '500px'});
	},
	nextEffect2: function(){
		if(this.idioma=='es_ES'){
 		 	this.other2="<a href='javascript:Videobox2.close2();'>cerrar </a><br><br>Necesita una nueva versi&oacute;n de Explorer para visualizar este contenido correctamente.<br/><br/>";
 	 		this.other2 = this.other2 + "<div style='text-align:center'><a href='#' target='_new'>descargar</a></div>";
 		}
 		else if(this.idioma=='en_GB'){
     			this.other2="<a href='javascript:Videobox2.close2();'>cerrar</a><br><br>GB Necesita una nueva versi&oacute;n de Explorer para visualizar este contenido correctamente.<br/><br/>";
 	 		this.other2 = this.other2 + "<div style='text-align:center'><a href='#'>descargar</a></div>";
		}
		else if(this.idioma=='fr_FR'){
     			this.other2="<a href='javascript:Videobox2.close2();'>cerrar</a><br><br>FR Necesita una nueva versi&oacute;n de Explorer para visualizar este contenido correctamente.<br/><br/>";
 	 		this.other2 = this.other2 + "<div style='text-align:center'><a href='#'>descargar</a></div>";
		}
		else if(this.idioma=='de_DE'){
     			this.other2="<a href='javascript:Videobox2.close2();'>cerrar</a><br><br>DE Necesita una nueva versi&oacute;n de Explorer para visualizar este contenido correctamente.<br/><br/>";
 	 		this.other2 = this.other2 + "<div style='text-align:center'><a href='#'>descargar</a></div>";
		}
		else{
   			this.other2="<a href='javascript:Videobox2.close2();'>cerrar</a><br><br>else Necesita una nueva versi&oacute;n de Explorer para visualizar este contenido correctamente.<br/><br/>";
 	 		this.other2 = this.other2 + "<div style='text-align:center'><a href='#'>descargar</a></div>";
		}
		switch (this.step2++){
		case 1:
			this.center2.setHTML(this.other2) ;
			this.fx.center2.start({'width': [this.options2.contentsWidth], 'marginLeft': [this.options2.contentsWidth/-2]});
			break;
			this.step2++;
		}
	},
	close2: function(){
		window.document.getElementById('lbOverlay2').style.display ='none';
		window.document.getElementById('lbCenter2').style.display ='none';
		this.overlay2.style.display ='none';
		this.center2.style.display ='none';
		this.center2.innerHTML = '';
		return ;
	}
};


