if( document.getElementById('logo') != undefined ) {
	document.getElementById('logo').onclick = function() {
		document.location.href = '/';
	}
}

/**
 * Gdy kliknie siÄ‚â€žĂ˘â‚¬ĹˇÄ‚ËĂ˘â€šÂ¬ÄąÄľĂ„â€šĂ‹ÂÄ‚ËĂ˘â€šÂ¬ÄąÄľÄ‚â€ąĂ‚Â w wyszukiwarce w zakladke produkty
 */
if( document.getElementById('bookmarkProducts') != undefined ) {
	document.getElementById('bookmarkProducts').onclick = function() {
		document.getElementById('bookmarkWarehouseSearch').style.display = 'none';
		document.getElementById('bookmarkProductsSearch').style.display = 'block';

		document.getElementById('bookmarkWarehouse').className = 'noSelected';
		this.className = 'selected';

		document.location.href = '/?oferta';
		return true;
	}
}


/**
 * Gdy kliknie siÄ‚â€žĂ˘â‚¬ĹˇÄ‚ËĂ˘â€šÂ¬ÄąÄľĂ„â€šĂ‹ÂÄ‚ËĂ˘â€šÂ¬ÄąÄľÄ‚â€ąĂ‚Â w wyszukiwarce w zakladke hurtownie
 */
if( document.getElementById('bookmarkWarehouse') != undefined ) {
	document.getElementById('bookmarkWarehouse').onclick = function() {
		document.getElementById('bookmarkProductsSearch').style.display = 'none';
		document.getElementById('bookmarkWarehouseSearch').style.display = 'block';

		document.getElementById('bookmarkProducts').className = 'noSelected';
		this.className = 'selected';

		document.location.href = '/partnerzy';
		return true;
	}
}


/**
 * Gdy siÄ‚â€žĂ˘â‚¬ĹˇÄ‚ËĂ˘â€šÂ¬ÄąÄľĂ„â€šĂ‹ÂÄ‚ËĂ˘â€šÂ¬ÄąÄľÄ‚â€ąĂ‚Â kliknie na stronie glownej w zakladke z produktami:
 * # Oferta specjalna
 */
if( document.getElementById('bookmarkProductsSpecials') != undefined ) {
	document.getElementById('bookmarkProductsSpecials').onclick = function() {
		document.getElementById('bookmarkProductsPromotionItems').style.display = 'none';
		document.getElementById('bookmarkProductsDistinguishedItems').style.display = 'none';
		document.getElementById('bookmarkProductsSpecialsItems').style.display = 'block';
		document.getElementById('bookmarkProductsPromotion').className = 'noSelected';
		document.getElementById('bookmarkProductsDistinguished').className = 'noSelected';
		this.className = 'selected';
	}
}


/**
 * Gdy siÄ‚â€žĂ˘â‚¬ĹˇÄ‚ËĂ˘â€šÂ¬ÄąÄľĂ„â€šĂ‹ÂÄ‚ËĂ˘â€šÂ¬ÄąÄľÄ‚â€ąĂ‚Â kliknie na stronie glownej w zakladke z produktami:
 *	# WyrĂ„â€šĂ˘â‚¬ĹľÄ‚ËĂ˘â€šÂ¬ÄąË‡Ä‚â€žĂ„â€¦Ä‚ËĂ˘â€šÂ¬ÄąË‡Ă„â€šĂ˘â‚¬ĹľÄ‚â€žĂ˘â‚¬Â¦Ă„â€šĂ˘â‚¬ĹľÄ‚â€ąÄąÄ„nione
 */
if( document.getElementById('bookmarkProductsPromotion') != undefined ) {
	document.getElementById('bookmarkProductsPromotion').onclick = function() {
		document.getElementById('bookmarkProductsSpecialsItems').style.display = 'none';
		document.getElementById('bookmarkProductsDistinguishedItems').style.display = 'none';
		document.getElementById('bookmarkProductsPromotionItems').style.display = 'block';

		document.getElementById('bookmarkProductsSpecials').className = 'noSelected';
		document.getElementById('bookmarkProductsDistinguished').className = 'noSelected';
		this.className = 'selected';
	}
}


