/*
$(function() {
	$('li').children('ul').hide();
	
	$('li:has(ul)').children('a').click(
		function() {
			// $(this).parent('li').children('ul').toggle();
			$(this).parent('li').children('ul').slideToggle();
			return false;		
		
		}
	);
	
	$('html').removeClass('js');
	
	
	$('a.on').parent('li').children('ul').show();
	$('a.on').parent('li').parent('ul').show();

});
*/

$(function() {
	$('li').children('ul').hide();
	
	//$('#jq_click_show_hide_menu > li').children('ul').hide();
	
	$('li:has(ul)').children('a').click(

	//$('#jq_click_show_hide_menu > li:has(ul)').children('a').click(

		function() {
			$(this).parent('li').children('ul').toggle("100");
			//$(this).parent('li').children('ul').slideToggle();
			return false;
		}
	);
	
	$('html').removeClass('js');
	
	
	$('a.on').parent('li').children('ul').show();
	$('a.on').parent('li').parent('ul').show();

});


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());
	return false;
}

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 toggleVisibility(id, imgid, openimg, openmsg, closeimg, closemsg) {
	var e = document.getElementById(id);
	var img = document.getElementById(imgid);
	var acron = document.getElementById(imgid+"_acronym");
	
	var status=getCookie('block_'+id+'_status');

	if(e.style.visibility == 'visible'){
		e.style.visibility = 'hidden';
		e.style.display='none';
		img.setAttribute("src", openimg);
		img.setAttribute("alt", openmsg);
		acron.setAttribute("title", openmsg);
		setCookie('block_'+id+'_status','hidden',30);
	} else {
		e.style.visibility = 'visible';
		e.style.display='block';
		img.setAttribute("src", closeimg);
		img.setAttribute("alt", closemsg);
		acron.setAttribute("title", closemsg);
		setCookie('block_'+id+'_status','visible',30);
	}
	return false;
}




/*
function getVisibility(id,openlink,closelink) {
	var elem=document.getElementById(id);
	if (document.getElementById(id).currentStyle)
		var state = document.getElementById(id).currentStyle[visibility];
	else if (window.getComputedStyle)
		var state = document.defaultView.getComputedStyle(document.getElementById(id),null).getPropertyValue(visibility);
	if(state=="none") document.write()
}
*/