function getWelTime(){
	now = new Date(),hour = now.getHours() 
	if(hour < 6){document.write("凌晨好，")} 
	else if (hour < 9){document.write("早上好，")} 
	else if (hour < 12){document.write("上午好，")} 
	else if (hour < 14){document.write("中午好，")} 
	else if (hour < 17){document.write("下午好，")} 
	else if (hour < 19){document.write("傍晚好，")} 
	else if (hour < 22){document.write("晚上好，")} 
	else {document.write("夜里好!")}
}

/*hover*/
$(document).ready(function(){
/**more login hover*/
$(".pophover").bind({
  mouseover:function(){
	  $(this).children(".mypop").show();
  },
  mouseout:function(){
	  $(this).children(".mypop").hide();
  }
});

/**my center hover*/
$(".cur").bind({
  mouseover:function(){
	  $(this).css({"background":"#FFF","border":"solid 1px #ccc"}).children(".mypop").show();
  },
  mouseleave:function(){
	  $(this).css({"background":"#f5f5f5","border":"solid 1px #f5f5f5"}).children(".mypop").hide();
  }
});

/**my center hover*/
$(".shouye_btn span").bind({
  mouseover:function(){
	  if(document.getElementById("shouye_btn_id")){
	     $(this).addClass("shouye_btn_hover");
	  }
  },
  mouseout:function(){
	  if(document.getElementById("shouye_btn_id")){
	     $(this).removeClass("shouye_btn_hover");
	  } 
  }
});

/** nav top hover */
$(".nav_ct ul li").bind({
	  mouseover:function(){
		  if($(".nav_ct ul li").index($(this))==($(".nav_ct ul li").length-1)){
			  $(this).addClass("nav_last");
		  }else if($(".nav_ct ul li").index($(this)) > 0){
			  if(!$(this).attr("id"))
				  $(this).addClass("nav_hover");
		  }else{
			  $(this).addClass("nav_tg");
		  } 
	  },
	  mouseout:function(){
		  if($(".nav_ct ul li").index($(this))==($(".nav_ct ul li").length-1)){
			  $(this).removeClass("nav_last");
		  }else if($(".nav_ct ul li").index($(this)) > 0){
			  if(!$(this).attr("id"))
			   $(this).removeClass("nav_hover");
		  }else{
			  $(this).removeClass("nav_tg");
		  } 
	  }
});

/**catnav hover*/
$(".list_search_left").bind({
  mouseover:function(){
	  $(this).attr("class","search_left left");  
	  $(this).children(".left_nav_ico").attr("class","left_nav_on left");
	  $("#current").show();
  },
  mouseleave:function(){
      $(this).attr("class","list_search_left left");
      $(this).children(".left_nav_on").attr("class","left_nav_ico left");
	  $("#current").hide();
  }
});

/** nav cat hover */	
$(".left_nav_ct li").bind({
  mouseover:function(){
	  $(this).children(".cat_item").css("display","block");
	  $(this).children(".cat_parent").attr("class","cat_parenthover");
	  $(this).children(".cat_parenthover").children("span").css({"padding":"0 0 0 8px"});
  },
  mouseleave:function(){
	  $(this).children(".cat_item").css("display","none");
	  $(this).children(".cat_parenthover").attr("class","cat_parent");
	  $(this).children(".cat_parent").children("span").css({"padding":"0 0 0 10px"});
  }
});

/** notice */
$(".shop_news_title ul li").bind({
	  mouseover:function(){
		  $(this).parent().children("li").attr("class","shop_news");
		  $(this).attr("class","shop_news_hover");
		  if($(".shop_news_title ul li").index($(this)) == 0){
			   $("#shop_guarantees").show();
			   $("#shop_notices").hide();
		  }else{
			   $("#shop_guarantees").hide();
			   $("#shop_notices").show();
		  }
	  },
	  mouseout:function(){
		  //$(this).parent().children("li").children("a").removeClass("shop_news_hover");
		  //$(this).parent().children("li:first").children("a").addClass("shop_news_hover");
	  }
});

/** promotion title */
$(".index_bl02_left_title ul li").bind({
	  mouseover:function(){
		  if($(".index_bl02_left_title ul li").index($(this)) == 0){
			  $("#renqi").show();$("#renqi2").hide();
			  $("#promo").show();$("#promo2").hide();
			  $("#week").show();$("#week2").hide();
			  $("#new").show();$("#new2").hide();
			  $(this).parent().parent().attr("class","pro_title01");
			  $("#hot_good").show();
			  $("#promotion_good").hide();
			  $("#best_good").hide();
			  $("#new_good").hide();
		  }else if($(".index_bl02_left_title ul li").index($(this)) == 1){
			  $("#renqi").hide();$("#renqi2").show();
			  $("#promo").hide();$("#promo2").show();
			  $("#week").show();$("#week2").hide();
			  $("#new").show();$("#new2").hide();
			  $(this).parent().parent().attr("class","pro_title02");
			  $("#hot_good").hide();
			  $("#promotion_good").show();
			  $("#best_good").hide();
			  $("#new_good").hide();
		  }else if($(".index_bl02_left_title ul li").index($(this)) == 2){
			  $("#renqi").hide();$("#renqi2").show();
			  $("#promo").show();$("#promo2").hide();
			  $("#week").hide();$("#week2").show();
			  $("#new").show();$("#new2").hide();
			  $(this).parent().parent().attr("class","pro_title03");
			  $("#hot_good").hide();
			  $("#promotion_good").hide();
			  $("#best_good").show();
			  $("#new_good").hide();
		  }else if($(".index_bl02_left_title ul li").index($(this)) == 3){	 
			  $("#renqi").hide();$("#renqi2").show();
			  $("#promo").show();$("#promo2").hide();
			  $("#week").show();$("#week2").hide();
			  $("#new").hide();$("#new2").show();
			  $(this).parent().parent().attr("class","pro_title04");
			  $("#hot_good").hide();
			  $("#promotion_good").hide();
			  $("#best_good").hide();
			  $("#new_good").show();
		  }
	  },
	  mouseout:function(){
	  }
});

/** top title */
$("#renqi_main li").bind({
	  mouseover:function(){
		  $(this).parent().children("li").children("a").attr("class","renqi_a");
		  $(this).children("a").attr("class","renqi_ahover");
		  var index = $("#renqi_main li").index($(this))+1;
		  for(var i=1;i<6;i++){
			  if(i==index){
				  $("#renqi_pro"+i).show();
			  }else{
				  $("#renqi_pro"+i).hide();
			  }
		  }
	  },
	  mouseout:function(){
		  //$(this).parent().children("li:first").children("a").addClass("renqi_a");
		  //$(this).parent().children("li:first").children("a").addClass("shop_news_hover");
	  }
});	

/** top content */
$(".renqi_main .renqi_pro .rank_bl").bind({
	  mouseover:function(){
		  var parentele = $(this).parent();
		  if(parentele.children().index($(this)) > 0){
			  $(this).siblings().children(".rank_on2").hide();
			  $(this).siblings().children(".rank_off2").show();
			  $(this).siblings().children(".rank_on").hide();
			  $(this).siblings().children(".rank_off").show();
			  $(this).children(".rank_on").show();
			  $(this).children(".rank_off").hide();
		  }else{
			  $(this).children(".rank_on2").show();
			  $(this).children(".rank_off2").hide();
			  $(this).siblings().children(".rank_on").hide();
			  $(this).siblings().children(".rank_off").show();
		  } 
	  },
	  mouseout:function(){
	  }
});


$(".sm_list_title").bind({
	click:function(){
		if($(this).children("div").hasClass("sm_on")){
			$(this).children("div").attr("class","sm_off left");
			$(this).siblings().show();
		}else{
			$(this).children("div").attr("class","sm_on left");
			$(this).siblings().hide();
		}
		
	}
});

$("#kefudiv").bind({
	  mouseover:function(){
		  $("#online_off").css("display","none");
		  $("#online_on").css("display","block");
	  },
	  mouseleave:function(){
		  $("#online_off").css("display","block");
		  $("#online_on").css("display","none");
	  }
});

});