/**
 * Gdy siÄ‚â€žĂ˘â‚¬ĹˇÄ‚ËĂ˘â€šÂ¬ÄąÄľĂ„â€šĂ‹ÂÄ‚ËĂ˘â€šÂ¬ÄąÄľÄ‚â€ąĂ‚Â kliknie na stronie glownej w zakladke z produktami:
 *	# Promocje
 *	# WyrĂ„â€šĂ˘â‚¬ĹľÄ‚ËĂ˘â€šÂ¬ÄąË‡Ä‚â€žĂ„â€¦Ä‚ËĂ˘â€šÂ¬ÄąË‡Ă„â€šĂ˘â‚¬ĹľÄ‚â€žĂ˘â‚¬Â¦Ă„â€šĂ˘â‚¬ĹľÄ‚â€ąÄąÄ„nione
 */
if( document.getElementById('bookmarkProductsDistinguished') != undefined ) {
	document.getElementById('bookmarkProductsDistinguished').onclick = function() {
		document.getElementById('bookmarkProductsSpecialsItems').style.display = 'none';
		document.getElementById('bookmarkProductsPromotionItems').style.display = 'none';
		document.getElementById('bookmarkProductsDistinguishedItems').style.display = 'block';

		document.getElementById('bookmarkProductsSpecials').className = 'noSelected';
		document.getElementById('bookmarkProductsPromotion').className = 'noSelected';
		this.className = 'selected';
	}
}


