function clearMe(formfield, defaultValue) {
	if ((defaultValue == null) || (defaultValue == undefined))
		defaultValue = formfield.defaultValue;
	if (formfield.value == defaultValue)
		formfield.value = "";
}
function restoreMe(formfield, defaultValue) {
	if ((defaultValue == null) || (defaultValue == undefined))
		defaultValue = formfield.defaultValue;
	if (formfield.value.replace(/^\s+|\s+$/g, "") == "")
		formfield.value = defaultValue;
}

 $(document).ready(function() {
	$(".dropdown dt a").click(function() {
		$(".dropdown dd ul").toggle();
	});
				
	$(".dropdown dd ul li a").click(function() {
		var text = $(this).html();
		$(".dropdown dt a span").html(text);
		$(".dropdown dd ul").hide();
		$("#result").html("Selected value is: " + getSelectedValue("sample"));
	});
				
	function getSelectedValue(id) {
		return $("#" + id).find("dt a span.value").html();
	}

	$(document).bind('click', function(e) {
		var $clicked = $(e.target);
		if (! $clicked.parents().hasClass("dropdown"))
			$(".dropdown dd ul").hide();
	});

   $('area').each(function(){
	  $(this).qtip({ 
		 content: $(this).attr('value'),
		 hide: {fixed: true, effect: 'fade'},
		 position: {target: 'mouse'},
		 style: {name: 'blue'}
	  });
	});
	
	$(".toggle_container").hide();
	$(".trigger").toggle(function(){
		$(this).addClass("active"); 
		}, function () {
		$(this).removeClass("active");
	});
	$(".trigger").click(function(){
		$(this).next(".toggle_container").slideToggle(200);
	});
});
