
video = function(url)
{
    var win = window.open(url, 'video', 'width='+640+',height='+480+',resizable=no,scrollbars=no,menubar=no');
	return false;
}


help = function(url)
{
    var win = window.open(url, 'helper', 'width='+600+',height='+430+',resizable=0,scrollbars=yes,menubar=no');
	return false;
}

showInfo = function(url)
{
    var win = window.open(url, 'helper', 'width='+400+',height='+355+',resizable=0,scrollbars=no,menubar=no');
	return false;
}

showRanks = function(url)
{
    var win = window.open(url, 'helper', 'width='+400+',height='+405+',resizable=0,scrollbars=no,menubar=no');
	return false;
}

review = function(url)
{
    var win = window.open(url, 'review', 'width='+600+',height='+495+',resizable=0,scrollbars=yes,menubar=no');
	return false;
}

illustration = function(url)
{
    var win = window.open(url, 'illustration', 'width='+750+',height='+563+',resizable=0,scrollbars=no,menubar=no');
	return false;
}

compare = function()
{
	var cIds = '';
	
	$('ul li input[@type=checkbox][@checked]').each(
		function (i)
		{
			cIds = cIds+(i==0 ? '' : '_')+$(this).attr('value');
		}
	);
	
	var win = window.open('shop,comparer,'+cIds, 'compare', 'width='+1000+',height='+750+',resizable=yes,scrollbars=yes,menubar=no');
}


$(document).ready(function() 
{
	/*
	$('#top').flash({
	    src: 'images/top.swf',
	    width: 990,
	    height: 245,
		flashvars: { KoszykUrl: 'shop,cart', StartUrl: '' }
	});
	
	$('#top > embed').attr('wmode', 'transparent');
	*/
	//$('#topmenu').hide();
	
	if(!$.browser.safari) $('#safaritop').hide();
	
	
	$('#comapreProducts').click(compare);
	
	
	$('#topmenu > ul > li > ul').hide();
	
	$('#topmenu > ul > li').hover(
		function()
		{
			$(this).find('ul').show();
		},
		
		function()
		{
			$(this).find('ul').hide();
		}	
	);
	
	
	
	$('#header ul li').hover(function () {
		$(this).addClass('hover');
	}, function () {
		$(this).removeClass('hover');
	});
	
	$('.select .wrap .val').each(function () {
		$(this).text($(this).next('select').find('option:selected').text());
	});
	
	$('.select .wrap select').change(function () {
		$(this).prev('.val').text($(this).find('option:selected').text());
	});
	
	
	var tabContainers = $('.tabs div[id!=""]');

	$('.tabs ul.tabNavigation a').click(function () {
		tabContainers.hide();
		tabContainers.filter(this.hash).show();
		$('.tabs ul.tabNavigation li').removeClass('selected');
		$(this).parent().addClass('selected');
		return false;
	}).filter(':first').click();

	$('.images a').not('.first').fancybox({ titleShow: false });
	
	$('.images a.first').click( function () 
	{
		$('#mini').click();
		
		return false;
	});
	



	$('.negotiation').fancybox();
	$('.phone_contact').fancybox();
	
	
	$('#welcomeBox form').submit(function ()
	{
		var form = $('#welcomeBox form');

		$.fancybox.showActivity();

		$.ajax({
			type	: "POST",
			cache	: false,
			url		: form.attr('action'),
			data	: form.serializeArray(),
			success: function(data) {
				//alert(data);
				$.fancybox(data);
			}
		});


		return false;
	});
	
	
	// show contact box after 7 minutes
	setTimeout( function()
	{
		$('.phone_contact').click();
	}, 1000 * 60 * 7 );
	
	
	
	$('.transport select, .transport input[type=radio]').bind('click change', function ()
	{
		var pointer = $(this).parents('tbody');
		var select = $('select', pointer);
		var radio = $('input[type=radio]', pointer);
		
		if( radio.is(':checked') )
		{
			$('#total_to_pay').html( $( select.get(0).options[ select.get(0).selectedIndex ] ).attr('rel') );
		}
	});
	
	
	
	$('.quicksearch select').change( function ()
	{
		$(this).parents('form').submit();
	});
	
	
	
	
	$("#facebookpanel").hover( function()
	{  
        $(this).addClass('active');
    }, function()
	{  
        $(this).removeClass('active');
    });


	// :D
	if( $('.bottomLinks').get(0) )
	{
		$('.images .label').css('top',  $('.bottomLinks').offset().top - 294 + 'px');
	}
	

});




