przewijanie=0;
szukano=false;
aktywneMenu="";
foty = new Array();
tbheight = 611;tbwidth=830;
var star_text='';
if (screen.height<900) {
	tbheight = 530;
}
if (screen.height<700) {
	tbheight = 360;
	tbwidth = 700;
} 

function ramka (s) {
	document.getElementById(s).style.borderColor="#F96B00";
}

function ramkaBrak (s) {
	document.getElementById(s).style.borderColor="#ffffff";
}
function ramkaBrak1 (s) {
	document.getElementById(s).style.borderColor="#DDDDDD";
}

function change(el,klasa) {
	el.className = klasa;
}

function set_stars(id,o) {
	var wys = ((5-parseInt(o))*15);
	document.getElementById(id).style.top = "-"+wys+"px";
}

function unflash_stars(tekst) {
	var o = document.getElementById('ocena').value;
	var wys = ((5-parseInt(o))*15);
	document.getElementById('stars').style.top = "-"+wys+"px";
	document.getElementById('tekst_ocena').innerHTML='&nbsp;&nbsp;'+star_text;
}

function flash_stars(obj,tekst){
	var wys = ((5-obj)*15);
	document.getElementById('stars').style.top = "-"+wys+"px";
	document.getElementById('tekst_ocena').innerHTML='&nbsp;&nbsp;'+tekst;
}

function select_star(obj,tekst){
	document.getElementById('ocena').value=obj;
	document.getElementById('tekst_ocena').innerHTML='&nbsp;&nbsp;'+tekst;
	star_text = tekst;
}

function init()
{
	optionTest = true;
	lgth = document.getElementById('k').options.length;
	document.getElementById('k').options[lgth] = null;
	if (document.getElementById('k').options[lgth]) optionTest = false;
	populate();
}

function populate()
{
	if (!optionTest) return;
	var box = document.getElementById('k');
	var number = box.selectedIndex+1;
	if (!number) return;
	var list = tabKol[number];
	var box2 = document.getElementById('r');
	stary = box2.value;
	staryIndex = 0;
	box2.options.length = 0;
	for(i=0;i<list.length;i+=2)
	{
		box2.options[i/2] = new Option(list[i],list[i+1]);
		if (list[i+1]==stary) { staryIndex = i/2; }
	}
	if (stary!="" && staryIndex>1) {
		box2.selectedIndex = staryIndex;
	} else { 
		box2.selectedIndex = 0;
	}
	if ((tabKol.length)>=3 && tabKol[2].length==4 && tabKol[2][3]=="0") { 
	$('rozmsel').style.display="none";
	if (tabKol[2][3]=="0") { 
		$('r').selectedIndex=1;
	}
	} else {
		$('rozmsel').display="block;";
	}
	if (tabelaRozmiarow) { podswietlRozmiar($("r").value); }
}

function goUrl(url) {
	document.location.href=url;
}

function addToCart(kom,act,wer) {
	if (wer) {
		open_courtesy("");
	} else {
		document.getElementById("addToCartButtonDiv").style.display="none";
		document.getElementById("addToCartLoaderDiv").style.display="block";
	}
		
	ilosc = 0;
	if (wer==true) 
	{ 
		ilosc = parseInt(document.getElementById('i').value);
	} else {
		ilosc = parseInt(document.getElementById('q').value);
	}
	
	if (ilosc==0) document.getElementById('q').value="1";
	document.getElementById("katalogForm").action = act;
	document.getElementById("katalogForm").submit();
}

function removeItem(url)
{
	document.getElementById("film").innerHTML='<div style="width:350px;height:200px;"><br><br><span style="font-weight:bold"><span style="color:#000000;">Conferma</span><br><br><br>Vuoi cancellare questo articolo?<br><br><a href="javascript:goUrl(\''+url+'\')"><img src="/images/si.gif" onmouseover="chIm(this,\'sin.gif\')" onmouseout="chIm(this,\'si.gif\')"></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:close_courtesy()"><img src="/images/no.gif" onmouseover="chIm(this,\'non.gif\')" onmouseout="chIm(this,\'no.gif\')"></a></span><br><br></div>';
	document.getElementById("flash_show").style.display="block";
	document.getElementById("film").style.display="block";
}

