var IE6 = false;
var scrolling = false;

function switchK(n) {
  document.getElementById("kolor").selectedIndex = n-1; // tak jak w middle-upper-produkt.html
}

function imageHovering() {
 if (!document.getElementsByTagName) return;
 var e = document.getElementsByTagName("img");
 for (var i=0; i<e.length; i++) {
  if (e[i].className.indexOf("hvr")>=0) {
    e[i].onmouseover = imageHover;
    e[i].onmouseout = imageDeHover;
  }
 }
 var e = document.getElementsByTagName("input");
 for (var i=0; i<e.length; i++) {
  if (e[i].className.indexOf("hvr")>=0) {
    e[i].onmouseover = imageHover;
    e[i].onmouseout = imageDeHover;
  }
 }
}

window.onload = function() {
imageHovering();
}

function imageHover() {
  this.src = this.src.replace(".nor",".hot");
}

function imageDeHover() {
  this.src = this.src.replace(".hot",".nor");
}


// a - tile height
// b - number of tiles
// c - number of tiles per row

function fixHeight(a,b,c) {
  var d = a * Math.ceil(b/c);
  document.getElementById("scrContent").style.height = d + "px";
}

// a - tile height
// b - number of tiles
// c - number of tiles per column

function fixWidth(a,b,c) {
  var d = a * Math.ceil(b/c);
  document.getElementById("scrContent").style.width = d +"px";
}

function displayP(a,b) {
  document.getElementById("Q"+a+"_3").style.display = (b ? "block" : "none");
}

// a - nr bloku
// d - wymiar miniaturki (160, 210 lub 250)
// b - id produktu
// c - id koloru

function switchP(a,d,b,c) {
  var el = document.getElementById("Q"+a+"_img");
  var newsrc = _templates_dir + "gfx/"+d+"_"+b+"_"+c+".png";
  if (IE6) {
    el.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'" + newsrc + "\', sizingMethod=\'scale\'";
  } else {
    el.src = newsrc;
  }
  var link1 = document.getElementById("Q"+a+"_link1");
  if (link1) {
    var link2 = document.getElementById("Q"+a+"_link2");
    link1.href = "produkt," + b + "," + c + ".html";
    link2.href = "produkt," + b + "," + c + ".html";
  }
  var zoomlink = document.getElementById("Q"+a+"_zoomlink");
  if (zoomlink) {
    zoomlink.href = "zoom," + b + "," + c + ".html";
  }
  var inp = document.getElementById("kolor"); // dostosowac do nazwy pola w MIDDLE-FULL-UPPER-PRODUKT
  if (inp) {
    inp.value = c;
  }
}

function fixCart(a,r) {
  document.getElementById("scrScrollbar").style.display = (a > r ? "block" : "none");
  document.getElementById("cartFooter").style.display = (a > 0 ? "block" : "none");
  document.getElementById("cartFooter").style.top = 56 + ((a > r ? r : a) * 24) + "px";
  if (a == 0) document.getElementById("scrContent").style.top = "50px";
}

var prevorder = -1;

function expandOrder(n) {
  if (n != prevorder) {
   var ep = document.getElementById("X"+prevorder);
   if (ep) {
     ep.style.display = "none";
   };
   document.getElementById("X"+n).style.display = "block";   
   prevorder = n;
  }
}
function showFmenu(){
	document.getElementById("menu-flash-hold").style.height = "286px";
	//alert("showFmenu");
}
function hideFmenu(){
	document.getElementById("menu-flash-hold").style.height = "66px";
	//alert("hideFmenu");
}