pokazFormulaz = function( p, powiadom, url ) {

		 	 if (navigator.appName == 'Microsoft Internet Explorer') {
				 document.getElementById('overlay').style.display = 'block';
				 document.getElementById('ov').style.display = 'block';
				 document.getElementById('window').style.left = (document.body.scrollWidth/2)-(617/3.5) + 'px'
				 document.getElementById('window').style.top = (document.body.scrollTop)+(375/3.5) + 'px'
			 } else {
				 document.getElementById('overlay').style.display = 'table';
         		 document.getElementById('inner').style.height = '450px';
			 }


				 //Budowanie kontererow
       var inner = document.getElementById('inner');
       		 inner.innerHTML = '';

       if (navigator.appName == 'Microsoft Internet Explorer') {

	 	     divResult = document.createElement('<div id="result">');
				 divResult.style.display = 'none';
				 inner.appendChild(divResult);

	 	     divLoading = document.createElement('<div id="loading">');
				 imgLoading = document.createElement('<img src="' + url + '/css/img/loading.gif" alt="wczytywanie, proszÄ‚â€žĂ˘â‚¬ĹˇÄ‚ËĂ˘â€šÂ¬ÄąÄľĂ„â€šĂ‹ÂÄ‚ËĂ˘â€šÂ¬ÄąÄľÄ‚â€ąĂ‚Â czekaÄ‚â€žĂ˘â‚¬ĹˇÄ‚ËĂ˘â€šÂ¬ÄąÄľĂ„â€šĂ‹ÂÄ‚ËĂ˘â‚¬ĹˇĂ‚Â¬Ä‚â€ąĂ˘â‚¬Ë‡..." />');
				 divLoading.style.display = 'none';
				 divLoading.appendChild(imgLoading);
				 inner.appendChild(divLoading);

				 divClose = document.createElement('<div id="close">');
				 aClose = document.createElement('<a id="closeWindow" href="javascript:;">');
				 aClose.onclick = function() {
						 document.getElementById('overlay').style.display = 'none';
						 document.getElementById('ov').style.display = 'none';
					 	 return false;
				 }
				 spanClose = document.createElement('span');
				 spanClose.innerHTML = 'x';
				 aClose.appendChild(spanClose);
				 divClose.appendChild(aClose);
			   inner.appendChild(divClose);

				 divPowiadom = document.createElement('<div id="powiadomZnajomego">');

				 divPowiadomH3 = document.createElement('<h3>');
				 img = document.createElement('<img src="' + url + '/css/img/koperta.gif">');
         divPowiadomH3.appendChild(img);
				 span = document.createElement('<span>');
         span.innerHTML = 'Powiadom znajomego';
         divPowiadomH3.appendChild(span);
				 divPowiadom.appendChild(divPowiadomH3);
				 inner.appendChild(divPowiadom);

				 divPowiadomForm = document.createElement('form');
				 divPowiadomForm.action = 'javascript:;';
				 divPowiadomForm.method = 'post';
				 divPowiadomForm.onsubmit = function() {
						if ( !this.imie.value ) {
							alert('Proszę wprowadzić imię, nazwisko lub nazwę firmy');
							this.imie.focus();
						} else if ( !this.mail.value ) {
							alert('Proszę wprowadzić email');
							this.mail.focus();
						} else if ( !checkMail(this.mail.value) ) {
							alert('Adres email jest niewłaściwy');
							this.mail.focus();
						} else if ( (this.mailFriend != undefined) && !this.mailFriend.value ) {
							alert('Nie wprowadziłeś adresu email znajomego');
							this.mailFriend.focus();
						} else if ( (this.mailFriend != undefined) && !checkMail(this.mailFriend.value) ) {
							alert('Adres email twojego znajomego jest niewłaściwy');
							this.mailFriend.focus();
						} else if ( !this.token.value ) {
							alert('Nie wprowadziłeś kodu z obrazka');
							this.token.focus();
						} else {
							powiadomZnajomego(this,  url);
						}
						return false;
				 }

				 // To jest IMIE
				 divPowiadomDl = document.createElement('<dl>');
				 divPowiadomDt = document.createElement('<dt>');
				 divPowiadomDt.innerHTML = 'Imię, nazwisko / Firma:';
				 divPowiadomDl.appendChild(divPowiadomDt);
				 divPowiadomDd = document.createElement('<dd>');
				 divPowiadomInput = document.createElement('<input type="text" name="imie" value="" class="tekst">');
				 divPowiadomDd.appendChild(divPowiadomInput);
				 divPowiadomDl.appendChild(divPowiadomDd);
				 divPowiadomForm.appendChild(divPowiadomDl);

				 // To jest email
				 divPowiadomDl = document.createElement('<dl>');
				 divPowiadomDt = document.createElement('<dt>');
				 divPowiadomDt.innerHTML = 'Twój e-mail:';
				 divPowiadomDl.appendChild(divPowiadomDt);
				 divPowiadomDd = document.createElement('<dd>');
				 divPowiadomInput = document.createElement('<input type="text" name="mail" value="" class="tekst">');
				 divPowiadomDd.appendChild(divPowiadomInput);
				 divPowiadomDl.appendChild(divPowiadomDd);
				 divPowiadomForm.appendChild(divPowiadomDl);


				 divPowiadomDl = document.createElement('<dl>');
				 divPowiadomDt = document.createElement('<dt>');
				 divPowiadomDt.innerHTML = 'E-mail znajomego:';
				 divPowiadomDl.appendChild(divPowiadomDt);
				 divPowiadomDd = document.createElement('<dd>');
				 divPowiadomInput = document.createElement('<input type="text" name="mailFriend" value="" class="tekst">');
				 divPowiadomDd.appendChild(divPowiadomInput);
				 divPowiadomDl.appendChild(divPowiadomDd);
				 divPowiadomForm.appendChild(divPowiadomDl);


				 // To jest opis
				 divPowiadomDl = document.createElement('<dl>');
				 divPowiadomDt = document.createElement('<dt>');
				 divPowiadomDt.innerHTML = 'Treść wiadomości:';
				 divPowiadomDl.appendChild(divPowiadomDt);
				 divPowiadomDd = document.createElement('<dd>');
				 divPowiadomInput = document.createElement('<textarea name="tresc">');
				 divPowiadomInput.value = "Witaj\n\n";
				 divPowiadomInput.value+= 'W Centrum Handlu Hurtowego znalazłem produkt: "' + ((document.title).substr(9)) + "\". Powinien Cię zainteresować.\n\nZnajduje się pod adresem: " + document.URL + "\n\n";
				 divPowiadomInput.style.width = '400px';
				 divPowiadomInput.style.height = '170px';
				 divPowiadomDd.appendChild(divPowiadomInput);
				 divPowiadomDl.appendChild(divPowiadomDd);
				 divPowiadomForm.appendChild(divPowiadomDl);


				 // To jest token
				 divPowiadomDl = document.createElement('<dl>');
				 divPowiadomDt = document.createElement('<dt>');
				 divPowiadomToken = document.createElement('<img id="token" src="' + url + '/token.png" />');
				 divPowiadomDt.appendChild(divPowiadomToken);
				 divPowiadomDl.appendChild(divPowiadomDt);
				 divPowiadomDd = document.createElement('<dd>');
				 divPowiadomInput = document.createElement('<input class="tekst" style="width: 100px;" type="text" name="token" value="" />');
				 divPowiadomDd.appendChild(divPowiadomInput);
				 divPowiadomDd.innerHTML+= '<span style="color: #999;">&nbsp;(wpisz kod z obrazka)</span><br />';
				 divPowiadomDd.innerHTML+= '<a href="javascript:;" onClick="reloadToken(\'' + url + '\');" />Obrazek nieczytelny? Przeładuj go!</a>';
				 divPowiadomDl.appendChild(divPowiadomDd);
				 divPowiadomForm.appendChild(divPowiadomDl);
				 divPowiadomDiv = document.createElement('<div class="wyslij" style="margin-top: 10px;clear: both;">');
				 divPowiadomInputWyslij = document.createElement('<input type="submit" value="Wyślij">');
				 divPowiadomDiv.appendChild(divPowiadomInputWyslij);
				 divPowiadomForm.appendChild(divPowiadomDiv);
				 divPowiadom.appendChild(divPowiadomForm);
				 inner.appendChild(divPowiadom);

			 } else {

	 	     divResult = document.createElement('div');
				 divResult.setAttribute('id', 'result');
				 divResult.style.display = 'none';
				 inner.appendChild(divResult);

				 divLoading = document.createElement('div');
				 divLoading.setAttribute('id', 'loading');
				 imgLoading = document.createElement('img');
				 imgLoading.src = url + '/css/img/loading.gif';
				 imgLoading.title = 'wczytywanie, proszę czekać...';
				 divLoading.style.display = 'none';
				 divLoading.appendChild(imgLoading);
				 inner.appendChild(divLoading);

				 divClose = document.createElement('div');
				 divClose.setAttribute('id', 'close');

				 aClose = document.createElement('a');
				 aClose.setAttribute('id', 'closeWindow');
				 aClose.href = 'javascript:;';
				 aClose.onclick = function() {
						 document.getElementById('overlay').style.display = 'none';
						 //document.getElementById('chh').setAttribute('style', '');
					 	 return false;
				 }
				 spanClose = document.createElement('span');
				 spanClose.innerHTML = 'x';
				 aClose.appendChild(spanClose);
				 divClose.appendChild(aClose);
			   inner.appendChild(divClose);

				 divPowiadom = document.createElement('div');
				 divPowiadom.setAttribute('id', 'powiadomZnajomego');

				 divPowiadomH3 = document.createElement('h3');
				 img = document.createElement('img');
  	     img.setAttribute('src', url + '/css/img/koperta.gif');
         divPowiadomH3.appendChild(img);
				 span = document.createElement('span');
         span.innerHTML = 'Powiadom znajomego';
         divPowiadomH3.appendChild(span);
				 divPowiadom.appendChild(divPowiadomH3);

				 divPowiadomForm = document.createElement('form');
				 divPowiadomForm.action = 'javascript:;';
				 divPowiadomForm.method = 'post';
				 divPowiadomForm.onsubmit = function() {
						if ( !this.imie.value ) {
							alert('Proszę wprowadzić imię, nazwisko lub nazwę firmy');
							this.imie.focus();
						} else if ( !this.mail.value ) {
							alert('Proszę wprowadzić email');
							this.mail.focus();
						} else if ( !checkMail(this.mail.value) ) {
							alert('Adres email jest niewłaściwy');
							this.mail.focus();
						} else if ( (this.mailFriend != undefined) && !this.mailFriend.value ) {
							alert('Nie wprowadziłeś adresu email znajomego');
							this.mailFriend.focus();
						} else if ( (this.mailFriend != undefined) && !checkMail(this.mailFriend.value) ) {
							alert('Adres email twojego znajomego jest niewłaściwy');
							this.mailFriend.focus();
						} else if ( !this.token.value ) {
							alert('Nie wprowadziłeś kodu z obrazka');
							this.token.focus();
						} else {
							powiadomZnajomego(this, url);
						}
						return false;
				 }

				 // To jest IMIE
				 divPowiadomDl = document.createElement('dl');
				 divPowiadomDt = document.createElement('dt');
				 divPowiadomDt.innerHTML = 'Imię, nazwisko / Firma:';
				 divPowiadomDl.appendChild(divPowiadomDt);
				 divPowiadomDd = document.createElement('dd');
				 divPowiadomInput = document.createElement('input');
				 divPowiadomInput.setAttribute('class', 'tekst');
				 divPowiadomInput.type = 'text';
				 divPowiadomInput.name = 'imie';
				 divPowiadomInput.value = '';
				 divPowiadomDd.appendChild(divPowiadomInput);
				 divPowiadomDl.appendChild(divPowiadomDd);
				 divPowiadomForm.appendChild(divPowiadomDl);

				 // To jest email
				 divPowiadomDl = document.createElement('dl');
				 divPowiadomDt = document.createElement('dt');
				 divPowiadomDt.innerHTML = 'Twój e-mail:';
				 divPowiadomDl.appendChild(divPowiadomDt);
				 divPowiadomDd = document.createElement('dd');
				 divPowiadomInput = document.createElement('input');
				 divPowiadomInput.setAttribute('class', 'tekst');
				 divPowiadomInput.type = 'text';
				 divPowiadomInput.name = 'mail';
				 divPowiadomInput.value = '';
				 divPowiadomDd.appendChild(divPowiadomInput);
				 divPowiadomDl.appendChild(divPowiadomDd);
				 divPowiadomForm.appendChild(divPowiadomDl);

				 if ( powiadom == true ) {
					 // To jest email odbiorcy
					 divPowiadomDl = document.createElement('dl');
					 divPowiadomDt = document.createElement('dt');
					 divPowiadomDt.innerHTML = 'E-mail znajomego:';
					 divPowiadomDl.appendChild(divPowiadomDt);
					 divPowiadomDd = document.createElement('dd');
					 divPowiadomInput = document.createElement('input');
					 divPowiadomInput.setAttribute('class', 'tekst');
					 divPowiadomInput.type = 'text';
					 divPowiadomInput.name = 'mailFriend';
					 divPowiadomInput.value = '';
					 divPowiadomDd.appendChild(divPowiadomInput);
					 divPowiadomDl.appendChild(divPowiadomDd);
					 divPowiadomForm.appendChild(divPowiadomDl);
				 } else {
					 divPowiadomDl = document.createElement('dl');
					 divPowiadomDt = document.createElement('dt');
					 divPowiadomDt.innerHTML = 'Telefon:';
					 divPowiadomDl.appendChild(divPowiadomDt);
					 divPowiadomDd = document.createElement('dd');
					 divPowiadomInput = document.createElement('input');
					 divPowiadomInput.setAttribute('class', 'tekst');
					 divPowiadomInput.type = 'text';
					 divPowiadomInput.name = 'telefon';
					 divPowiadomInput.value = '';
					 divPowiadomDd.appendChild(divPowiadomInput);
					 divPowiadomDl.appendChild(divPowiadomDd);
					 divPowiadomForm.appendChild(divPowiadomDl);
				 }



				 // To jest opis
				 divPowiadomDl = document.createElement('dl');
				 divPowiadomDt = document.createElement('dt');
				 divPowiadomDt.innerHTML = 'Treść wiadomości:';
				 divPowiadomDl.appendChild(divPowiadomDt);
				 divPowiadomDd = document.createElement('dd');
				 divPowiadomInput = document.createElement('textarea');
				 divPowiadomInput.name = 'tresc';
				 divPowiadomInput.value = "Witaj\n\n";
				 divPowiadomInput.value+= 'W Centrum Handlu Hurtowego znalazłem produkt: "' + ((document.title).substr(9)) + "\". Powinien Cię zainteresować.\n\nZnajduje się pod adresem: " + document.URL + "\n\n";
				 divPowiadomInput.style.width = '400px';
				 divPowiadomInput.style.height = '170px';
				 divPowiadomDd.appendChild(divPowiadomInput);
				 divPowiadomDl.appendChild(divPowiadomDd);
				 divPowiadomForm.appendChild(divPowiadomDl);


				 // To jest token
				 divPowiadomDl = document.createElement('dl');
				 divPowiadomDt = document.createElement('dt');
				 divPowiadomToken = document.createElement('img');
				 divPowiadomToken.setAttribute('id', 'token');
				 divPowiadomToken.src = url + '/token.png';
				 divPowiadomDt.appendChild(divPowiadomToken);
				 divPowiadomDl.appendChild(divPowiadomDt);
				 divPowiadomDd = document.createElement('dd');
				 divPowiadomInput = document.createElement('input');
				 divPowiadomInput.setAttribute('class', 'tekst');
				 divPowiadomInput.style.width = '100px';
				 divPowiadomInput.type = 'text';
				 divPowiadomInput.name = 'token';
				 divPowiadomInput.value = '';
				 divPowiadomDd.appendChild(divPowiadomInput);
				 divPowiadomDd.innerHTML+= '<span style="color: #999;">&nbsp;(wpisz kod z obrazka)</span><br />';
				 divPowiadomDd.innerHTML+= '<a href="javascript:;" onClick="reloadToken(\'' + url + '\');" />Obrazek nieczytelny? Przeładuj go!</a>';
				 divPowiadomDl.appendChild(divPowiadomDd);
				 divPowiadomForm.appendChild(divPowiadomDl);


				 divPowiadomDiv = document.createElement('div');
				 divPowiadomDiv.style.clear = 'both';
				 divPowiadomDiv.style.marginTop = '10px';
				 divPowiadomDiv.setAttribute('class', 'wyslij');
				 divPowiadomInputWyslij = document.createElement('input');
				 divPowiadomInputWyslij.type = 'submit';
				 divPowiadomInputWyslij.value = 'Wyślij';
				 divPowiadomDiv.appendChild(divPowiadomInputWyslij);
				 divPowiadomForm.appendChild(divPowiadomDiv);
				 divPowiadom.appendChild(divPowiadomForm);

				 inner.appendChild(divPowiadom);
			}

			document.getElementById('token').src = url + '/token.png?' + (new Date()).getTime();
		}




