
		//popup
		var popupStatus = 0;
		
		//loading popup login or something... i don't know
		
		function loadPopup(){
			var windowWidth = document.documentElement.clientWidth;
			var windowHeight = document.body.clientHeight;
			var popupHeight = $(".popup-auth").height();
			var popupWidth = $(".popup-auth").width();
			var tp = document.documentElement.scrollTop;
		
			//loads popup only if it is disabled
			if(popupStatus == 0){
				$("#backgroundPopup").css({"opacity": "0.7"});
				$("#backgroundPopup").fadeIn("slow");
				$(".popup-auth").fadeIn("slow");
				popupStatus = 1;

			//centering
				$(".popup-auth").css({
					"top": Math.round($(document).scrollTop()+($(window).height()-$(".popup-auth").height())/2),
					"left": windowWidth/2-popupWidth/2
				});	
				$(".breadcrumbs, .boxOffice").css({"position":"static"});				
			}
			
		}
		
		
		//loading popup
		function loadInfoRequest(){
		
			//loads popup only if it is disabled
			if(popupStatus == 0){
				$("#backgroundPopup").css({"opacity": "0.7"});
				$("#backgroundPopup").fadeIn("slow");
				$(".infoRequest").fadeIn("slow");
				popupStatus = 1;
			}
		}		
		
		//disabling popup
		function disablePopup(){
			
			//disables popup only if it is enabled
			if(popupStatus == 1){
				$("#backgroundPopup").fadeOut("slow");
				$(".popup, .popup-auth").fadeOut("slow");
				popupStatus = 0;
				$(".breadcrumbs, .boxOffice").css({"position":"relative"});
			}
		}

		//centering popup
		function centerPopup(){
			
			//popup vars centering
			var windowWidth = document.documentElement.clientWidth;
			var windowHeight = document.body.clientHeight;
			var popupHeight = $(".popup").height();
			var popupWidth = $(".popup").width();
			
			var tp = document.documentElement.scrollTop;
			//centering
			$(".popup").css({
				"top": Math.round($(document).scrollTop()+($(window).height()-$(".popup").height())/2),
				"left": windowWidth/2-popupWidth/2
			});
		
			//only need force for IE6
			$("#backgroundPopup").css({"height": windowHeight});
		}
		
		function centerBred() {
			var brHeight = $(".breadcrumbs").height();
			if(brHeight > 18){
				$(".breadcrumbs").css({"top":"-9px"});
				if(brHeight > 40){$(".breadcrumbs").css({"top":"-19px"});}
			} else {
				$(".breadcrumbs").css({"top":"0px"});
			}
		}
		
	$(document).ready(function () {
		
		//add mask 
		$("a.btn-cat div").prepend("<div class='mask'>");
		
		//fix ie6 first child
		$('li.block:first-child').addClass('ieFix');
		
		//style checkbox in office page
		$('input[type="checkbox"].chBox').ezMark();
		
		//image slider
		$(".imageSlider").imageSlider();
		$(".imageSliderExh").imageSlider();
				
		var thisImg = $("ul.overview li img");

		$(thisImg).animate({opacity: 0.4}, 100);
		$(thisImg).hover(function(){
			$(this).stop().animate({opacity: 1}, 300);
		}, function () {
			$(this).stop().animate({opacity: 0.4}, 300);
		});	
		
		$("div.catalogTable table tr:odd").addClass("odd");
		
		
		//select style
		$("select.customSelect").sSelect();
		
		//get large image
		$("a.smallImg").live("click", function(e){
			e.preventDefault();
			var largePath = $(this).attr("href");			
			var relImg = $(this).attr("rel");
			$("#largeImg").attr({ src: largePath });
			$("#largeImgLink").attr({ href: relImg });
			    //shadowbox setup
				Shadowbox.setup("a#largeImgLink", {
					gallery:        "productGallery",
					continuous:     true,
					counterType:    "skip"
				});
		});
		
		
		Shadowbox.init();
		
		//popup registration loading
		$("a.login").live("click", function(e){
			e.preventDefault();
			//centering with css
			centerPopup();
			//load popup
			loadPopup();
		});

		$("a.btn-link, a.btn-stuff").live("click", function(e){
			e.preventDefault();
			//centering with css
			centerPopup();
			//load popup
			loadInfoRequest();
		});

		$("a.btn-stuff").live("click", function(e){
			e.preventDefault();
			//centering with css
			centerPopup();
			//load popup
			loadInfoRequest();
			var mark = $(this).attr("rev");
			var thisName = $(this).attr("rel");
			$("input#prod").val(thisName);
			$("input#mark").val(mark);
		});		
		
		//popup close
		$("a.close").live("click", function(e){
			e.preventDefault();
			disablePopup();
		});
		
		//escape button
		$(document).keyup(function(e) {
		  if (e.keyCode == 27) { $("a.close, a.mapClose").click(); }
		});


		//login
		$("form#loginForm").submit(function() {
			var thisTrue = true;
			if ($("input#email").val() != "") {
				$("p.validEmail").hide();
				$("p.email").removeClass("redDot");
			} else {
				$("p.validEmail").show();
				$("p.email").addClass("redDot");
				$("input#email").focus();
				thisTrue = false;
			}
			if ($("input#pass").val() != "") {
				$("p.validPass").hide();
				$("p.pass").removeClass("redDot");
			} else {
				$("p.validPass").show();
				$("p.pass").addClass("redDot");
				$("input#pass").focus();
				thisTrue = false;
			}			
			return thisTrue;
		});

		//info request
		
		$("form#infoReq").submit(function() {
			var thisTrue = true;
			if ($("input#name").val() != "") {
				$("p.validName").hide();
				$("p.name").removeClass("redDot");
			} else {
				$("p.validName").show();
				$("p.name").addClass("redDot");
				$("input#name").focus();
				thisTrue = false;
			}	
					 
			if ($("input#info").val() != "") {
				$("p.validInfo").hide();
				$("p.info").removeClass("redDot");
			} else {
				$("p.validInfo").show();
				$("p.info").addClass("redDot");
				$("input#info").focus();
				thisTrue = false;
			}
		  
			if ($("textarea#comment").val() != "") {
				$("p.validComm").hide();
				$("p.comment").removeClass("redDot");			
			} else {
				$("p.validComm").show();
				$("p.comment").addClass("redDot");
				$("textarea#comment").focus();
				thisTrue = false;
			}
			return thisTrue;
		});
		
		//map open
		$("a.mapOpen").live("click", function(e){
			e.preventDefault();
		    var thisId = $(this).attr("rel");
			$("#backgroundPopup").css({"opacity": "0.7"});
			$("#backgroundPopup").fadeIn("slow");	
			$("#mapOpen-"+thisId).css({"top": "50%"}).fadeIn("slow");
			$(".breadcrumbs, .boxOffice").css({"position":"static"});
		});
		
		//map close
		$("a.mapClose").live("click", function(e){
			e.preventDefault();
			$("div.mapPopup").fadeOut("slow").css({"top": "-10000px"});
			$("#backgroundPopup").fadeOut("slow");
			$(".breadcrumbs, .boxOffice").css({"position":"relative"});
		});

		//center breadcrumbs
		centerBred();
		
		$(".boxPerson table").each(function(){
			var aLink = $(this).find("td.email a").length;
			if(aLink <= 1){
				$(this).css({"height":"195px"});
			}
		});
		$("ul.footerBlock li:first-child").addClass("first")
	});
		
	
