$(document).ready(function(){

	$('#valign').vAlign();

	$("li.header").next("span").hide();
	$("#show_huge_1").hide();
	$("#show_huge_2").hide();
	$("#show_huge_3").hide();
	$("#blackout").hide();
});

$(document).ready(function(){

		
	$("#models_link").click(function () { 
      window.location = "?page=models"
    });
    $("#howto_link").click(function () { 
      window.location = "?page=system"
    });
    $("#projects_link").click(function () { 
      window.location = "?page=projects"
    });
    $("#wheretobuy_link").click(function () { 
      window.location = "?page=dealers"
    });
    $("#askquestion_link").click(function () { 
      window.location = "?page=question"
    });
		
		$("#models-plate div").hover(function () {
				$(this).css("cursor","pointer");
        		
     	}, function () {
        		$(this).css("cursor","normal");
      });
      
      $("#map_links div").hover(function () {
				$(this).css("cursor","pointer");
        		
     	}, function () {
        		$(this).css("cursor","normal");
      });
      
       $("#huge_maps div").hover(function () {
				$(this).css("cursor","pointer");
        		
     	}, function () {
        		$(this).css("cursor","normal");
      });
		

		$("#models-plate div").click(function(event) {
		  event.preventDefault();
		  
		  window.location = $(this).attr("url");
		});
		
		
		$("#map_links div").click(function(event) {
		  event.preventDefault();
		  namr = '#' + $(this).attr("url");
		  $("#huge_maps div").hide();
		  $("#blackout").show();
		  $(namr).show();
		});
		
		$("#huge_maps div").click(function(event) {
		  event.preventDefault();
		  $("#blackout").hide();
		  $(this).hide();
		});
		
		$("#blackout").click(function(event) {
		  event.preventDefault();
		  $(this).hide();
		  $("#huge_maps div").hide();
		});
		
		//$("ul#q-list li").append("&uarr;&nbsp;<a href='javascript:scrollbar5.tweenTo(0);'>Вернуться на верх</a>");
		
		
		
});







// VERTICALLY ALIGN 
(function ($) {

$.fn.vAlign = function() {
	return this.each(function(i){
	var ah = $(this).height();
	var ph = $(".model_img").height();
	var mh = (ph - ah) / 2;
	$(this).css('margin-top', mh/4);
	});
};
})(jQuery);

jQuery.fn.delay = function(time,func){
	this.each(function(){
		setTimeout(func,time);
	});
	
	return this;
};



		
		

		 
		
		


		(function ($) {

		$.fn.rScroll = function() {  
		
		 scroller3  = new jsScroller3(document.getElementById("projects-list"), 225, 530);
		 new jsScrollbar3(document.getElementById("projects-scrollbar"), scroller3, false);
		 	
		};
		})(jQuery);
		
		

		$(function(){
		 
		$("li.header").click(function(event) {
			event.preventDefault();
		
			$(this).next("span").slideToggle().delay(400, function(){
			
			$(document).rScroll();
			
			});
			
			
			
			

		
			});
		
		
		 
		//$("li.header").click(function(event) {
		//event.preventDefault();
		//$("li.item").slideUp();
		//});
		});
		
		
		
		
		
		
		
		