window.addEvent("domready", function(){

         /* lang */ 

if($$("html").get("lang") == "en"){
  var search_value = "Searching";
} else {
  var search_value = "Vyhledávání";
}

          /* form-validation */
          
if($$("form.form-validation").length > 0){
	var form_validation = new FormValidation({
	  parent_class_error : true
	});
}

          /* targetblanks */

$$("a.targetblank").addEvent("click", function(event){
  if(typeof window.open(this.href)=="object"){
    event.stop();
  }
});

   
          /* search text */

if($("search")){
  if($("search").value == ""){
    $("search").value = search_value;
  }
  $("search")
    .addEvent("click", function(){
      if($("search").value == search_value){
        $("search").value = "";
      }    
    })
    .addEvent("blur", function(){
      if($("search").value == ""){
        $("search").value = search_value;
      }    
  });  
}

          /* navi */

var navi = new PBNavi({
	width : {
		0 : {
			left : 0,
			right : 527
		},
		1 : {
			left : 59,
			right : 463
		},
		2 : {
			left : 123,
			right : 380
		},
		3 : {
			left : 205,
			right : 286
		},
		4 : {
			left : 299,
			right : 222
		},
		5 : {
			left : 363,
			right : 150
		},
		6 : {
			left : 435,
			right : 82
		},
		7 : {
			left : 503,
			right : 0
		}
	} 
});

          /* logo */

var logo_icon = new PBIcon({
	delay: 1900,
  duration : 1750
});

          /* pb wheeler */
          
if($("collage_wheeler")){
	var pb_wheeler = new PBWheeler({
		delay: 5000,
	  duration : "normal",
	  transition : "Sine:In:Out"
	});
}

          /* pb references */

if($("global_reference_list")){
	var pb_references = new PBReferences({
  	clear_hover : 800,
  	speed : {
			normal : {
				step  : 1
			},
			fast : {
				step  : 5
			},
			faster : {
				step  : 10
			},
			fastest : {
				step  : 20
			},
			kurde_fastest : {
				step  : 40
			},
			delay : 15
		},
		default_slide_id : 4,
		default_slide_hash : "#!/best-of"
  });
}

          /* pb reference detail */

if($("reference_detail")){
	var pb_reference_detail = new PBReferenceDetail({
  	clear_hover : 800,
  	speed : {
			normal : {
				step  : 1
			},
			fast : {
				step  : 5
			},
			faster : {
				step  : 10
			},
			fastest : {
				step  : 20
			},
			kurde_fastest : {
				step  : 40
			},
			delay : 15
		}
  });
}

          /* pb clients */

if($("global_clients_list")){
	var pb_references = new PBClients({
  	clear_hover : 800,
  	speed : {
			normal : {
				step  : 1
			},
			fast : {
				step  : 5
			},
			faster : {
				step  : 10
			},
			fastest : {
				step  : 20
			},
			kurde_fastest : {
				step  : 40
			},
			delay : 15
		}
  });
}

          /* pb clients */
          
if($("services_list_wheeler") && $("services_tab_ul")){
	var pb_services = new PBServices({
		start_delay : 1500,
		tab_delay : 55
	});
}        

					/* hp gmap */

if($("hp_gmap")){
  var hp_gmap = new GMap({
    id : "hp_gmap",
    map_type : "hp_gmap",
    gmap_info : {
      center : {
        lat : 50.1118,
        lng : 14.50347 
      },
      zoom : 11,
      points : {
        0 : {
          lat : 50.1118,
          lng : 14.50347,
          title : "PragueBest s.r.o."
        }
      }
    }
  });
  
  $("show_on_gmap").addEvent("click", function(){
		$("hp_gmap_content").toggleClass("act");
		this.blur();
		return false;
	});
  
}

					/* hp clients zoom */

if($("hp_clients_globus")){
	var hp_clients_globus = new PBZoom({
		id : "hp_clients_globus",
		duration : 150, 
		hover : {
			left : 16,
			top : 5,
			width : 84,
			height : 55
		},
  	def : {
			left : 24,
			top : 10,
			width : 69,
			height : 45
		}
	});
}

if($("hp_clients_rako")){
	var hp_clients_rako = new PBZoom({
		id : "hp_clients_rako",
		duration : 150, 
		hover : {
			left : 13,
			top : 9,
			width : 150,
			height : 42
		},
  	def : {
			left : 23,
			top : 13,
			width : 129,
			height : 36
		}
	});
}

if($("hp_clients_pfcp")){
	var hp_clients_pfcp = new PBZoom({
		id : "hp_clients_pfcp",
		duration : 150, 
		hover : {
			left : 15,
			top : 1,
			width : 61,
			height : 62
		},
  	def : {
			left : 22,
			top : 9,
			width : 47,
			height : 48
		}
	});
}

if($("hp_clients_xerox")){
	var hp_clients_xerox = new PBZoom({
		id : "hp_clients_xerox",
		duration : 150, 
		hover : {
			left : 11,
			top : 9,
			width : 160,
			height : 45
		},
  	def : {
			left : 20,
			top : 13,
			width : 139,
			height : 39
		}
	});
}

if($("hp_clients_cra")){
	var hp_clients_cra = new PBZoom({
		id : "hp_clients_cra",
		duration : 150, 
		hover : {
			left : 16,
			top : 0,
			width : 130,
			height : 60
		},
  	def : {
			left : 23,
			top : 2,
			width : 114,
			height : 53
		}
	});
}

if($("hp_clients_incheba")){
	var hp_clients_incheba = new PBZoom({
		id : "hp_clients_incheba",
		duration : 150, 
		hover : {
			left : 11,
			top : 11,
			width : 170,
			height : 44
		},
  	def : {
			left : 22,
			top : 13,
			width : 149,
			height : 39
		}
	});
}

if($("hp_clients_honda")){
	var hp_clients_honda = new PBZoom({
		id : "hp_clients_honda",
		duration : 150, 
		hover : {
			left : 15,
			top : 1,
			width : 76,
			height : 60
		},
  	def : {
			left : 19,
			top : 7,
			width : 66,
			height : 52
		}
	});
}

if($("hp_clients_honda_2")){
	var hp_clients_honda_2 = new PBZoom({
		id : "hp_clients_honda_2",
		duration : 150, 
		hover : {
			left : 16,
			top : 2,
			width : 73,
			height : 60

		},
  	def : {
			left : 22,
			top : 8,
			width : 60,
			height : 50
		}
	});
}

if($("hp_clients_tesla")){
	var hp_clients_tesla = new PBZoom({
		id : "hp_clients_tesla",
		duration : 150, 
		hover : {
			left : 12,
			top : 3,
			width : 79,
			height : 57

		},
  	def : {
			left : 19,
			top : 8,
			width : 68,
			height : 49
		}
	});
}

if($("hp_clients_barum")){
	var hp_clients_barum = new PBZoom({
		id : "hp_clients_barum",
		duration : 150, 
		hover : {
			left : 14,
			top : 22,
			width : 150,
			height : 21

		},
  	def : {
			left : 22,
			top : 24,
			width : 126,
			height : 18
		}
	});
}

					/* form_labels */

if($$("form.form_labels").length > 0){
	$$("form.form_labels .input_box label, form.form_labels .textarea_box label").each(function(label, index){
		if(!label.hasClass("nohide")){
			if(label.getPrevious().value != ""){
				label.addClass("act");
			}
			label.addEvent("click", function(){
				this.addClass("act");
				this.getPrevious().focus();
			});
			label.getPrevious().addEvent("blur", function(){
				if(this.value == ""){
					this.getNext().removeClass("act");
				}
			});
			label.getPrevious().addEvent("click", function(){
				this.getNext().addClass("act");
			});
			label.getPrevious().addEvent("focus", function(){
				this.getNext().addClass("act");
			});
		}
	});
}

if($("footer_croper") && $("footer_croper_button")){
	var footer_crop_height = $("footer_croper").getHeight();
	$("footer_croper").setStyle("height", "auto");
	var footer_full_height = $("footer_croper").getHeight();
	$("footer_croper").setStyle("height", footer_crop_height);
	$("footer_croper_button").addEvent("click", function(){
		if(!this.hasClass("act")){
			$("footer_croper").tween("height", footer_full_height);
			$$("#twitter_content p").setStyle("visibility", "visible");
			(function(){
				$("footer_croper_button").addClass("act");
				
			}).delay(500);
		}
	});
}

if($("add_cv")){
	var cv_index = 0;
	$("add_cv").addEvent("click", function(){
		var career_row = new Element("div", {
      "class" : "row"
    });
    career_row.set("html", '<input type="file" name="f_file[]" class="file" /><span class="remove">x</span><span class="clr"></span>');
		career_row.inject(this.getParent(), "top");
		career_row.getElement(".remove").addEvent("click", function(){
			this.getParent().destroy();
		});
		cv_index++;
		if(cv_index > 0){
			$("add_cv").set("html", "Připojit další soubor...");
		}		
	});
}

					/* contact gmap */

if($("contact_gmap")){
  var contact_gmap = new GMap({
    id : "contact_gmap",
    map_type : "contact_gmap",
    gmap_info : {
      center : {
        lat : 50.1115,
        lng : 14.50347
      },
      zoom : 17,
      points : {
        0 : {
          lat : 50.11185,
          lng : 14.50347,
          title : "Praguebest s.r.o.",
          ico : "pb"
        }
      }
    }
  });
}

					/* history back */

if($$(".history_back").length > 0){
	$$(".history_back").addEvent("click", function(){
		/*
		window.history.back();
		return false;
		*/
	});
}

					/* career */

if($("career_list")){
  var career = new PBCareer({
		height_count_delay : 1500,
		default_select_value : "Nevybráno"
	});
}

          /* 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");
  });
}

});

/* 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,{}));
