<!--
function trace(sString)
{
	alert(sString);
}	

function size(obj) {
    var size = 0, key;
    for (key in obj) {
        if (obj.hasOwnProperty(key)) size++;
    }
    return size;
};

function popImage(url,windowTitle,windowName,closeOnClick,width,height,t){
	closeOnClick=true;
	if(!url)return
	function readSize(){if(t.complete)showPopup(t.width,t.height);else setTimeout(readSize,1e2)}
	function showPopup(w,h){with(window.open('',windowName||'','width='+(width||w)+',height='+(height||h)).document){open();write('<html><head><title>'+(windowTitle||'')+'</title></head><body onBlur="self.close()" style="margin:0;padding:0"><img src="'+url+'" style="display:block'+(closeOnClick?';cursor: pointer" onclick="self.close()" title="Zamknij okno"':'"')+'></body></html>');close()}}
	if(!width||!height)t=new Image(),t.src=url,readSize()
	else showPopup(width,height)
}

function popup(mylink) 
{
	if (!window.focus)return true;
	var href;
	if (typeof(mylink) == 'string')
	   href=mylink;
	else
	   href=mylink.href;
	window.open(href, 'Popup', 'width=636,height=400,scrollbars=yes');
	return false;
}

/*
Form2Pop Script- By Peter Bailey (http://www.peterbailey.net)
Featured on JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
*/

function createTarget(sTarget,sWhat,sOptions){
	window.open(sWhat, sTarget, sOptions);
	return false;
}

function getComments(sTargetDiv, iPage, sSearchKey, iSearchValue) // target div, strona, czego mo szukac, id tego szukania
{
	var divComments = jQuery('.' + sTargetDiv);
	jQuery.ajax({
		method: "get",
		url: "ajax/comments/getComments.php",
		data: "page=" + iPage + "&key=" + sSearchKey + "&value=" + iSearchValue + "&random=" + Math.random(),
		beforeSend: function(){
			showHidePreloader(sTargetDiv);
		},
		success: function(html) {
			showHidePreloader(sTargetDiv,true);
			jQuery(divComments).html(html);
		}
	}); //close jQuery.ajax(
}

function submitForm(sFormName, bDontHideButton){
//	showHideFixedPreloader();
	if (bDontHideButton == undefined) {
		bDontHideButton = false;
	}
	if (!bDontHideButton) {
		jQuery('#' + sFormName + 'Submit').hide();
	}		
	jQuery('#' + sFormName).submit();
}

function initializeFancyBoxImages()
{
	jQuery("a.fancyBoxImage").fancybox({
		'zoomSpeedIn':	500,
		'zoomSpeedOut':	300,
		'overlayShow':	true,
		'hideOnContentClick': true
	});
}

function initializeFancyBoxPage()
{
	jQuery("a.fancyBoxPage").fancybox({
		'frameWidth': 800,
		'frameHeight': 500,
		'autoDimensions': true,
		'zoomSpeedIn':	500,
		'zoomSpeedOut':	300,
		'overlayShow':	true,
		'hideOnContentClick': false
	});
}

function v()
{
	void(null);
}

function initializeInputFocusEffect(sInputName, sText)
{
	if (!jQuery("input[name='" + sInputName + "']").attr('value')) {
		jQuery("input[name='" + sInputName + "']").attr('value', sText);
	}
	jQuery("input[name='"+sInputName+"']").focus(function()
		{
			jQuery("input[name='"+sInputName+"']").attr('value','');
		}
	)
	jQuery("input[name='"+sInputName+"']").blur(function()
		{
			if (!jQuery("input[name='"+sInputName+"']").attr('value')) {
				jQuery("input[name='"+sInputName+"']").attr('value', sText);
			}
		}
	)
}

/*** JQUERY ***/
jQuery.noConflict();
jQuery(document).ready(function() {
	externalLinks();
	/*** FANCY BOX ***/
	initializeFancyBoxImages();
	initializeFancyBoxPage();
//	showLanguageMenu();
//	setLanguageMenuTimeout();
	/*** CHANGING FONT SIZE ***/
//	changeFontSize();

	setupPopUpBanner();

	jQuery("ul.category").click(
		function() 
		{
			var iId = jQuery(this).attr('id');
			jQuery("ul#sub_"+iId).slideToggle(200);
		}
	)
	
	jQuery('.yui-carousel-scroller').bind('mouseenter', function() {
		jQuery('.yui-carousel-scroller').trigger('stop');
	});
	jQuery('.yui-carousel-scroller').bind('mouseleave', function() {
		jQuery('.yui-carousel-scroller').trigger('start');
	});

});

function showHidePreloader(sTargetDiv, bHide)
{
	if (bHide == 'undefined') {
		bHide = false;
	}
	var iDivContentHeight = jQuery('.' + sTargetDiv).height();
	var divPreloader = jQuery('div.preloaderApla_' + sTargetDiv);
	iDivContentHeight = (iDivContentHeight > 59) ? iDivContentHeight : 60;
	jQuery(divPreloader).height(iDivContentHeight);
	if (!bHide) {
		jQuery(divPreloader).show();
	} else {
		jQuery(divPreloader).hide();
	}
}

function showHideFixedPreloader(bHide)
{
	if (bHide == undefined) {
		bHide = false;
	}
	var divFixedPreloader = jQuery('div#ajaxLoading');
	if (!bHide) {
		jQuery(divFixedPreloader).show();
	} else {
		jQuery(divFixedPreloader).hide();
	}
}

function setPrintHTML(sHTML)
{
	var sName = 'toPrint';
	
	jQuery.post("ajax/jQuerySession.php", {set: '1', name: sName, value: sHTML}, function(data)
	{
		if(data == "ok") {
			//jQuery("#container").html("<b>SESSION Setup Successfully!</b>");
			return createTarget('print','toPrint', 'width=700,height=600,resizable=no,scrollbars=yes');
			alert
		} else {
	//		jQuery("#container").html("<b>Something Broke! HELP!</b>");
		}
	});
	
//	alert(sHTML);
//	return false;
}


function changeAmount(hInputId, iAmount, iForceAmount) // order gwarek
{
	var hInput = jQuery('#' + hInputId);
	var iValue = eval(hInput.val());
	if (iForceAmount != undefined) {
		hInput.val(iForceAmount);
	} else {
		if ((iValue + iAmount) >= 0) {
			hInput.val(iValue + iAmount);
		}
	}
}

function formatPrice(iPrice)
{
	iPrice = new String(iPrice);
	aParts = iPrice.split('.');

//	alert('aParts[1].length: ' aParts[1].length);
	
	if (aParts[1] != undefined) {
		if (aParts[1].length == 0){
			aParts[1] = '00';
		} else if (aParts[1].length == 1) {
			aParts[1] += '0';
		}
		iPrice = aParts.join(',');
	} else {
		iPrice = iPrice + ',00';
	}
	
//    iPrice = number_format(iPrice, 2, ',', ' ');
//	alert('dddd-> ' + iPrice);
    return iPrice;
}

function calculatePrice(hInputId, iAmount0, iAmount1)
{
	var hInput = jQuery('#' + hInputId);
	var iPrice = iAmount0 * iAmount1;
	iPrice = formatPrice(iPrice);
	hInput.val(iPrice);

}

function setupPopUpBanner()
{
	jQuery(".bannerClose a").click(
		function(){
			jQuery(".bannerPopUp").hide();
			return false;
		}
	);
}

-->

