/**
 * Tabs
// When the document loads do everything inside here ...
$(document).ready(function() {

	// When a link is clicked
	$("a.tab").click(function() {

		// switch all tabs off
		$(".active").removeClass("active");

		// switch this tab on
		$(this).addClass("active");

		// slide all content up
		$(".content").slideUp();

		// slide this content up
		var content_show = $(this).attr("title");
		$("#" + content_show).slideDown();

	});

});
 */

/**
 * Dropdown
 */
$(document).ready(function() {
	// createDropDown();

	$(".dropdown dt a").click(function() {
		$(".dropdown dd ul").toggle();
	});

	$(document).bind('click', function(e) {
		var $clicked = $(e.target);
		if (!$clicked.parents().hasClass("dropdown"))
			$(".dropdown dd ul").hide();
	});

	$(".dropdown dd ul li a").click(function() {
		var text = $(this).html();
		$(".dropdown dt a").html(text);
		$(".dropdown dd ul").hide();

		var source = $("#source");
		source.val($(this).find("span.value").html())
	});
});

function createDropDown() {
	var source = $("#source");
	var selected = source.find("option[selected]");
	var options = $("option", source);

	$("#menu-lang").append('<dl id="target" class="dropdown"></dl>')
	$("#target").append(
			'<dt><a href="#">' + selected.text() + '<span class="value">'
					+ selected.val() + '</span></a></dt>')
	$("#target").append('<dd><ul></ul></dd>')

	options.each(function() {
		$("#target dd ul").append(
				'<li><a href="#">' + $(this).text() + '<span class="value">'
						+ $(this).val() + '</span></a></li>');
	});
}

/**
 * JQuery Buttons
$(function() {
	$("button, input:submit, a", ".button").button();
	$("a", ".mybutton").click(function() {
		return false;
	});
});
*/

/**
 * Modals
 */
function display_modal() {
	$(document).ready(function() {
		$("#modal").draggable();
		$("#modal").modal({
			opacity : 60,
			overlayCss : {
				backgroundColor : "#000"
			}
		});
	});
}

/**
 * 
 */
$(function() {
	// Use this example, or...
	// $('a[@rel*=lightbox]').lightBox(); // Select all links that contains
	// lightbox in the attribute rel
	// This, or...
	// $('#gallery a').lightBox(); // Select all links in object with gallery ID
	// This, or...
	//$('a.lightbox').lightBox(); // Select all links with lightbox class
	// This, or...
	// $('a').lightBox(); // Select all links in the page
	// ... The possibility are many. Use your creative or choose one in the
	// examples above
});

