// JavaScript Document
var v = jQuery.noConflict();
v(document).ready(function(){

	var shitBrowser = false;
	v.each(v.browser, function(i, val) {
		if(i == 'msie'){
			shitBrowser = true;
		}
	});

	v('.play-video').click(function(){
		var id = v(this).attr('id');
		
		v('#video-player > embed').attr('flashvars',id);
		
		if(shitBrowser == true){
			v('embed').remove();
			v('<embed src="http://widget-7e.slide.com/widgets/slideticker.swf" type="application/x-shockwave-flash" flashvars="'+id+'" quality="high" scale="noscale" salign="l" wmode="transparent" style="width:375px;height:250px" name="flashticker" align="middle"></embed>').prependTo('#video-player');
		}
		
		var vertmiddle = parseInt(v(window).height()) / 2 - parseInt(v('#video-player').height())/2;
		var hormiddle = parseInt(v(window).width()) / 2 - parseInt(v('#video-player').width())/2;

		if(v('#full-bg').length == 0){
			v('<div id="full-bg"></div>').insertBefore('#video-player');
		}
		v('#full-bg').animate({
			opacity: .7,
			height: parseInt(v(window).height())+'px',
			width: parseInt(v(window).width())+'px'
		},700);

		v('#video-player').show();
		v('#video-player').animate({
			marginTop: vertmiddle+'px',
			marginLeft: hormiddle+'px',
		},900);
	});
	
	v('#full-bg').live('click',function(){
		v('#video-player').fadeOut(500).delay(600);
		v('#full-bg').animate({
			opacity: .7,
			height: 0,
			width: 0
		},700);
	});
});