function addToWishList(kom,act) {
	if (document.getElementById('i').value!="" && parseInt(document.getElementById('i').value)>0)
	{
		document.getElementById("katalogForm").action=act;
		document.getElementById("katalogForm").submit();
	} else {
		alert(kom);	
	}
}

function zoom(fot,tab,act) {	
	if (act!="") { act="&a="+act; }
	window.open('zoom.htm?p='+fot+'&t='+tab+act,'','width=700,height=670');
}

function zoomer(fot,tab,act) {	
	if (act!="") { act="&a="+act; }
	window.open('zoomer.htm?z=1&p='+fot+'&t='+tab+act,'','width=630,height=670');
}

function zoomer3d() {	
	window.open('http://download.bonprix.pl/partner/zoomer3d.php','','width=465,height=580');
}

function chIm(im,fi) {
	im.src="/images/"+fi;	
}

function orderForm (nr)  {
	document.getElementById("orderForm").submit();
}

function orderFormPrice (si)  {
	war=(document.getElementById("r").options[si].value).split(";");
	document.getElementById("orderFormCena").innerHTML=war[1];
}

function addToCartForm(kom) {
	if (document.getElementById('i').value!="" && parseInt(document.getElementById('i').value)>0)
	{
		document.getElementById("orderForm").submit();
	} else {
		alert(kom);	
	}
}

function voting(url) {	
	window.open(url,'','width=580,height=710');
}

function voting_odpowiedzi(ilepyt) {	
	odpstr = "";
	blad = false;
	
	for (i=0;i<=ilepyt*4;i=i+4)
	{
		wybor = false;
		
		if (document.registerUser.elements[i].checked) { odpstr = odpstr + "1"; } else if (document.registerUser.elements[i+1].checked) { odpstr = odpstr + "0"; }
		if (document.registerUser.elements[i+2].checked) { odpstr = odpstr + "1"; } else if (document.registerUser.elements[i+3].checked) { odpstr = odpstr + "0"; }
	}
	
	if (odpstr.length != ilepyt*2) { blad = true; }
	
	if (!blad) {
	document.getElementById("katglowna").value = odpstr;
	document.getElementById("registerUser").submit();
	} else {
		alert("Prosimy o odpowiedź na wszystkie pytania.");
	}
}

function ankieta_odpowiedzi() {	
	odpstr = "";
	blad = false;
	odp = 0;
	
	for (i=0;i<=13;i=i+1)
	{
		wybor = false;
		
		if (document.pool.elements[i].checked) { odpstr = odpstr + "1"; odp = odp +1;} else { odpstr = odpstr + "0"; }
	}
	
	if (odp <4) { blad = true; }
	
	if (!blad) {
	document.getElementById("katglowna").value = odpstr;
	document.getElementById("pool").submit();
	} else {
		alert("Prosimy o odpowiedź na wszystkie pytania.");
	}
}

function fn_szukaj(obiekt) {
	if (!szukano) {
		obiekt.value="";
	}
}

function widocznosc(warstwa,stan) {
	document.getElementById(warstwa).style.display=stan;
}

function schowekAkcja() {
	str="";
	if (document.schowekForm.schowekWybor.length!=undefined) {
		ilosc = document.schowekForm.schowekWybor.length; 
	} else {
		ilosc = 1;
	}
	for (i=0;i<ilosc;i++)
	{
		if (ilosc>1) {
			if (document.schowekForm.schowekWybor[i].checked)
			{
				str = str + document.schowekForm.schowekWybor[i].value + ":";
			}
		} else {
			if (document.schowekForm.schowekWybor.checked)
			{
				str = str + document.schowekForm.schowekWybor.value + ":";
			}
		}
		
	}
	document.schowekForm.str.value=str;
	document.schowekForm.submit();
}

