	function noSpam(user,domain)
	{
					 window.location = "mailto:" + user + "@" + domain;
	} 

	function refreshPage(main,params)
	{
			//url='main.php?mode='+mode;
			url=main;
			if (params!=undefined)
					url+=params;
			location.replace(url);
	}	
	
	function category_changeDisplay(id,mainimages) {
		var element = document.getElementById(id);
		var display_block_value = 'block';
		var display_none_value = 'none';
		if (element != null) {
			if(element.style.display == display_block_value) {
				element.style.display = display_none_value;
			} else {
				element.style.display = display_block_value;
			}
		}
	}	
	
	function OpenWindow(theURL,width,height,windowname,html)
	{
		if (windowname == undefined)
			windowname='';
		if (html!=undefined)
		{
			var ww = parseFloat(width)+20;
			var wh = parseFloat(height)+20;
			var params = 'width='+ww+',height='+wh+',toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no';

			var html = '<html><head><style type="text/css">\n'+
					'body,html { text-align: center; margin: 0px; padding: 0px;}\n'+
					'</style></head><body>\n'+
					'<a onclick="window.close();"><img src="'+theURL+'" width="'+width+'" height="'+height+'" border="0" alt=""/></a>\n'+
					'</body></html>';

			newwindow=window.open('',windowname,params);
			newwindow.document.write(html);
		}
		else
			window.open(theURL,windowname,'height='+height+',width='+width+',menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,right=0,bottom=0');
	}

	function randomPassword(length)
	{
			chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
			pass = '';
			for(x=0;x<length;x++)
			{
					i = Math.floor(Math.random() * 62);
					pass += chars.charAt(i);
			}
			return pass;
	}
	
	
	function changeDisplay(id) {
	
		var element = document.getElementById(id);

		if (element != null) {
				if(element.style.display == 'block') {
						element.style.display = 'none';
				} else {
						element.style.display = 'block';
				}
		}
	}	
	
	function disableSubmitElement(name)
	{
			document.getElementById(name).disabled=true;
			document.getElementById(name).className='submit_disabled';
	}
	function enableSubmitElement(name)
	{
			document.getElementById(name).disabled=false;
			document.getElementById(name).className='submit';		
	}		
	
	
$(document).ready(function(){
		 $("#MainListNews .image").click(function () {
				 if ($(this).attr("rel") != '')
						window.location = $(this).attr("rel");
		 });
		 
/*		 $('.calendar-days li:last-child').css('float','right');*/
});	

$(function() {
	$('a[rel=lightbox]').lightBox({
			overlayBgColor: '#dadada',
			overlayOpacity: 0.6,
			imageLoading: 'tmpls/default/images/lightbox-ico-loading.gif',
			imageBtnClose: 'tmpls/default/images/lightbox-btn-close.gif',
			imageBtnPrev: 'tmpls/default/images/lightbox-btn-prev.gif',
			imageBtnNext: 'tmpls/default/images/lightbox-btn-next.gif',
			containerResizeSpeed: 350,
			txtImage: 'Zdjęcie',
			txtOf: 'z'
	});
});	


$(document).ready(function() {
		$("ul.css-tabs").tabs("div.css-panes > div");
/*
		//podmienianie obrazkow glownych
		$(".productimages").click(function(){
				 $("#productimagemain").hide();
				 $("#productimagemain").attr('src',$(this).attr('rel'));  
				 $(".productimages").css('border','solid 3px #f5f5f5');
					var newImg = new Image();
					newImg.src = $(this).attr('rel');
					newImg.onload = function()
					{
							var height = newImg.height;
							var width = newImg.width;				 

							$("#productimagemain").attr('width',width);
							$("#productimagemain").attr('height',height);
							
							$("#productimagemain").show();
					}
					$(this).css('border','solid 3px #009ee3');
		});
*/
		$("#products_choose_first").mouseover(function() {
				$("#products_choose_first_info").show();
		});
		$("#products_choose_first").mouseout(function() {
				$("#products_choose_first_info").hide();
		});	

		$("#products_choose_list_table").find("td.products_choose_list_td_:first").children().css('border','solid 5px #28abe4');
		$("#products_choose_list_table").find("td.products_choose_list_td_").children().css('cursor','pointer');
		
		//obrazek klikalny
		$(".products_choose_list").click(function() {
				var pID = $(this).attr('rel');
				$("#products_choose_first").html('<br/><br/>&nbsp;&nbsp;&nbsp;ładowanie...').load('http://olimpolsztyn.pl/template_ext.php?pagename=products_choosebox&id='+pID+'&ERRORS');
				//$(this).parent().parent().parent().parent().children('tr').children("td.products_choose_list_td").css('border','solid 5px #efefef');
				//$(this).parent().parent().parent().parent().find("td.products_choose_list_td").each(function() { $(this).css('border','solid 5px #efefef'); });
				$("#products_choose_list_table").find("td.products_choose_list_td_").each(function() { $(this).children().css('border','solid 5px #efefef'); });
				//$(this).parent().css('border','solid 5px #28abe4');
				$(this).parents("td.products_choose_list_td_").children().css('border','solid 5px #28abe4');
				//console.log($(this).parentsUntil(".products_choose_list_td"));
		});				

$(function(){
 
    $("#wysuwane").css("left","-300px");
 
		$("#wysuwane").hover(
			function () {
					$("#wysuwane").animate({left: "0px"}, 100 );
					$(this).addClass("zamknij");
			},
			function () {
					$("#wysuwane").animate({left: "-300px"}, 100 );
					$(this).removeClass("zamknij");
			}
		);
});		
		
});
