function initSWF()
{
	if (swfobject.hasFlashPlayerVersion("8")) 
	{
		var iHTML='<style type="text/css">';
		iHTML+="#header { background-image:none; }\n#header h1.title, #language {display:none;}";
		iHTML+='</style>';
		
		document.writeln(iHTML);
	}
}

function createSWF()
{
	if (swfobject.hasFlashPlayerVersion("8")) 
	{
		$('#header hgroup').append('<div id="mainbanner"></div>');
		
		var params = {quality:'high',menu:'false',wmode:'transparent'};

		swfobject.embedSWF(window.config.baseUrl+'/main/files/header.swf', "mainbanner", "901", "430", "8.0.0", window.config.baseUrl+'/main/js/expressInstall.swf',{},params);
	}
}

function releaseSWF()
{
	$('.title, #language').css('display','block');
}

function productsNav()
{
	var tables = $('.bigbox table.products');
	tables.find('tbody tr.desc').hide().removeClass('remove-noscript');
	
	tables.find('tbody tr.ref td a').each(function()
	{
		$(this.parentNode).html('<span>'+this.innerHTML+'</span>');
	});
	
	tables.find('tbody tr.ref').click(function()
	{
		var id = this.id.split('-');
		
		tables.find('tbody tr.desc[id!=desc-'+id[1]+']').hide();
		tables.find('#desc-'+id[1]).toggle();
	});
}

// main code
initSWF();
$(document).ready(function() 
{ 
	$('#leftmenu ul, #catmenu ul').superfish({childTag:'div',delay:1000,autoArrows:false,dropShadows: false}).find('div').bgIframe({opacity:0});
	
	$('.lightbox').lightBox(
	{
		imageLoading:window.config.baseUrl+'/main/files/lightbox/lightbox-ico-loading.gif',
		imageBtnPrev:window.config.baseUrl+'/main/files/lightbox/lightbox-btn-prev-'+window.config.currentLanguage+'.gif',
		imageBtnNext:window.config.baseUrl+'/main/files/lightbox/lightbox-btn-next-'+window.config.currentLanguage+'.gif',
		imageBtnClose:window.config.baseUrl+'/main/files/lightbox/lightbox-btn-close-'+window.config.currentLanguage+'.gif',
		imageBlank:window.config.baseUrl+'/main/files/lightbox/lightbox-blank.gif',
		txtOf:window.config.keywords.sur
	});
	
	$('.gallery .text .gallery-container').cycle();
	
	createSWF();
	
	productsNav();
	
	/*@cc_on
	if (typeof(PIE)!='undefined') 
	{
		if (typeof(document.body.style.maxWidth)=='undefined')
		{
			$('.bigbox .actions a, .bigbox .actions a:hover, .rounded-box, .tinybox header img').each(function() {
				this.style.position='relative';
				PIE.attach(this);
			});
		}
		else
		{
			$('.bigbox .actions a, .bigbox .actions a:hover, .rounded-box, .tinybox header img, #login fieldset legend span, #login a.logout span').each(function() {
				this.style.position='relative';
				PIE.attach(this);
			});
		}
	}

	if (typeof(document.body.style.maxWidth)=='undefined') // IE6
	{
		$('#catmenu ul li.haschild > a').each(function()
		{
			this.style.backgroundImage='url('+window.config.baseUrl+'/main/files/white-arrow.gif)';
			this.style.backgroundRepeat='no-repeat';
			this.style.backgroundPosition='97% 50%';
		});
		
		$('#login fieldset legend').hover(function()
		{
			var target = $(this.parentNode).find('.login-form');
			target.get(0).style.display='block';
			target.hover(function(){this.style.display='block';},function(){this.style.display='';});
		},
		function()
		{
			$(this.parentNode).find('.login-form').get(0).style.display='';
			target.unbind();
		});
		
		$('table.products tbody tr.ref').each(function()
		{
			$(this).hover(function()
			{
				$(this).addClass("tr-hover");
			},function()
			{
				$(this).removeClass("tr-hover");
			});
		});
	}
	@*/
});
