
/* <b style="font-size:12px;color:red; text-decoration:blin)k">&gt;</b>  Detale produktu NOWA KARTA lamptique (projector - projector_details) [56897]*/
// START Z ROZMIAREM CZY NIE (0 - start bez rozmiaru, 1 - z rozmiarem)
var rozmiar_start = 1;

// JEDNOSTKI MIAR PRZY CENIE (0 - tak, 1 -nie)
var unit_start = 1;

// KOSZTY DOSTAWY (0 - tak, 1 -nie)
var delivery_start = 1;


// PODAJ ILOSC (0 - tak, 1 -nie)
var number_start = 1;

// POKAZ ILOSC (0 - tak, 1 -nie)
var amount_start = 1;

// POKAZ CENE NETTO (0 - tak, 1 -nie)
var pricenetto_start = 1;

var txt_niemastanu = 'Produkt niedostępny';
var txt_status_24 = 'w ciągu 24h';
var txt_status_natychmiast = 'dzisiaj';
var txt_days = ' dni'
var txt_za = ' za ';
var txt_taniej = 'Taniej o ';
var txt_oszczedzasz = 'oszczędzasz ';
var txt_wybrany_rozmiar = 'Rozmiar:  ';
var txt_wysylka = '';
var txt_wysylka_za = 'w ciągu ';
var txt_dostepny = 'Dostawa  ';
var txt_dostepny_za = 'Dostawa za ';
var txt_pkt = ' pkt.';
var txt_tylkotel = 'Skontaktuj się ze sprzedawcą';
var txt_niedostepny = 'Produkt niedostępny';
var txt_status_amount_full = 'większa ilość';
var txt_status_amount_null = 'brak w magazynie';
var txt_forpointsonly ='Produkt możesz kupić za punkty';
var txt_forpoints_txt = 'Zaznacz jak chcesz kupić za punkty';
var txt_disable_desc = '<a href=\"contact.php\">Skontaktuj się z nami</a>';
/**
TESTER
*/

function tester()
{
var itemz='';
for(n in selectSizes)
{
		itemz += n + ' - ' + selectSizes[n] + '<br />';
}

var mycode='<div style=\"background:#fff;position:fixed;top:0;right:0;padding:10px;border:1px solid;\">' +itemz +'</div>';

var tester_id = document.getElementById("'tester");
tester_id.innerHTML = mycode;
}


/**
Alert
*/

var Alertek = {

	alert_cover   : '',
	
	getScrollXY : function () {
		  var scrOfX = 0, scrOfY = 0;
		  if( typeof( window.pageYOffset ) == 'number' ) {
		    //Netscape compliant
		    scrOfY = window.pageYOffset;
		    scrOfX = window.pageXOffset;
		  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		    //DOM compliant
		    scrOfY = document.body.scrollTop;
		    scrOfX = document.body.scrollLeft;
		  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		    //IE6 standards compliant mode
		    scrOfY = document.documentElement.scrollTop;
		    scrOfX = document.documentElement.scrollLeft;
		  }
		  return scrOfY;
	},	

	pageHeight : function () {
	var heighter = window.innerHeight != null? window.innerHeight: document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.body != null? document.body.clientHeight:null;
	return heighter =  heighter + Alertek.getScrollXY();
	},
	

	
	show_alert : function (txt) {
		Alertek.alert_cover = document.getElementById('alert_cover');
		Alertek.alert_cover.innerHTML = txt;	
		Alertek.alert_cover.style.display='block';

		Alertek.alert_cover.style.top = Alertek.pageHeight() / 2 + 'px';
		Alertek.alert_cover.style.left = ns6? ((Popup.pageSizes()[2] / 2) - (Alertek.alert_cover.clientWidth / 2)) + "px" : ((Popup.pageSizes()[2] / 2) - (Alertek.alert_cover.clientWidth / 2)) + "px";
	
	if (navigator.appVersion.indexOf("MSIE")!=-1){
		temp=navigator.appVersion.split("MSIE");
		ver_brow=parseFloat(temp[1]);

				if (ver_brow<7.0) {
				 Alertek.alert_cover.style.left = (document.body.clientWidth / 2) - (Alertek.alert_cover.clientWidth /2 ) + 'px';
				 }
				if (ver_brow==7.0)
				 {
				 Alertek.alert_cover.style.top = (document.body.clientHeight / 2) - (Alertek.alert_cover.clientHeight) + 'px';
				 Alertek.alert_cover.style.left = (document.body.clientWidth / 2) - (Alertek.alert_cover.clientWidth /2 ) + 'px';
				 }
		 }	
		 
	setTimeout('Alertek.hide_alert()', 3000);		 
	
	},
	
	hide_alert : function () {	
		Alertek.alert_cover = document.getElementById('alert_cover');
		Alertek.alert_cover.style.display='none';
	} 	

}

/**
  Projector
*/