function pokazPodmenu(menu) {                         
	if (aktywneMenu!="") {
		ukryjPodmenu(aktywneMenu);	
	}
	
	if (menu!="") {
		document.getElementById(menu).style.display="block";
		aktywneMenu=menu;
	} 
}

function ukryjPodmenu(menu) {
	document.getElementById(menu).style.display="none";
}

function switchImage(id, url) {
	new Effect.Opacity(id,
	    { duration: 0.3, from: 1.0, to: 0.0, afterFinish: callback });
	
	
	new Effect.Opacity(id,
	    { duration: 0.3, from: 0.0, to: 1.0, queue: 'end' });
	
	
	function callback(){
		$(id).src = url;
	};
}
	
function switchColor(nrkat) {
	 var box = document.getElementById('k');
	 box.value=nrkat;
	 
}

function MoveLeft(il) {
	if (przewijanie>0) {
		new Effect.MoveBy('BigBox', 0, 110, 
                              {
                                  duration: 0.3,  
                                  transition: Effect.Transitions.sinoidal
                              });
		przewijanie--;
	}
	$('ostatnioPrawe').style.visibility='visible';

	if (przewijanie==0) {
		$('ostatnioLewe').style.visibility='hidden';
	}
}

function MoveRight(il) {
	if (przewijanie<il-5) {
		new Effect.MoveBy('BigBox', 0, -110, 
                              {
                                  duration: 0.3,  
                                  transition: Effect.Transitions.sinoidal
                              });
		przewijanie++;
	}

	$('ostatnioLewe').style.visibility='visible';

	if (przewijanie==il-6) {
		$('ostatnioPrawe').style.visibility='hidden';
	}

	
}

function video(film,s,w) {
    var url = window.location+"";
	var urlparts = url.split("/");
	window.open('/'+urlparts[3]+'/video.htm?path='+film+'&s='+s+'&w='+w,'','width='+s+',height='+w+',scrollbars=0');
}

function submitByEnter(e, goToUrl, sumbitId) {
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;

	if (keycode == 13)
	{
		if(goToUrl != '')
			goUrl(goToUrl);
		
		if(sumbitId != '')
			document.getElementById(sumbitId).submit();
	
		return false;
	}
	else
		return true;
}

function open_loader(){
	var swo = new SWFObject("/swf/loader.swf", "film", "500", "500", "10");
	swo.addParam("wmode", "transparent");
	swo.write("film");
	document.getElementById("flash_show").style.display="block";
	document.getElementById("film").style.display="block";
	
}

function close_loader(){
	document.getElementById("film").style.display="none";
	document.getElementById("film").innerHTML="";
	document.getElementById("flash_show").style.display="none";
}

var inputString = '';
function jumpTo(fromElObj, toEl) {
	var regexp = /^[0-9]*$/i;
	if(!regexp.test(fromElObj.value)){
		fromElObj.value = inputString;
	} else {
		inputString = fromElObj.value;
		if(fromElObj.value.length >= fromElObj.maxLength){
			inputString = '';
			document.getElementById(toEl).focus();
		}
	}
}

function rozciagnij(){
	Nifty("ul#Menu a","small transparent top");
}

function getElementHeight(Elem) {
	xPos = null;
	if(document.getElementById) {
		var elem = document.getElementById(Elem);
	} else if (document.all){
		var elem = document.all[Elem];
	}
	if(elem != null)
		xPos = elem.offsetHeight;
		
	return xPos;
}

function showResponse123() {
}

function open_loader() {
	document.getElementById("film").innerHTML='<img src="/images/big-ajax-loader.gif" style="border:120px solid #ffffff;border-bottom-width:50px;"><br><br><span style="font-weight:bold">Ti preghiamo di avere un attimo di pazienza</span><br><br>';
	document.getElementById("flash_show").style.display="block";
	document.getElementById("film").style.display="block";
}

