$(document).ready(function()
{		
	//顶部登录
	//$.get(ajaxURL, {"act":"toploginform"},function (data,textStatus){$("#J_welcome").html(data);});
 	$.getJSON(ajaxURL, { act: "ajax_toploginform"}, function(json){
		if (json.status==0){
			alert(json.content);
		}else if (json.status==1){
			$("#J_welcome").html(json.content);
		}else{
			disapperTooltip("remind","未知错误");
		}
	});
	//退出
 	$('.J_user_logout').live('click',function() {
		 $.getJSON(ajaxURL, { act: "ajax_logout"}, function(json){
			if (json.status==0){
				disapperTooltip("remind",json.content);
			}else if (json.status==1){
				disapperTooltip("success",json.content);
					
						setTimeout(function () { 
							window.location.reload();
						}, 1800);
			}else{
				disapperTooltip("remind","未知错误");
			}
		});
	});
	//点击登录
	$('.J_user_login').live('click',function() {
		$(".modal,.modal_backdrop").remove();
		user_login_show();
	});
	//点击注册
	$('.J_user_reg').live('click',function() {
		$(".modal,.modal_backdrop").remove();
		user_reg_show();
	});
	//点击找回密码
	$('.J_user_findpwd').live('click',function() {
		$(".modal,.modal_backdrop").remove();
		user_findpwd_show();
	});
	//登录操作
	function user_login_show(){
		 var UUDialog = $(this).dialog({
		        title: false,
        		loading: true,
				footer: false,
				header: false,
				border: false,
				backdrop: false
		});
		 $.getJSON(ajaxURL, { act: "ajax_user_login"}, function(json){
					if (json.status==0){
						UUDialog.hide();
						disapperTooltip("remind", json.content);
					}else if (json.status==1){
						UUDialog.hide();
						var LoginDialog = $(this).dialog({
								title: false,
								content:json.content,
								footer: false,
								header: false,
								border: false,
								innerPadding: false,
								backdrop: true
						});
					}else{
						UUDialog.hide();
						disapperTooltip("remind","未知错误");
					}
		});
	}
	//注册操作
	function user_reg_show(){
		 var UUDialog = $(this).dialog({
		        title: false,
        		loading: true,
				footer: false,
				header: false,
				border: false,
				backdrop: false
		});
		 $.getJSON(ajaxURL, { act: "ajax_user_reg"}, function(json){
					if (json.status==0){
						UUDialog.hide();
						disapperTooltip("remind", json.content);
					}else if (json.status==1){
						UUDialog.hide();
						var regDialog = $(this).dialog({
								title: false,
								content:json.content,
								footer: false,
								header: false,
								border: false,
								innerPadding: false,
								backdrop: true
						});
					}else{
						UUDialog.hide();
						disapperTooltip("remind","未知错误");
					}
		});
	}
	//注册操作
	function user_findpwd_show(){
		 var UUDialog = $(this).dialog({
		        title: false,
        		loading: true,
				footer: false,
				header: false,
				border: false,
				backdrop: false
		});
		 $.getJSON(ajaxURL, { act: "ajax_user_findpwd"}, function(json){
					if (json.status==0){
						UUDialog.hide();
						disapperTooltip("remind", json.content);
					}else if (json.status==1){
						UUDialog.hide();
						var regDialog = $(this).dialog({
								title: false,
								content:json.content,
								footer: false,
								header: false,
								border: false,
								innerPadding: false,
								backdrop: true
						});
					}else{
						UUDialog.hide();
						disapperTooltip("remind","未知错误");
					}
		});
	}
	//监听表单单选（单项目。单选项）
	$('.imgchecked_txt').live('click',function() {
		 checkedinput=$(this).find("input");
			v=checkedinput.val();
			if (v=='1')
			{
				checkedinput.val(0);
				$(this).removeClass('select');
			}
			else
			{
				checkedinput.val(1);
				$(this).addClass('select');
			}
		});
});


//模拟下拉
		function ShowMenu(J_click,input_id,input_cn,showID)
		{
			$(J_click).live('click',function() {
				$(J_click).blur();
				//$(menuID).parent("div").css("position","relative");
				$(showID).slideToggle("fast");
				//生成背景
				$(J_click).parent("div").before("<div class=\"menu_bg_layer\"></div>");
				$(".menu_bg_layer").height($(document).height());
				$(".menu_bg_layer").css({ width: "100%", position: "fixed",left: "0",top: "0","z-index": "0"});
				//生成背景结束
				$(showID+" li").live('click',function() {
					$(J_click).text($(this).attr("title"));
					$(input_id).val($(this).attr("id"));
					$(input_cn).val($(this).attr("title"));
					$(".menu_bg_layer").remove();
					$(showID).hide();
					//$(menuID).parent("div").css("position","");	
					$(this).css("background-color","");		
					});
					$(".menu_bg_layer").click(function(){
						$(".menu_bg_layer").remove();
						$(showID).hide();
					});
			});
		}