String.prototype.PA = function (_hamper,_prefix,_postfix,_face)
    {
        _hamper=_prefix+"@"+this+(_postfix || '');
        document.write(_face+(_hamper).link("mailto:"+_hamper));
    }
		
jQuery.fn.showLogo = function(classa) {
    $(this).hover(function() {
        $(this).find(classa).stop().fadeTo(500, 0);
    }, function () {
        $(this).find(classa).stop().fadeTo(500, 1);
    });
}
		
$(document).ready(function(){
    $(document).pngFix();
    cont = document.getElementById("carcas");
    pat_box = document.getElementById("main_container");

    function resizeCarcas(){
        var w = document.body.clientWidth;
        var h = document.body.clientHeight;
        if ( w > 1024 || w < 1350){
            cont.style.width = (w-165)+"px";
            pat_box.style.backgroundPosition = (w-303) + 'px 0';
        }
        if ( w >= 1300) {
            cont.style.width = 1135+"px";
            pat_box.style.backgroundPosition = 997 + 'px 0'
        }
        if (w < 1189) {
            cont.style.width = 1000 + "px";
        }
		
    }
    resizeCarcas();
    pat_box.style.visibility='visible';
    window.onresize = function(){
        resizeCarcas()
    };
    //Подцепляем прокручиваемые галереи работ
    $(".thisscrolling").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
        //circular: false,
        visible: 5
    });
    $(".thisscrolling1").jCarouselLite({
        btnNext: ".next1",
        btnPrev: ".prev1",
        //circular: false,
        visible: 5
    });
    $(".thisscrolling2").jCarouselLite({
        btnNext: ".next2",
        btnPrev: ".prev2",
        //circular: false,
        visible: 5
    });
	
    //Разворачивающиеся блоки
    $("div.rollaipi span").click(function(){
        var obj = $(this).parent().parent();
        /*obj.css("visibility","hidden");
		var nl = $(this).attr("rel");
		obj.prev().slideDown(400, function(){obj.css("visibility","visible")});
		$(this).attr("href",nl).find("span:first").css("display","none").next().css("display","inline");
		return false;*/
        obj.prev().slideDown('400',function(){
            obj.css("visibility","visible")
        });
        $(this).hide('fast');
        $(this).next('a').show('fast');
    });


    // For form start
    
    jQuery.fn.inputDefaultVal= function (val){
        $(this).focus(function(){
            if($(this).val() == val){
                $(this).val('');
            }
            $(this).parents('.field').addClass('f-active');
        });
        $(this).blur(function(){
            if($.trim($(this).val()) == ''){
                $(this).val(val);
            }
            $(this).parents('.field').removeClass('f-active');
        });
    }

    jQuery.fn.styledSelect= function (){
        $(this).parents('.select-box').find('>.cur-val').html($(this).find('> option:selected').html());
        $(this).change(function(){
            $(this).parents('.select-box').find('>.cur-val').html($(this).find('> option:selected').html());
        });
    }

    $('.field input, .field textarea, .field select,').each(function(){
       $(this).inputDefaultVal($(this).val()); 
    });
    $('.select-box select').styledSelect();
    $('#hka-link').click(function(e){
        e.preventDefault();
        $this = $('#how-know-about');
        if($this.is(':visible')){
            $(this).find('>.al-arr').removeClass('arr-up').addClass('arr-down');
            $this.slideUp('fast');
        }
        else if($this.not(':visible')){
            $(this).find('>.al-arr').removeClass('arr-down').addClass('arr-up');
            $this.slideDown('400');
        }
    });
    if($.isFunction($.fn.corner)){
        $('#corners-wrap').corner('6px');
        $('#corners').corner('5px');
    }

    // For form end
    
});

jQuery.fn.maska = function(classa) {

    $(this).hover(function(){
        $(this).find(classa).stop().animate({
            height:'40px',
            opacity: '0.7'
        }, 400);
    },function () {
        $(this).find(classa).stop().animate({
            height:'0',
            opacity: '0'
        }, 400);
    });
}
  
//$(document).ready(function(){$('.box').maska('.maska');}); 

jQuery.fn.showLogo = function(classa) {
    $(this).hover(function() {
        $(this).find(classa).stop().fadeTo(500, 0);
    }, function () {
        $(this).find(classa).stop().fadeTo(500, 1);
    });
}

$(document).ready(function()
{
    $('div.logos2').showLogo('.front');
 
    $("div.logos2 img").each(function ()
    {
        $(this).css({
            "margin-top" : ($(this).parent("div.logos2").height() - $(this).height()) / 2
        });
        $(this).css({
            "left" : ($(this).parent("div.logos2").width() - $(this).width()) / 2
        });
    });
   
});	
$(document).ready(function()
{
    $("div.logos div").showLogo('.front');
 
    $("div.logos div img").each(function ()
    {
        $(this).css({
            "margin-top" : ($(this).parent("div.logos").height() - $(this).height()) / 2
        });
        $(this).css({
            "margin-left" : ($(this).parent("div.logos").width() - $(this).width()) / 2
        });
    });
});
	
function newWindow () {
    leftVal = (screen.width - 800)/2;
    popupWin = window.open('/application/html/print_moscow.html', 'asas', 'resizable=no, location,scrollbars=1,toolbar=no,width=780,height=860, left='+leftVal+'');
    popupWin.focus();
    return false;
}
	
function newWindow2 () {
    leftVal = (screen.width - 650)/2;
    topVal = (screen.height - 720)/2;
    popupWin = window.open('/application/html/print_ulsk.html', 'asas', 'resizable=no, location,scrollbars=1,toolbar=no,width=650,height=720,top='+topVal+',left='+leftVal+'');
    popupWin.focus();
    return false;
}	
	  
function unDefault()
{
    var inp=document.getElementsByTagName('input');
    forma=document.getElementById('requestform')
    for(i=0; i<forma.length; ++i) {
        if (forma[i].value==forma[i].title && forma[i].className != 'hidden')
        {
            forma[i].value='';
        }
    }
    return false;
}	  
	  
	  
function CreateTextMask(elementid, masktext)
{
    var element = document.getElementById(elementid);

    element.value = masktext;

    element.onfocus = function()
    {
        if (element.value == masktext)
        {
            element.value = "";
        }
    }

    element.onblur = function()
    {
        if (element.value.length == 0)
        {
            element.value = masktext;
        }
    }
}	


 
$(document).ready(function()
{
    $(".auth .arr").click(function () {
        $(this).parent().css({
            "display":"none"
        });
        $(".auth2").fadeIn("slow");
    });
    $(".auth .arr_ent").click(function () {
        $(this).parent().fadeOut("fast");
        $(".auth2").fadeIn("slow");
    });
	  
    $(".auth2 form .arr").click(function () {
        $(this).parent().parent().fadeOut("fast");
        $(".auth").fadeIn("slow");
    });
    
    $(".auth2 form .arr_ent").click(function () {
        $(this).parent().parent().fadeOut("fast");
        $(".auth").fadeIn("slow");
    });    
 
});	  
