window.addEvent("domready", function(){

          /* LANGUAGE pointer */

if($$("html").get("lang") == "en"){         // EN
  var lang = "en";
} else if($$("html").get("lang") == "de"){  // DE
  var lang = "de";
} else if($$("html").get("lang") == "ru"){  // RU
  var lang = "ru";
} else if($$("html").get("lang") == "pl"){  // PL
  var lang = "pl";
} else if($$("html").get("lang") == "sk"){  // SK
  var lang = "sk";
} else {                                    // CZ + Other
  var lang = "cz";
}



          /* rako_bg */

var rako_bg = new RakoBackground({
  bg_id : "rako_backgrounds",
  ratio : 0.625
}); 
          /* rako_showcase */
          
if($("product_detail")){
  var rako_showcase = new RakoShowcase({
    showcase_id : "s_wheeler",
    wheeler_id : "wheeler",
    heading_id : "showcase_heading",
    left_id : "arrow_left_2",
    right_id : "arrow_right_2",
    width: 987,
    item_width : 141,
    heading_transition : "elastic:out",
    heading_duration : "normal",
    delay: 4000,
    stop_wheeling : true,
    full_showcase : false,
    preset_product_index : true
  });
} else {
  var rako_showcase = new RakoShowcase({
    showcase_id : "s_wheeler",
    wheeler_id : "wheeler",
    heading_id : "showcase_heading",
    left_id : "arrow_left",
    right_id : "arrow_right",
    width: 987,
    item_width : 141,
    heading_transition : "elastic:out",
    heading_duration : "normal",
    delay: 4000,
    stop_wheeling : false
  }); 
}
          /* full_background */
 
var full_background = new  FullBackground({
  bg_class : "full_background"
});

          /* mediabox */

if($$('a[rel^="lightbox"]').length > 1){
  var mediabox_info = {
    "cz": {
      "control" : "Galerie lze přepínat šipkami na klávesnici"
    },
    "sk": { 
      "control" : "Galéria možno prepínať šípkami na klávesnici"
    },
    "de": { 
      "control" : "Galerien können Sie die Pfeile auf der Tastatur wechseln"
    },
    "ru": { 
      "control" : "Галереи вы можете переключить стрелки на клавиатуре"
    },
    "pl": { 
      "control" : "Galerie można przełączać strzałkami na klawiaturze"
    },
    "en": {
      "control" : "Galleries you can switch the arrows on the keyboard"
    }
  };
  var mediabox_gallery = $$('a[rel^="lightbox"]');
  mediabox_gallery.each(function(item, index){
		if(!item.hasClass("no_title")){
	  	item.title = item.title + "::" + mediabox_info[lang].control;
		}
  });
}

if($("textbox")){
  var text = new TextBox({
      opacity: .75,
      offset_top: 150
  }); 
}


          /* map */

if($("dealers_map")){
  $$("#dealers_map area").each(function(area){
    area.addEvent("mouseenter", function(){
      if(area.id == "map_stredocesky-kraj"){ 
        $("js_prague").setStyle("display", "block");
      } else {
        $("js_prague").setStyle("display", "none");
      }       	   
      $("js_hover").className = "map_hover " + area.id;
      $("js_hover").href = area.href;
    });
  });

  $("js_prague").addEvent("mouseenter", function(){
    $("js_hover").className = "map_hover map_hlavni-mesto-praha";
  })
  
  $("js_click").addEvent("mouseenter", function(){
      if($("js_click").hasClass("map_stredocesky-kraj")){ 
        $("js_prague").setStyle("display", "block");
      } else {
        $("js_prague").setStyle("display", "none");
      } 
  });
}

          /* FiveStar */
          
var setFiveStar = new Request.JSON({
  url: "/main.php",
  onSuccess: function(info){
    //alert(info);
  }
});        

var fivestar_info = {
  "cz": {
    error : "Již jste hlasoval."  
  },
  "sk": { 
    error : "Již jste hlasoval."  
  },
  "de": { 
    error : "You have already rated."  
  },
  "ru": { 
    error : "Вы уже голосовали."  
  },
  "pl": { 
    error : "Masz już oceniane."  
  },
  "en": {
    error : "You have already rated."  
  }
};
          
var five_star = new FiveStar({
    scoreClass : "score",
    hoverClass : "hover",   
    controlClass : "score_add",
    onSuccess : function(element){
    
      var star = element.index+1;
      var product_id =  element.item.getParent().getParent().id.replace("fivestar_","");
      
      setFiveStar.post({
        "action": "set_five_star",
        "module": "product",
        "star": star,
        "product_id": product_id      
      });
      
    },
    onError : function(element){
      alert(fivestar_info[lang].error);
    }
}); 

          /* form-validation */

var form_validation_info = {
  "cz": {
		error_message : "Musíte vyplnit všechny povinné údaje označené hvězdičkou !!",
		error_mail_message : "Musíte zadat E-mail ve správném tvaru !! [např.: jmeno@domena.cz]",
		error_number_message : "Musíte zadat celé číslo !!",
		error_phone_message : "Musíte zadat telefoní číslo ve správném tvaru !! [např.: +420 789 123 456]",
		error_zipcode_message : "Zadejte PSČ ve správném tvaru !! [např.: 512 03]",
		error_mail_or_phone_message : "Zadejte E-mail nebo telefoní číslo !!",
		error_agree_message : "Musíte souhlasit s podmínkami !!"
  },
  "sk": { 
		error_message : "Musíte vyplnit všechny povinné údaje označené hvězdičkou !!",
		error_mail_message : "Musíte zadat E-mail ve správném tvaru !! [např.: jmeno@domena.sk]",
		error_number_message : "Musíte zadat celé číslo !!",
		error_phone_message : "Musíte zadat telefoní číslo ve správném tvaru !! [např.: +421 789 123 456]",
		error_zipcode_message : "Zadejte PSČ ve správném tvaru !! [např.: 123 45]",
		error_mail_or_phone_message : "Zadejte E-mail nebo telefoní číslo !!",
		error_agree_message : "Musíte souhlasit s podmínkami !!"
  },
  "de": { 
		error_message : "You must fill in all required fields marked with asterisk !!",
		error_mail_message : "You must enter an e-mail in the correct form !! [např.: name@domain.de]",
		error_number_message : "You must enter a number !!",
		error_phone_message : "You must enter a phone number in the correct form !! [např.: +420 789 123 456]",
		error_zipcode_message : "Enter a zip code in the correct form !! [např.: 512 03]",
		error_mail_or_phone_message : "Enter the e-mail or phone number !!",
		error_agree_message : "You must agree to the terms !!" 
  },
  "ru": { 
		error_message : "Вы должны заполнить все необходимые поля, отмеченные звездочкой !!",
		error_mail_message : "Вы должны ввести адрес электронной почты в правильный путь! [Например: имя@области.ru]",
		error_number_message : "Вы должны ввести целое число !!",
		error_phone_message : "Вы должны ввести номер телефона в правильной форме !! [Например: +420 789 123 456]",
		error_zipcode_message : "Введите почтовый индекс в правильной форме !! [Например: 512 03]",
		error_mail_or_phone_message : "Введите адрес электронной почты или номер телефона !!",
		error_agree_message : "Вы должны согласиться с условиями !!"
  },
  "pl": { 
		error_message : "Musisz wypełnić wszystkie wymagane pola oznaczone gwiazdką !!",
		error_mail_message : "Musisz podać e-mail w odpowiedniej formie! [np.:. name@domain.pl]",
		error_number_message : "Należy wpisać numer !!",
		error_phone_message : "Należy wpisać numer telefonu w odpowiedniej formie !! [np.: +420 789 123 456]",
		error_zipcode_message : "Wpisz kod pocztowy w odpowiedniej formie !! [np.: 512 03]",
		error_mail_or_phone_message : "Wpisz e-mail lub numer telefonu !!",
		error_agree_message : "Musisz zgodzić się na warunki !!" 
  },
  "en": {
		error_message : "You must fill in all required fields marked with asterisk !!",
		error_mail_message : "You must enter an e-mail in the correct form !! [např.: name@domain.com]",
		error_number_message : "You must enter a number !!",
		error_phone_message : "You must enter a phone number in the correct form !! [např.: +420 789 123 456]",
		error_zipcode_message : "Enter a zip code in the correct form !! [např.: 512 03]",
		error_mail_or_phone_message : "Enter the e-mail or phone number !!",
		error_agree_message : "You must agree to the terms !!" 
  }
};

var form_validation = new FormValidation({
  parent_class_error : true,
	error_message : form_validation_info[lang].error_message,
	error_mail_message : form_validation_info[lang].error_mail_message,
	error_number_message : form_validation_info[lang].error_number_message,
	error_phone_message : form_validation_info[lang].error_phone_message,
	error_zipcode_message : form_validation_info[lang].error_zipcode_message,
	error_mail_or_phone_message : form_validation_info[lang].error_mail_or_phone_message,
	error_agree_message : form_validation_info[lang].error_agree_message 
});

          /* targetblanks */

$$("a.targetblank").addEvent("click", function(event){
  if(typeof window.open(this.href)=="object"){
    event.stop();
  }
});

          /* hint -> LB Object color types */

if($$(".color_types_more").length > 0){
  var color_type_hint = new Hint({
    css_selector : ".color_types_more",
    horizontal_offset : 0,
    vertical_offset : 12,
    arrow_position : "top",
    hint_position : "bottom_left",
    width: 70
  }); 
}

          /* hint -> Rako product price */

if($$(".price_hint").length > 0){
  var price_hint = new Hint({
    css_selector : ".price_hint",
    horizontal_offset : 15,
    vertical_offset : -8,
    arrow_position : "left",
    hint_position : "top_right",
    width: 200,
    mouseover : true
  }); 
}


          /* hint -> Rako send to friend */

if($("send_to_friend")){
  var send_to_friend = new Hint({
    css_selector : "#send_to_friend",
    horizontal_offset : -701,
    vertical_offset : -294,
    arrow_position : "bottom_right",
    hint_position : "bottom_right",
    width: 645
  }); 
}

if($("page_url")){
  $("page_url").value = window.location.href;
}

if($("page_url_link")){
  $("page_url_link").href = window.location.href;
  $("page_url_link").set("html", window.location.href);
}

          /* product_popup */

if($$(".product_popup").length > 0){
  var product_popup = new RakoPopUp({
    product_class : "product_popup",
    product_info_class : "product_info",
    popup_id : "product_popup",
    top_offset : -65,
    left_offset : -15
  });
}

          /* product_choice */

var product_choice_default_top = {
  "cz": {
		defalut_top : 183
  },
  "sk": {
		defalut_top : 193
  },
  "de": {
		defalut_top : 223
  },
  "ru": {
		defalut_top : 243
  },
  "pl": {
		defalut_top : 243
  },
  "en": {
		defalut_top : 183
  }
};

if($("product_choice")){
  var product_choice = new ProductChoice({
    products_id : "product_choice",
    product_class : "info",
    defalut_top : product_choice_default_top[lang].defalut_top,
    new_top : 0
  });
}

          /* hp_filter */
          
if($("hp_filter")){
  
  if($("oc_switch")){
    var hp_filter_height = $("hp_filter").getHeight();
    var hp_hidden_filter_height = 31;
    $("hp_filter").setStyle("overflow", "hidden");    
    $("oc_switch").addEvent("click", function(){
      if($("oc_switch").hasClass("act")){
        $("hp_filter").tween("height", hp_hidden_filter_height, hp_filter_height);
      } else {
        $("hp_filter").tween("height", hp_filter_height, hp_hidden_filter_height);
      }
      $("oc_switch").toggleClass("act");      
    });
  }
  /* 1024 width fix */
  if(window.getWidth() < 1101){
    $("hp_filter").setStyle("right", 60);
  }
}

          /* footer layers */

if($("wishlist_layer")){
  var wishlist_layer = new FooterLayer({
    layer_id : "wishlist_layer",
    fire_id : "wishlist_layer_fire",
    width : 180,
    height : 68,
    left_offset : -2,
    onShow : function(){
			if($("wishlist_layer").getElement("table").hasClass("act")){
	      var wishlist_table = $("wishlist_layer").getElement("table");
	      var wishlist_table_content = $("footer_wishlist_content");
	      var wishlist_width = wishlist_table.getWidth() + wishlist_table_content.getStyle("padding-left").toInt() + wishlist_table_content.getStyle("padding-right").toInt();
	      var wishlist_height = wishlist_table.getHeight() + wishlist_table_content.getStyle("padding-top").toInt() + wishlist_table_content.getStyle("padding-bottom").toInt();
	      wishlist_height = wishlist_height + 27;
	      if(wishlist_width < 300){
        	wishlist_width = 300;
      	}
      	$("wishlist_layer").setStyle("width", wishlist_width);
      	$("wishlist_layer").setStyle("height", wishlist_height);
			}
		}
  });
  
  /* width && height correction */  
  $("wishlist_layer_fire").addEvent("click", function(){
    if($("wishlist_layer").getElement("table").hasClass("act")){
      var wishlist_table = $("wishlist_layer").getElement("table");
      var wishlist_table_content = $("footer_wishlist_content");
      var wishlist_width = wishlist_table.getWidth() + wishlist_table_content.getStyle("padding-left").toInt() + wishlist_table_content.getStyle("padding-right").toInt();
      var wishlist_height = wishlist_table.getHeight() + wishlist_table_content.getStyle("padding-top").toInt() + wishlist_table_content.getStyle("padding-bottom").toInt();
      
      // add bottom control height + other correction
      /*
      if(Browser.ie){
        wishlist_height = wishlist_height + 37;
      } else {
        wishlist_height = wishlist_height + 27;
      }
      */      
      
      wishlist_height = wishlist_height + 27;
      
      // if width < text control width
      if(wishlist_width < 270){
        wishlist_width = 270;
      }
      
      $("wishlist_layer").setStyle("width", wishlist_width);
      $("wishlist_layer").setStyle("height", wishlist_height);
    }
  });
}

					/* add_to_wishlist - product */

if($("add_to_wishlist")){
	var addToWishlist = new Request({
	  url: $("add_to_wishlist").get("action"),
	  onSuccess: function(table_content){
			$("wishlist_layer").getElement("table").addClass("act")
			$("empty_wishlist").removeClass("act");
			$("footer_wishlist_control").addClass("act");
			
	    $("wishlist_layer").getElement("table").set("html", table_content);
	    $("wishlist_layer").removeClass("act");
	    $("wishlist_layer_fire").fireEvent("click", 1, 300);
	  }
	}); 

	$("add_to_wishlist").addEvent("submit", function(){
		addToWishlist.post({
			"action": "add_to_list",
			"product_id": $("w_product_id").value,
			"set_id": $("w_set_id").value,
			"lb": $("w_lb").value,
			"f_ks": $("f_ks").value,
			"ajax": 1
		});
		return false;
	});
}

					/* add_to_wishlist - serie */

if($("add_set_to_wishlist")){
	var addSetToWishlist = new Request({
	  url: "/main.php",
	  onSuccess: function(table_content){
			$("wishlist_layer").getElement("table").addClass("act")
			$("empty_wishlist").removeClass("act");
			$("footer_wishlist_control").addClass("act");
			
	    $("wishlist_layer").getElement("table").set("html", table_content);
	    $("wishlist_layer").removeClass("act");
	    $("wishlist_layer_fire").fireEvent("click", 1, 300);
	  }
	}); 
	
	$("add_set_to_wishlist").addEvent("submit", function(){
		addSetToWishlist.post({
			"module": "shopping_list",
			"action": "add_to_list",
			"set_id": $("w_set_id").value,
			"lb": $("w_lb").value,
			"ajax": 1
		});
		return false;
	});
}

          /* gmap */

if($("gmap")){
  if(typeof(gmap_points_info) != undefined){
    var gmap = new GMap({
      id : "gmap",
      center_lat_correction : 0.002,
      gmap_info : gmap_points_info,
      lb_object : lb_object
    });
  }
}


          /* gmap - wysiwyg */

if($("gmapbox")){
  if(typeof(gmap_points_info) != undefined){
    var gmap = new GMap({
      id : "gmapbox",
      map_type : "wysiwyg_map",
			center_lat_correction : 0.002,
      gmap_info : gmap_points_info,
      lb_object : lb_object
    });
  }
}


        /* gmap - partner */

if($("saleroom_gmap")){
  if(typeof(gmap_points_info) != undefined){
    var gmap = new GMap({
      id : "saleroom_gmap",
      map_type : "saleroom",
      gmap_info : gmap_points_info,
      lb_object : lb_object
    });
  }
}

        /* gmap - partners_list */

if($("partners_gmap")){
  if(typeof(gmap_points_info) != undefined){
    var gmap = new GMap({
      id : "partners_gmap",
      map_type : "partners_list",
      gmap_info : gmap_points_info,
      lb_object : lb_object
    });
  }
}

        /* gmap - abroad */

if($("tab_abroad_map")){
	
	var abroad_map_info = {
		"center":{"lat":39.533729,"lng":-5.169922},"zoom":2,"points":[
			{"lat":45.42481,"lng":-75.657526,"title":"Bohemia Ceramics Inc, Ottawa, Kanada"},
			{"lat":51.80865,"lng":1.166244,"title":"SK CERAMICS, Clacton-on-sea, Velká Británie"},
			{"lat":46.227638,"lng":2.213749,"title":"LASSELSBERGER, s.r.o., Franco Cassavia, Francie"},
			{"lat":55.754682,"lng":37.608963,"title":"????????????????? ?/? «?????????????» station Urshak, Rusko"},
			{"lat":60.268107,"lng":24.979221,"title":"ABL Finland OY, Helsinki, Finsko"},
			{"lat":59.359577,"lng":17.978985,"title":"Centro Kakel & Klinker AB, SOLNA, Švédsko"},
			{"lat":52.499444,"lng":5.0675,"title":"LASSELSBERGER, s.r.o., Volendam, Norsko"},
			{"lat":55.521763,"lng":8.357186,"title":"COLOUR CERAMICA A/S, Toftevaenget 2, Dánsko"},
			{"lat":50.503887,"lng":4.469936,"title":"LASSELSBERGER, s.r.o., Belgie"},
			{"lat":48.132585,"lng":11.540108,"title":"LASSELSBERGER, s.r.o., Německo"},
			{"lat":47.368129,"lng":8.552341,"title":"LASSELSBERGER, s.r.o., Švýcarsko"},
			{"lat":48.21671,"lng":15.247993,"title":"LASSELSBERGER, s.r.o., Rakousko"},
			{"lat":44.547818,"lng":10.885971,"title":"LASSELSBERGER, s.r.o., Itálie"},
			{"lat":46.245801,"lng":14.374859,"title":"LASSELSBERGER, s.r.o., Slovinsko"},
			{"lat":45.82188,"lng":16.061647,"title":"LASSELSBERGER, s.r.o., Chorvatsko"},
			{"lat":37.98534,"lng":23.735275,"title":"LASSELSBERGER, s.r.o., Řecko"},
			{"lat":42.693429,"lng":23.33436,"title":"LASSELSBERGER, s.r.o., Bulharsko"},
			{"lat":44.866333,"lng":20.659103,"title":"LASSELSBERGER, s.r.o., Srbsko"},
			{"lat":46.672056,"lng":16.798439,"title":"LASSELSBERGER, s.r.o., Maďarsko"},
			{"lat":48.454382,"lng":18.903394,"title":"LASSELSBERGER, s.r.o., Slovensko"},
			{"lat":50.25519,"lng":19.036045,"title":"LASSELSBERGER, s.r.o., Polsko"},
			{"lat":50.457504,"lng":30.541992,"title":"LASSELSBERGER, s.r.o., Ukrajina"},
			{"lat":53.906361,"lng":27.456894,"title":"LASSELSBERGER, s.r.o., Bělorusko"},
			{"lat":54.897638,"lng":23.892345,"title":"LASSELSBERGER, s.r.o., Litva"},
			{"lat":56.963591,"lng":24.165201,"title":"LASSELSBERGER, s.r.o., Lotyšsko"},
			{"lat":59.442697,"lng":24.915361,"title":"LASSELSBERGER, s.r.o., Estonsko"}
		]};

  var gmap = new GMap({
    id : "content_gmap",
    map_type : "abroad_map",
    gmap_info : abroad_map_info,
    lb_object : lb_object
  });
}

if($("partners_map_showfull")){
	$("partners_map_showfull").addEvent("click", function(){
		$("partners_map").toggleClass("bigger");
		gmap.refreshMap();
		return false;
	});
}

          /* map_filter */
          
if($("map_filter")){
  
  if($("oc_switch")){
    var hp_filter_height = $("map_filter").getHeight();
    var hp_hidden_filter_height = 31;
    $("map_filter").setStyle("overflow", "hidden");    
    $("oc_switch").addEvent("click", function(){
      if($("oc_switch").hasClass("act")){
        $("map_filter").tween("height", hp_hidden_filter_height, hp_filter_height);
      } else {
        $("map_filter").tween("height", hp_filter_height, hp_hidden_filter_height);
      }
      $("oc_switch").toggleClass("act");      
    });
  }
  
  if($("f_map_filter_region")){
  
    var map_info = {
      "cz": {
        0: {
          name : "prodejen"
        },
        1: {
          name : "prodejna"
        },
        2: {
          name : "prodejny"
        },
        10: {
          name : "prodejen"
        }
      },
      "sk": { 
        0: {
          name : "prodejen"
        },
        1: {
          name : "prodejna"
        },
        2: {
          name : "prodejny"
        },
        10: {
          name : "prodejen"
        }
      },
      "de": { 
        0: {
          name : "stores"
        },
        1: {
          name : "store"
        },
        2: {
          name : "stores"
        },
        10: {
          name : "stores"
        }
      },
      "ru": { 
        0: {
          name : "магазины"
        },
        1: {
          name : "магазин"
        },
        2: {
          name : "Магазины"
        },
        10: {
          name : "магазины"
        }
      },
      "pl": { 
        0: {
          name : "stores"
        },
        1: {
          name : "store"
        },
        2: {
          name : "stores"
        },
        10: {
          name : "stores"
        }
      },
      "en": {
        0: {
          name : "stores"
        },
        1: {
          name : "store"
        },
        2: {
          name : "stores"
        },
        10: {
          name : "stores"
        }
      }
    };
  
  
    var getMapFilterCount = new Request.JSON({
      url: "/main.php",
      onSuccess: function(info){
        if(info.count){
          if(info.count == 0){
            var info_text = map_info[lang][0].name;
          } else if(info.count == 1){
            var info_text = map_info[lang][1].name;
          } else if(info.count > 1 && info.count < 5){
            var info_text = map_info[lang][2].name;
          } else if(info.count > 4){
            var info_text = map_info[lang][10].name;
          } else {
            var info_text = map_info[lang][10].name;
          }
          $("ajax_count_text").set("html", info_text);
          $("ajax_count").set("html", info.count);
          $("ajax_result").setStyle("display", "block");  
        } else {
          $("ajax_result").setStyle("display", "none");
        }
        
      }
    });
    var partner_state_id = $("partner_state_id").value;
    $("f_map_filter_region").addEvent("change", function(){
      getMapFilterCount.get({
        "module": "partner",
        "action": "map_filter_count",
        "partner_state_id": partner_state_id,
        "f_map_filter_place": $("f_map_filter_place").value, 
        "f_map_filter_region": this.value
      });
      this.blur();
    });
  }
  
  if($("f_map_filter_place")){
    $("f_map_filter_place").addEvent("keyup", function(event){
      if($("f_map_filter_place").value.length > 2){
        getMapFilterCount.get({
          "module": "partner",
          "action": "map_filter_count",
          "partner_state_id": partner_state_id,
          "f_map_filter_place": this.value, 
          "f_map_filter_region": $("f_map_filter_region").value
        });        
      }
    });
  }
  
}

          /* remove input text */

if($$(".remove_text").length > 0){
  $$(".remove_text").addEvent("click", function(){
    if(this.getPrevious()){
      this.getPrevious().value = ""; 
    }
  });
}

          /* scrollbars */

var getInspirationCount = new Request.JSON({
  url: "/main.php",
  onSuccess: function(info){
    $("ajax_count").set("html", info.count);
    if(info.count == 0){
      var info_count_text = insipration_count_info[lang][0].name;
    } else if(info.count == 1){
      var info_count_text = insipration_count_info[lang][1].name;
    } else if(info.count > 1 && info.count < 5){
      var info_count_text = insipration_count_info[lang][2].name;
    } else if(info.count > 4){
      var info_count_text = insipration_count_info[lang][10].name;
    } else {
      var info_count_text = insipration_count_info[lang][10].name;
    }
    $("ajax_count_text").set("html", info_count_text);
  }
});

var insipration_count_info = {
  "cz": {
    0: {
      name : "inspirací"
    },
    1: {
      name : "inspirace"
    },
    2: {
      name : "inspirace"
    },
    10: {
      name : "inspirací"
    }
  },
  "sk": { 
    0: {
      name : "inspirací"
    },
    1: {
      name : "inspirace"
    },
    2: {
      name : "inspirace"
    },
    10: {
      name : "inspirací"
    }
  },
  "de": { 
    0: {
      name : "inspirations"
    },
    1: {
      name : "inspiration"
    },
    2: {
      name : "inspirations"
    },
    10: {
      name : "inspirations"
    }
  },
  "ru": { 
    0: {
      name : "вдохновение"
    },
    1: {
      name : "вдохновение"
    },
    2: {
      name : "вдохновение"
    },
    10: {
      name : "вдохновение"
    }
  },
  "pl": { 
    0: {
      name : "inspirations"
    },
    1: {
      name : "inspiration"
    },
    2: {
      name : "inspirations"
    },
    10: {
      name : "inspirations"
    }
  },
  "en": {
    0: {
      name : "inspirations"
    },
    1: {
      name : "inspiration"
    },
    2: {
      name : "inspirations"
    },
    10: {
      name : "inspirations"
    }
  }
};

if($("use_scroll")){
  
  var use_info = {
    "cz": {
      0 : {
        "name" : "Koupelny",
        "rewrite" : "inspirace/koupelna",
        "id" : 1
      },
      1 : {
        "name" : "Kuchyně",
        "rewrite" : "inspirace/kuchyne",
        "id" : 2
      },
      2 : {
        "name" : "Podlahy",
        "rewrite" : "inspirace/podlaha",
        "id" : 3
      },
      3 : {
        "name" : "Exteriér",
        "rewrite" : "inspirace/exterier",
        "id" : 4
      },
      4 : {
        "name" : "Technické zázemí",
        "rewrite" : "inspirace/technicke-zazemi",
        "id" : 5
      }
    },
    "sk": { 
      0 : {
        "name" : "Kúpeľne",
        "rewrite" : "sk/inspiracie/koupelne",
        "id" : 1
      },
      1 : {
        "name" : "Kuchyne",
        "rewrite" : "sk/inspiracie/kuchyne",
        "id" : 2
      },
      2 : {
        "name" : "Podlahy",
        "rewrite" : "sk/inspiracie/podlaha",
        "id" : 3
      },
      3 : {
        "name" : "Exteriér",
        "rewrite" : "sk/inspiracie/exterier",
        "id" : 4
      },
      4 : {
        "name" : "Technické zázemie",
        "rewrite" : "sk/inspiracie/technicke-zazemie",
        "id" : 5
      }
    },
    "de": { 
      0 : {
        "name" : "Bad",
        "rewrite" : "de/inspiration/bad",
        "id" : 1
      },
      1 : {
        "name" : "Küche",
        "rewrite" : "de/inspiration/kuche",
        "id" : 2
      },
      2 : {
        "name" : "Fußboden",
        "rewrite" : "de/inspiration/fussboden",
        "id" : 3
      },
      3 : {
        "name" : "Outside",
        "rewrite" : "en/inspiration/outside",
        "id" : 4
      },
      4 : {
        "name" : "Technical",
        "rewrite" : "en/inspiration/technical",
        "id" : 5
      }
    },
    "ru": { 
      0 : {
        "name" : "Ванные комнаты",
        "rewrite" : "ru/vdokhnovenie/koupelny",
        "id" : 1
      },
      1 : {
        "name" : "Кухня",
        "rewrite" : "ru/vdokhnovenie/kuchyne",
        "id" : 2
      },
      2 : {
        "name" : "Полы",
        "rewrite" : "ru/vdokhnovenie/podlaha",
        "id" : 3
      },
      3 : {
        "name" : "Внешний",
        "rewrite" : "ru/vdokhnovenie/exterier",
        "id" : 4
      },
      4 : {
        "name" : "Техническая поддержка",
        "rewrite" : "ru/vdokhnovenie/technicke-zazemi",
        "id" : 5
      }
    },
    "pl": { /* pl-lang*/
      0 : {
        "name" : "Łazienka",
        "rewrite" : "pl/inspiracje/lazienka",
        "id" : 1
      },
      1 : {
        "name" : "Kuchnia",
        "rewrite" : "pl/inspiracje/kuchnia",
        "id" : 2
      },
      2 : {
        "name" : "Podłoga",
        "rewrite" : "pl/inspiracje/podloga",
        "id" : 3
      },
      3 : {
        "name" : "Poza",
        "rewrite" : "pl/inspiracje/outside",
        "id" : 4
      },
      4 : {
        "name" : "Techniczne",
        "rewrite" : "pl/inspiracje/technical",
        "id" : 5
      }
    },
    "en": {
      0 : {
        "name" : "Bathroom",
        "rewrite" : "en/inspiration/bathroom",
        "id" : 1
      },
      1 : {
        "name" : "Kitchen",
        "rewrite" : "en/inspiration/kitchen",
        "id" : 2
      },
      2 : {
        "name" : "Floor",
        "rewrite" : "en/inspiration/floor",
        "id" : 3
      },
      3 : {
        "name" : "Outside",
        "rewrite" : "en/inspiration/outside",
        "id" : 4
      },
      4 : {
        "name" : "Technical",
        "rewrite" : "en/inspiration/technical",
        "id" : 5
      }
    }
  };
  
  var use_scroll = new Slider($("use_scroll"), $("use_scroll_bar"), {
          steps: 218,
          mode: "horizontal",
          wheel: "true",
          onChange: function(step){
            // form info set
            if(step <= 73){
              var step_index = 0;
            } else if(step > 73 && step <= 146){
              var step_index = 1;
            } else if(step > 146){
              var step_index = 2;
            } else {
              var step_index = 2;
            }
            
            if($("f_use").value != use_info[lang][step_index].id){
              $("use_value").set("html", use_info[lang][step_index].name);
              $("f_use").value = use_info[lang][step_index].id;
              $("hp_inspiration_filter").set("action", "/" + use_info[lang][step_index].rewrite + ".html");
              // ajax
              getInspirationCount.get({
                "module": "inspiration",
                "action": "inspiration_count",
                "f_search_use": $("f_use").value,
                "f_search_price": $("f_price").value, 
                "f_search_price_prep": $("f_price_prep").value
              });               
            }

            // step cover correction
            if(step < 109){
              step = step + 2;
            } else {
              step = step - 2;
            }
            $("use_scroll_cover").setStyle("width", step);
          }            
  }).set(30);
}

if($("price_scroll")){

  var preposition = {
    "cz": {
      0 : {
        name : "Do"
      },
      1 : {
        name : "Bez omezení"
      }
    },
    "sk": { 
      0 : {
        name : "Do"
      },
      1 : {
        name : "Bez omezení"
      }
    },
    "de": { 
      0 : {
        name : "To"
      },
      1 : {
        name : "Unlimited"
      }
    },
    "ru": { 
      0 : {
        name : "До"
      },
      1 : {
        name : "Неограниченный"
      }
    },
    "pl": { 
      0 : {
        name : "Aby"
      },
      1 : {
        name : "Nieograniczony"
      }
    },
    "en": {
      0 : {
        name : "To"
      },
      1 : {
        name : "Unlimited"
      }
    }
  };

  var price_info = {
    "cz": {
      0 : {
        "price" : 200,
        "value" : 200
      },
      1 : {
        "price" : 300,
        "value" : 300
      },
      2 : {
        "price" : 400,
        "value" : 400
      },
      3 : {
        "price" : 500,
        "value" : 500
      },
      4 : {
        "price" : 600,
        "value" : 600
      },
      5 : {
        "price" : 0,
        "value" : 0
      }
    },
    "sk": { 
      0 : {
        "price" : 8,
        "value" : 200
      },
      1 : {
        "price" : 12,
        "value" : 300
      },
      2 : {
        "price" : 17,
        "value" : 400
      },
      3 : {
        "price" : 21,
        "value" : 500
      },
      4 : {
        "price" : 25,
        "value" : 600
      },
      5 : {
        "price" : 0,
        "value" : 0
      }
    },
    "de": { 
      0 : {
        "price" : 8,
        "value" : 200
      },
      1 : {
        "price" : 12,
        "value" : 300
      },
      2 : {
        "price" : 17,
        "value" : 400
      },
      3 : {
        "price" : 21,
        "value" : 500
      },
      4 : {
        "price" : 25,
        "value" : 600
      },
      5 : {
        "price" : 0,
        "value" : 0
      }
    },
    "ru": { 
      0 : {
        "price" : 8,
        "value" : 200
      },
      1 : {
        "price" : 12,
        "value" : 300
      },
      2 : {
        "price" : 17,
        "value" : 400
      },
      3 : {
        "price" : 21,
        "value" : 500
      },
      4 : {
        "price" : 25,
        "value" : 600
      },
      5 : {
        "price" : 0,
        "value" : 0
      }
    },
    "pl": { 
      0 : {
        "price" : 8,
        "value" : 200
      },
      1 : {
        "price" : 12,
        "value" : 300
      },
      2 : {
        "price" : 17,
        "value" : 400
      },
      3 : {
        "price" : 21,
        "value" : 500
      },
      4 : {
        "price" : 25,
        "value" : 600
      },
      5 : {
        "price" : 0,
        "value" : 0
      }
    },
    "en": {
      0 : {
        "price" : 8,
        "value" : 200
      },
      1 : {
        "price" : 12,
        "value" : 300
      },
      2 : {
        "price" : 17,
        "value" : 400
      },
      3 : {
        "price" : 21,
        "value" : 500
      },
      4 : {
        "price" : 25,
        "value" : 600
      },
      5 : {
        "price" : 0,
        "value" : 0
      }
    }
  };

  var price_scroll = new Slider($("price_scroll"), $("price_scroll_bar"), {
          steps: 218,
          mode: "horizontal",
          wheel: "true",
          onChange: function(step){
            // form info set
            if(step <= 36){
              var step_index = 0;
              var prep_index = 0;
            } else if(step > 36 && step <= 72){
              var step_index = 1;
              var prep_index = 0;
            } else if(step > 72 && step <= 108){
              var step_index = 2;
              var prep_index = 0;
            } else if(step > 108 && step <= 144){
              var step_index = 3;
              var prep_index = 0;
            } else if(step > 144 && step <= 180){
              var step_index = 4;
              var prep_index = 0;
            } else if(step > 180){
              var step_index = 5;
              var prep_index = 1;
            } else {
              var step_index = 5;
              var prep_index = 1;
            }
            
            if($("f_price").value != price_info[lang][step_index].value){
              $("f_price").value = price_info[lang][step_index].value;
              if(price_info[lang][step_index].price == 0){
                $("price_value").set("html", "");  
              } else {
                $("price_value").set("html", price_info[lang][step_index].price);
              }
              $("price_prep").set("html", preposition[lang][prep_index].name);
              $("f_price_prep").value = prep_index;
              //ajax
              if(!$("f_price_temp")){
	              getInspirationCount.get({
	                "module": "inspiration",
	                "action": "inspiration_count",
	                "f_search_use": $("f_use").value,
	                "f_search_price": $("f_price").value, 
	                "f_search_price_prep": $("f_price_prep").value
	              });
	            } else {
	            	$$("#inspiration_use li a").each(function(item, index){
	            		var regex_link_with_price = /^http:\/\/[^\/]+\/([\/a-z]*)-([a-z]*)-([0-9]*)\.html$/;
	            		var regex_link_without_price = /^http:\/\/[^\/]+\/([\/a-z]*)\.html$/;
	            		if(index > 0){
	            			if(regex_link_with_price.test(item.href)){
											var temp_info = item.href.match(regex_link_with_price);											
											if($("f_price").value == 0){
												item.href = "/" + temp_info[1] + ".html";
											} else {
												item.href = "/" + temp_info[1] + "-" + temp_info[2]  + "-" + $("f_price").value + ".html";
											} 
										} else if(regex_link_without_price.test(item.href)) {
											var temp_info = item.href.match(regex_link_without_price);
											if($("f_price").value == 0){
												item.href = "/" + temp_info[1] + ".html";
											} else {
												item.href = "/" + temp_info[1] + "-do-" + $("f_price").value + ".html";
											}
										}
									}
								});
							}
            }
            
            // step cover correction
            if(step < 109){
              step = step + 2;
            } else {
              step = step - 2;
            }
            $("price_scroll_cover").setStyle("width", step);             
            
          }            
  }).set(170);
  
  if($("f_price_temp")){
  	var price_convert = {
			200: {
				"slider_width" : 18 
			},
			300: {
				"slider_width" : 54
			},
			400: {
				"slider_width" : 90
			},
			500: {
				"slider_width" : 126
			},
			600: {
				"slider_width" : 162
			},
			0: {
				"slider_width" : 198
			}
			
		};
		//alert($("f_price_temp").value);
  	price_scroll.set(price_convert[$("f_price_temp").value].slider_width);
	}
}

          /* variation_tabz */

if($("variation_tabz")){

  if(!$("variation_tabz").hasClass("lb_object")){ 
    if(window.location.hash){
      var location_hash = window.location.hash;
      location_hash = "variation_" + location_hash.replace("#!", "");
      if($(location_hash)){
        $$(".variation_item").setStyle("display", "none");
        $(location_hash + "_content").setStyle("display", "block");
        $$("#variation_tabz li").removeClass("act");      
        $(location_hash).addClass("act");
      }
    } 
  
    $("variation_tabz").getElements("li").each(function(tabz){
      tabz.addEvent("click", function(){
        $$(".variation_item").setStyle("display", "none");
        $(this.id + "_content").setStyle("display", "block");
        $$("#variation_tabz li").removeClass("act");      
        this.addClass("act");
        window.location.hash = "!" + this.id.replace("variation_","");
      });
    });
  }
}

          /* product_tab */

if($("product_tab")){
  $("product_tab").getElements("li").each(function(tab){
    tab.addEvent("click", function(){
      $$(".product_tab_content").removeClass("act");
      $(this.id + "_content").addClass("act");
      $$("#product_tab li").removeClass("act");      
      this.addClass("act");
    });
  });
}

          /* JOBS form */

if($("job_url")){
  $("job_url").value = window.location.href;
}

          /* catalogue order */

if($("catalogue_order")){
  
  $("f_type_1").addEvent("change", function(){
    if(this.checked == true){
      $("company_address").setStyle("display", "none"); 
      $("company_address").getElements(".input").set("value", "");
      $("company_address").getElements(".input").removeClass("check-is-blank");
      $("company_address").getElements(".validate_error").removeClass("validate_error");
      $("f_copy_address").set("checked", "");
      $("company_different_address").setStyle("display", "block");
    }
  });
  
  $("f_type_2").addEvent("change", function(){
    if(this.checked == true){
      $("company_address").setStyle("display", "block");
      $("company_address").getElements(".input").addClass("check-is-blank");
    }
  });

  $("f_copy_address").addEvent("change", function(){
    if(this.checked == true){
      $("company_different_address").setStyle("display", "none");
      $("company_different_address").getElements(".input").set("value", "");
      $("company_different_address").getElements(".input").removeClass("check-is-blank");
      $("company_different_address").getElements(".validate_error").removeClass("validate_error");
    } else {
      $("company_different_address").setStyle("display", "block");
      $("company_different_address").getElements(".input").addClass("check-is-blank");
    }
  });
  
}

					/* Taby */

if($("tab")){
	
	$$("#tab li").addEvent("click", function(){
		$$(".tab_content").removeClass("act");
		$$("#tab li").removeClass("act");
		$(this.id).addClass("act");
		$(this.id + "_content").addClass("act");
		
		if($("content_gmap")){
			gmap.refreshMap();
		}
			
	});
}

          /* Cufon apply */
if (lang == "ru") {
  
  if (Cufon && Cufon.replace) {
    //Cufon.replace('#crumb, .wysiwyg h1, .wysiwyg h2, h1.wsw, h2.wsw, #detail_rcol .price, #inspiration_list .item h2, #lb_object_products #lb_object_products_lcol h1, #product_choice .item .header .info h2, #product_choice_other h2, #partners_count_result, #lb_object_product_h1', {hover: true});
    Cufon.replace('#showcase_heading h2', {
      textShadow: '#333 1px 1px',
	hover: {
	  textShadow: '#333 1px 1px'
        }
    });
  }

} else {
  
  if (Cufon && Cufon.replace) {
    Cufon.replace('#crumb, .wysiwyg h1, .wysiwyg h2, h1.wsw, h2.wsw, #inspiration_list .item h2, #lb_object_products #lb_object_products_lcol h1, #product_choice .item .header .info h2, #product_choice_other h2, #partners_count_result, #lb_object_product_h1', {hover: true});
    Cufon.replace('#showcase_heading h2', {
      textShadow: '#333 1px 1px',
	hover: {
	  textShadow: '#333 1px 1px'
        }
    });
  }

}

          /* IE6 bug fixing */

if(Browser.Engine.trident && Browser.Engine.version == 4){

  /* position:fixed bug */
  window.addEvent("scroll", function(){
    $("footer").setStyle("top", window.getScrollTop() + window.getHeight() - 40);
    if($("showcase")){
      $("showcase").setStyle("top", window.getScrollTop() + window.getHeight() - 154);
    }
    if($("visited_products")){
      $("visited_products").setStyle("top", window.getScrollTop() + window.getHeight() - 72);
    }
  });

}

          /* KUBURE Antispam */

if($$(".antispam")){
var r=/u\s(.+)\s.+\s(.+)\sa/i;
  $$(".antispam").each(function(el){
    var n=r.exec(el.getElement("label").innerHTML);
    el.getElement("input").value=readNumber(n[1])+readNumber(n[2]);
    el.setStyle("display","none");
  });
}


				/* popup */

if ($("wall")){
  $("wall").setStyle("width", window.getScrollWidth());
  $("wall").setStyle("height", window.getScrollHeight());
  $("close2").addEvent("click", function(){
  	$("pop2").setStyle("display", "none");
  	$("wall").setStyle("display", "none");
  });
}
/*
if ($("wall")){
  $("wall").setStyle("width", window.getScrollWidth());
  $("wall").setStyle("height", window.getScrollHeight());
  $("close").addEvent("click", function(){
  	$("pop").setStyle("display", "none");
  	$("wall").setStyle("display", "none");
  });
}
*/


});

