function alarm( text ){
     alert(text)
}

$(document).ready(function(){

$(".gallery .one").hover(
  function () {
    $(this).addClass("hov-");
  },
  function () {
    $(this).removeClass("hov-");
  }
);

$(".gallery .one").each(function(){
	if ($(this).find("img").width() < 200) {
		z=Math.round(($(this).css("width").substr(0, $(this).css("width").length-2)-$(this).find("img").width())/2);
		$(this).find(".descr").css("padding-left", z+"px");
	}
	
})


$("#button").click(function () {
	if ($("#down").hasClass("down")) 
			$("#down").removeClass("down")
	else $("#down").addClass("down");
	$("#slide").slideToggle("slow");	
	});


$("#menu_button").click(
function () 
{
	$("#menu_slide").slideToggle("slow");	
}
);
	
	
$("#but-str").click(function () {
	if ($("#down").hasClass("down")) 
			$("#down").removeClass("down")
	else $("#down").addClass("down");
	$("#slide").slideToggle("slow");	
	});
});

/*
function menuresize() 
{		
	var cur = document.getElementById("curMenuItem");
	var sub = document.getElementById("menu2nd");
	var wholemenu = document.getElementById("wholemenu");

	if (sub)
	{
	sub.style.marginLeft = 0;
	

	var pos = Math.max(getPosition(cur).x - getPosition(sub).x - $(sub).width()/2 + $(cur).width()/2, 0);
	if(	pos > getPosition(wholemenu).x - getPosition(sub).x + $(wholemenu).width() - $(sub).width()-1)
	{pos = getPosition(wholemenu).x - getPosition(sub).x + $(wholemenu).width() - $(sub).width()-1;	
		}
	
	if (getPosition(sub).x < ( $(cur).width() - getPosition(cur).x )){
	pos = getPosition(cur).x;
	}
	
	if  (( getPosition(sub).x < (getPosition(cur).x + $(cur).width())) && (getPosition(cur).x < 150)){
	pos =getPosition(cur).x - getPosition(sub).x - 12;

	}
	
	sub.style.marginLeft=pos+"px";	
	}
}	
*/

function preloadImages( imageRoot ){
 if (document.images) {  

    preloadPics(imageRoot,
        'logo-jetstyle', 'logo-jetstyle-'
         );

    preloadPics(imageRoot+'meta/',
        'home', 'home-',
        'mail', 'mail-',
        'map', 'map-'
         );

  }

  preloadFlag = true;
}

//comments
function init_comments(blocks_ids)
{
	window.console.log(blocks_ids)
	for (var i in blocks_ids)
	{
      $("#" + blocks_ids[i]).hide();
      $("#" + blocks_ids[i] + "-link").show()
/*      .click(function(){
//      $("#" + blocks_ids[i] + "-link").onclick = function(){
      });
//        window.console.log($("#" + blocks_ids[i] + "-link").click)
*/
    }
}

function show_comment_continue(block_id)
{
    $("#" + block_id).show("slow")
    $("#" + block_id + "-link").hide()
    return false
}


/*
<script type="text/javascript">	

function menuresize() 
{
	
	
	var cur = document.getElementById("curMenuItem");
	var sub = document.getElementById("menu2nd");
	var wholemenu = document.getElementById("wholemenu");
	
	sub.style.marginLeft = 0;
	
	pos = Math.max( getPosition(cur).x - getPosition(sub).x - $(sub).width()/2 + $(cur).width()/2, 0);
	if (pos < getPosition(wholemenu).x - getPosition(sub).x + $(wholemenu).width() - $(sub).width()-1)
		{
		pos = Math.max( getPosition(cur).x - getPosition(sub).x - $(sub).width()/2 + $(cur).width()/2, 0);
		}
	sub.style.marginLeft=pos+"px";	

}	

</script>

*/


function showmap(map){    
    $('#map-bg').show();
    $('select').hide();
    $(map).show();
    return false;
}

function hidemap(){
    $('select').show();
    $('#map-bg, #map-asia, #map-europe, #map-africa, #map-america').hide();
    return false;
}