var menuids = ['category'];

		function powiadomZnajomego( formularz, urlOffer ) {
			var xmlSend = '/powiadom.php';
			advAJAX.post({
				url: xmlSend,
				parameters : {
						'imie' 				: formularz.imie.value,
			      'mail' 				: formularz.mail.value,
    			  'mailFriend'	: formularz.mailFriend.value,
						'tresc' 			: formularz.tresc.value,
						'token' 			: formularz.token.value
		    },
				onLoading : function(obj) {
					document.getElementById('loading').style.display = 'block';
				},
				onSuccess : function(obj) {
					document.getElementById('loading').style.display = 'none';

          xml = obj.responseXML;
					with (xml.getElementsByTagName('powiadomienie').item(0)) {
						var result = getAttribute('wyslano')*1;
					}

					if ( !result ) {
            document.getElementById('result').innerHTML = '<strong>Błąd: Wiadomość nie została wysłana.</strong><br />Być może został wprowadzony niewłaściwy kod z obrazka!';
		        document.getElementById('result').style.display = 'block';
						document.getElementById('result').style.background = '#fdd';
						document.getElementById('result').style.width = '400px';
						document.getElementById('result').onclick = function() {
							this.style.display = 'none';
						}
					} else {
            document.getElementById('result').innerHTML = '<strong>Wiadomość została wysłana</strong>';
						document.getElementById('result').style.background = '#cf6';
			      document.getElementById('result').style.display = 'block';

						document.getElementById('result').onclick = function() {
							document.getElementById('overlay').style.display = 'none';
							document.getElementById('ov').style.display = 'none';
							document.getElementById('result').style.display = 'none';
						}

						setTimeout(function() { document.getElementById('overlay').style.display = 'none';document.getElementById('ov').style.display = 'none';document.getElementById('result').style.display = 'none'; }, 2500);
					}


				}
			});
		}

