﻿var mainTop = true;
var footerBottom = true;
var footerBottom2 = true;
  
  function load_fon0(q) {

   var imageCheck = false; 
   imageCheck=q;
 
   	mainTop = document.getElementById("main");
    mainTop.style.visibility="visible";
    footerBottom = document.getElementById("footer");
    footerBottom.style.visibility="visible";

	}
 
 
 function load_fon(q) {
  
   var imageCheck = false; 
   imageCheck=q;
  
   	mainTop = document.getElementById("main2");
    mainTop.style.visibility="visible";
    footerBottom2 = document.getElementById("footer2");
    footerBottom2.style.visibility="visible";

	}
 /*-----------------------------------load_fon-------------------------------*/

 
 var timem=false;
  
  function mouseOut_box_tel() {
    $('#logo_telefon').stop(true, true);
   timem=setTimeout(function() {$('#logo_telefon').fadeOut(1000);}, 1000);
  }

  function mouseOver_box_tel() {
    $('#logo_telefon').stop(true, true);
    if(timem != false){clearTimeout(timem);} 
    
  }
  
   function mouseOut_tel() {
    $('#logo_telefon').stop(true, true);
   timem=setTimeout(function() {$('#logo_telefon').fadeOut(1000);}, 1000);
   
  }

  function mouseOver_tel() {
    $('#logo_telefon').stop(true, true);
     if(timem != false){clearTimeout(timem); $('#logo_telefon').stop();} 
    
    $('#logo_telefon').fadeIn(500);
  }
/*-----------------------work_telefon---------------------------------*/  

var timem2=false;
  var lupa = false; 
  function form_blur_lupa(t) {
    $('#logo_lup').stop(true, true);
     lupa=t;
    if(lupa == false && button1 == false){
    timem2=setTimeout(function() {$('#logo_lup').fadeOut(1000);}, 1000);
   }
   return lupa;
  }
  
  function form_focus_lupa(t) {
    $('#logo_lup').stop(true, true);
    if(timem2 != false){clearTimeout(timem2);} 
    lupa=t;
    return lupa;
  }
  
  
  var button1 = false;
  function form_blur_button(t) {
    $('#logo_lup').stop(true, true);
    button1=t;
    if(lupa == false && button1 == false){
    timem2=setTimeout(function() {$('#logo_lup').fadeOut(1000);}, 1000);
   }
    return button1;
  }
  function form_focus_button(t) {
    $('#logo_lup').stop(true, true);
    clearTimeout(timem2);  
    button1=t;
    return button1;
  }
  
  function mouseOut_box_lupa() {
     $('#logo_lup').stop(true, true);
    if(lupa == false && button1 == false){
    timem2=setTimeout(function() {$('#logo_lup').fadeOut(1000);}, 1000);
   }
  }

  function mouseOver_box_lupa() {
     $('#logo_lup').stop(true, true);
   if(timem2 != false){clearTimeout(timem2);  $('#logo_lup').stop(true, true); } 
  }
  
  function mouseOut_lupa() {
     $('#logo_lup').stop(true, true);
    if(lupa == false && button1 == false){
    timem2=setTimeout(function() {$('#logo_lup').fadeOut(1000);}, 1000);
   }
  }

  function mouseOver_lupa() {
    
    if(timem2 != false){clearTimeout(timem2);  $('#logo_lup').stop(true, true); } 
   
    $('#logo_lup').fadeIn(1000);
    
  }
/*------------------------work_search---------------------------------------------------*/

        $(document).ready(function() {

  


  $('#menu2 .fon2 .swimming a .i1').hover(function() {
	$('.h1').fadeOut(1);},function(){$('.h1').fadeIn(1);}
  );
  
  $('#menu2 .fon2 .swimming a .i2').hover(function() {
	$('.h2').fadeOut(1);},function(){$('.h2').fadeIn(1);}
  );
  
 $('#menu2 .fon2 .swimming a .i3').hover(function() {
	$('.h3').fadeOut(1);},function(){$('.h3').fadeIn(1);}
  );
  
  $('#menu2 .fon2 .swimming a .i4').hover(function() {
	$('.h4').fadeOut(1);},function(){$('.h4').fadeIn(1);}
  );
  
  
  
  $('#all_content2 #middle_part .history .content_about .services a .is1').hover(function() {
	$('.hs1').fadeOut(1);},function(){$('.hs1').fadeIn(1);}
  );
  
  $('#all_content2 #middle_part .history .content_about .services a .is2').hover(function() {
	$('.hs2').fadeOut(1);},function(){$('.hs2').fadeIn(1);}
  );
  
 $('#all_content2 #middle_part .history .content_about .services a .is3').hover(function() {
	$('.hs3').fadeOut(1);},function(){$('.hs3').fadeIn(1);}
  );
  
  $('#all_content2 #middle_part .history .content_about .services a .is4').hover(function() {
	$('.hs4').fadeOut(1);},function(){$('.hs4').fadeIn(1);}
  );



});//end work_icon_menu2---------------------------------------------------------------------------------------------