var Projector = {
	displayed   : '',
	price_cont  : '',
	phoneprice_cont   :  '',
	sizes_cont  : '',	
	sizes_cont_onesize  : '',		
	price_cont_yousave  : '',	
	proj_btn    : '',
	proj_img_cover_sub    : '',		
	proj_status_gfx    : '',	
	proj_status_desc    : '',	
	forpoints_check	   : '',
	status_amount    : '',
	msg_alert : '',
	temp  : '',
	
	//START  ZEROWY
	start_zero : function () {

	if(zm1 == '1') 
	{
		if(zm2 == 'onesize')
		{
			Projector.start('onesize','onesize');
		}
		else
		{
			Projector.start(zm2);
			Projector.menus('sizes_menu_list',0,zm3);			
		}

	}
	else
	{
		if(rozmiar_start == 0 && zm1 != '1')
		{
			Projector.start();
		}
		else
		{
			Projector.start(zm2);
			Projector.menus('sizes_menu_list',0,zm3);
		}
	}


	},
		
	
	start : function (rozm, onesize) {
	
	// CHECKING IF XML TRUE
	var itnum=0;
	for(n in selectSizes)
	{
			itnum++;
	}
	if(itnum == 0) 
	{
		document.getElementById('projector_ALL_component').style.display = 'none';
		Alertek.show_alert('XML ERROR ' + itnum);
		return false;
		
	}
	
	// DEFINICJA WSZYTSKICH ELEMENTOW DO UZYTKU POZNIEJ
	Projector.sizes_cont_onesize = document.getElementById('projector_sizes_cont_onesize');
	Projector.sizes_cont = document.getElementById('projector_sizes_cont');
	Projector.proj_status_cont = document.getElementById('projector_status_cont');
	Projector.proj_status_gfx = document.getElementById('projector_status_gfx');
	Projector.proj_status_gfx_cont = document.getElementById('projector_status_gfx_cont');
	Projector.proj_status_desc = document.getElementById('projector_status_description');
	Projector.proj_status_desc_title = document.getElementById('projector_status_description_title');
	Projector.proj_status_desc2 = document.getElementById('projector_status_description2');	
	Projector.price_cont = document.getElementById('projector_price_cont');
	Projector.price_maxprice = document.getElementById('projector_status_maxprice');
	Projector.price_cont_yousave = document.getElementById('projector_price_cont_yousave');		
	Projector.phoneprice_cont = document.getElementById('projector_phoneprice_cont');
	Projector.forpoints_cont = document.getElementById('projector_forpoints');
	Projector.forpoints_check = document.getElementById('forpoints_check');	
	Projector.pricepoints_sub = document.getElementById('projector_pricepoints_cont');	
	Projector.pricepoints_value = document.getElementById('projector_pricepoints_cont_value');	
	Projector.delivery_sub = document.getElementById('projector_delivery_cont');	
	Projector.delivery_value = document.getElementById('projector_delivery_cont_value');	
	Projector.deliveryfree = document.getElementById('projector_deliveryfree_cont');
	Projector.number_sub = document.getElementById('projector_number_cont');	
	Projector.number_value = document.getElementById('projector_number_value');		
	Projector.amount_sub = document.getElementById('projector_amount_cont');	
	Projector.amount_value = document.getElementById('projector_amount_cont_value');	
	Projector.pricenetto_sub = document.getElementById('projector_pricenetto_cont');	
	Projector.pricenetto_value = document.getElementById('projector_pricenetto_cont_value');	
	
	
		// UZUPELNIENIE FORMUALRZA 
		document.getElementById('form_projector').size.value = rozm;
	
		// ZMIANA OSZCZEDZASZ NA STARCIE
		if(projector_first_price[4] != '' && projector_first_price[5] != '')
		{
			Projector.price_cont_yousave.innerHTML = txt_taniej + projector_first_price[5] + '%, '+ txt_oszczedzasz + projector_first_price[4] + projector_currency;	
		}	
	
	
		// ZMIANA PROMOCJI NA STARCIE
		if(projector_first_price[2] != '') 
		{
			Projector.price_maxprice.innerHTML = projector_first_price[2] + projector_currency;
		}
		
		// ZMIANA CENY NA STARCIE	
		if(projector_first_price[0] == projector_first_price[1] && projector_first_price[0] != 0)
		{
		
				// ZMIANA CENA NETTO NA STARCIE
				if(pricenetto_start == '0' && projector_pricenetto != '') 
				{
					Projector.pricenetto_sub.style.display = "block";
					Projector.pricenetto_value.innerHTML = projector_pricenetto + projector_currency;
				}	
				else
				{
					Projector.pricenetto_sub.style.display = "none";		
				}
				
			Projector.phoneprice_cont.style.display = 'none';		
			Projector.price_cont.innerHTML = projector_first_price[0] + projector_currency;		
		}
		else
		{
			if(projector_first_price[0] != projector_first_price[1] && projector_first_price[0] != 0)
			{
			
				Projector.price_cont.innerHTML = projector_first_price[0] + '-' +projector_first_price[1] + projector_currency;	
			}		
			if(projector_first_price[0] == 0)
			{
				Projector.price_cont.style.display = 'none';
				Projector.phoneprice_cont.style.display = 'block';
			}
		}
		
		//JEDNOSTKA MIARY
		if(projector_unit != '' && unit_start == '0')
		{
			Projector.price_cont.innerHTML += " / " + projector_unit;
		}		
	
		if(rozm) Projector.status_change(rozm, onesize);

		
	},		
	
	
	status_change : function (rozm, onesize) {
	
	// ZMIENNE
	var status_price = selectSizes[rozm][0];
	var status_price_netto = selectSizes[rozm][1];
	var status_price_yousavepercent = selectSizes[rozm][2];
	var status_price_yousave = selectSizes[rozm][3];
	var status_price_maxprice = selectSizes[rozm][4];	
	var status_status = selectSizes[rozm][5];	
	var status_devilery_days = selectSizes[rozm][6];
	var status_desc = selectSizes[rozm][7];
	var status_desc_tel = selectSizes[rozm][8];
	var status_gfx_src = selectSizes[rozm][9];	
	var status_name = selectSizes[rozm][10];	
	var status_phoneprice = selectSizes[rozm][11];	
	var status_forpoints = selectSizes[rozm][12];	
	var status_points = selectSizes[rozm][13];	
	var status_delivery = selectSizes[rozm][14];	
	
	Projector.status_amount = selectSizes[rozm][15];	
	var status_gfx_tel = selectSizes[rozm][16];		
	
	//PODMIANA GRAFIKI  ORAZ TXT CENA NA TEL IF EXIST
	if(status_gfx_tel != '' || status_desc_tel != '')
	{
		if(status_gfx_tel != '')
		{
			Projector.phoneprice_cont.innerHTML = '<img id=\"projector_gfx_phoneprice\" src=\"blank.gif\" alt=\"' + status_desc_tel + '\"/>';
			document.getElementById('projector_gfx_phoneprice').src = status_gfx_tel;
		}
		else if(status_desc_tel != '')
		{
			Projector.phoneprice_cont.innerHTML = status_desc_tel;
		}		
	}

	
	//PUNKTY JEZELI ZALOGWANY
	if(status_forpoints == 'true' && status_status != 'disabled')
	{
		Projector.forpoints_cont.style.display = "block";
	}
	else
	{
		Projector.forpoints_cont.style.display = "none";	
	}
	
	//PUNKTY - WYSWEILERNIE
	if(status_points != '')
	{
		Projector.pricepoints_sub.style.display = "block";
		Projector.pricepoints_value.innerHTML = status_points + txt_pkt;
	}
	else
	{
		Projector.pricepoints_sub.style.display = "none";	
	}
	
	//ILOSC - WYSWIETLENIE
	if(Projector.status_amount != '' && amount_start == '0')
	{
		Projector.amount_sub.style.display = "block";
		if(Projector.status_amount == '0')
		{
			Projector.amount_value.innerHTML = txt_status_amount_null;
		}
		if(Projector.status_amount == '-1')
		{
			Projector.amount_value.innerHTML = txt_status_amount_full;
		}	
		if(parseInt(Projector.status_amount) > 0)
		{
			Projector.amount_value.innerHTML = Projector.status_amount;
		}
	}
	else
	{
		Projector.amount_sub.style.display = "none";	
	}		
	
	//KOSZTY DOSTAWY
	if(status_delivery != '' && delivery_start == '0')
	{
		if(parseInt(status_delivery) > 0)
		{
			Projector.deliveryfree.style.display = "none";		
			Projector.delivery_sub.style.display = "block";
			Projector.delivery_value.innerHTML = status_delivery + projector_currency;
		}
		else
		{
			Projector.delivery_sub.style.display = "none";
			Projector.deliveryfree.style.display = "block";	
		}
	}
	else
	{
		Projector.pricepoints_sub.style.display = "none";	
	}	
	
	//PODAWANIE ILOSCI - WIDOCZNOSC
	if(number_start == '0' && status_status != 'disable')
	{
		Projector.number_sub.style.display = "block";
		Projector.number_value.value = 1;
	}
	else
	{
		Projector.number_sub.style.display = "none";	
	}		


	// UKRYCIE WIDOCZNOSCI SELECTA IF ONESIZE ORAZ WYPISANIE JEDNEGO ROZMIARU JEZELI ROZNY OD ONESIZE
	if(onesize == 'onesize')	
	{	
		if(rozm != 'onesize')
		{
			Projector.sizes_cont_onesize.style.display='block';	
			Projector.sizes_cont_onesize.firstChild.innerHTML = txt_wybrany_rozmiar + status_name;		
		}
		Projector.sizes_cont.style.display='none';
	}
	else
	{
		Projector.sizes_cont.style.display='block';	
	}	
	
	// WLACZENIE WIDOCZNOSCI CONTENERA STATUSU
	Projector.proj_status_cont.style.display = 'block';
	
	
	// ZMIANA CENY
	if(status_price_maxprice != '') 
	{
		Projector.price_maxprice.innerHTML = status_price_maxprice + projector_currency;
	}
	
	if(status_phoneprice == 'true')
	{

		Projector.price_cont.style.display = 'none';		
		Projector.phoneprice_cont.style.display = 'block';	
	}
	else
	{
		Projector.price_cont.style.display = 'block';		
		Projector.phoneprice_cont.style.display = 'none';
		Projector.price_cont.innerHTML = status_price + projector_currency;		
	}
	
	// ZMIANA CENA NETTO
	if(pricenetto_start == '0' && status_price_netto != '' && status_phoneprice != 'true') 
	{
		Projector.pricenetto_sub.style.display = "block";
		Projector.pricenetto_value.innerHTML = status_price_netto + projector_currency;
	}	
	else
	{
		Projector.pricenetto_sub.style.display = "none";		
	}	

	//JEDNOSTKA MIARY
	if(projector_unit != '' && unit_start == '0')
	{
		Projector.price_cont.innerHTML += " / " + projector_unit;
	}
	
	// ZMIANA OSZCZEDZASZ
	if(status_price_yousavepercent != '' && status_price_yousave != '')
	{
		Projector.price_cont_yousave.innerHTML = txt_taniej + status_price_yousavepercent + '%, '+ txt_oszczedzasz + status_price_yousave + projector_currency;	
	}
		
	// ZMIANA GRAFIKI STATUSU
	if(status_gfx_src != '')
	{
		Projector.proj_status_gfx_cont.style.display = "block";
		Projector.proj_status_gfx.innerHTML = '<img src=\"blank.gif\" />';
		status_imageObj = new Image();
		status_imageObj.src = status_gfx_src;
		Projector.proj_status_gfx.firstChild.src = status_gfx_src;
	}
	else
	{
		Projector.proj_status_gfx_cont.style.display = "none";	
	}

	// ZMIANA TXT STATUSU I DNI
	Projector.proj_status_desc.innerHTML ='';
	Projector.proj_status_desc_title.style.display = "block";	
	
	if(status_status == 'enable' || status_status == 'order')
	{
		if(status_desc != '')
		{	
			Projector.proj_status_desc.innerHTML = status_desc;	
		}		
	}
	
	if(status_status == 'disable')
	{
		if(status_desc != '')
		{	
			Projector.proj_status_desc.innerHTML = status_desc;	
			if(status_devilery_days != '')
			{
			
				if(status_devilery_days == '0')
				{
					Projector.proj_status_desc.innerHTML += txt_status_natychmiast;
				}
				if(status_devilery_days == '1')
				{
					Projector.proj_status_desc.innerHTML += txt_za + txt_status_24;
				}	
				if(status_devilery_days > '1')
				{
					Projector.proj_status_desc.innerHTML += txt_za + status_devilery_days + txt_days;
				}				
			}
		}	
		else
		{
			Projector.proj_status_desc.innerHTML += txt_disable_desc;			
		}
		Projector.proj_status_desc_title.style.display = "none";
	
		
	}
	
	//TXT DOSTAWY np. DOSTAWA ZA 2 DNI
	if(status_status == 'enable' || status_status == 'order' && status_devilery_days != '')
	{	
		Projector.proj_status_desc2.innerHTML = Projector.fun_delivery_days(status_devilery_days, status_status);
	}
	
	// AKTYWACJA LUB NIE BUTTONA DODAJ DO KOSZYKA  i ULUBIONYCH
	Projector.button_act(status_status, status_phoneprice, status_forpoints);
	
	
	},	
	
	// FUNKCJA ZWRACAJACA TXT WYSYLKI X DNI
	fun_delivery_days : function (days,status) {
		var rezult;
		
		if(status == 'disable' && days != '' && parseInt(days) > 1)
		{
			rezult = txt_dostepny_za;
		}
		else if(status == 'disable' && days != '' && parseInt(days) <= 1)
		{
			rezult = txt_dostepny;
		}
		else
		{
			rezult = '';
		}
		
		if(status == 'enable' || status == 'order')
		{
			if(days != '' && parseInt(days) > 1)
			{
				rezult = txt_wysylka_za;
			}
			if(days != '' && parseInt(days) <= 1)
			{
				rezult = txt_wysylka;
			}			
		}		
	
			
			if(days == '0')
			{
				rezult += txt_status_natychmiast;
			}
			if(days == '1')
			{
				rezult += txt_status_24;
			}	
			if(days > '1')
			{
				rezult += days + txt_days;
			}	
		
		return rezult;
	},
	
	imagerotate : function (id) {
		if (Projector.displayed == '') {
			document.getElementById('img_1').style.display = 'none';
		} 
	   else {
	       document.getElementById(Projector.displayed).style.display = 'none';
	   }
	   document.getElementById(id).style.display = '';
	   Projector.displayed = id;
	},
	
	button_act : function (status, phone, points) {

		Projector.forpoints_cont.removeAttribute("onclick");	

		if(status == 'disable' || phone == 'true')
		{		

			Projector.button_deact(txt_niedostepny);
			
			if(phone != '' && phone == 'true')
			{
				Projector.button_deact(txt_tylkotel);
			}
			if(points != '')
			{
				
				if(points == 'true' && phone == 'true') 
				{
					Projector.forpoints_check.disabled = 'disabled';	
					Projector.forpoints_check.checked = true;
					msg_alert = txt_forpointsonly;
					Projector.forpoints_cont.onclick = Projector.onclicker_3;	
					
					Projector.proj_btn = document.getElementById('projector_button_basket');
					Projector.proj_btn.style.cursor ='pointer';
					Projector.proj_btn.onclick = Projector.onclicker_1;						

				}
				else
				{
					Projector.button_deact(txt_tylkotel);
				}
			}
		}
		else
		{
			Projector.forpoints_check.disabled = '';
			Projector.forpoints_check.checked = false;	
			msg_alert = txt_forpoints_txt;
			Projector.forpoints_cont.removeAttribute("onclick");
			
			Projector.proj_btn = document.getElementById('projector_button_basket');
			Projector.proj_btn.style.cursor ='pointer';
			Projector.proj_btn.onclick = Projector.onclicker_1;
		
		}
			// DLA OBSERVE
			var zo = "document.getElementById('iemode').value=2;document.getElementById('form_projector').submit();";
			Projector.proj_btn_observe = document.getElementById('projector_button_observe');	
			Projector.proj_btn_observe.style.cursor ='pointer';		
			Projector.proj_btn_observe.onclick = Projector.onclicker_2;			

		
	},
	
	onclicker_false : function()
	{
		return false;
	},	
	
	onclicker_1 : function()
	{
		document.getElementById('iemode').value=1;
		document.getElementById('form_projector').submit();
	},
	
	onclicker_2 : function()
	{
		document.getElementById('iemode').value=2;
		document.getElementById('form_projector').submit();
	},	
	
	onclicker_3 : function()
	{
		Alertek.show_alert(msg_alert);
		return false;
	},		
	
	button_deact : function (msg) {
		
		msg_alert = msg;
		Projector.proj_btn = document.getElementById('projector_button_basket');
		Projector.proj_btn.style.cursor ='not-allowed';
		Projector.proj_btn.onclick = Projector.onclicker_3;	
	},	
	
	if_isanumber  : function(test)
	{
			if(test.match("^[1-9]{1}[0-9]{0,9}$") || test ==''){
				return test;
			}else
			{
				test = test.substring(0, test.length-1);
				return test;
			}	
	
	},
	
	number_check  : function()
	{
	
		Projector.number_value.value = Projector.if_isanumber(Projector.number_value.value);
		
		if(Projector.number_value.value >= parseInt(Projector.status_amount) && isFinite(Projector.status_amount) && Projector.status_amount != '-1')
		{
			Projector.number_value.value = parseInt(Projector.status_amount);
		}
		else
		{
			return false;	
		}
	},
	
	number_up  : function()
	{
		if(isNaN(parseInt(Projector.number_value.value))) Projector.number_value.value = 1;
		if(Projector.number_value.value >= parseInt(Projector.status_amount) && isFinite(Projector.status_amount) && Projector.status_amount != '-1')
		{
			return false;
		}
		else
		{
			Projector.number_value.value = parseInt(Projector.number_value.value) + 1;		
		}
	},
	
	number_down  : function()
	{
		if(isNaN(parseInt(Projector.number_value.value))) Projector.number_value.value = 1;
		if(Projector.number_value.value > 1)
		{
			Projector.number_value.value = parseInt(Projector.number_value.value) - 1;
		}
	},	
	
	onmouseover_img : function()
	{
		this.style.display = 'none';
	},		
	
	
	img_cover : function (id) {
	
		/*Projector.proj_img_cover_sub = document.getElementById('projector_img_cover_sub');		
		if(Projector.proj_img_cover_sub.style.display == 'block')
		{
			Projector.proj_img_cover_sub.style.display = 'none';	
		}
		else
		{
			Projector.proj_img_cover_sub.style.display = 'block';	
		}
		if(id != 'null')
		{
			temp = id.getAttribute("onclick");		
			Projector.proj_img_cover_sub.onmouseover = Projector.onmouseover_img;
			Projector.proj_img_cover_sub.style.top = id.firstChild.clientHeight / 2 - 10 + 'px';
			//alert(id.firstChild.clientWidth + ' ---- ' +Projector.proj_img_cover_sub.clientWidth);
			Projector.proj_img_cover_sub.style.left = (id.firstChild.clientWidth  / 2) - (Projector.proj_img_cover_sub.clientWidth / 2) + 'px';		
		} */
	},
	
	menus : function (menu,switc, name) { 

		if(switc==1)
		{
			if(document.getElementById(menu))document.getElementById(menu).style.display='block';
		}
		else
		{
			if(document.getElementById(menu))document.getElementById(menu).style.display='none';	
			
			if (name != 0)
			{

					if(document.getElementById('results_size_lista'))document.getElementById('results_size_lista').innerHTML=name;	
					if(document.getElementById('bok_results_size'))document.getElementById('bok_results_size').innerHTML=name;	
			}
		}
	},
	
	forpoints : function () { 
		if(Projector.forpoints_cont)
		{
			if(Projector.forpoints_cont.className == 'n53486_points')
			{
				Projector.forpoints_cont.className = 'n53486_points_active'
			}
			else
			{
				Projector.forpoints_cont.className = 'n53486_points'
			}			
		
		
		}
		
	}
		
}


