function openVerMenu(mid){
	if($("#vsubmenu_"+mid).css("display")=="none"){
		$("#vsubmenu_"+mid).show(200);
		$("#vmenu_group_"+mid).css("background","#f1f4f0");
		saveOpenedMenu(mid,1);
	}else{
		$("#vsubmenu_"+mid).hide(200);
		$("#vmenu_group_"+mid).css("background","none");
		saveOpenedMenu(mid,0);
	}
}
function saveOpenedMenu(mid,stat){
	 $.ajax({
	   type: "get",
	   url: saveMenuScript,
	   data: "mid="+mid+"&stat="+stat,
	   success: function(msg){
		 void(0);
	   }
	 });
}

window.onload=function() {
	$('input[type=text][title!=""]').each(function() {
	if ($.trim($(this).val()) == '') $(this).val($(this).attr('title'));
	if ($(this).val() == $(this).attr('title')) $(this).addClass('exampleText');
	}).focus(switchText).blur(switchText);
	$("a.zoom").fancybox({
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	false
	});
	$('.dev').hide();
	$('#dev0').show();
	showTopMenuSub();

	$('a.new-window').click(function(){
		window.open(this.href);
		return false;
	});

}
function switchText(){
	if ($(this).val() == $(this).attr('title'))
		$(this).val('').removeClass('exampleText');
	else if ($.trim($(this).val()) == '')
		$(this).addClass('exampleText').val($(this).attr('title'));
}

var devc=1;		
function dev(){
	$('.dev').hide();
	if(devc<cdev){$('#dev'+devc).show();devc++;
	}else{
		$('#dev0').show();
		devc=1;
	}
}

function showTopMenuSub(){
	$('li.mainLevelLi').each(function(){
		var div = $($(this).children('div').children('div'));
		$(this).bind("mouseenter",function(){
			div.show();	
			$(this).addClass('openMenu');
		}).bind("mouseleave",function(){
			div.hide();
			$(this).removeClass('openMenu');
		});
	});
	$('ul.topMenusub li').each(function(){
		var div = $($(this).children('div'));
		$(this).bind("mouseenter",function(){
			div.show();	
			$(this).addClass('openMenu');
		}).bind("mouseleave",function(){
			div.hide();
			$(this).removeClass('openMenu');
		});
	});
	return false;
}

function make_twit(link,urla,intro){
	$.ajax({
		url : link,
		data : { urla:urla,intro:intro,action:'twitter_message' },
		type : 'post',
		success : function(msg){
			window.location = msg;
			return false;
		}
	});
}
function ajax_sendnews(link, container, value, capcha) {
	if(value != ''){
		$.ajax({
			url : link,
			data : { email:value,action:'asdsa',capcha:capcha },
			type : 'post',
			success : function(msg){
				$('#'+container).html(msg).fadeIn(100);
				$('#'+container).fadeOut(10000);
			}
		});
	}
}
function disableEnterKey(e)
{
	 var key;
	 if(window.event)
		  key = window.event.keyCode;     //IE
	 else
		  key = e.which;     //firefox
	 if(key == 13){
			$('#sendnews a').trigger('click');
		return false;
	 }else
		  return true;
}
