function setCookie(a,b,c){
    var d=new Date;
    d.setDate(d.getDate()+c);
    var e=escape(b)+(c==null?"":"; expires="+d.toUTCString());
    document.cookie=a+"="+e
    }
    function AjaxValidate(a,b,c){
    try{
        $(".not_valid").removeClass("not_valid");
        $(".validation_errors").html("");
        $.ajax({
            type:"POST",
            url:urlBase+c,
            data:b,
            async:false,
            success:function(c){
                var d=c.getElementsByTagName("validation");
                var e=d[0].getAttribute("counter");
                if(e>0){
                    var f=c.getElementsByTagName("error");
                    for(i=0;i<f.length;++i){
                        var g=f[i].getAttribute("id");
                        $("#"+g).addClass("not_valid");
                        g="#"+g+"_error";
                        $(g,a).html(f[i].firstChild.nodeValue)
                        }
                    }else{
                var h=b;
                var j="index/sendMessage";
                var k="#contact_info";
                GetAjax(h,j,k);
                retValue=false
                }
            }
        });
return retValue
}catch(d){
    alert(d);
    return false
    }
}
function GetAjax(a,b,c){
    try{
        $.ajax({
            type:"POST",
            url:urlBase+b,
            data:a,
            async:true,
            success:function(a){
                if(c!=null){
                    $("#contact_form").css("display","none");
                    $(c).html(a)
                    }
                    return true
                }
            });
    return true
    }catch(d){
    alert(d);
    return false
    }
}
$(window).bind("load",function(){
    $("img.plus-icon").attr("style",function(){
        return"top:"+($(this).parent().next().height()-13)+"px; left:"+($(this).parent().next().width()-23)+"px"
        })
    });
