$(document).ready(function(){	
	$(document).pngFix();
	cont = document.getElementById("carcas");
	pat_box = document.getElementById("main_container");
	/*var botwinc = document.getElementById("botwinc");*/
	function resizeCarcas(){
		var w = document.body.clientWidth;
		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";
		}
		/*botwinc.style.width = w +'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.next().stop().slideToggle('400',function(){obj.next().css("visibility","visible")});
		$(this).toggleClass('minus');
	});
});

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.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});
   });
});
	
	String.prototype.PA = function (_hamper,_prefix,_postfix,_face)
        {
          _hamper=_prefix+"@"+this+(_postfix || '');
          document.write(_face+(_hamper).link("mailto:"+_hamper));
        }
		
function newWindow () {
		leftVal = (screen.width - 700)/2;
		popupWin = window.open('/application/html/print_moscow.html', 'asas', 'resizable=no, location,scrollbars=1,toolbar=no,width=700,height=1300, 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 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;
 }
 }
}	

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;
}
 
$(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");
	  });	  
 
}); 
