﻿//首页js
function slideSwitch() {
	var $current = $("#slideshow div.current");
	// 判断div.current个数为0的时候 $current的取值
	if ( $current.length == 0 ) $current = $("#slideshow div:last");
	// 判断div.current存在时则匹配$current.next(),否则转到第一个div
	var $next =  $current.next().length ? $current.next() : $("#slideshow div:first");
	$current.addClass('prev');
	$next.css({opacity: 0.0}).addClass("current").animate({opacity: 1.0}, 1000, function() {
			//因为原理是层叠,删除类,让z-index的值只放在轮转到的div.current,从而最前端显示
			$current.removeClass("current prev");
		});
}
$(function() {
	$("#slideshow span").css("opacity","0.7");
	$(".current").css("opacity","1.0");
	
	// 设定时间为3秒(1000=1秒)
    setInterval( "slideSwitch()", 3000 ); 
	$("#search").bind("click",function(){
	    $("#search").attr("value"," ");
		$("#search").focus();	
    });
	$("#submit").click(function(){
		if($("#username").val() == ""){
			alert("用户名不能为空");
			$("#username").focus();
			return false;
		}
		if($("#password").val() == ""){
			alert("密码不能为空");
			$("#password").focus();
			return false;
		}
		
	});
	$(":text").css({width:"150px",height:"19px"});
	$(":password").css({width:"150px",height:"19px"});
	$("#register").click(function(){
		window.open("http://www.pinsou.com/member/register/index.asp","_brank")						  
	});
	
	$("#register").mouseover(function(){
		$("#register").css("background","#666");
		$("#register").css("cursor","pointer");
	}).mouseout(function(){
			$(this).css("background","#e32d0d")
	});
	
	$("#submit").mouseover(function(){
		$("#submit").css("background","#666");
		$("#submit").css("cursor","pointer");
	}).mouseout(function(){
			$(this).css("background","#e32d0d")
	});
});