function buildsubmenus() {
	if( document.getElementById('elementCategoriesAndLeftOver')) {
	for (var i=0; i<menuids.length; i++) {
		var ultags = document.getElementById(menuids[i]).getElementsByTagName('ul');
		for (var t=0; t<ultags.length; t++) {
			ultags[t].parentNode.getElementsByTagName('a')[0].className='subfolderstyle';
			/*
			if (ultags[t].parentNode.parentNode.id==menuids[i]) {
				ultags[t].style.left=ultags[t].parentNode.offsetWidth+'px';
			} else {
				ultags[t].style.left=ultags[t-1].getElementsByTagName('a')[0].offsetWidth+'px';
			}
			*/


			ultags[t].parentNode.onmouseover=function() {
				this.getElementsByTagName('ul')[0].style.display = 'block';
				//alert(this.getElementsByTagName('ul')[0].clientHeight);
			}
			ultags[t].parentNode.onmouseout=function() {

				this.getElementsByTagName('ul')[0].style.display = 'none';
			}
		}
		for (var t=ultags.length-1; t>-1; t--) {
			ultags[t].style.visibility = 'visible';
			ultags[t].style.display = 'none';
		}
	}
	}
}

function openHosting() {
	if(document.getElementById('pak').value == 'S') {
		document.getElementById('Ska').style.display = 'block';
		document.getElementById('Mka').style.display = 'none';
		document.getElementById('Lka').style.display = 'none';
		document.getElementById('XLka').style.display = 'none';
	}
	else if(document.getElementById('pak').value == 'M') {
		document.getElementById('Ska').style.display = 'none';
		document.getElementById('Mka').style.display = 'block';
		document.getElementById('Lka').style.display = 'none';
		document.getElementById('XLka').style.display = 'none';
	}
	else if(document.getElementById('pak').value == 'L') {
		document.getElementById('Ska').style.display = 'none';
		document.getElementById('Mka').style.display = 'none';
		document.getElementById('Lka').style.display = 'block';
		document.getElementById('XLka').style.display = 'none';
	}
	else if(document.getElementById('pak').value == 'XL') {
		document.getElementById('Ska').style.display = 'none';
		document.getElementById('Mka').style.display = 'none';
		document.getElementById('Lka').style.display = 'none';
		document.getElementById('XLka').style.display = 'block';
	} else {
		document.getElementById('Ska').style.display = 'none';
		document.getElementById('Mka').style.display = 'none';
		document.getElementById('Lka').style.display = 'none';
		document.getElementById('XLka').style.display = 'none';
	}

	if(document.getElementById('pak').value == 'S') {
		document.getElementById('SkaH').style.display = 'block';
		document.getElementById('MkaH').style.display = 'none';
		document.getElementById('LkaH').style.display = 'none';
		document.getElementById('XLkaH').style.display = 'none';
	}
	else if(document.getElementById('pak').value == 'M') {
		document.getElementById('SkaH').style.display = 'none';
		document.getElementById('MkaH').style.display = 'block';
		document.getElementById('LkaH').style.display = 'none';
		document.getElementById('XLkaH').style.display = 'none';
	}
	else if(document.getElementById('pak').value == 'L') {
		document.getElementById('SkaH').style.display = 'none';
		document.getElementById('MkaH').style.display = 'none';
		document.getElementById('LkaH').style.display = 'block';
		document.getElementById('XLkaH').style.display = 'none';
	}
	else if(document.getElementById('pak').value == 'XL') {
		document.getElementById('SkaH').style.display = 'none';
		document.getElementById('MkaH').style.display = 'none';
		document.getElementById('LkaH').style.display = 'none';
		document.getElementById('XLkaH').style.display = 'block';
	} else {
		document.getElementById('SkaH').style.display = 'none';
		document.getElementById('MkaH').style.display = 'none';
		document.getElementById('LkaH').style.display = 'none';
		document.getElementById('XLkaH').style.display = 'none';
	}

}


