<!--
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 submitForm(sFormName)
{
	showHideFixedPreloader();
//	jQuery('#' + sFormName).submit();
	document.getElementById(sFormName).submit();
	jQuery('#' + sFormName + 'Submit').hide();
}

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

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();
	initializeInputFocusEffect('newsletterName','Imię i nazwisko');
	initializeInputFocusEffect('newsletterEmail','Adres E-mail');
//	initializeInputFocusEffect('userLogin','użytkownik');
//	initializeInputFocusEffect('userPassword','haslo');
});

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();
	}
}

/*** PRODUCTS ***/

function getProducts(sTargetDiv, iPage, sSearchKey, iSearchValue) // target div, strona, czego mo szukac, id tego szukania
{
	var divProducts = jQuery('.' + sTargetDiv);
	jQuery.ajax({
		method: "get",url: "ajax/products/getProducts.php",data: "page=" + iPage + "&key=" + sSearchKey + "&value=" + iSearchValue + "&sTarget=" + sTargetDiv + "&random=" + Math.random(),
		beforeSend: function(){
			showHidePreloader(sTargetDiv);
		}, // show loading just when link is clicked
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html) { //so, if data is retrieved, store it in html
			showHidePreloader(sTargetDiv,true);
			jQuery(divProducts).html(html); // show the html inside .content div
//			initializeFancyBoxImages();
		}
	}); //close jQuery.ajax(
}

/*** GROUPS - PRODUCTS PROPERTIES ***/

function getProductsByProperties(sTargetDiv, iGroupId, aProperties, iI, iProducts, iProductId) // target div, id grupy, tablica z wlasciwosciami do wyciagniecia, iI, iProducts
{
	var iI = (iI >= 0) ? iI : 0;
//	alert('iProducts ' + iProducts);

	iProductId = (iProductId != undefined) ? iProductId : 0;
	
	var divProducts = jQuery('.' + sTargetDiv + ' #radioProduct' + iProducts);
	if (divProducts.length == 0) {
		jQuery('.' + sTargetDiv).append('<div id="radioProduct' + iProducts + '" class="radioProduct"></div>');
		divProducts = jQuery('.' + sTargetDiv + ' #radioProduct' + iProducts);
//		alert('empty');
	}
//	alert('.' + sTargetDiv + ' #radioProduct' + iProducts);
//	var divProducts = jQuery('.' + sTargetDiv);
	
	var sArrayProperties = '';

	jQuery(jQuery('#radioProduct' + iProducts + ' .propertiesRadioButtons')).each(
		function (iDivId) {
			if (iDivId >= iI) {
//				alert('REMOVE '  + iDivId);
				jQuery(this).remove();
			}
		}
	)

//	alert('iProductId: ' + iProductId);
//	if (!iProductId) {
//		var divProductCount = jQuery("#divProductCartCount" + iProducts);
//		if (jQuery(divProductCount).lenght > 0) {
//			jQuery(divProducts).remove();
//			alert('remove');
//		}
//	}

	for (i in aProperties) {
		sPropertyName = aProperties[i]['sCheckedRadioName'];
		sPropertyValue = aProperties[i]['sCheckedRadioValue'];
		
//		alert('Key: ' + aProperties[i]['sCheckedRadioName'] + ' value: ' + aProperties[i]['sCheckedRadioValue']);
		sArrayProperties += "&properties["+sPropertyName+"]="+sPropertyValue;
	}
		
	jQuery.ajax({
		method: "get",
		url: "ajax/products/getProductsByProperties.php",
		data: "groupId=" + iGroupId + "&properties=" + encodeURI(sArrayProperties) + "&divProducts=" + divProducts + "&sTargetDiv=" + sTargetDiv + "&iI=" + iI + "&iProducts=" + iProducts + "&iProductId=" + iProductId + "&random=" + Math.random(),
		beforeSend: function(){
			showHideFixedPreloader();
		}, // show loading just when link is clicked
//		complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html) { //so, if data is retrieved, store it in html
			showHideFixedPreloader(true);
			jQuery(divProducts).append(html); // show the html inside .content div
//			initializeFancyBoxImages();
		}
	}); //close jQuery.ajax(
}

var iLastChangeSmallPicId = -1;
var iLastChangeSmallPicPhotoId = 0;

function changeSmallPic(iId, iPhotoId) //smallGroup, smallProduct
{
//	return; // OFFFFF
//	jQuery('#changePhotoButton' + iLastChangeSmallPicId + '_' + iLastChangeSmallPicPhotoId).removeClass('changePhotoButtonActive');
//	jQuery('#changePhotoButton' + iId + '_' + iLastChangeSmallPicPhotoId).removeClass('changePhotoButtonActive');
	
	var aImages = jQuery('#smallPictures' + iId + ' img.smallPicture').each (
		function(image) {
//			alert('image: ' + image);
			var hImage = jQuery('#smallPictures' + iId + ' img#smallPicture' + iId + '_' + image);
			jQuery(hImage).hide();
			if (image == iPhotoId) {
				jQuery(hImage).show();
			}
		}
	)
//	jQuery('#changePhotoButton' + iId + '_' + iPhotoId).addClass('changePhotoButtonActive');
	iLastChangeSmallPicId = iId;
	iLastChangeSmallPicPhotoId = iPhotoId;	
}

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

-->

