function ShowFullTree( el ) {
	if($(el).next('div').attr('tree_shown') != 'true') {
		$(el).next('div').show().attr('tree_shown','true').find('.submenu_system').show().prev('div').children('p').children('a').attr('class','mmblue').attr('shown','true');
	} else {
		$(el).next('div').hide().attr('tree_shown','false').find('.submenu_system').hide().prev('div').children('p').children('a').attr('class','mmgrey').attr('shown','false');
	}
}

function ShowHideSubMenu( menu_id , set_act ) {
	
	is_show = $('#menu' + menu_id).attr('shown');
	menu_content = $('#menu' + menu_id).parent('p').parent('div').next('div').html();
	
	if(is_show != 'true') {
		$('#menu' + menu_id).attr('shown','true');
		
		if(menu_content == '') {
			
			$('#menu' + menu_id).parent('p').parent('div').next('div').load("/cache/products/typemenu"+ menu_id +".shtml")
		}
		
		if(set_act) {
			$('#menu' + menu_id).attr('class','mmblue');
		}
		$('#menu' + menu_id).parent('p').parent('div').next('div').show();
	} else {
		HideMenu( menu_id , set_act );
	}
}


function HideMenu( menu_id, deact ) {
	$('#menu' + menu_id).attr('shown','false');
	if(deact) {
		$('#menu' + menu_id).attr('class','mmgrey');
	}
	$('#menu' + menu_id).parent('p').parent('div').next('div').hide();
}

function GoToUrlFromInner( url, tab ) {
	setCookie('selectedTab', tab, 365);
	window.location = url;
}

function setCookie(c_name,value,expiredays) {
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name + "=" + escape(value) +
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString() +
	";path=/");
}

function getCookie(c_name) {
	if (document.cookie.length>0) {
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1) { 
			c_start=c_start + c_name.length+1; 
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		} 
	}
	return "";
}

function tabbind() {
	$('.topmenu').find('a').click(
		function(){
			
			SetTabActive( $(this).attr('id') );
			setCookie('selectedTab',$(this).attr('id'),365);
			
			//var pechenie = getCookie($(this).attr('id') + 'location');
			//if(pechenie != "") {
			//	window.location = pechenie;
			//} else {
				$('table [id$="content"]').hide();
				$('#'+ $(this).attr('id') +'content').show();
			//}
		}
	);
}

function SetTabActive( id ){
	
	$('.topmenu').find(".act").removeClass("act");
	$('#' + id).parent('div').addClass("act");
	
	
}

function CarouselPopUp(filename) {
	alert(1);
	return false;
}
