<!--

function establishcookie(){
	if (!$.cookie("zrlang")){
	$.cookie("zrlang", 'lg=ru', { path: '/', expires: 7 });
	return false;
	}
}

function simple_tooltip(target_items, name){
 $(target_items).each(function(i){
		$("body").append("<div class='"+name+"' id='"+name+i+"'><p>"+$(this).attr('title')+"</p></div>");
		var my_tooltip = $("#"+name+i);
		
		if($(this).attr("title") != "" && $(this).attr("title") != "undefined" ){
		
		$(this).removeAttr("title").mouseover(function(){
					my_tooltip.css({opacity:0.8, display:"none"}).fadeIn(400);
		}).mousemove(function(kmouse){
				var border_top = $(window).scrollTop(); 
				var border_right = $(window).width();
				var left_pos;
				var top_pos;
				var offset = 20;
				if(border_right - (offset *2) >= my_tooltip.width() + kmouse.pageX){
					left_pos = kmouse.pageX+offset;
					} else{
					left_pos = border_right-my_tooltip.width()-offset;
					}
					
				if(border_top + (offset *2)>= kmouse.pageY - my_tooltip.height()){
					top_pos = border_top +offset;
					} else{
					top_pos = kmouse.pageY-my_tooltip.height()-offset;
					}	
				
				
				my_tooltip.css({left:left_pos, top:top_pos});
		}).mouseout(function(){
				my_tooltip.css({left:"-9999px"});				  
		});
		
		}
		
		
		
	});
}



      $(document).ready(function() {

/* =============================
info rolls
================================*/
 simple_tooltip("#leftcolumn img","tooltip");

/* =============================
cookie
================================*/
//--- find and set
establishcookie()
	// Establish Keys as Function
	var mycookie = $.cookie('zrlang');
	var mykeys = mycookie.split('&');
	var cookieValue  = getcookkey("lg");
	function getcookkey(x){
	for (var i = 0; i < mykeys.length; i++) {
	var cookie = jQuery.trim(mykeys[i]);
	if (cookie.substring(0, x.length + 1) == (x + '=')) {
	return  decodeURIComponent(cookie.substring(x.length + 1));
	break;
	}
	}
}


	// General Login criteria
	//alert(cookieValue)
	// gather data
	switch (cookieValue) {  
	case 'ru':  
	//$('body').append("russian");
	$(".langen").animate({	
	opacity: 0.3,
	filter: 'alpha(opacity=30)'
	}, 600 ).css("border-bottom", "none");
	$(".langru").animate({
	opacity: 1,
	filter: 'alpha(opacity=100)'
	}, 600 ).css("border-bottom", "solid");
	break;  
	case 'en':  
	//$('body').append("English");
	$(".langru").animate({
	opacity: 0.3,
	filter: 'alpha(opacity=30)'
	}, 600 ).css("border-bottom", "none");
	$(".langen").animate({
	opacity: 1,
	filter: 'alpha(opacity=100)'
	}, 600 ).css("border-bottom", "solid");
	break;  
	}
/* =============================
variable content handler
================================*/
var strId  = (window.location.search.substr(4).toLowerCase());
if((strId) == '' || strId == null ) {strId = 1}
//alert(strId + cookieValue)
$('#pougherwords').hide();
$.ajax({ 
  url: "aj_getlang.aspx?l=" + cookieValue + "&i=" + strId + "&r=" + (Math.random() * 3),
  dataType: "html", 
  type: "GET", 
  error: function(){ 
	alert('Houston, we have a problem.'); 
  }, 
  success: function(data){
	$('#pougherwords').html(data).fadeIn(500);
	if (cookieValue == "ru") {
	$('.ru').fadeIn(500);  
	} else {
	$('.en').fadeIn(500);             
	}
  } 
}); 

/* =============================
Lang Clicker
================================*/
$('.lang img').click(function() {
var langchooser = "lg=" + $(this).attr("title");
$.cookie("zrlang", langchooser, { path: '/', expires: 7 });
  $('.langen,.langru').animate({
	opacity: 0.3,
	filter: 'alpha(opacity=30)'
	}, 600 ).css("border-bottom", "none");
        $(this).animate({
	opacity: 1,
	filter: 'alpha(opacity=100)'
	}, 600 ).css("border-bottom", "solid");
window.location=window.location.href
        return false;
}); 





/* =============================
google
================================*/
var mygoogle = $("#googit");
var hideformap = $("#hideformap");

mygoogle.animate( { height:"1px"}, 1000 )
 
mygoogle.queue(function(){ 
  setTimeout(function(){ 
   mygoogle.dequeue(); 
  }, 2000 ); 
}); 
mygoogle.fadeOut(100); 

         $('.google').toggle(
	function () {
	mygoogle.animate( { height:"580px"}, 1000 ) 
	hideformap.animate({ opacity: "hide" }, "fast");
	},
	function () {
	mygoogle.animate( { height:"1px"}, 1000 )
	hideformap.animate({ opacity: "show" }, "fast");
});

/* =============================
load contacts
================================*/
var whichpage = window.location.search.substr(4).toLowerCase();
if( whichpage == "5"){
$.ajax({
url : "contact.htm",
success : function (data) {
$("#contactform").html(data);
}
});
}

/* =============================
load catalogue data
================================*/
var pageis = ( location.search.slice(4))
if( pageis == "3"){
$("#cataloguelink").animate({ opacity: "show" }, 2000);
}
/* =============================
links pop anything
================================*/
  $('.outside').click(function(event) {
    window.location.href = "http://www." + $(this).attr('name');
return false;
  });

/* =============================
drop tog data
================================*/


$('.addrss').show();
$("a.headerbar").toggle(
		function(){
			$(".addrss").slideDown("slow").blur();
			$("img.handle").attr("src","img/navigation/close.gif");
		},
		function(){
			$(".addrss").slideUp("slow").blur();
			$("img.handle").attr("src","img/navigation/drop_btn.gif");
		});

      /* =============================
nav anim + excess
================================*/
        var navDuration = 150; //time in miliseconds
        var navJumpHeight = "5px";

        $('#nav1 li').hover(function() {
            $(this).animate({ top : "-="+navJumpHeight }, navDuration);            
        }, function() {
            $(this).animate({ top : "15px" }, navDuration);
        });
        
        
        //  nav animation2  
        $('#nav_move').css({ 
          width: $('#nav2 li:first a').width()+20, 
          height: $('#nav2 li:first a').height()+20 
        });
        $('#nav2 li:first a').addClass('cur');
        
        $('#nav2 a').click(function() {
          var offset = $(this).offset();
          var offsetBody = $('#center_wrapper').offset(); //find the offset of the wrapping div    
          $('#nav_move').animate(
            { 
              width: $(this).width()+20, 
              height: $(this).height()+20, 
              left: (offset.left - offsetBody.left - 143) 
            }, 
            { duration: 350, easing: 'easeInOutCirc' }
          );
          $('.cur').removeClass('cur');
          $(this).addClass('cur');
          return false;
        });           
        
        
        //  list animation  
        var fadeDuration = 150; //time in milliseconds
        
        $('#list1 li a').hover(function() {
          $(this).animate({ paddingLeft: '30px' }, fadeDuration);
          $(this).children('span').show().animate({ left: -5 }, fadeDuration);
        }, function() {
          $(this).animate({ paddingLeft: '15px' }, fadeDuration);
          $(this).children('span').animate({ left: -35 }, fadeDuration).fadeOut(fadeDuration);          
        });

        $('.see_code').click(function() {
          if($(this).parent().next().is(':visible')) {
            $(this).html('+ Show Code');
            $(this).parent().next().toggle();
          } else {
            $(this).html('- Hide Code');
            $(this).parent().next().toggle();            
          }
          return false;
        });
        
      });//doc ready
// -->