//input焦点css类转换
$(function(){
	if($("#login-email-address").val()){
		$("#login-email-address").focus();
	}else{
		$("#login-password").focus();
	}
	
	//登陆密码        用户名
	$("#login-password").focus(function(){
			  $(this).addClass("focus");
		}).blur(function(){
			 $(this).removeClass("focus");
		});
	$("#login-email-address").focus(function(){
		  $(this).addClass("focus");
	}).blur(function(){
		 $(this).removeClass("focus");
	});
	
	
	//切换城市
	var $guides_change =$('#guides-city-change');
	var $guides_list = $('#guides-city-list');
	$guides_change.click(function(){
		$guides_list.toggle();
	});
	
});

$(function(){
	//键盘事件
	$("#deal-buy-quantity-input").keyup(function(){
		var price = $("#deal-buy-price").html();
		var account = $("#deal-buy-quantity-input").val();
		if (!account){
			account = 1;
		}
		var total = account*price;
		$("#deal-buy-total").html(total);
		$("#deal-buy-total-t").html(total);
	});
	//鼠标事件
	$("#deal-buy-quantity-input").hover(function(){
		var price = $("#deal-buy-price").html();
		var account = $("#deal-buy-quantity-input").val();
		checkInt($("#deal-buy-quantity-input"),"购买数量");
		if (!account){
			account = 1;
		}
		var total = account*price;
		$("#deal-buy-total").html(total);
		$("#deal-buy-total-t").html(total);
	});
	//检查输入格式  需要修改
	//参数：需要检测的对象；显示在警告窗口中的输入项名。
//	function checkInt(obj, objName){ 
//	  var flag = 0;
//	  var num = "0123456789";
//	  for(var i = 0; i < (obj.value.length); i++){
//	    tmp = obj.value.substring(i, i + 1);
//	    if(num.indexOf(tmp) < 0){
//	      flag++;
//	    }
//	  }
//	  if(flag > 0){
//	    alert(objName + "必须输入正整数！");
//	    obj.focus();
//	    obj.select();
//	    return false;
//	  }
//	  return true;
//	}
});


function signup(){
	$(":input:not(:checked,:submit)").focus(function(){
		$(this).addClass("focus");
	}).blur(function(){
		$(this).removeClass("focus");
	});
};