function close_loader() {
	document.getElementById("film").style.display="none";
	document.getElementById("flash_show").style.display="none";
}

function open_courtesy(co) {
	document.getElementById("film").innerHTML='<img src="/images/big-ajax-loader.gif" style="border:120px solid #ffffff;border-bottom-width:50px;"><br><br><span style="font-weight:bold">Ti preghiamo di avere un attimo di pazienza</span><br><br>';
	document.getElementById("flash_show").style.display="block";
	document.getElementById("film").style.display="block";
}

function close_courtesy(co) {
	document.getElementById("film").style.display="none";
	document.getElementById("flash_show").style.display="none";
}

function checkWebService(formularz,order,customerNumber){
	with(formularz){
		if ( numerklienta.value.length > 0 ){
			if ( imie.value.length > 0 && nazwisko.value.length > 0) {
				
				open_loader();
				
				var params = '';
				
				if(order != null && order == true)
					params = 'imie='+imie.value+'&nazwisko='+nazwisko.value+'&numerklienta='+numerklienta.value+"&order=1";
				else
					params = 'imie='+imie.value+'&nazwisko='+nazwisko.value+'&numerklienta='+numerklienta.value+"&order=0";
				
				
				if(customerNumber != null)
					params += "&customerNumber";
				
				var url = 'checkcustomernumber.htm';
				
				//alert(url+"?"+params);
			
				var ajax = new Ajax.Updater(
				{success: 'checkCustomerNumber'},
				url,
				{method: 'post', parameters: params, evalScripts: true, onComplete: close_loader});
				
			}
		}
	}
}


function getPosition(elem) {
	obj = document.getElementById(elem);
	var pos = {y : obj.offsetTop, x : obj.offsetLeft};
	while(obj.offsetParent)
	{
		pos.y=pos.y+obj.offsetParent.offsetTop;
		pos.x=pos.x+obj.offsetParent.offsetLeft;
		if(obj==document.getElementsByTagName('body')[0]){break}
		else{obj=obj.offsetParent;}
	}
	return pos;
} 
		
function popupAtTop()  {
	document.getElementById('quickviewnew').style.top = (getPosition("newsTopLink").y+30)+"px";
	document.getElementById('quickviewnew').style.left = (getPosition("centerDiv").x-299) + "px";
}

function popupAtBottom()  {
	document.getElementById('quickviewnew').style.top = (getPosition("newsBottomLink").y-330) + "px";
	document.getElementById('quickviewnew').style.left = (getPosition("centerDiv").x-299) + "px";
}

function startDrag2() {
	var quickviewnew = DragHandler.attach(document.getElementById('quickviewnew')); 
} 

function stopDrag2() {
	DragHandler.dettach(document.getElementById('quickviewnew'));
} 

function showResponse2() {
}

function q_close2() {
	d2.hide();
}

function submitNewsletter() {
	$('subscribeNewsletter').request({
			onFailure: function() {},
			onSuccess: function(t) {
				$('quickviewnew').update(t.responseText);
	}
	});
	startDrag2();
}

function personalizepre(id,tx)
{
	p = tx.split('|||');
	for (i=1;i<=p.length;i++)
	{
		$('pers'+id+'_'+i).value=p[i-1];
	}
}

function personalizepreHTML(id,tx)
{
	p = tx.split('|||');
	for (i=1;i<=p.length;i++)
	{
		$('pers'+id+'_'+i).innerHTML="<b>"+p[i-1]+"</b>";
	}
}

function personalize(id,il)
{
	tekst = "";
	for (i=1;i<=il;i++) {
		tekst = tekst + $('pers'+id+'_'+i).value;
		if (i<il) tekst = tekst + "|||";
	}

	$('pe').value = tekst;
	$('pid').value = id;
	$('personalization').submit();
}
