var IE = document.all?true:false

var basketSlideT = false;

function refreshCheks() {
	var $customChecks = $("input.customC:checkbox");
	$customChecks.parent().removeClass("customCheckOn");
	var $customChecks = $("input.customC:checked");
	$customChecks.parent().addClass("customCheckOn");
}
 $(document).ready(function(){
	$customCheck = $("input.customC:checkbox");
	$customCheck.wrap('<div class="customCheck"></div>');
	$customCheck.parent().toggle(function(){
		$(this).addClass("customCheckOn");
		$(this).children().attr("checked","checked");
		$(this).children().change(function(){
			return true;
		})
		.change();
	}, function(){
		$(this).removeClass("customCheckOn");
		$(this).children().attr("checked","");
		$(this).children().change(function(){
			return true;
		})
		.change();
	}
	)
	$customRadio = $("input.customR:radio");
	$customRadio.wrap('<div class="customRadio"></div>');
	$customRadio.parent().click(function(){
		var atrybut = $(this).children().attr("name");
		$customRadio.filter("input[name='"+atrybut+"']").parent().removeClass("customRadioOn");
		$(this).addClass("customRadioOn");
		$(this).children().attr("checked","checked");
	})	
		$("a[rel='lightbox']").lightBox({
			overlayBgColor: '#000000',
			overlayOpacity: 0.6,
			imageLoading: _templates_dir+'images/loading.gif',
			imageBtnClose: _templates_dir+'images/close.gif',
			imageBtnPrev: _templates_dir+'images/prev.gif',
			imageBtnNext: _templates_dir+'images/next.gif',
			containerResizeSpeed: 350,
			txtImage: 'Obrazek',
			txtOf: 'z'

	});	

	

	$("div.googleMapLink a").click(function(){

			$("#googleMap").toggle();

	});

	

	 refreshCheks();

	

	 });























function showBasket() {

	if (!basketSlideT) {

		$("div#scrlBasket").slideDown("normal");

		basketSlideT = true;

	}

}

function hideBasket() {

	if (basketSlideT) {

		$("div#scrlBasket").slideUp("normal");

		basketSlideT = false;

	}

}

function basketDown() {

var bPoz = document.getElementById("sBasket").offsetTop;

    //d = 270;

		//a = 30;

		//if(d>a)

		//	if(h-d>i)

				//a+=Math.ceil((d-a))

		//	else

		//		a+=Math.ceil((d-a-(h-d))/Scroller.speed)

		//else

		//	a = a+(d-a)/Scroller.speed;





document.getElementById("sBasket").style.top = 30+'px'; 

//document.getElementById("kontrol").value=document.getElementById("sBasket").offsetTop;

basketSlideT = setTimeout("basketDown()", 50);

}

function orderItemChange(n, id) {

  if(n.className=="minus") {

    n.className="plus";

    document.getElementById(id).style.display = "none";

  } else {

    n.className="minus";

    document.getElementById(id).style.display = "block";

  }

}





function HidePoll() {

document.getElementById('pollResult').style.display = "none";

}

function ShowPoll() {

pageS = new Array();

pages = getPageSize();

pollX = (pages[0]/2)-260+'px';

document.getElementById('pollResult').style.display = "block";

document.getElementById('pollResult').style.left = pollX;

if(IE)

document.getElementById('pollResult').style.top = document.documentElement.scrollTop + 50 + 'px';

else 

document.getElementById('pollResult').style.top = window.pageYOffset + 50 + 'px';



}



function ShowAskExpert() {

pageS = new Array();

pages = getPageSize();

pollX = (pages[0]/2)-260+'px';

document.getElementById('askExpert').style.display = "block";

document.getElementById('askExpert').style.left = pollX;

if(IE)

document.getElementById('askExpert').style.top = document.documentElement.scrollTop + 50 + 'px';

else 

document.getElementById('askExpert').style.top = window.pageYOffset + 50 + 'px';

}

function HideAskExpert() {

document.getElementById('askExpert').style.display = "none";

}



function ShowNewsletterBox() {

pageS = new Array();

pages = getPageSize();

pollX = (pages[0]/2)-260+'px';

document.getElementById('newsletterBox').style.display = "block";

document.getElementById('newsletterBox').style.left = pollX;

if(IE)

document.getElementById('newsletterBox').style.top = document.documentElement.scrollTop + 50 + 'px';

else 

document.getElementById('newsletterBox').style.top = window.pageYOffset + 50 + 'px';

}

function HideNewsletterBox() {

document.getElementById('newsletterBox').style.display = "none";

}



function ShowProductRateBox() {

pageS = new Array();

pages = getPageSize();

pollX = (pages[0]/2)-260+'px';

document.getElementById('productRateBox').style.display = "block";

document.getElementById('productRateBox').style.left = pollX;

if(IE)

document.getElementById('productRateBox').style.top = document.documentElement.scrollTop + 50 + 'px';

else 

document.getElementById('productRateBox').style.top = window.pageYOffset + 50 + 'px';

}

function HideProductRateBox() {

document.getElementById('productRateBox').style.display = "none";

}



function getPageSize(){

  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){ // all but Explorer Mac

     xScroll = document.body.scrollWidth;

     yScroll = document.body.scrollHeight;

  } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari

     xScroll = document.body.offsetWidth;

     yScroll = document.body.offsetHeight;

  }

  var windowWidth, windowHeight;

  if (self.innerHeight) {   // all except Explorer

     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) { // other Explorers

     windowWidth = document.body.clientWidth;

     windowHeight = document.body.clientHeight;

  }

  // for small pages with total height less then height of the viewport

  if(yScroll < windowHeight){

     pageHeight = windowHeight;

  } else {

     pageHeight = yScroll;

  }

  // for small pages with total width less then width of the viewport

  if(xScroll < windowWidth){

     pageWidth = windowWidth;

  } else {

     pageWidth = xScroll;

  }

  arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)

  return arrayPageSize;

}



function vote(n) {

for(i=1;i<6;i++) {



document.getElementById('vote'+i).className = "voteLink";



document.getElementById('vote'+n).className = "voted";

document.getElementById('voteValue').value = n;

}



}





function toggleCheck(el) {

  var inp = el.getElementsByTagName("input")[0];

  if (inp.checked == true) {

    inp.checked = false;

    el.className = "check-row";

  } else {

    inp.checked = true;

    el.className = "check-row checked";

  }

}

function updateCheck() {
  var inps = document.getElementsByTagName("input");
  for (i=0; i<inps.length; i++) {
    if (inps[i].parentNode.className == "check-row") {
      inps[i].parentNode.className = (inps[i].checked ? "check-row checked" : "check-row");
    }
  }
}

function getColorToFront(handle)
{
	var images=handle.getElementsByTagName('img');
	images[1].style.display='block';
	images[0].style.display='none';
}

function getGrayscaleToFront(handle)
{
	var images=handle.getElementsByTagName('img');
	images[1].style.display='none';
	images[0].style.display='block';
}

/*



	scroll: function(d){

		i = window.innerHeight || document.documentElement.clientHeight;

		h=document.body.scrollHeight;

		a = Scroller.scrollTop()

		if(d>a)

			if(h-d>i)

				a+=Math.ceil((d-a)/Scroller.speed)

			else

				a+=Math.ceil((d-a-(h-d))/Scroller.speed)

		else

			a = a+(d-a)/Scroller.speed;

		window.scrollTo(0,a)

	  	if(a==d || Scroller.offsetTop==a)clearInterval(Scroller.interval)

	  	Scroller.offsetTop=a

	}// JavaScript Document

	

	

	

*/


