jQuery(document).ready(function() {
	jQuery(".cat-item").each(function() {
		var nav_c = jQuery(this);
		if (jQuery(this).find(".nav") != undefined) {
			jQuery(this).hover(
					function() { nav_c.find(".cat-item_list").show(); /*css("opacity", " 1")*/ },
					function() { nav_c.find(".cat-item_list").hide(); }
			)
			jQuery(nav_c.find(".cat-item_list")).hover(
					function() { jQuery(this).show(); /*css("opacity", " 1")*/ },
					function() { jQuery(this).hide(); }
			)
		}
		jQuery(".nav:last").css("border-right", "none");
	});
	//图片划过改变透明度
	ChangeGBfade();
	//切换语言
//	$("#top dl dt").click(function() {
//	$("#top dd").show("fast");
//	});

//	$("#top dl dd a").mouseover(function(){
//	$("#top dl dd").css("display","block");
//	});
//	$("#top dl").mouseout(function(){
//	$("#top dl dd").hide();
//	});

	//nav-bg
	/*$('.cat-item').hover(
			function() {
				$(this).addClass("nav_bg");
				$(this).find("a.nav").css("color", "#fff");

			},
			function() {
				$(this).removeClass("nav_bg");
				$(this).find("a.nav").css("color", "#333");
			}
	);*/
	var Sys = {};
	var ua = navigator.userAgent.toLowerCase();
	var s;
	(s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] :
		(s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] :
			(s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] :
				(s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] :
					(s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;
					//gallery页面属性筛选,边框控制
					/*$(".Fabric dd").each(function() {
						if (Sys.ie) {
							var lis = $(this).find("li").length;
							if (lis > 9) {
								$(this).css("border", "1px solid #ccc");
								$(this).css("height", "143px");
							}
						}
						else {
							var height = parseInt($(this).css("height"));
							if (height > 148) {
								$(this).css({ "height": "148px", "border": "1px solid #ccc" });
							}
						}
					});
					$("#left-menu dl:has('dd')").addClass("hasdd");
					//会员中心左菜单
					jQuery("a.menus").click(function() { //When trigger is clicked...
						jQuery(this).parent().find("ul").slideToggle('fast'); //Drop down the subnav on click
					});
					*/
})
function ChangeGBfade() {
	if ($(".GBfade") == null) return;
	$(".GBfade").mouseover(
			function() {
				$(this).stop(true).animate({ opacity: 0.7 }, { duration: 205 })
			});
	$(".GBfade").mouseout(function() {
		$(this).stop(true).animate({ opacity: 1 }, { duration: 205 })
	}
	)
}
//搜索本框失去焦点文
function inputOnBlur(a, b) {
	a = "#" + a;
	if (jQuery(a).val() == "") {
		jQuery(a).val(b);
		jQuery(a).css("color", "#999999")
	}
}
function inputOnKeyDown(a, b) {
	a.keyCode == "13" && jQuery("#" + b)[0].click()
}
function inputOnFocus(a) {
	a = "#" + a;
	var b = jQuery(a).css("color");
	if (b == "rgb(153, 153, 153)" || b == "#999999") {
		jQuery(a).val("");
		jQuery(a).css("color", "#000000")
	}
}
function GoSearch() {
	var key = document.getElementById("SearchText").value;
	if ($.trim(key) == "") return;
	if (key != "") {
		key = jQuery.trim(key);
		jQuery("#go_search").submit();
	}
}

//时间倒计时
var totaltime;
var nowtime;
jQuery(function(){
	jQuery.ajax({
		type:'POST',
		url:'/time.php?time=1',
		success:function(response){
			totaltime=parseInt(response);
			nowtime = window.setInterval(SetRemainTime, 1000); 
		}
	});
});

function SetRemainTime(){

	if(totaltime>0){
		totaltime = totaltime - 1;
		var second = Math.floor(totaltime % 60);             // 计算秒     
		var minite = Math.floor((totaltime / 60) % 60);      //计算分 
		var hour = Math.floor((totaltime / 3600) % 24);      //计算小时 
		var day = Math.floor((totaltime / 3600) / 24);        //计算天 
		jQuery("#days").html(day);
		jQuery("#hour").html(hour);
		jQuery("#minute").html(minite);
		jQuery("#seconds").html(second);
	}else{
		jQuery("#days").html(0);
		jQuery("#hour").html(0);
		jQuery("#minute").html(0);
		jQuery("#seconds").html(0);
	}
}


