	$().ready(function() {
		$("div.dropdown").hover(function() {
			$(this).find("a.choose").css("background-position","0 -20px");
			$(this).find("ul").stop().slideDown(300,function() {
				$(this).css("height","auto");
			});
		},function() {
			$(this).find("a.choose").css("background-position","0 0");
			$(this).find("ul").stop().slideUp(300,function() {
				$(this).css("height","auto");
			});
		});
		$("div#download_mp3s_and_ringtones div.send_ringtone div.dropdown ul li a").click(function() {
			$("div#download_mp3s_and_ringtones div.send_ringtone div.dropdown a.selected").removeClass("selected");
			$(this).addClass("selected");
			$(this).parent().parent().parent().find("span.default").html($(this).html());
			$("input#carrier").val($(this).attr("title"));
			if($(this).html()=="AT&amp;T (iPhone)") {
				$("div.send_ringtone div.phone_number").css("display","none");
				$("div.send_ringtone div.send").css("display","none");
				$("div.send_ringtone div.download").css("display","block");
			} else {
				$("div.send_ringtone div.phone_number").css("display","block");
				$("div.send_ringtone div.send").css("display","block");
				$("div.send_ringtone div.download").css("display","none");
			}
			$(this).parent().parent().stop().css({display:"none",height:"auto"});
			return false;
		});
		$("div#download_wallpapers div ul li:last").css("background","none");
		$("div#download_mp3s_and_ringtones div ul li:last").css("background","none");
		$("div.send_ringtone a.close").click(function() {
			$(this).parent().fadeOut(300);
			return false;
		});
		$("div.sent_ringtone a.close").click(function() {
			$(this).parent().fadeOut(300);
			return false;
		});
		$("a.get_ringtone").click(function() {
			$("div.send_ringtone").fadeIn(300);
			return false;
		});

		// Login Pages
		$("div.message a.login_form").click(function() {
			$("div.message").fadeOut(150,function() {
			  $("div.form").fadeIn(150);
			});		
			return false;
		});
		$("div.form a.forgot_password").click(function() {
			$("div.form").fadeOut(150,function() {
			  $("div.forgot").fadeIn(150);
			});
			return false;
		});
		$("div.forgot a.cancel").click(function() {
			$("div.forgot").fadeOut(150,function() {
			  $("div.form").fadeIn(150);
			});
			return false;
		});
		$("div.send_msg a.login").click(function() {
			$("div.send_msg").fadeOut(150,function() {
			  $("div.form").fadeIn(150);
			});
			return false;
		});		
		$("div.forgot a.send_password").click(function() {
			var email = $("input#email").val();
			$("div.forgot div.error_message").css("display","none");
			$.ajax({
			   type: "POST",
			   url: "/cx/ajax/send-password.php",
			   async: false,
			   data: "email="+email,
			   success: function(msg){
				 if (msg==1) {
					$("div.forgot").fadeOut(150,function() {
					  $("div.send_msg").fadeIn(150);
					});	
				 } else {
			 	 	$("div.forgot div.error_message").css("display","block");
				 }
			   },
			   error: function(msg) {																											
			   		$("div.forgot div.error_message").css("display","block");			
			   }
			});			
			return false;
		});		
		$("div.form a.login").click(function() {
			$("form#game_login_form").submit();
			return false;
		});
				
		
		
	});