function reloadToken( url ) {
		document.getElementById('token').src =  url + '/token.png?' + (new Date()).getTime();
}

function CalcOrdF( podstJednostka, pakowane ) {
	if( (((document.getElementById('lockerQuant').value % podstJednostka) == 0) && (document.getElementById('lockerQuant').value != 0) && (pakowane)) ||  (((document.getElementById('lockerQuant').value >= podstJednostka) ) && (document.getElementById('lockerQuant').value != 0) && (!pakowane)) ) {
		document.getElementById('CalcOrd').innerHTML = 'Podano poprawną ilość';
		document.getElementById('CalcOrd').style.display = 'none';
		document.getElementById('submitProd').removeAttribute('disabled');
		document.getElementById('submitProd').removeAttribute('class');
		document.getElementById('submitProd').setAttribute('class', 'enableButton');
	} else {
		if( pakowane == 0 ) {
			document.getElementById('CalcOrd').innerHTML = 'Podana wartość jest od minimalnego zamówienia minimalnego zamówienia ('+podstJednostka+' sztuk)';
		} else {
			document.getElementById('CalcOrd').innerHTML = 'Podana wartość nie jest wielokrotnością minimalnego zamówienia ('+podstJednostka+' sztuk)';
		}
		document.getElementById('CalcOrd').style.background = '#e44';
		document.getElementById('CalcOrd').style.color = '#fff';
		document.getElementById('CalcOrd').style.display = 'block';
		if(document.getElementById('CalcOrdDodanie') != null) {
			document.getElementById('CalcOrdDodanie').style.display = 'none';
		}
		if(document.getElementById('CalcOrdNDodanie') != null) {
			document.getElementById('CalcOrdNDodanie').style.display = 'none';
		}
		document.getElementById('submitProd').setAttribute('disabled', 'disabled');
		document.getElementById('submitProd').removeAttribute('class');
		document.getElementById('submitProd').setAttribute('class', 'disabledButton');
	}
}