function hover_over_portfolio(q) {
	

		var portfolioTop = document.getElementById("anons"+q);
    portfolioTop.style.visibility="visible";

	}

	
function hover_out_portfolio(q) {
		var portfolioTop2 = document.getElementById("anons"+q);
    portfolioTop2.style.visibility="hidden";

	}
 
/*---------------------------work_window_portfolio-----------------------------*/ 

var wHeight = 1;
var menuHeight = 48;
var topHead = 100;
var topHead_fon = 1;
var topWidth = 1;
var topWidth_fon = 1;
var curContainer = 1;
function initComponents() {
	topHead = document.getElementById("in_header");  
	resizeHeader();
	window.onfocus = function() {resizeHeader();};
}

function resizeHeader() {
//	wHeight = document.body.clientHeight;
   
       
    wHeight=document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
	if(wHeight < 510)
	{
	  topHead.style.height = (510 - menuHeight) + "px";
      topHead_fon = 510 - menuHeight; 
	}else{
	  topHead.style.height = (wHeight - menuHeight) + "px";
      topHead_fon = wHeight - menuHeight; 
	}
    topWidth_fon = document.getElementById("all_fon").offsetWidth;
	//alert(topWidth_fon);

	var curImg = "#img-fon-" + (curContainer);
	
	var tmp_img = new Image();
	tmp_img.src = $(curImg).attr("src");
	var tmp_width = tmp_img.width;
	tmp_img.width = topWidth_fon;
	theight = tmp_img.height;
	tmp_img.height /= (tmp_width / tmp_img.width);
	
	var tmpWidth = tmp_img.width;
	var tmpHeight = tmp_img.height;

	
	if(topHead_fon > tmpHeight) {
		var persent_h = tmpHeight;
		ban_h = topHead_fon;
		
		persent_h = ban_h / persent_h;
		ban_w = tmpWidth * persent_h;
		$(curImg).attr("width", ban_w);
		$(curImg).attr("height", ban_h);
		var margin_top = (ban_h - topHead_fon) / 2;
		$(curImg).css("margin-top", "-"+margin_top+"px");
		
		var margin_left = (ban_w - topWidth_fon) / 2;
		if(margin_left < 0) {margin_left *= -1;}
		$(curImg).css("margin-left", "-"+margin_left+"px");
	} else {
		$(curImg).attr("width", tmpWidth);
		$(curImg).attr("height", tmpHeight);
		var margin = (tmpHeight - topHead_fon) / 2;
		$(curImg).css("margin-top", "-"+margin+"px");
		
		var margin_left = (tmpWidth - topWidth_fon) / 2;
		if(margin_left < 0) {margin_left *= -1;}
		$(curImg).css("margin-left", "-"+margin_left+"px");
	}
	
}
/*----------------------------------------------*/
 


/*-------------------------------------------*/
/*-------------------------work_index_height------------------------------*/


 
 /****************no*********************/
var wHeight2 = 1;
var menuHeight2 = 288;
var topHead2 = 1;
var wBlock = 1;


function initComponents2() {
  wBlock = document.getElementById("middle_part").offsetHeight;
  wHeight2=document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight; 

  if(wHeight2 - menuHeight2 > wBlock)
  
  /*alert(wBlock);*/
  /*if(900 > wBlock)*/
  {
  /*wHeight2 = document.documentElement.clientHeight;*/
  topHead2 = document.getElementById("height_center7");  
	topHead2.style.height = (wHeight2 - menuHeight2) + "px";
 
	}
    
    
  }
  

  
/*---------------------------work_all_page_height-----------------------*/	

