$(document).ready(function(){

/* inicializácia záložiek */
	$('ul.tabs').tabs('div.panes > div');
/* /inicializácia záložiek */ 
	$('#main-menu ul > li:last').css('background-image','none');
	$("#productparams table tr:nth-child(odd)").addClass('odd');
  	$("#productparams table tr:nth-child(even)").addClass('even');
	
	$("#special_buttons .comparelink a").html("Pridať produkt do porovnania");
	$(".prorating .message").remove();
	
	$("#paymentsBox .payment:nth-child(odd)").addClass('odd');
  	$("#paymentsBox .payment:nth-child(even)").addClass('even');

/* oprava png s alpha kanálom pre IE5.5 a IE6 */
if ($.browser.msie && $.browser.version < 7) {
	$(this).find('*').each(function() {
		
		b = $(this).css('background-image');
		if (b.indexOf('.png') != -1) {
			var f = b.split('url("')[1].split('")')[0];
			$(this).css('background-image', 'none');
		}

		if ($(this).is('[src$=.png]')) {
			var f = $(this).attr('src');
			$(this).attr({
				src: '/Data/default/images/blank.gif',
				width: $(this).width(),
				height: $(this).height()
			});
		}

		if (f) $(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + f + "',sizingMethod='crop')";
	});
}
/* /oprava png s alpha kanálom pre IE5.5 a IE6 */

/*  new */
	if($('#main-cart .cena-s .kosik-obsah').text()!='0 ks za'){
		$("#box-left").html($("form.search").parent().html());
		$("#box-right").html($("#kosik").html());
		
		objSearchHtml = $(".top form.search").html();
		setMainBar();
		
		$(window).bind("scroll",function(){setMainBar()});
	}		
	
	$('#totop a').click(function(){
		$(document).scrollTo(0, 500);
		return false;
	});

	$(window).scroll(function () { 	
	 if($(window).scrollTop()!=0) $("#totop a").css("display", "block"); 	
	 else $("#totop a").css("display", "none");	
	});
	/*****************/

});

function setMainBar(){

	var a=$(document).scrollTop();	
	if(a<210){
		$("#main-bar").slideUp().css({top:"5px"})
		$(".top form.search").html(objSearchHtml);
		$("#box-left form.search").find("#search_suggest").html('');
	}else{
		if($('body').width()>=1245){
			$("#main-bar").slideDown().css({top:"5px"})
			$(".top form.search").html('').find("#search_suggest").html('');
			document.getElementById("main-bar").style.position="fixed";
		}
	}	
}