/**
  Popup _ NOWA GALERIA
*/

var ns6=document.getElementById&&!document.all;
var ie=document.all;
var html = document.getElementsByTagName("html");
var Popup = {
        url :'http://' + location.host,
	link   : '',
	width  : 0,
	height : 0,
        loaded : 0,
	show : function (link,x,y) {
		Popup.link = link;
		Popup.width = x;
		Popup.height = y;
        Popup.loaded = 1;
		if (document.getElementById('big_photo')) {
			document.getElementById('big_photo').style.display = "none";
			document.getElementById('big_photo').src = Popup.link;
		}
		if (basecount < 2 || !basecount) {
			document.getElementById('popup_next_prev').style.visibility = "hidden";
		}
		var edit = document.getElementById('show_popup_photo_sub');		
        edit.style.width = parseInt(x) + "px";
        edit.style.height = parseInt(y) + "px";			
		
		if (!ns6) {Popup.hideSelects(1);}
		Popup.creatLayers();
	},
    reload : function () {
              if (Popup.loaded) {
                     Popup.resize(Popup.link,Popup.width,Popup.height);
              }
        },
    next_img : function () {
		Popup.link = document.getElementById('big_photo').src;
                if(Popup.link.indexOf(Popup.url) != '-1') Popup.link= Popup.link.substr(Popup.url.length+1,Popup.link.length);
	        for(n=1; n <= basecount; n++)
			{
				if(Popup_enclosures[n][0] == Popup.link) {
				    n++;
					if(n <= basecount){
						Popup.resize(Popup_enclosures[n][0], Popup_enclosures[n][1],Popup_enclosures[n][2]);
						Popup.link = Popup_enclosures[n][0];
						return false;
					}
					else
					{
						Popup.resize(Popup_enclosures[1][0], Popup_enclosures[1][1],Popup_enclosures[1][2]);
						Popup.link = Popup_enclosures[1][0];
						return false;
					}
				}
			} 

           
        },		
    prev_img : function () {
		Popup.link = document.getElementById('big_photo').src;	
                if(Popup.link.indexOf(Popup.url) != '-1') Popup.link= Popup.link.substr(Popup.url.length+1,Popup.link.length);
	        for(n=basecount; n <= basecount; n--)
			{

				if(Popup_enclosures[n][0] == Popup.link) {
					n--;
					if(n >= 1){
						Popup.resize(Popup_enclosures[n][0], Popup_enclosures[n][1],Popup_enclosures[n][2]);
						Popup.link = Popup_enclosures[n][0];
						return false;
					}
					else
					{
						Popup.resize(Popup_enclosures[basecount][0], Popup_enclosures[basecount][1],Popup_enclosures[basecount][2]);
						Popup.link = Popup_enclosures[basecount][0];
						return false;
					}					
				}
			}
            
        },			
	resize : function (sciezka, width, height) {
		document.getElementById('big_photo').style.display='none';		
		var edit = document.getElementById('show_popup_photo_sub');
		var edit2 = document.getElementById('show_popup_photo');		
        document.getElementById('big_photo').src = sciezka;
        edit.style.width = parseInt(width) + "px";
        edit2.style.width = parseInt(width) + "px";		
        edit.style.height = parseInt(height) + "px";		
		edit2.style.left = ns6? (Popup.pageSizes()[2] - (edit2.clientWidth + 10))/2 + html[0].scrollLeft +"px" : (Popup.pageSizes()[2] - (edit2.clientWidth + 10))/2 + "px";		

	},
	hide : function () {
		var edit = document.getElementById('show_popup_photo');
        var edit_close = document.getElementById('show_popup_photo_close');
		var cover = document.getElementById('cover');
		edit.style.display = "none";
        edit_close.style.display = "none";
		cover.style.display = "none";
        Popup.loaded = 0;
		if (!ns6) {Popup.hideSelects(0);}
	},
	cover : function (wartosc) {
		var cover = document.getElementById('cover');
	    ns6? cover.style.opacity = '.' + wartosc  :  cover.style.filter = "alpha(Opacity=" +wartosc+")";
	    if (window.opera) {
			cover.style.opacity = '.' + wartosc;
		}
	},	
	creatLayers : function () {


var edit = document.getElementById('show_popup_photo');
var edit_close = document.getElementById('show_popup_photo_close');
		edit.style.position = 'absolute';
	    edit.style.display = "block";
	    edit_close.style.display = "block";
		edit.style.width = (Popup.width) + "px";
	    edit.style.left = ns6? (Popup.pageSizes()[2] - (Popup.width + 10))/2 + html[0].scrollLeft +"px" : (Popup.pageSizes()[2] - (Popup.width + 10))/2 + "px";

var ver_brow=0;
if (navigator.appVersion.indexOf("MSIE")!=-1){
temp=navigator.appVersion.split("MSIE");
ver_brow=parseFloat(temp[1]);

if (ver_brow<7.0)
 {
edit.style.top = ((((Popup.pageSizes()[3] - (Popup.height + 10))/2) - 100  + document.body.scrollTop) < 0) ? "50px" : (((Popup.pageSizes()[3] - (Popup.height + 10))/2) - 100  + document.body.scrollTop + 50) + "px";
          }
else
{
edit.style.top = ((((Popup.pageSizes()[3] - (Popup.height + 10))/2) - 100  + html[0].scrollTop) < 0) ? "50px" : (((Popup.pageSizes()[3] - (Popup.height + 10))/2) - 100  + html[0].scrollTop + 50) + "px";
}
}
            else
{
edit.style.top = ((((Popup.pageSizes()[3] - (Popup.height + 10))/2) - 100  + html[0].scrollTop) < 0) ? "50px" : (((Popup.pageSizes()[3] - (Popup.height + 10))/2) - 100  + html[0].scrollTop + 50) + "px";
}



        edit.style.zIndex = 1000;
		edit.style.Background = '#FFFFFF';

	    //'cover'- div do blokowania elementow innych niz edit
	    var cover = document.getElementById('cover');
	    cover.style.display = "block";
        cover.style.position = "absolute";
	    cover.style.zIndex = 900;
	    ns6? cover.style.opacity = .5 :  cover.style.filter = "alpha(Opacity=50)";
	    if (window.opera) {
			cover.style.opacity = .5;
		}
		cover.style.left = "0px";
	    cover.style.top = "0px";
            offsetX = 0;
            if (!ns6 && !window.opera) {
                  offsetX = 20;
            }
	    cover.style.width = ns6? (Popup.pageSizes()[0] - 16) + "px" : Popup.pageSizes()[0] - offsetX + "px"; //ns6? html[0].offsetWidth +"px" : document.body.offsetWidth + "px";
	    cover.style.height = Popup.pageSizes()[1] + "px" //ns6? html[0].offsetHeight +"px" : document.body.offsetHeight + "px";
	},
	pageSizes : function () {
		var xScroll, yScroll;
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = document.body.scrollWidth;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else {
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		var windowWidth, windowHeight;
		if (self.innerHeight) {
			windowWidth = self.innerWidth;
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) {
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
		if(xScroll < windowWidth){	
			pageWidth = windowWidth;
		} else {
			pageWidth = xScroll;
		}
		arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
		return arrayPageSize;
	},
	hideSelects : function (flag) {
		var selects = document.getElementsByTagName('SELECT');
		if (flag == 1) {
			for (i = 0; i < selects.length; i++) {
				selects[i].style.display = 'none';
			}
		} else {
			for (i = 0; i < selects.length; i++) {
				selects[i].style.display = '';
			}
		}
	}
}
window.onresize = function() {if (Popup.loaded == 1) {Popup.reload();}}
/* !!! Wyszukiwarka ver. 4.0  ( odchudzony kod i ujednolicony wygląd ) (searching - searching) [54635]*/

function insletter(letter, idk) {
 var inp = document.getElementById (idk);
 inp.value += letter;
 inp.focus();
}

function insletterB(letter, idk) {
 var inp = document.getElementById (idk);
 tv = inp.value;
 tv = tv.substr(0,tv.length-1);
 letter = letter.toUpperCase();

 inp.value = tv+letter;
 inp.focus();
}
/* TOP lamptique (layout_top - menu_top) [56829]*/

function top_searching_blur(x) {
         if (x.value == '') {
                 x.value = top_searchtxt;
         }
}
function top_searching_focus(x) {
         if (x.value != '') {
                 x.value = '';
         }
}


function top_blur(x) {
         if (x.value == '') {
                 x.value = top_txt;
         }
}
function top_focus(x) {
         if (x.value != '') {
                 x.value = '';
         }
}

var Cloud = {
    Start:function(id) 
    {
        //var testID = document.getElementById('test');
	    var cloudID = document.getElementById('cloudContainer');
        if (id.firstChild.innerHTML) {
	        cloudID.innerHTML = "<div id=\"cloudContainer_sub\">" + id.firstChild.innerHTML + "</div>";
            var coors;
	        coors = Cloud.FindPos(id);
            cloudID.style.display = "block";
		    cloudID.style.opacity = "0";	
		    cloudID.style.filter = "alpha(Opacity=0)";
	        cloudID.style.position = "absolute";
	        cloudID.style.zIndex = "1000";	
            Cloud.X=40;
            Cloud.Top = coors[1] - cloudID.clientHeight - Cloud.X -1;
            Cloud.I=0;
			if((coors[1] - cloudID.clientHeight) < 0)
			{
				Cloud.X=10;
				Cloud.Top = coors[1] + id.clientHeight + Cloud.X;
				//alert(Cloud.Top);
			}
            cloudID.style.top = Cloud.Top + 'px';

			var cloudLeft = document.body.clientWidth;
			if(cloudLeft < (cloudID.clientWidth + coors[0]))
			{
				cloudID.style.left = coors[0] - cloudID.clientWidth + id.clientWidth + 'px';
			}
			else
			{
				cloudID.style.left = coors[0] -7 + 'px';			
			}
            
            clearInterval(Cloud.Time);
            clearTimeout(Cloud.Time2);
            Cloud.Attribute=0;
            Cloud.Time = setInterval("Cloud.Move('"+id+"')", 40);
	        Cloud.Time2 = setTimeout("Cloud.End('"+id+"')", 3000);
        } else {
            return false;
        }
    },
    
    End:function(id)
    {
	    var cloudID = document.getElementById('cloudContainer');
	    var coors; 
	    coors = Cloud.FindPos(cloudID);
		Cloud.X=40;			
		if((coors[1] - cloudID.clientHeight) < 0)
		{
			Cloud.X=10;	
		}
	    Cloud.Top = coors[1];
	    Cloud.I=100;	
	    clearInterval(Cloud.Time);	
	    clearTimeout(Cloud.Time2);	
		Cloud.Attribute=1;
	    Cloud.Time = setInterval("Cloud.Move('"+id+"')", 40);
    },
    
    Move:function(id)
    {
	   // var testID = document.getElementById('test');
	    var cloudID = document.getElementById('cloudContainer');
	    if(Cloud.Attribute == 0) {
            Cloud.Top = Math.round(Cloud.Top) + (Cloud.X/ 2);
        }
	    if(Cloud.Attribute == 1) {
            Cloud.Top = Math.round(Cloud.Top) - (Cloud.X/ 2);
        }
	    Cloud.X = Math.round(Cloud.X/ 2);
	    if(Cloud.Attribute == 0) {
            Cloud.I = Cloud.I + 15;
        }
	    if(Cloud.Attribute == 1) {
            Cloud.I = Cloud.I - 15;
        }
	    cloudID.style.top = Cloud.Top +'px';
	    if (Cloud.I < 100 ) {
		    cloudID.style.opacity = "0." + Cloud.I;	
		    cloudID.style.filter = "alpha(Opacity=" + Cloud.I + ")";			
    	} else {
		    cloudID.style.opacity = "1";
		    cloudID.style.filter = "alpha(Opacity=100)";			
	    }
	    if(Cloud.X == 1) {
		    if(Cloud.Attribute == 0) {
			    cloudID.style.opacity = "1";
                cloudID.style.filter = "alpha(Opacity=100)";				
            } else if(Cloud.Attribute == 1) {
			    cloudID.style.opacity = "0";	
			    cloudID.style.filter = "alpha(Opacity=0)";	
			    cloudID.style.display = "none";	
		    }
		    clearInterval(Cloud.Time);	
	    }
    },
    
    FindPos:function(obj)
    {
	    var curleft = curtop = 0;
	    if (obj.offsetParent) {
		    curleft = obj.offsetLeft
		    curtop = obj.offsetTop
		    while (obj = obj.offsetParent) {
			    curleft += obj.offsetLeft
			    curtop += obj.offsetTop
		    }
	    }
	    return [curleft,curtop];
    }, 
    Time: 0,
    Time2: 0,
    Top: 0,
    X: 0,
    I: 0,
    Attribute: 0
}
var Cloud2 = {
    Start:function(id) 
    {
        //var testID = document.getElementById('test');
	    var cloudID = document.getElementById('cloudContainerBasket');
        if (id.firstChild.innerHTML) {
	        cloudID.innerHTML = "<div id=\"cloudContainer_sub_basket\">" + id.firstChild.innerHTML + "</div>";
            var coors;
	        coors = Cloud2.FindPos(id);
            cloudID.style.display = "block";
		    cloudID.style.opacity = "0";	
		    cloudID.style.filter = "alpha(Opacity=0)";
	        cloudID.style.position = "absolute";
	        cloudID.style.zIndex = "1000";	
            Cloud2.X=40;
            Cloud2.Top = coors[1] - cloudID.clientHeight - Cloud2.X -1;
            Cloud2.I=0;
			if((coors[1] - cloudID.clientHeight) < 0)
			{
				Cloud2.X=10;
				Cloud2.Top = coors[1] + id.clientHeight + Cloud2.X;
				//alert(Cloud.Top);
			}
            cloudID.style.top = Cloud2.Top + 'px';

			var cloudLeft = document.body.clientWidth;
			if(cloudLeft < (cloudID.clientWidth + coors[0]))
			{
				cloudID.style.left = coors[0] - cloudID.clientWidth + id.clientWidth + 'px';
			}
			else
			{
				cloudID.style.left = coors[0] -35 + 'px';			
			}
            
            clearInterval(Cloud2.Time);
            clearTimeout(Cloud2.Time2);
            Cloud2.Attribute=0;
            Cloud2.Time = setInterval("Cloud2.Move('"+id+"')", 40);
	        Cloud2.Time2 = setTimeout("Cloud2.End('"+id+"')", 3000);
        } else {
            return false;
        }
    },
    
    End:function(id)
    {
	    var cloudID = document.getElementById('cloudContainerBasket');
	    var coors; 
	    coors = Cloud2.FindPos(cloudID);
		Cloud2.X=40;			
		if((coors[1] - cloudID.clientHeight) < 0)
		{
			Cloud2.X=10;	
		}
	    Cloud2.Top = coors[1];
	    Cloud2.I=100;	
	    clearInterval(Cloud2.Time);	
	    clearTimeout(Cloud2.Time2);	
		Cloud2.Attribute=1;
	    Cloud2.Time = setInterval("Cloud2.Move('"+id+"')", 40);
    },
    
    Move:function(id)
    {
	   // var testID = document.getElementById('test');
	    var cloudID = document.getElementById('cloudContainerBasket');
	    if(Cloud2.Attribute == 0) {
            Cloud2.Top = Math.round(Cloud2.Top) + (Cloud2.X/ 2);
        }
	    if(Cloud2.Attribute == 1) {
            Cloud2.Top = Math.round(Cloud2.Top) - (Cloud2.X/ 2);
        }
	    Cloud2.X = Math.round(Cloud2.X/ 2);
	    if(Cloud2.Attribute == 0) {
            Cloud2.I = Cloud2.I + 15;
        }
	    if(Cloud2.Attribute == 1) {
            Cloud2.I = Cloud2.I - 15;
        }
	    cloudID.style.top = Cloud2.Top +'px';
	    if (Cloud2.I < 100 ) {
		    cloudID.style.opacity = "0." + Cloud2.I;	
		    cloudID.style.filter = "alpha(Opacity=" + Cloud2.I + ")";			
    	} else {
		    cloudID.style.opacity = "1";
		    cloudID.style.filter = "alpha(Opacity=100)";			
	    }
	    if(Cloud2.X == 1) {
		    if(Cloud2.Attribute == 0) {
			    cloudID.style.opacity = "1";
                cloudID.style.filter = "alpha(Opacity=100)";				
            } else if(Cloud2.Attribute == 1) {
			    cloudID.style.opacity = "0";	
			    cloudID.style.filter = "alpha(Opacity=0)";	
			    cloudID.style.display = "none";	
		    }
		    clearInterval(Cloud2.Time);	
	    }
    },
    
    FindPos:function(obj)
    {
	    var curleft = curtop = 0;
	    if (obj.offsetParent) {
		    curleft = obj.offsetLeft
		    curtop = obj.offsetTop
		    while (obj = obj.offsetParent) {
			    curleft += obj.offsetLeft
			    curtop += obj.offsetTop
		    }
	    }
	    return [curleft,curtop];
    }, 
    Time: 0,
    Time2: 0,
    Top: 0,
    X: 0,
    I: 0,
    Attribute: 0
}
/* <span style="color:blue;font-weight:bold;">ZALECANY</span> Rejestracja klienta - Formularz (client-new - client_new_form) [56203]*/
var client_new_txt1 = 'Wysyłka na adres zamawiającego';
var client_new_txt1b = 'Wysyłka na adres z faktury';

var client_new_txt2 = 'Adres zamawiającego';
var client_new_txt2b = 'Dane do faktury';

var client_new_txt3 = 'Dane kontaktowe';
var client_new_txt3b = 'Dane kontaktowe';
var client_new_texts;


var ClientNew_status = true;
var ClientNew_firma = false;
var ClientNew_adres = true;
var ClientNewMandatoryMail = false; 
var ClientNewMandatoryPhone = false;

var ClientSender = new Array();

var RemoveAddresLink;

var ClientNew = {
    switchDiVDeliveryAddres: function()
    {
        document.getElementById("selectDeliveryAddress").style.display = "none";
        document.getElementById("selectDeliveryAddress2").style.display = "block";
    },

    switchDeliveryAddres: function(id, obj)
    {
        var IdAddress = id;
        if (IdAddress) {
           document.getElementById('delivery_id').value = IdAddress;
            document.getElementById("selectDeliveryAddress").innerHTML = obj.firstChild.innerHTML;

           document.getElementById("selectDeliveryAddress2").style.display = "none";
           document.getElementById("selectDeliveryAddress").style.display = "block";

            document.getElementById('additional_firstname').value = ClientDeliveryAddreses[IdAddress+"_firstname"];
            document.getElementById('additional_lastname').value = ClientDeliveryAddreses[IdAddress+"_lastname"];
            document.getElementById('additional_city').value = ClientDeliveryAddreses[IdAddress+"_city"];
            document.getElementById('additional_additional').value = ClientDeliveryAddreses[IdAddress+"_additional"];
            document.getElementById('additional_street').value = ClientDeliveryAddreses[IdAddress+"_street"];
            document.getElementById('additional_zipcode').value = ClientDeliveryAddreses[IdAddress+"_zipcode"];
            document.getElementById('additional_phone').value = ClientDeliveryAddreses[IdAddress+"_phone"];

            if (document.getElementById('additional_region') && document.getElementById('additional_region').options) {
                for (i=0; i < document.getElementById('additional_region').options.length; i++) {
                    if (document.getElementById('additional_region').options[i].value == ClientDeliveryAddreses[IdAddress+"_region_id"]) {      
                        document.getElementById('additional_region').selectedIndex  = i;
                        break;
                    }
                }
            }
  
            if (ClientDeliveryAddreses[IdAddress+"_removable"] == 'yes') {
                document.getElementById('delete_delivery_address').style.display = '';
                RemoveAddresLink = ClientDeliveryAddreses[IdAddress+"_removelink"];
            } else {
                document.getElementById('delete_delivery_address').style.display = 'none';
                RemoveAddresLink = '';
            }
        } else {
            document.getElementById('delete_delivery_address').style.display = 'none';
            RemoveAddresLink = '';
            document.getElementById('additional_firstname').value = '';
            document.getElementById('additional_lastname').value = '';
            document.getElementById('additional_city').value = '';
            document.getElementById('additional_additional').value = '';
            document.getElementById('additional_street').value = '';
            document.getElementById('additional_zipcode').value = '';
            document.getElementById('additional_phone').value = '';
        }

        if (ClientDeliveryAddreses[IdAddress+"_editable"] == 'no') {
            document.getElementById('additional_firstname').disabled = 'disabled';
            document.getElementById('additional_lastname').disabled = 'disabled';
            document.getElementById('additional_city').disabled = 'disabled';
            document.getElementById('additional_additional').disabled = 'disabled';
            document.getElementById('additional_street').disabled = 'disabled';
            document.getElementById('additional_zipcode').disabled = 'disabled';
            document.getElementById('additional_phone').disabled = 'disabled';
            document.getElementById('additional_region').disabled = 'disabled';
        } else {
            document.getElementById('additional_firstname').disabled = '';
            document.getElementById('additional_lastname').disabled = '';
            document.getElementById('additional_city').disabled = '';
            document.getElementById('additional_additional').disabled = '';
            document.getElementById('additional_street').disabled = '';
            document.getElementById('additional_zipcode').disabled = '';
            document.getElementById('additional_phone').disabled = '';
            document.getElementById('additional_region').disabled = '';
        }
    },

    removeDeliveryAddress: function() 
    {
        if (RemoveAddresLink) {
            if (confirm("Czy na pewno chcesz usunąć ten adres dostawy?")) {
                IAI_Ajax.Request('ajax/client-new.php?removeAddres=true', 'address='+document.getElementById('delivery_id').value, {onSuccess: 'ClientNew.deleteAddress'});
            }
        }
    },

    newDeliveryAddress: function() 
    {
        document.getElementById('delivery_id').value = '';
        document.getElementById('selectDeliveryAddress').style.display = 'none';
        document.getElementById('selectDeliveryAddress2').style.display = 'none';
        document.getElementById('additional_address_list_txt').style.display = 'none';
        document.getElementById('delete_delivery_address').style.display = 'none';
        document.getElementById('newDeliveryAddress').style.display = 'none';
        document.getElementById('saveDeliveryAddress').style.display = 'block';
        RemoveAddresLink = '';
        document.getElementById('additional_firstname').value = '';
        document.getElementById('additional_lastname').value = '';
        document.getElementById('additional_city').value = '';
        document.getElementById('additional_additional').value = '';
        document.getElementById('additional_street').value = '';
        document.getElementById('additional_zipcode').value = '';
        document.getElementById('additional_phone').value = '';

        document.getElementById('additional_firstname').disabled = '';
        document.getElementById('additional_lastname').disabled = '';
        document.getElementById('additional_city').disabled = '';
        document.getElementById('additional_additional').disabled = '';
        document.getElementById('additional_street').disabled = '';
        document.getElementById('additional_zipcode').disabled = '';
        document.getElementById('additional_phone').disabled = '';
        document.getElementById('additional_region').disabled = '';
    },

    deleteAddress: function(x)
    {
        try {
            var response = eval('(' + x + ')');
        } catch (e) {
            return false;
        }
        xr = response;
        
       document.getElementById('delivery_list_id_'+response.remove).style.display = "none";

        ClientNew.switchDeliveryAddres(response.selected, document.getElementById('delivery_list_id_'+response.selected));
    },

    copyDeliveryAddres: function() 
    {
        if (document.getElementById('deliver_to_billingaddr').checked) {
            document.getElementById('delivery_additional').value = ClientNew_firma  ? document.getElementById('client_firm').value : '';
            document.getElementById('delivery_firstname').value  = document.getElementById('client_firstname').value;
            document.getElementById('delivery_lastname').value   = document.getElementById('client_lastname').value;
            document.getElementById('delivery_zipcode').value    = document.getElementById('client_zipcode').value;
            document.getElementById('delivery_street').value     = document.getElementById('client_street').value;
            document.getElementById('delivery_city').value       = document.getElementById('client_city').value;
            document.getElementById('delivery_phone').value    = document.getElementById('client_phone').value;
                
            document.getElementById('box_4').className = 'n56203_box_idle';
            document.getElementById('delivery_additional').disabled = 'disabled';
            document.getElementById('delivery_firstname').disabled = 'disabled';
            document.getElementById('delivery_lastname').disabled = 'disabled';
            document.getElementById('delivery_zipcode').disabled = 'disabled';
            document.getElementById('delivery_street').disabled = 'disabled';
            document.getElementById('delivery_city').disabled = 'disabled';
            if (document.getElementById('delivery_region')) {
                document.getElementById('delivery_region').value     = document.getElementById('client_region').value;
                document.getElementById('delivery_region').disabled = 'disabled';
            } 
        } else {
            document.getElementById('box_4').className = 'n56203_box';
            document.getElementById('delivery_additional').disabled = '';
            document.getElementById('delivery_firstname').disabled = '';
            document.getElementById('delivery_lastname').disabled = '';
            document.getElementById('delivery_zipcode').disabled = '';
            document.getElementById('delivery_street').disabled = '';
            document.getElementById('delivery_city').disabled = '';
            document.getElementById('delivery_phone').disabled = '';

            document.getElementById('delivery_additional_img_off').style.display = document.getElementById('client_firm_img_off').style.display;
	    document.getElementById('delivery_additional_img_on').style.display = document.getElementById('client_firm_img_on').style.display;
            document.getElementById('delivery_firstname_img_off').style.display = document.getElementById('client_firstname_img_off').style.display;
	    document.getElementById('delivery_firstname_img_on').style.display = document.getElementById('client_firstname_img_on').style.display;
            document.getElementById('delivery_lastname_img_off').style.display = document.getElementById('client_lastname_img_off').style.display;
	    document.getElementById('delivery_lastname_img_on').style.display = document.getElementById('client_lastname_img_on').style.display;
            document.getElementById('delivery_zipcode_img_off').style.display = document.getElementById('client_zipcode_img_off').style.display;
	    document.getElementById('delivery_zipcode_img_on').style.display = document.getElementById('client_zipcode_img_on').style.display;
            document.getElementById('delivery_street_img_off').style.display = document.getElementById('client_street_img_off').style.display;
	    document.getElementById('delivery_street_img_on').style.display = document.getElementById('client_street_img_on').style.display;
            document.getElementById('delivery_city_img_off').style.display = document.getElementById('client_city_img_off').style.display;
	    document.getElementById('delivery_city_img_on').style.display = document.getElementById('client_city_img_on').style.display;
            document.getElementById('delivery_phone_img_off').style.display = document.getElementById('client_phone_img_off').style.display;
	    document.getElementById('delivery_phone_img_on').style.display = document.getElementById('client_phone_img_on').style.display;

            if (document.getElementById('delivery_region')) {
                document.getElementById('delivery_region').disabled = '';
            } 
        }
    },

    check_inp: function (idd, name, delay) {
        if (document.getElementById(idd)) {
            idd = document.getElementById(idd);
        }
        var value = idd.value;
        if (ClientSender[name] > 5) {
            ClientSender[name] = 1;
            if (name == 'client_zipcode') { 
                // kod pocztowy przeslany wraz z regionem
                IAI_Ajax.Request('ajax/client-new.php?validAjax=true', 'client_zipcode='+value+'&client_region='+document.getElementById('client_region').value, {onSuccess: 'ClientNew.info', arg: idd.id});
            } else if (name == 'delivery_zipcode') {
                // kod pocztowy dostawy przeslany wraz z regionem
                IAI_Ajax.Request('ajax/client-new.php?validAjax=true', 'delivery_zipcode='+value+'&delivery_region='+document.getElementById('delivery_region').value, {onSuccess: 'ClientNew.info', arg: idd.id});
            } else if (name == 'additional_zipcode') {
                // kod pocztowy dostawy przeslany wraz z regionem
                IAI_Ajax.Request('ajax/client-new.php?validAjax=true', 'additional_zipcode='+value+'&additional_region='+document.getElementById('additional_region').value, {onSuccess: 'ClientNew.info', arg: idd.id});
            } else if (name == 'client_region') { 
                // przy zmianie rogionu konieczne sprawdzenie kodu pocztowego
                ClientNew.check_inp(document.getElementById('client_zipcode'), 'client_zipcode');
             } else if (name == 'delivery_region') {
                // przy zmianie rogionu konieczne sprawdzenie kodu pocztowego dostawy
                ClientNew.check_inp(document.getElementById('delivery_zipcode'), 'delivery_zipcode');
            } else if (name == 'additional_region') {
                // przy zmianie rogionu konieczne sprawdzenie kodu pocztowego dostawy
                ClientNew.check_inp(document.getElementById('additional_zipcode'), 'additional_zipcode');
            } else if (name == 'client_password') {
                // haslo musi byc rozne od loginu
                IAI_Ajax.Request('ajax/client-new.php?validAjax=true', 'client_password='+value+'&client_login='+document.getElementById('client_login').value, {onSuccess: 'ClientNew.info', arg: idd.id});
            } else if (name == 'repeat_password') {
                // hasla musza byc identyczne
                IAI_Ajax.Request('ajax/client-new.php?validAjax=true', 'repeat_password='+value+'&client_password='+document.getElementById('client_password').value, {onSuccess: 'ClientNew.info', arg: idd.id});
            } else {
                // pozostałe wartości wysyłamy pojedynczo
                if (value) {
                    IAI_Ajax.Request('ajax/client-new.php?validAjax=true', name+'='+value, {onSuccess: 'ClientNew.info', arg: idd.id});
                } else {
                    ClientNew.error(idd.id, 0);
                    document.getElementById(idd.id + '_img_off').style.display = "none";
                    document.getElementById(idd.id + '_img_on').style.display = "none";	
                }
            }
        } else {
            if (delay) {
                if (ClientSender[name] > 1) { 
                    ClientSender[name]++;
                    delay++;
                } else {
                    return false;
                }
            } else {
                if (ClientSender[name] > 2) {
                    ClientSender[name]=2;
                    return false;
                } else {
                    ClientSender[name]=2;
                    delay = 1;
                }
                
            }
            setTimeout('ClientNew.check_inp("'+idd.id+'", "'+name+'", "'+delay+'")', 100); 
        }
        if (name == 'client_login') {
            // login
            document.getElementById('client_login').value = document.getElementById('client_login').value.toLowerCase();
        }
        if (document.getElementById('deliver_to_billingaddr')) {
            if (document.getElementById('deliver_to_billingaddr').checked) { 
                ClientNew.copyDeliveryAddres();
            }
        }
    },
    info: function (x, obj) {
        try {
            var response = eval('(' + x + ')');
        } catch (e) {
            return false;
        }
        xr = response;
        if (response.errno == 0) {
            // stawiamy poprawny znaczek
            new ClientNew.error(obj, 0);
        } else {
            // bledy
            if (response.message.val[0]) {
                document.getElementById(obj+ '_help').innerHTML = '<div>'+response.message.val[0]+'</div>';
            }
            new ClientNew.error(obj, 1);
        }
    },
    
    button: function (num) {
		if(num == 0 && document.getElementById('terms_agree').checked) {
			document.getElementById('submit_register').className = 'act';
		} else {
			document.getElementById('submit_register').className = 'idle';
		}
		
    }, 
    
    submitform: function () {
                ClientNew_status = true;
                if (!document.getElementById("client_firstname").value) {
                    ClientNew_status = false;
                }
                if (!document.getElementById("client_lastname").value) {
                    ClientNew_status = false;
                }
                if (!document.getElementById("client_email").value) {
                    ClientNew_status = false;
                }
                if (!document.getElementById("client_city").value) {
                    ClientNew_status = false;
                }
                if (!document.getElementById("client_zipcode").value) {
                    ClientNew_status = false;
                }
                if (!document.getElementById("client_street").value) {
                    ClientNew_status = false;
                }
                if (document.getElementById("firm_data2")) {
                    if (document.getElementById("firm_data2").checked && !document.getElementById("client_firm").value && !document.getElementById("client_nip").value) {
                        ClientNew_status = false;
                    }
                }
               if (document.getElementById("client_login")) {
                   if (!document.getElementById("client_login").value) {
                       ClientNew_status = false;
                   }
               }
               if (document.getElementById("client_password")) {
                   if (!document.getElementById("client_password").value || !document.getElementById("repeat_password").value) {
                       ClientNew_status = false;
                   }
               }
               if (document.getElementById("deliver_to_billingaddr")) {
                   if (!document.getElementById("deliver_to_billingaddr").checked) {
                       if ((!document.getElementById("delivery_firstname").value || !document.getElementById("delivery_lastname").value) && !document.getElementById("delivery_additional").value) {
                           ClientNew_status = false;
                       }
                       if (!document.getElementById("delivery_zipcode").value) {
                           ClientNew_status = false;
                       }
                       if (!document.getElementById("delivery_street").value) {
                           ClientNew_status = false;
                       }
                       if (!document.getElementById("delivery_city").value) {
                           ClientNew_status = false;
                       }
                   }
               }
               if (ClientNewMandatoryPhone) {
                   if (! document.getElementById('client_phone').value) {
                       ClientNew_status = false;
                   }
                   if (document.getElementById('additional_phone')) {
                       if ((! document.getElementById('additional_phone').value) && !document.getElementById('additional_phone').disabled ) {
                           ClientNew_status = false;
                        }
                   } else if (document.getElementById('delivery_phone')) {
                       if ((! document.getElementById('delivery_phone').value) && !document.getElementById('delivery_phone').disabled) {
                           ClientNew_status = false;
                        }
                   }
               }
               if (ClientNewMandatoryMail) {
                   if (! document.getElementById('client_email').value) {
                       ClientNew_status = false;
                   }
               }
               if (document.getElementById('terms_agree') ) {
                   if ((!document.getElementById('terms_agree').checked) && document.getElementById('terms_agree').type != 'hidden') {
                       ClientNew_status = false;
                   }
               }
		if(ClientNew_status == true ) {
if (document.getElementById("button_alert")) {
                        document.getElementById("button_alert").style.display = "none";
}
			return true;
		} else {
if (document.getElementById("button_alert")) {
                       document.getElementById("button_alert").style.display = "block";
                        setTimeout('ClientNew.AlertOff()', 5000);
}
			return false;		
		}
    }, 
    
    ramka: function () {
        if (!document.getElementById('terms_agree').checked) {
            document.getElementById('terms_agree_box').className = 'ramka_ON';
        } else {
            document.getElementById('terms_agree_box').className = 'ramka_OFF';	
        }
    },

    AlertOff: function() {
        document.getElementById("button_alert").style.display = "none";
    },
    
    copy_adres: function (type) {
        var CopyData = false;
        if (document.getElementById("firm_data")) {
            CopyData = document.getElementById("firm_data").checked;
        }
        
        if(CopyData && type == 1) {
            document.getElementById('client_firstname').value = document.getElementById('client_firstname_copy').value;
            document.getElementById('client_firstname_img_off').style.display = document.getElementById('client_firstname_copy_img_off').style.display;
	    document.getElementById('client_firstname_img_on').style.display = document.getElementById('client_firstname_copy_img_on').style.display;
            document.getElementById('client_lastname').value = document.getElementById('client_lastname_copy').value;
            document.getElementById('client_lastname_img_off').style.display = document.getElementById('client_lastname_copy_img_off').style.display;
	    document.getElementById('client_lastname_img_on').style.display = document.getElementById('client_lastname_copy_img_on').style.display;
         } else if (type ==2) {
            document.getElementById('client_firstname_copy').value = document.getElementById('client_firstname').value;
            document.getElementById('client_firstname_copy_img_off').style.display = document.getElementById('client_firstname_img_off').style.display;
	    document.getElementById('client_firstname_copy_img_on').style.display = document.getElementById('client_firstname_img_on').style.display;
            document.getElementById('client_lastname_copy').value = document.getElementById('client_lastname').value;
            document.getElementById('client_lastname_copy_img_off').style.display = document.getElementById('client_lastname_img_off').style.display;
	    document.getElementById('client_lastname_copy_img_on').style.display = document.getElementById('client_lastname_img_on').style.display;
         }
    },
    
    error: function (idd, err) {
            if(err == 1) {
			document.getElementById(idd + '_img_off').style.display = "block";
			document.getElementById(idd + '_img_on').style.display = "none";
            if (document.getElementById(idd + '_help')) {
			    document.getElementById(idd + '_help').style.display = "block";
                ClientNew.hide_info_help(idd, 10);
            }
			return false;
		} else {
			document.getElementById(idd + '_img_off').style.display = "none";
			document.getElementById(idd + '_img_on').style.display = "block";
            if (document.getElementById(idd + '_help')) {
                document.getElementById(idd + '_help').style.display = "none";
                ClientNew.hide_info_help(idd, 10);
            }
			return false;		
            }
    }, 

    hide_info_help: function(idd, licznik) {
        if (licznik > 1) {
            setTimeout("ClientNew.hide_info_help('"+idd+"', '"+(licznik-1)+"');", 1000);
        } else if (document.getElementById(idd + '_help')) {
			    document.getElementById(idd + '_help').style.display = "none";
        }
    }
}
var xr;

function agree() {
    if (document.getElementById('terms_agree').checked && ClientNew_status == true) {
        document.getElementById('submit_register').className = 'act';
    } else {
        document.getElementById('submit_register').className = 'idle';

    }
}

function clientnew_firm() {
    if (document.getElementById('firm_data').checked) {
	    ClientNew_firma = false;
        document.getElementById('client_firm_div').style.display = 'none';
        document.getElementById('box_3_header').innerHTML = client_new_txt2;
        document.getElementById('box_1_header').innerHTML = client_new_txt3;
        if (document.getElementById('send_to')) {
             document.getElementById('send_to').innerHTML = client_new_txt1;
        }
        document.getElementById('client_firstname_copy_txt').className = '';
        document.getElementById('client_firstname_copy').className = '';
        document.getElementById('client_lastname_copy_txt').className = '';
        document.getElementById('client_lastname_copy').className = '';
    } else {
	    ClientNew_firma = true;	
        document.getElementById('client_firm_div').style.display = 'block';
        document.getElementById('box_3_header').innerHTML = client_new_txt2b;
        document.getElementById('box_1_header').innerHTML = client_new_txt3b;
        if (document.getElementById('send_to')) {


            document.getElementById('send_to').innerHTML = client_new_txt1b;
        }
        document.getElementById('client_firstname_copy_txt').className = 'hidden';
        document.getElementById('client_firstname_copy').className = 'hidden';
        document.getElementById('client_lastname_copy_txt').className = 'hidden';
        document.getElementById('client_lastname_copy').className = 'hidden';
    }
}
/* Linki w stopce 4.0 4 kolumny w tym obsluga konta + newsletter + rss skorzana (layout_bottom - menu_footer_links) [56508]*/

function newsletter_blur(x) {
         if (x.value == '') {
                 x.value = top_txt;
         }
}
function newsletter_focus(x) {
         if (x.value != '') {
                 x.value = '';
         }
}

function  removeNewslleter(){


document.getElementById('mailing_action').value='remove';
document.getElementById('mailing_action_form').submit();

}
/* <span style="color:blue;font-weight:bold;">ZALECANY</span> Wybór płatność  - Formularz (order-newpayment - newpayment_form) [53474]*/

function orderpayment(id) {

document.getElementById('idle_payment').style.display = 'none';
    allDivs = document.getElementsByTagName("div");

    for (i = 0; i < allDivs.length; i++) {
        if ((/^newpayment_form_/).test(allDivs[i].id) == true) {
            allDivs[i].style.display = 'none';
        }
    }

    if (document.getElementById('newpayment_form_'+id) ) {
        document.getElementById('newpayment_form_'+id).style.display = 'block';
    }
}
/* <b style="font-size:12px;color:red; text-decoration:blink">&gt;</b>  Order 1 NEW z wyborem płatności ver 5.1 - radiobutton!!! (ukrywanie pustych form) + inputy dla kalendarza dostaw (order1 - order1) [54726]*/

function order1_shop_payformdiv(show)
{
    if (show) {
        document.getElementById('payform_div').style.display = 'block';
    } else {
        document.getElementById('payform_div').style.display = 'none';
        document.getElementById('payform_id').selectedIndex = 0;

        allDivs = document.getElementsByTagName("div");
        for (i = 0; i < allDivs.length; i++) {
            if ((/^newpayment_form_/).test(allDivs[i].id) == true) {
                allDivs[i].style.display = 'none';
            }
        }
    }
}

function order1_changepayform()
{
    selVal = document.getElementById('payform_id').value;
    allDivs = document.getElementsByTagName("div");

    for (i = 0; i < allDivs.length; i++) {
        if ((/^newpayment_form_/).test(allDivs[i].id) == true) {
            allDivs[i].style.display = 'none';
        }
    }

    if (document.getElementById('newpayment_form_'+selVal) ) {
        document.getElementById('newpayment_form_'+selVal).style.display = 'block';
    }
}
var Prepaid = {
    changeDelivery: function(time) {
        // zmiana czasu w kalendarzu
        if (window['orderCalendarActive'] == true) {
            OrderCalendar.changeDeliveryTime(time);
        }
    }
};
/* <font style="text-decoration:blink;font-weight:bold;color:green;">[!] </font>koszyk CZERWIEC 08  (basketedit - basketedit_productslist) [55925]*/

function basket_isNumeric(id, precision){
	
		var elem = document.getElementById(id);
	
		if (precision > 0){
			if(elem.value.match("^[0-9]{1,9}[.,]{0,1}[0-9]{0,"+precision+"}$") || elem.value ==''){
				elem.value = elem.value.replace(',', '.'); 
				return true;
			}else{
				elem.value = elem.value.substring(0, elem.value.length-1 );
				return false;
			}
	
		}
		if (precision == 0){
			if(elem.value.match("^[1-9]{1}[0-9]{0,9}$") || elem.value ==''){
				
				return true;
			}else{
				elem.value = elem.value.substring(0, elem.value.length-1 );
				return false;
			}
		}	
	
	


	
}
/* <span style="color:blue;font-weight:bold;">ZALECANY</span> Karta produktu - Ukrywacz menu zakładek <b style="color:red; font-weight:bold;">MATKA</b>  (projector - projector_components_hiding) [56163]*/
var HOVER_classname_start = 'tab';
var HOVER_classname_stat = 0;

// Włączenie opini jako pierwszych, jeżeli są:
var HOVER_opinions = false;

var HOVER_choosenone = '2'; // TU MUSI BYC COS CO JEST ZAWSZE np. ZADAJ PRODUKT - PODAJ JEGO L.P.
var Hover_Array_Disable = new Array();
var Hover_Array = new Array();
var Hover_Array2 = new Array();


//////////////////////////////////////////////////////////////////////////////////////////////////////

Hover_Array2[6] = new Array('component_projector_sizes','0');
Hover_Array2[1] = new Array('component_projector_opinions','0', '2');
Hover_Array2[7] = new Array('component_projector_associated_zones','0', '1');
Hover_Array2[3] = new Array('component_projector_suggestproduct','0');
Hover_Array2[2] = new Array('component_projector_askforproduct','1');
Hover_Array2[5] = new Array('component_projector_warranty','0');
Hover_Array2[8] = new Array('component_projector_enclosures','0');
Hover_Array2[9] = new Array('component_projector_longdescription','0');
Hover_Array2[4] = new Array('component_projector_dictionary','0');

//////////////////////////////////////////////////////////////////////////////////////////////////////

var Hover_Array_ZONES = new Array();
Hover_Array_ZONES[1] = new Array('component_projector_associated_zone1');
Hover_Array_ZONES[2] = new Array('component_projector_associated_zone2');
Hover_Array_ZONES[3] = new Array('component_projector_associated_zone3');
Hover_Array_ZONES[4] = new Array('component_projector_associated_zone4');

var Hover_Array_OPINIONS = new Array();
Hover_Array_OPINIONS[1] = new Array('component_projector_opinions');
Hover_Array_OPINIONS[2] = new Array('component_projector_addopinions');
//////// Funkcje ukrywacza /////////

function HOVER_sort()
{
	for (i = 1; i<Hover_Array2.length; i++) {
		Hover_Array[i] = Hover_Array2[i];
	}
}


function HOVER(start)
{



//SORTOWANIE TABLICY
HOVER_sort();



var Hover_Elements = new Array();



	for(n in Hover_Array)
	{


		if(start != 1)
		{

		//COPY
if(document.getElementById('btn_' + Hover_Array[n][0]))
{
		Hover_Elements[n] = document.getElementById('btn_' + Hover_Array[n][0]).innerHTML;
		
		//REMOVE CHILD
		document.getElementById('Hover_blanks').removeChild(document.getElementById('btn_' + Hover_Array[n][0]));
		
		//PASTE
		var ni = document.getElementById('Hover_NewMENU');
		var newDiv =  document.createElement('div');
		newDiv.id = 'btn_' + Hover_Array[n][0];
		if(HOVER_classname_stat == 1)
		{
			newDiv.className = Hover_Array[n][0];	
		}
		else
		{
			newDiv.className = HOVER_classname_start;		
		}
		newDiv.style.display = 'none';	
		newDiv.onclick = function(){HOVER_change(this.id)};			
		newDiv.innerHTML = Hover_Elements[n];
		ni.appendChild(newDiv);
}

		}

	
	}



//CHECK IF EXIST
HOVER_disable();

	if(start != 1) HOVER_addhover();	
	
	if(start != 1) HOVER_opinions_show();		
	
	//POKAZYWANIE 
	HOVER_visible();

}

function HOVER_addhover()
{

	for(n in Hover_Array)
	{
		if(Hover_Array_Disable[n] == 'true')
		{
			document.getElementById('btn_' + Hover_Array[n][0]).onmouseover = HOVER_BUTTOn_onmouseover;
			document.getElementById('btn_' + Hover_Array[n][0]).onmouseout = HOVER_BUTTOn_onmouseout;			
		}
	}

}

function HOVER_BUTTOn_onmouseover()
{

	if(this.className.indexOf('_on') == -1)
	{
		HOVER_className = this.className;	
		this.className = HOVER_className + '_hover';
	}
}

function HOVER_BUTTOn_onmouseout()
{
	if(this.className.indexOf('_on') == -1)
	{
		this.className = HOVER_className;
	}
}

function HOVER_visible()
{

	for(n in Hover_Array)
	{
		if(Hover_Array_Disable[n] == 'true')
		{
			document.getElementById('btn_' + Hover_Array[n][0]).style.display = "block";	
			if(Hover_Array[n][1] == '1')
			{
				if(HOVER_classname_stat == 1)
				{
					document.getElementById('btn_' + Hover_Array[n][0]).className = Hover_Array[n][0] + '_on';		
				}
				else
				{
					document.getElementById('btn_' + Hover_Array[n][0]).className = HOVER_classname_start + '_on';					
				}
			}
		}
	}

}

function HOVER_opinions_show()
{
	for(n in Hover_Array)
	{
		//IF OPINIONS TRUE TO JE WLACZ
		if(parseInt(HOVER_opinions_counter) > 0 && HOVER_opinions == true)
		{
			Hover_Array[n][1] = '0';
			if(Hover_Array[n][0] == 'component_projector_opinions')
			{
				Hover_Array[n][1] = '1';
				HOVER_disable();		
			}
		
		}
	}

}


function HOVER_disable()
{
	// ZONES CLEAR
	for(n in Hover_Array_ZONES)
	{
		if(document.getElementById(Hover_Array_ZONES[n][0])) document.getElementById(Hover_Array_ZONES[n][0]).style.display = "none";
	}
	
	// OPINIONS CLEAR
	for(n in Hover_Array_OPINIONS)
	{	
		if(document.getElementById(Hover_Array_OPINIONS[n][0])) document.getElementById(Hover_Array_OPINIONS[n][0]).style.display = "none";
	}
	
	for(n = 1; n < Hover_Array.length; n++)
	{

		Hover_Array_Disable[n] = 'false';

				//ZEROWANIE
				if(HOVER_classname_stat == 1)
				{
					if(document.getElementById('btn_' + Hover_Array[n][0]))document.getElementById('btn_' + Hover_Array[n][0]).className = Hover_Array[n][0];	
				}
				else
				{
					if(document.getElementById('btn_' + Hover_Array[n][0]))document.getElementById('btn_' + Hover_Array[n][0]).className = HOVER_classname_start;			
				}
				
	
				
				// JEZELI ISTENIEJE i ROZNY OD ZONES i OPINIONS
				if(document.getElementById(Hover_Array[n][0]) && Hover_Array[n][2] != '1' && Hover_Array[n][2] != '2')
				{
					Hover_Array_Disable[n] = 'true';
					
					//DISPLAY  DLA KOMPONENTOW			
					if(Hover_Array[n][1] == '1')
					{
						if(document.getElementById(Hover_Array[n][0]))document.getElementById(Hover_Array[n][0]).style.display = "block";	
					}
					else
					{
						if(document.getElementById(Hover_Array[n][0]))document.getElementById(Hover_Array[n][0]).style.display = "none";
					}
				}
				
		
	
				// JEZELI ZONES TO
				if(Hover_Array[n][2] == '1')
				{
					// ZONES EXIST
					for(k=1; k<Hover_Array_ZONES.length;k++)
					{
						
						if(document.getElementById(Hover_Array_ZONES[k][0])) 
						{
							Hover_Array_Disable[n] = 'true';
						}

					}

					
					//DISPLAY  DLA KOMPONENTOW			
					if(Hover_Array[n][1] == '1')
					{
						// ZONES SHOW
						for(k=1; k<Hover_Array_ZONES.length;k++)
						{
							if(document.getElementById(Hover_Array_ZONES[k][0])) document.getElementById(Hover_Array_ZONES[k][0]).style.display = "block";
						}
					}
					
				}		
	
		
				// JEZELI OPINIONS TO
				if(Hover_Array[n][2] == '2')
				{
					// OPNIONS EXIST
					for(k=1; k<Hover_Array_OPINIONS.length;k++)
					{			
						if(document.getElementById(Hover_Array_OPINIONS[k][0])) Hover_Array_Disable[n] = 'true';
					}
					//DISPLAY  DLA KOMPONENTOW			
					if(Hover_Array[n][1] == '1')
					{
						for(k=1; k<Hover_Array_OPINIONS.length;k++)
						{
							if(document.getElementById(Hover_Array_OPINIONS[k][0])) document.getElementById(Hover_Array_OPINIONS[k][0]).style.display = "block";
						}
					}
				}			



		
				//PRZESKOK DO NEXT IF PRIOR 1 I NIE MA KOMPONENTU
				if(Hover_Array_Disable[n] == 'false' && Hover_Array[n][1] == '1')
				{
					Hover_Array[n][1] = '0';
					Hover_Array[HOVER_choosenone][1] = '1';
					HOVER_disable();
				}
		
	
	}

}

function HOVER_clear_prior()
{
	for(n in Hover_Array)
	{
		Hover_Array[n][1] = '0';
	}

}

function HOVER_change(idek)
{
HOVER_clear_prior();

	for(n in Hover_Array)
	{

		if('btn_' + Hover_Array[n][0] == idek)
		{
			Hover_Array[n][1] = '1';
		}
	}
HOVER(1);
}
/* javascript + kod przewijaka (layout_top - menu_javascript) [56857]*/

var IAI_Ajax={
    cO: function()
    {
        var r;
        try {
            r=new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            try {
                r=new ActiveXObject("Microsoft.XMLHTTP");
            } catch(oc) {
                r=null;
            }
        }
        if (!r&&typeof XMLHttpRequest!="undefined") {
            r=new XMLHttpRequest();
        }
        return r;
    },

    Request: function(url, pd, fun)
    {
        var x;
        x=IAI_Ajax.cO();

        x.open("POST",url,true);
        x.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
        x.setRequestHeader("Accept","text/javascript, text/html, application/xml, text/xml, */*");
        x.setRequestHeader("X-IAI-Version", "1.0");
        
        x.onreadystatechange=function()
        {
            if (x.readyState == 4) {
                if (x.status >= 200 && x.status < 300) {
                    if (fun) {
                        if (fun.onSuccess) {
                            if (fun.arg) {
                                eval(fun.onSuccess+'(\'' +x.responseText+ '\', \''+fun.arg+'\');');
                            } else {
                                eval(fun.onSuccess+'(\'' +x.responseText+ '\');');
                            }
                        }
                    }
                } else {
                    // narazie brak
                }
            }
        }
        x.send(pd);
        delete x;
    }
}

var IDMAIN_Array = new Array('n56248_both','n56254_news','n54677_noreg','n54677_reg');
var IDMAIN_padding = 20;

function MAIN_resizer()
{
    var id_temp;
	for(n in IDMAIN_Array)
	{
		if(document.getElementById(IDMAIN_Array[n]) && document.getElementById(IDMAIN_Array[n]).parentNode)
		{
	    	       var main_td_width = document.getElementById(IDMAIN_Array[n]).parentNode.clientWidth;
			id_temp = document.getElementById(IDMAIN_Array[n]);
			id_temp.style.width = (main_td_width/2) - IDMAIN_padding + "px";
			id_temp.style.position = "relative";
		}
	}
    setTimeout("MAIN_resizer()", 1000);	
}


MAIN_resizer();


var HliderClass = function(){

	var obj = this;
	this.Hlider_mainID = 0;
	this.Hlider_naviID = 0;
	this.Hlider_naviclass = 0;
	this.Hlider_speed = 3;

	this.Hlider_jump = 0;
	this.lilist = 0;
	this.mainwidth = 0;
	this.mainID = '';
	this.width_pasek = 0;
	this.elements_count = 0;
	this.navi_count = 0;
	this.element_width = 0;
	this.scroll_width = 0;
	this.scroll_width_tmp = 0;	
	this.Time = 0;
	this.Scroll = 0;
	this.SI = 0;

	
	this.Navi = function(num, id, id2, clas, nullek)
	{
	this.Hlider_jump = num;
	this.Hlider_mainID = id;
	this.Hlider_naviID = id2;
	this.Hlider_naviclass = clas;
	
	////////////////	
	
	this.mainID = document.getElementById(this.Hlider_mainID);
	this.mainwidth = this.mainID.clientWidth;
	this.lilist = document.getElementById(this.Hlider_mainID).firstChild;

	this.mainwidth = this.mainID.clientWidth;		

	var elements = this.lilist.getElementsByTagName('li');
	this.elements_count = elements.length;
	
	this.navi_count = Math.ceil(this.elements_count / this.Hlider_jump);
	var naviID = document.getElementById(this.Hlider_naviID);
	if(nullek != 'NULL')
	{
		this.width_pasek = 0;	
		naviID.innerHTML = '';
	
		for(i=1; i <= this.navi_count; i++)
		{	
			var newDiv =  document.createElement('div');
			newDiv.className = this.Hlider_naviclass;
			if(i==1) newDiv.className = this.Hlider_naviclass + "_on";	
			newDiv.id = this.Hlider_mainID +"|"+this.Hlider_naviclass;				
			newDiv.onclick = this.Start;	
			newDiv.innerHTML = '<span>' + i + '</span>';
			naviID.appendChild(newDiv);
		}	
		this.mainID.scrollLeft = 0;
	
		var elements = this.lilist.getElementsByTagName('li');	
		this.elements_count = elements.length;
	
		for(n=0; n < this.elements_count;n++)
        {
			this.width_pasek += elements[n].clientWidth;
			this.element_width = elements[n].clientWidth;
		}	
		
		if(this.element_width == 0)
		{
			setTimeout(function(){obj.Navi(num,id,id2,clas)}, 500);
			return false;
		}
	}
	
	}
	
	this.Clear = function(num)
	{
		var naviID = document.getElementById(this.Hlider_naviID);
		var elements = naviID.getElementsByTagName('div');	
		for(i=0; i < elements.length; i++)
		{	
			if(elements[i].firstChild.innerHTML == num)
			{
				elements[i].className = this.Hlider_naviclass + "_on";			
			}
			else
			{
				elements[i].className = this.Hlider_naviclass;
			}
		}		
	}
	
	this.Start = function(num)
	{
	var num = parseInt(this.firstChild.innerHTML);
	var table_id = this.id.split("|");
	this.Hlider_naviID = this.parentNode.id;
	this.Hlider_mainID = table_id[0];
	this.Hlider_naviclass = table_id[1];
	this.mainID = document.getElementById(this.Hlider_mainID);	
	obj.Move(num);	
	}
	

	this.Move = function(num)
	{
		obj.Clear(num);	
		clearInterval(obj.Time);
		this.scroll_width=0;
		for(n=1;n <= num; n++)
		{
				this.scroll_width += (this.element_width * this.Hlider_jump);
		}
		this.scroll_width = this.scroll_width_tmp = this.scroll_width - (this.element_width * this.Hlider_jump);
		this.Time = setInterval(function(){obj.Anim()}, 40);
	}

	this.Anim = function()
	{
	
		this.scroll_width = Math.abs(this.mainID.scrollLeft - this.scroll_width_tmp);
		if(this.mainID.scrollLeft < this.scroll_width_tmp)
		{
		
			this.Scroll = Math.ceil((this.mainID.scrollLeft) + (this.scroll_width/ this.Hlider_speed));

		}
		else
		{
			this.Scroll = Math.floor((this.mainID.scrollLeft) - (this.scroll_width/ this.Hlider_speed));		
			this.Scroll = Math.floor((this.mainID.scrollLeft) - (this.scroll_width/ this.Hlider_speed));		
		}
		this.scroll_width = Math.round(this.scroll_width/ this.Hlider_speed);
		if(Math.round(this.Scroll) == this.scroll_width_tmp) 
		{
			clearInterval(this.Time);
		}
		this.mainID.scrollLeft = this.Scroll;

	}
	
    this.Left = function(num, id, id2, clas, nullek) 
    {
	this.Navi(num,id,id2,clas,nullek);	
	
		clearInterval(this.Time);
		this.scroll_width=0;
		var number = Math.round((this.mainID.scrollLeft / this.element_width) / this.Hlider_jump);
		if(number == 0)
		{
			number = this.navi_count;
		}
		obj.Move(number);
	}
	
    this.Right = function(num, id, id2, clas, nullek) 
    {

	obj.Navi(num,id,id2,clas, nullek);
	
		clearInterval(this.Time);
		this.scroll_width=0;
		var number = Math.round((this.mainID.scrollLeft / this.element_width) / this.Hlider_jump);
		number++;
		number++;		
		if(number > this.navi_count)
		{
			number = 1;
		}
		obj.Move(number);
	}	
}



var searchtxt = 'wpisz szukaną frazę';



function searching_blur(x) {
         if (x.value == '') {
                 x.value = searchtxt;
         }
}
function searching_focus(x) {
         if (x.value != '') {
                 x.value = '';
         }
}

function getDateStr(){
 var Today = new Date()
 var WeekDay = Today.getDay()
 var Month = Today.getMonth() + 1
 var Day = Today.getDate()
 var Year = Today.getYear()
 if(Year <= 99){
 Year += 1900}
 if(Month < 10){
 Month = '0' + Month;
 }
 return Day + "." + Month + " " 
}



function Get_Names(Sep, lastSep, method) {
 switch (arguments.length) {
  case 0: Sep=null;
  case 1: lastSep=null;
  case 2: method=0;
 }
 if (Sep==null) Sep=", "; if (lastSep==null) lastSep=Sep;

 var date=new Date();
 var tab=ImieninyArray[date.getMonth()][date.getDate()-1].split(", ");

 if (method==1)
  for (var i=0, ch, name, len, last; i<tab.length; i++) {
   ch=(last=(name=tab[i]).substring((len=name.length)-3)).charAt(2);

   if (last=="ego") { tab[i]=name.substring(0,len-3)+"y";    continue; }
   if (last=="ńca") { tab[i]=name.substring(0,len-3)+"niec"; continue; }
   if (last=="tra") { tab[i]=name.substring(0,len-3)+"ter";  continue; }

   tab[i]=name.substring(0,len-1)+(ch=='a'?"":'a');
  }

 var str=tab[0];
 for (var i=1; i<tab.length-1; i++) str+=Sep+tab[i];
 if (tab.length!=1) str+=lastSep+tab[tab.length-1];

 return str;
}

function Write_Names(before, after, Sep, lastSep, method) {
 switch (arguments.length) {
  case 0: before="";
  case 1: after="";
  case 2: Sep=null;
  case 3: lastSep=null;
  case 3: method=0;
 }
 document.write(""+before+Get_Names(Sep,lastSep,method)+after);
}
/* <span style="color:blue;font-weight:bold;">ZALECANY</span> Koszyk - Podsumowanie koszyka (basketedit - basketedit_summary) [53833]*/

function countAnnuityZagiel(account, amount)
{ 
window.open('http://www.zagiel.com.pl/kalkulator/index_smart.php?action=getklientdet_si_rata&shopNo=' + account + '&goodsValue=' + amount, 'count_zagiel', 'width=630,height=500,directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
}
function validate_Zagiel()
{
var zagielconfirm = document.getElementById('zagiel_confirm');
  if (zagielconfirm.checked) {
    return true;
  } else {
    alert(zagielnotconfirmed);
    return false;
  }
}

/*eraty*/
function countAnnuityEraty(account, version, amount)
{ 
window.open('https://www.eraty.pl/symulator/oblicz.php?numerSklepu=' + account + '&wariantSklepu=' + version+ '&typProduktu=0&wartoscTowarow=' + amount, 'count_zagiel', 'width=630,height=500,directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
}
function validate_eraty()
{
  var zagielconfirm = document.getElementById('zagiel_confirm');
  if (!zagielconfirm) {
    return false;
  }
  if (zagielconfirm.checked) {
    return true;
  } else {
    alert(zagielnotconfirmed)
    return false;
  }
}
/* <b style="font-size:12px;color:red; text-decoration:blink">&gt;</b>Opinie BEZ FORMULARZA 3.6, z foto (kopia) (projector - projector_opinions) [56197]*/

var x;

function showOpinion(id)
{
    element = document.getElementById(id);
    element.style.display='block';
}

function hideOpinion(id)
{
    element = document.getElementById(id);
    element.style.display='none';
}
/* <span style="color:blue;font-weight:bold;">ZALECANY</span> Kontakt - Formularz z tematem (contact - contact_mailform) [54544]*/

function checkOnSubmit()
{
    if ((/^[0-9a-zA-Z._-]+@[0-9a-zA-Z._-]+.[0-9a-zA-Z]+$/).test(document.getElementById("from").value) == false || document.getElementById("from").value.length == 0){
        alert('Nie podano żadnego adresu e-mail.');
        return false;
    }
    return true;
}
/* <span style="color:blue;font-weight:bold;">ZALECANY</span> Kontakt - Newsletter (contact - contact_newsletter) [54691]*/
var newstxt = 'twój e-mail';
function newsletter_blur(x) {
         if (x.value == '') {
                 x.value = news_txt;
         }
}
function newsletter_focus(x) {
         if (x.value != '') {
                 x.value = '';
         }
}
/* <b style="font-size:13px;color:blue; text-decoration:blink;")">[ S ]</b>  Dodawanie opini do produktu 5.0 (projector - projector_opinions_add) [56194]*/

function drop_down(id) 
{
     document.getElementById(id).style.height = '150px';
}

function roll_back(id)

{
     document.getElementById(id).style.height = '';
}
/* <span style="color:blue;font-weight:bold;">ZALECANY</span> Słownik opisu (projector - projector_dictionary) [56173]*/

// SEARCH - DIALOGBOX
//////////////////////////////////////////////////////////////////////


var offsetfrommouse=[10,15]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var timer;
var idek;


function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}


function hidetrail(){	
	document.getElementById(idek).style.display= "none";
	document.onmousemove="";
	document.getElementById(idek).style.left="-2000px";
	clearTimeout(timer);
}

function showtrail(id){
	idek = id;
	if (isNaN(timer)){show();}
	timer = setTimeout("show();",100);
}
function show(){
	
    var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth - offsetfrommouse[0]
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)
	document.onmousemove=followmouse; 
	document.getElementById(idek).style.display="block";

}

function followmouse(e){

	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]
	
	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	if (typeof e != "undefined"){
		if (docwidth - e.pageX <  2*offsetfrommouse[0]){
			xcoord = e.pageX - xcoord; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < 2*offsetfrommouse[1]){
			ycoord += e.pageY - Math.max(0,(2*offsetfrommouse[1] + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < 2*offsetfrommouse[0]){
			xcoord = event.clientX + truebody().scrollLeft - xcoord; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (2*offsetfrommouse[1])){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(2*offsetfrommouse[1] + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}

	
	document.getElementById(idek).style.left=xcoord+"px"
	document.getElementById(idek).style.top=ycoord+"px"

}