function prepareOrd( podstJednostka, pakowane ) {
	if(((document.getElementById('lockerQuant').value >= podstJednostka) ) && (document.getElementById('lockerQuant').value != 0)) {
		return true;
	} else {
		alert('Wprowadziłeś mniejszą wartość niż minimalna ilość.');
		return false;
	}
}


if (window.addEventListener) {
	window.addEventListener('load', buildsubmenus, false);
} else if (window.attachEvent) {
	window.attachEvent('onload', buildsubmenus);
}

if((document.getElementById('CalcOrdNDodanie') != null)) {
	if (document.getElementById('CalcOrdNDodanie').innerHTML != '') {
		document.getElementById('CalcOrdNDodanie').style.color = '#fff';
		document.getElementById('CalcOrdNDodanie').style.background = '#e44';
		document.getElementById('CalcOrdNDodanie').style.display = 'block';
	}
}
if((document.getElementById('CalcOrdDodanie') != null)) {
	if (document.getElementById('CalcOrdDodanie').innerHTML != '') {
		document.getElementById('CalcOrdDodanie').style.color = '#fff';
		document.getElementById('CalcOrdDodanie').style.background = '#5c5';
		document.getElementById('CalcOrdDodanie').style.display = 'block';
	}
}

function wlaczOrder( podstJednostka, pakowane ){
	var Timer = setTimeout(submitProd( podstJednostka, pakowane ),100);
}
function wylaczOrder( podstJednostka ){
	try{clearTimeout(Timer);} catch(ex) {}
}

var vartosc = 0;

function submitProd( podstJednostka, pakowane ) {

	if( document.getElementById('CalcOrd').style.display == 'block' ) {
			document.getElementById('orderQuant').value = podstJednostka;
			document.getElementById('submitProd').removeAttribute('disabled');
			document.getElementById('submitProd').removeAttribute('class');
			document.getElementById('submitProd').setAttribute('class', 'enableButton');

	}
}

function pokazFormularz( adres ) {
	if( document.getElementById('FormEmail').style.display != 'block' ) {
		document.getElementById('FormEmail').style.display = 'block';
	} else {
		document.getElementById('FormEmail').style.display = 'none';
	}
}
/*
if( document.getElementById('Praca_w_sprzedazy') != undefined ) {
	document.getElementById('Praca_w_sprzedazy').innerHTML+= '<div id="pracawsprzedazy21001000111"></div>';
}
*/