var retValue=false;
$(document).ready(function(){
    function g(){
        if($(".jspPane img[alt=photo]").get(0).complete&&$(".jspPane img[alt=photo]").get(0).height>0){
            f()
            }else{
            setTimeout("waitFor()",100)
            }
        }
    function f(){
    var a=$(window).height();
    var b=parseInt(a)-300;
    var c=$("#news-box .jspPane").outerHeight();
    var d=$("#news-box").outerHeight()+30;
    $("#news-box .box").css("height","auto");
    if(c>=150){
        $("#showMoreButton").show()
        }
    }
Cufon.replace("#nav a",{
    hover:true
});
Cufon.replace("#nav span",{
    hover:true
});
Cufon.replace("h2",{
    hover:true
});
Cufon.replace(".cufon");
    Cufon.replace("#content #sidebar li");
    $("#closeNewsBox").click(function(){
    $("#news-box").hide();
    $("#transparentPage").hide()
    });
setTimeout(function(){
    $(".skype_pnh_container").html("");
    $(".skype_pnh_print_container").removeClass("skype_pnh_print_container")
    },1e3);
$("#contact_form").submit(function(){
    var a=$(this);
    var b="contact_name=" + encodeURIComponent($('#contact_name', this).val()) + "&contact_last_name=" + encodeURIComponent($('#contact_last_name', this).val()) +"&contact_mail="+encodeURIComponent($("#contact_mail",this).val())+"&contact_message="+encodeURIComponent($("#contact_message",this).val())+"&email-copy="+encodeURIComponent($("#email-copy",this).val()) +"&contact_phone=" + encodeURIComponent($('#contact_phone', this).val());
    var c="index/validate_contact";
    return AjaxValidate(a,b,c)
    });
var a;
$("a[rel^='prettyPhoto']").prettyPhoto();
    $("#nav").animate({
    width:"toggle"
},900);
$("#nav > li").bind("mouseenter",function(){
    clearTimeout(a);
    if($("li",this).css("display")=="none"){
        $("#nav ul li").animate({
            width:"hide"
        },900);
        $("ul li",this).animate({
            width:"show"
        },900)
        }
    }).bind("mouseleave",function(){
    a=setTimeout("$('#nav ul li').animate({width: 'hide'}, 900);",1e3)
    });
$("#nav li ul").bind("mouseenter",function(){
    clearTimeout(a)
    }).bind("mouseleave",function(){});
if(photo=="tb6.jpg"||photo=="tb2.jpg"||photo=="c3.jpg"||photo=="amn.7.jpg"||photo=="azja_7.jpg"){
    $("#contentBackground").css("background-position","center top")
    }
    if(photo=="zaufalibg2.jpg"){
    $("#contentBackground").css("background-position","left center")
    }
    if(photo=="zaufalibg3.jpg"||photo=="event_marketing_04.jpg"){
    $("#logo-image").attr("src",urlBase+"img/logo2.png")
    }
    var b=$(window).height();
var c=parseInt(b)-400;
var d=$(".box-content").outerHeight()+30;
if(c>d){
    if(c<221){
        $("#box").css("height","220px");
        $("#sidebar").css("height","220px");
        $(".box-content").css("height","220px")
        }else{
        if(d<221){
            d=221
            }
            $("#box").css("height",d+"px");
        $("#sidebar").css("height",d+"px");
        $(".box-content").css("height",d+"px")
        }
    }else{
    if(c<221){
        $("#box").css("height","220px");
        $("#sidebar").css("height","220px");
        $(".box-content").css("height","220px")
        }else{
        $("#box").css("height",c+"px");
        $("#sidebar").css("height",c+"px");
        $(".box-content").css("height",c+"px")
        }
    }
$(window).resize(function(){
    var a=$(window).height();
    var b=parseInt(a)-400;
    var c=$(".box-content").outerHeight()+30;
    if(b>c){
        if(b<221){
            $("#box").css("height","220px");
            $(".box-content").css("height","220px");
            $("#sidebar").css("height","220px")
            }else{
            $("#box").css("height",b+"px");
            $(".box-content").css("height",b+"px");
            $("#sidebar").css("height",b+"px")
            }
        }else{
    if(b<221){
        $("#box").css("height","220px");
        $(".box-content").css("height","220px");
        $("#sidebar").css("height","220px")
        }else{
        $("#box").css("height",b+"px");
        $(".box-content").css("height",b+"px");
        $("#sidebar").css("height",b+"px")
        }
    }
});
if($("#news").outerHeight()!=null&&$("#news").outerHeight()!="undefined"&&$("#news").outerHeight()!=undefined){
    var e=$("#news").outerHeight()+30;
    if(c>e){
        if(c<221){
            $("#box").css("height","220px");
            $("#sidebar").css("height","220px");
            $("#news").css("height","220px")
            }else{
            $("#box").css("height",c+"px");
            $("#sidebar").css("height",c+"px");
            $("#news").css("height",c+"px")
            }
        }else{
    if(c<221){
        $("#box").css("height","220px");
        $("#sidebar").css("height","220px");
        $("#news").css("height","220px")
        }else{
        $("#box").css("height",c+"px");
        $("#sidebar").css("height",c+"px");
        $("#news").css("height",c+"px")
        }
    }
$(window).resize(function(){
    var a=$(window).height();
    var b=parseInt(a)-400;
    var c=$("#news").outerHeight()+30;
    if(b>c){
        if(b<221){
            $("#box").css("height","220px");
            $("#news").css("height","220px");
            $("#sidebar").css("height","220px")
            }else{
            $("#box").css("height",b+"px");
            $("#news").css("height",b+"px");
            $("#sidebar").css("height",b+"px")
            }
        }else{
    if(b<221){
        $("#box").css("height","220px");
        $("#news").css("height","220px");
        $("#sidebar").css("height","220px")
        }else{
        $("#box").css("height",b+"px");
        $("#news").css("height",b+"px");
        $("#sidebar").css("height",b+"px")
        }
    }
})
}
$(".more").click(function(){
    if($(this).next(".text").css("display")=="none"){
        $(this).next(".text").slideDown("slow")
        }else{
        $(this).next(".text").slideUp("slow")
        }
    });
$("#go-left-area").hover(function(){
    $("#go-left").fadeIn("fast")
    },function(){
    $("#go-left").fadeOut("fast")
    });
$("#go-right-area").hover(function(){
    $("#go-right").fadeIn("fast")
    },function(){
    $("#go-right").fadeOut("fast")
    });
$(".scroll-pane").jScrollPane({
    showArrows:true,
    autoReinitialise:true
});
$(".showMore").live("click",function(){
    var a=$(window).height();
    var b=parseInt(a)-300;
    var c=$("#news-box .jspPane").outerHeight();
    var d=$("#news-box").outerHeight()+30;
    $("#news-box .box").css("height","auto");
    if(c<d){
        $("#news-box .box .description").animate({
            height:c+"px"
            })
        }else{
        $("#news-box .box .description").animate({
            height:d+"px"
            })
        }
        $(this).removeClass("showMore")
    });
f();
$(document).ready(function(){
    $("#newsletter-click").click(function(){
        $("#name").val("");
        $("#email").val("");
        $("#agreement").attr("checked",false);
        $("#newsletter_message").html("");
        $("#transparentPage").css("display","");
        $("#newsletter-box").show();
        return false
        })
    })
})
