if (!window.console) { console = {}; } // prevent errors from console.log calls
if (!console.log) { console.log = $.noop; }
function getPlayerParams(player)
{
	var variables = {
		width: "720",
		height: "405",
		skin: "/flash/stormtrooper.zip"
	};
	
	for(var key in variables)
	{
		if(player.getVariable(key) === undefined)
		{
			player.addVariable(key, variables[key]);
		}	
	};
}

SWFbox = function($name,$width,$height,$color,$file,$link){
    var fileName = $link;
    fileName = fileName.replace(/url=/,"").split("&");
	fileName = fileName[0];
    $.fancybox({
		padding: 1,
		margin: 0,
		zoomSpeedIn: 0,
		zoomSpeedOut: 0,
		transitionIn: "none",
		transitionOut: "none",
		autoDimensions: "false",
		centerOnScroll: "true",
		titleShow: false,
		width: 720,
		height: 430,
		scrolling: "no",
		overlayOpacity: 0.6,
		overlayColor: '#000',
		type: 'swf',
		href: 'flash/mediaplayer.swf',
		swf: {
			width: 720,
			height: 437,
			wmode: 'transparent',
			allowfullscreen: 'true',
			flashvars: 'width=720&height=430&autostart=false&file=' + fileName + '&repeat=false&showdownload=false&showdigits=true&shownavigation=true&skin=flash/stormtrooper.zip'
		}
    });
};

function swf(n,w,h){ 
  window.open("http://www.art3d.ru/swf/"+n+".html", "swf", "width="+w+", height="+h+", scrollbars, resizable"); 
}

$(document).ready(function(){
	$("a[href$='.jpg'] img, a[href$='.JPG'] img").parent().fancybox({titlePosition: 'over'});

});
$(document).ready(function(){
	
	$video = document.createElement('video');
	if(!!$video.canPlayType && document.createElement('video').canPlayType('video/mp4; codecs="mp4v.20.8"'))
	{}
	else
	{
	$("video").each(function(){
		fileVal = $(this).attr('src');
		imageVal = $(this).attr('poster');
		widthVal = $(this).attr('width');
		heightVal = $(this).attr('height');
		$(this).parent().jwPlayer({
			swf: 'assets/flash/player.swf',
			file: fileVal,
			image: imageVal,
			skin: 'assets/flash/glow.zip',
			width: widthVal,
			height: heightVal,
			controlbar: 'over',
			stretching: 'uniform',
			allowfullscreen: 'false',
			fullscreen: false
		});
	});
	}
});
	
var name = "#right-menu";
var menuYloc = null;
$(document).ready(function(){
	if($(name).length != 0)
	{
	menuYloc = parseInt($(name).css("top").substring(0,$(name).css("top").indexOf("px")));
	$(window).scroll(function () {
		scroll = $(document).scrollTop();
		if(scroll > menuYloc)
		{
			offset = $(document).scrollTop() + 10;
			$(name).animate({top:offset+"px"},{duration:500,queue:false});
		} else {
			$(name).animate({top:menuYloc+"px"},{duration:500,queue:false});
		}
	});
	}
	$("#anaglyph-switch").click(function(event){
		event.preventDefault();
		$("#main .content .anaglyph-container img:not([src$='anaglyph.jpg'])").fadeToggle();
		$(this).toggleClass('on');
    });
}); 