function ShowCartGoods()
{
	document.getElementById( 'ECS_CARTGOODS' ).style.display = '';
	var cartdiv = document.getElementById( 'ECS_CARTDIV' );
	if(cartdiv)  cartdiv.style.display = '';
}

function HideCartGoods()
{
	document.getElementById( 'ECS_CARTGOODS' ).style.display = 'none';
}

/**
* 删除购物车中商品
*/
function removeCartGoods ( goods_id )
{
	$.get('/flow.php?step=ajax_drop_goods', 'id=' + goods_id,
	function ( data )
	{
	  document.getElementById('ECS_CARTINFO').innerHTML = data;
	});
}

/*placehoder*/
(function() {
	var inp = document.createElement("input");
	window.supports = {
	placeholder: "placeholder" in inp
	}
	})();

	function bindPlaceholder(obj) {
	 var jqobj = $(obj),placeholder = jqobj.attr("placeholder");
	 if(jqobj.val() == ""){
	  jqobj.val(placeholder);
	  jqobj.addClass("placeholder");
	 }

	jqobj.bind({focus:function(){
	   if($(this).val() == placeholder) {
	     $(this).removeClass("placeholder");
	     $(this).val("");
	   }
	},
	blur:function(){
	  if($(this).val() == "") {
	    $(this).addClass("placeholder");
	    $(this).val(placeholder);
	  }
	 }
	}
	);
	}

