$(document).ready( function(){
	accordion();
	bookmarkMe();
	printPage();
});


/*accordion menu function*/
function accordion() {
		//hide the all of the element with class msg_body
	$(".acc-content").hide();
	$(".acc-content:eq(0)").show();
	$("#kui-accordion h3").click(function(e)
    {
		e.preventDefault();		
		 $(this).toggleClass("active");
		 $(this).siblings("h3").removeClass("active");
		 $(this).next(".acc-content").slideToggle('medium').siblings(".acc-content").slideUp("medium");
		 //$('html, body').animate({ scrollTop: 0 }, 'medium');
	});
}


function bookmarkMe() { //bookmark function
	// add a "rel" attrib if Opera 7+
	if(window.opera) {
		if ($("a.bookmark").attr("rel") != "") { // don't overwrite the rel attrib if already set
			$("a.bookmark").attr("rel","sidebar");
		}
	}
	$("a.bookmark").click(function(event) {								 
		event.preventDefault(); // prevent the anchor tag from sending the user off to the link
		var url=window.location;
		var title=$('#leftnav ul li.selected a:first').attr('title');
		
		if (window.sidebar) { // Mozilla Firefox Bookmark
			window.sidebar.addPanel(title, url,"");
		}
		else if( window.external ) { // IE Favorite
			window.external.AddFavorite( url, title);
		}
		else if(window.opera) { // Opera 7+
			return false; // do nothing - the rel="sidebar" should do the trick
		}
		else { // for Safari, Konq etc - browsers who do not support bookmarking scripts
			 alert('Unfortunately, this browser does not support the requested action,'
			 + ' please bookmark this page manually.');
		}
	});
}

function printPage() {	//print page function
	$("a.print").click(function(){
		window.print();
	});
}
