<!--
$(document).ready(function()
{
//-----------------------begin
//主导航	
	$(".hd_menu>ul>li").click(function(event){$(this).css("position","relative");$(this).find(".sub_menu").slideToggle('fast');})
	$(".hd_menu>ul>li").mouseleave(function(event){$(this).css("position","relative");$(this).find(".sub_menu").slideUp('fast');event.stopPropagation();})	
    
	$(".boxcon").mouseover(function(event){$(this).addClass("box2");})
	$(".boxcon").mouseleave(function(event){$(this).removeClass("box2");event.stopPropagation();})
	
	$(".product_all").mouseover(function(event){$(this).addClass("product_all_img");})
	$(".product_all").mouseleave(function(event){$(this).removeClass("product_all_img");event.stopPropagation();})
	
	$(".product_all_noborder").mouseover(function(event){$(this).addClass("product_all_img");})
	$(".product_all_noborder").mouseleave(function(event){$(this).removeClass("product_all_img");event.stopPropagation();})
	
	$(".leftnavi_bd2").mouseover(function(){$(this).find(".leftnavi_title").addClass('leftnavi_title2');$(this).find(".leftnavi_con").show();})
	$(".leftnavi_bd2").mouseleave(function(event){$(this).find(".leftnavi_title").removeClass('leftnavi_title2');$(this).find(".leftnavi_con").hide();event.stopPropagation();}) 
	$("#username").focus(function(){if($(this).val()=='username'){$(this).val('')}});
	$("#username").blur(function(){if($(this).val()==''){$(this).val('username')}});
	$("#username").keyup(function(){$("#topusername").hide()});
	$("#password").focus(function(){if($(this).val()=='******'){$(this).val('')}});
	$("#password").blur(function(){if($(this).val()==''){$(this).val('******')}});
	$("#password").keyup(function(){$("#toppassword").hide()});
//	$("#password").keyup(function(e){alert(String.fromCharCode(e.keyCode));});
	
//动态检测 
    $("#rusername").focus(function(){if($(this).val()==''){show_regnote('un_note','Choose a Username.')}}); 
	$("#rusername").keyup(function(){if($(this).val()!=""){show_regnote('un_note','ok.')}else{show_regnote('un_note','Choose a Username.');$(this).focus();}}); 
	
	$("#rpassword").focus(function(){if($(this).val()==''){show_regnote('pwd_note','Choose a Password.')}}); 
	$("#rpassword").keyup(function(){if($(this).val()!=""){show_regnote('pwd_note','ok.')}else{show_regnote('pwd_note','Choose a Password.');$(this).focus();}}); 
	
	$("#crpassword").focus(function(){if($(this).val()==''){show_regnote('cpwd_note','Retype your Password.')}}); 
	$("#crpassword").keyup(function(){if($(this).val()==$("#rpassword").val()){show_regnote('cpwd_note','ok.')}else{show_regnote('cpwd_note','Retype your Password.');$(this).focus();}}); 	
	$("#mail").focus(function(){if($(this).val()==''){show_regnote('mail_note','Valid email address is required to register.')}}); 
	$("#mail").keyup(function(){if($(this).val()!="" && isEmail($(this).val())){show_regnote('mail_note','ok.')}else{show_regnote('mail_note','Valid email address is required to register.');$(this).focus();}}); 	
	$("#tel").focus(function(){if($(this).val()==''){show_regnote('tel_note','Valid phone number is required to register.')}}); 
	$("#tel").keyup(function(){if($(this).val()!=""){show_regnote('tel_note','ok.')}else{show_regnote('tel_note','Valid phone number is required to register.');$(this).focus();}}); 
	
//检测重新密码
	$('#userreg').submit(function ()
	{
		if($('#rusername').val()=="")
		{			
			alert("User Name Not Null.！");
			$('#rusername').focus();
			return false;
		}		
		if($('#rpassword').val()=="")
		{			
			alert("User Password Not Null.");
			$('#rpassword').focus();
			return false;
		}
		
		
		if($('#rpassword').val()!=$('#crpassword').val())
		{			
			alert("Confirm Password Not null And Same As Password.");
			$('#crpassword').focus();
			return false;
		}
		if($('#mail').val()=="" || !isEmail($('#mail').val()))
		{			
			alert("Mail Not Null And Is Valider.");
			$('#mail').focus();
			return false;
		}
		if($('#tel').val()=="")
		{			
			alert("Tel Not Null.！");
			$('#tel').focus();
			return false;
		}	
		
		
		return true;
		
	})
	
	$('#remail').submit(function ()
	{		
		if($('#mail').val()=="" || !isEmail($('#mail').val()))
		{			
			alert("Mail Not Null And Is Valider.");
			$('#mail').focus();
			return false;
		}		
		return true;
		
	})
	
	$('#topform').submit(function ()
	{		
		if($('#username').val()=="" || $('#username').val()=='username')
		{	
		    $('#topusername').html('Enter username.');
			$('#topusername').show();
			$('#username').val('');
			return false;
		}	
		if($('#password').val()=="" || $('#password').val()=='******')
		{	
		    $('#toppassword').html('Enter password.');
			$('#toppassword').show();
			$('#password').val('');
			return false;
		}	
		
		return true;
		
	})
	
	
   
//-----------------------end
});
//检测邮件格式
function isEmail(strEmail) {
if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
return true;
else
return false;
}

function show_box(t,n,a,b)
{
   for(i=1;i<=t;i++)
   {
	  if(n==i){
	    document.getElementById(a+"_"+n).className='press';
		document.getElementById(b+"_"+n).style.display='';
	  }else{
		document.getElementById(a+"_"+i).className='';  
		document.getElementById(b+"_"+i).style.display='none';
	  }
   }
}
//ajax
function user_chk(id) {	
	var value=document.getElementById(id).value;		
	$.ajax({
		success: function (data) {			   
			if(data==0) {
				document.getElementById("username_msg").innerHTML='<font style="color:#2D7810">可以注册</font>';
			}
			if(data==1) {
				document.getElementById("username_msg").innerHTML='<font style="color:#ff0000">对不起，已注册</font>';
			}
		},
		url : '/reg/check.html',
		data: 'username='+value,
		type :"post"
	});
	return false;
}

function show_regnote(o,msg)
{
  $("#"+o).show();
  $("#"+o).html('');
  $("#"+o).html(msg);	
}
function hide_regnote(o)
{
  $("#"+o).hide();
}

-->