//ҳ������
$(document).ready(function(){
if(!window.supports.placeholder){
$("input[placeholder]").each(function(){
bindPlaceholder(this);
});
}
})

/*scroll*/
var scrolltotop={
	//startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
	//scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top).
	setting: {startline:1, scrollto: 0, scrollduration:50, fadeduration:[500, 100]},
	controlHTML: '<img src="/static/img/top_bg.png" alt="回到顶部" width="32px" height="61px"/>', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
	controlattrs: {offsetx:0, offsety:50}, //offset of control relative to right/ bottom of window corner
	anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links

	state: {isvisible:false, shouldvisible:false},

	scrollup:function(){
		if (!this.cssfixedsupport) //if control is positioned using JavaScript
			this.$control.css({opacity:0}) //hide control immediately after clicking it
		var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
		if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists
			dest=jQuery('#'+dest).offset().top
		else
			dest=0
		this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
	},

	keepfixed:function(){
		var $window=jQuery(window);
		var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx ;
		var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety ;
		this.$control.css({left:controlx+'px', top:controly+'px'})
	},

	togglecontrol:function(){
		var scrolltop=jQuery(window).scrollTop()
		if (!this.cssfixedsupport)
			this.keepfixed()
		this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
		if (this.state.shouldvisible && !this.state.isvisible){
			this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
			this.state.isvisible=true
		}
		else if (this.state.shouldvisible==false && this.state.isvisible){
			this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
			this.state.isvisible=false
		}
	},
	
	init:function(){
		jQuery(document).ready(function($){
			var mainobj=scrolltotop
			var iebrws=document.all
			mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
			mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
			mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
				.css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
				.attr({title:'Scroll Back to Top'})
				.click(function(){mainobj.scrollup(); return false})
				.appendTo('body')
			if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text
				mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text
			mainobj.togglecontrol()
			$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
				mainobj.scrollup()
				return false
			})
			$(window).bind('scroll resize', function(e){
				mainobj.togglecontrol()
			})
		})
	}
}

scrolltotop.init()