/* Form-Antispam readNumber function */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('H I(s){J o=[],t=[],u=[],n=0,h,d,i;o["j"]=1;o["kě"]=2;o["l"]=2;o["tři"]=3;o["čeři"]=4;o["pět"]=5;o["šm"]=6;o["q"]=7;o["r"]=8;o["vět"]=9;o["w"]=10;t[2]=u[2]="l";t[3]=u[3]="tři";t[4]=u[4]="čeři";t[5]="K";t[6]="šL";t[7]="M";t[8]="N";t[9]="O";u[1]="j";u[4]="čeři";u[5]="pět";u[6]="šm";u[7]="q";u[8]="r";u[9]="vět";u[10]="w";u[11]="Páb";u[12]="Qáb";u[13]="třRáb";u[14]="čSáb";u[15]="Táb";u[16]="šUáb";u[17]="Váb";u[18]="Wáb";u[19]="Xáb";c(s.a("x")>-1||s.a("yě")>-1||s.a("Y")>-1||s.a("z")>-1){c(s.a("x")>-1){n+=A}f c(s.a("yě")>-1){n+=Z}f c(s.a("třB")>-1){n+=1a}f c(s.a("čeřB")>-1){n+=1b}f{h=s.C(0,s.a("z"));c(o[h]){n+=o[h]*A}}}c(s.a("sát")>-1||s.a("D")>-1){d=(s.a("sát")>-1)?s.a("sát"):s.a("D");E(i=2;i<10;i++){c(s.C(d-t[i].g,d)==t[i]){n+=i*10;F}}}E(i=1;i<1c;i++){c(s.G(u[i])>-1&&s.G(u[i])==s.g-u[i].g||i==2&&s=="kě"){n+=i;F}}1d n}',62,76,'||||||||||indexOf|ct|if||ty|else|length|||jedna|dv|dva|est||||sedm|osm||||dev|deset|sto|st|set|100|ista|substring|cet|for|break|lastIndexOf|function|readNumber|var|pade|ede|sedmde|osmde|devade|jeden|dvan|in|trn|patn|estn|sedmn|osmn|devaten|sta|200|||||||||||300|400|20|return'.split('|'),0,{}));
