var common = common ? common : new Object();

common.grey_css_inactive = {"color" : "#a0a0a0", "font-style" : "italic"};
common.grey_css_active = {"color" : "#000000", "font-style" : "normal"};
common.grey_texts = new Array();

common.add_grey_text = function(element_id, text)
{
	common.grey_texts[element_id] = text;
	$("input#" + element_id).css(common.grey_css_inactive).val(text).focus(function() {
		if ( jQuery.trim($(this).val()) == common.grey_texts[element_id] )
		{
			$(this).val("");
		}
		$(this).css(common.grey_css_active);
	}).blur(function() {
		if ( jQuery.trim($(this).val()) == "" )
		{
			$(this).val(common.grey_texts[element_id]).css(common.grey_css_inactive);
		}
	});
}

common.jonbox_open_img = function(img_src)
{
	$("#jonbox_content").addClass("jonbox_content_white");
	return jonbox_open_img(img_src);
}


$(document).ready(function() {
	$("#nav > ul > li").hover(function() {
		var pos = $("a", this).position();
		var off = $("a", this).height();
		$("ul", this).css({
			  "display" : "block"
			, "left" : pos.left + "px"
			, "top" : (pos.top + off) + "px"
		});
	}, function() {
		$("ul", this).css("display", "none");
	});
	$("#bus_nav > ul > li").hover(function() {
		var pos = $("a", this).position();
		var off = $("a", this).height();
		$("ul", this).css({
			  "display" : "block"
			, "left" : pos.left + "px"
			, "top" : (pos.top + off) + "px"
		});
	}, function() {
		$("ul", this).css("display", "none");
	});
	$("a.coming_soon, button.coming_soon").click(function() {
		jonbox_info("This feature and many others will be enabled soon. Please help YourNight gain user content by inviting everyone you know. This will not only provide a better online experience, it could potentially put money in your pocket if your referrals become GOLD MEMBERS. <br \/><br \/><a href='invite.php'>Invite your friends here<\/a>", "<b style='font-size: 16px'>Coming Soon</b>");
		return false;
	});
	$("a.coming, button.coming").click(function() {
		jonbox_info("This feature and many others will be enabled soon. Please help YourNight gain user content by inviting everyone you know. This will not only provide a better online experience, it could potentially put money in your pocket if your referrals become GOLD MEMBERS. <br \/><br \/><a href='invite.php'>Invite your friends here<\/a>", "<b style='font-size: 16px'>Coming Soon</b>");
		return false;
	});
	$("a.coming_soon_pl").click(function() {
		jonbox_open_special("coming_soon_container");
		return false;
	});
	$("#jonbox_titlebar img").click(function() {
		$("#jonbox_content").removeClass("jonbox_content_white");
	});
	$("#jonbox_jblock").click(function() {
		$("#jonbox_content").removeClass("jonbox_content_white");
	});
	var nav_offset = $("#navigation").offset();
	$("#navigation ul li").each(function() {
		var left = $("a.Nav", this).offset().left - nav_offset.left;
		var width = $("a.Nav", this).innerWidth();
		$("div.Navdrop", this).css("left", left + "px");
		$("div.NavBlack", this).css("left", (left + 1) + "px").css("width", width + "px");
	});
});
