﻿ //var remainSeconds,remainSeconds_1155,remainSeconds_1163;
 var remainSeconds_home;
 var timeObj_home;
 $(document).ready(function() {
		remainSeconds_home = parseInt($("#leftSeconds_home").html()); 
		//timeObj_home = window.setInterval(remainTime_home, 100);
	 	setRemainTime();
	 	$("#button_cart_div").load("/charge/getCartProNumJquery.jsp");
 });

 function setRemainTime(){
	 	var proIdStr=$("#proIdStrDiv").html();
	 	if(proIdStr===null){
	 		
	 	}else{
		 	if(typeof proIdStr!="undefined"&&proIdStr!=''){
			 	var proIdStrArr=proIdStr.split(',');
			 	for(var i=1,n=proIdStrArr.length;i<n;i++){
			 		var proId = proIdStrArr[i];
			 		
			 		if(typeof proId!="undefined"&&proId!=''){
			 			if(proId!='0'){
			 				timeObj=window.setInterval("remainTime("+proId+")", 1000);
			 			}
			 		}
				}
			}
	 	}
 }
 function remainTime(proId) {
  var remainSeconds=parseInt($("#leftSeconds_"+proId).html());
  if (remainSeconds > 0) {
	   remainSeconds = remainSeconds - 1;
	   $("#leftSeconds_"+proId).html(remainSeconds);
	   var ss = Math.floor(((remainSeconds) - (parseInt(remainSeconds)))*10);
	   var second = Math.floor(remainSeconds % 60);                 
	   var minite = Math.floor((remainSeconds / 60) % 60);      
	   var hour = Math.floor((remainSeconds / 3600) % 24);      
	   var day = Math.floor((remainSeconds / 3600) / 24);       
	   $("#remainTime_"+proId).html("<span class=\"f18t\">"+day+"</span><span class=\"f12b\">天</span><span class=\"f18t\">"+hour+"</span><span class=\"f12b\">时</span><span class=\"f18t\">"+minite+"</span><span class=\"f12b\">分</span><span class=\"f18t\">"+second +"</span><span class=\"f12b\">秒</span>");
  } else {
   		//window.clearInterval(timeObj);
  }
 }
 function remainTime_home() {
  if (remainSeconds_home > 0) {
   remainSeconds_home = remainSeconds_home - 0.1;
   var ss = Math.floor(((remainSeconds_home) - (parseInt(remainSeconds_home)))*10) ;
   var second = Math.floor(remainSeconds_home % 60);                 
   var minite = Math.floor((remainSeconds_home / 60) % 60);      
   var hour = Math.floor((remainSeconds_home / 3600) % 24);      
   var day = Math.floor((remainSeconds_home / 3600) / 24);       
   $("#remainTime_home").html("<span class=\"f18t\">"+day+"</span><span class=\"f12b\">天</span><span class=\"f18t\">"+hour+"</span><span class=\"f12b\">时</span><span class=\"f18t\">"+minite+"</span><span class=\"f12b\">分</span><span class=\"f18t\">"+second + "."+ss+"</span><span class=\"f12b\">秒</span>");
  } else {
   	window.clearInterval(timeObj_home);
  }
 }
 
 
 function getBodyTop(){
		var bodyTop = 0;  
		var scrollHeight=0;
		var clientHeight = 0;
		if (typeof window.pageYOffset != 'undefined') {  
			bodyTop = window.pageYOffset; 
			clientHeight = document.documentElement.clientHeight;
			scrollHeight= document.documentElement.scrollHeight;
		}else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat'){  
			bodyTop = document.documentElement.scrollTop;  
			clientHeight = document.documentElement.clientHeight;
			scrollHeight= document.documentElement.scrollHeight;
		}else if (typeof document.body != 'undefined') {  
			bodyTop = document.body.scrollTop;  
			clientHeight = document.body.clientHeight;
			scrollHeight= document.body.scrollHeight;
		}
		return bodyTop;
}
var IO = Y = IO, H = 0, IE6;
var IO3 = document.getElementById('right_window_backtotop');
IE6 = window.ActiveXObject && !window.XMLHttpRequest;
if(IE6){
	while (Y) { H += Y.offsetTop; Y = Y.offsetParent };
	if (IE6){
	
		var bodyTop=getBodyTop();
		if(bodyTop>1179){
			IO3.style.cssText = "display:block;z-index:998;position:absolute;right:0;bottom:0;top:"+bodyTop;			
		}else{
			IO3.style.cssText = "display:none;z-index:998;position:absolute;right:0;bottom:0;top:"+bodyTop;
		}
	}
 window.onscroll = function() {
 	var d = document, s = Math.max(d.documentElement.scrollTop, document.body.scrollTop);
 	if (!IE6){ IO.style.position = IO.fix ? "" : "fixed";}
 	if(IE6){
 		var bodyTop=getBodyTop();
			if(bodyTop>1179){
				IO3.style.cssText = "display:block;z-index:998;position:absolute;right:0;bottom:0;top:"+bodyTop;			
			}else{
				IO3.style.cssText = "display:none;z-index:998;position:absolute;right:0;bottom:0;top:"+bodyTop;
			}
 	}
 	IO.fix = !IO.fix;
 	
	};
	try { document.execCommand("BackgroundImageCache", false, true) } catch (e) { };
}else{
	_is_show_800_nav=false;
	_is_hidden_800_nav=false;
	window.onscroll = function() {
 	var bodyTop = 0;  
		var scrollHeight=0;
		var clientHeight = 0;
		if (typeof window.pageYOffset != 'undefined') {  
			bodyTop = window.pageYOffset; 
			clientHeight = document.documentElement.clientHeight;
			scrollHeight= document.documentElement.scrollHeight;
		}else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat'){  
			bodyTop = document.documentElement.scrollTop;  
			clientHeight = document.documentElement.clientHeight;
			scrollHeight= document.documentElement.scrollHeight;
		}else if (typeof document.body != 'undefined') {  
			bodyTop = document.body.scrollTop;  
			clientHeight = document.body.clientHeight;
			scrollHeight= document.body.scrollHeight;
		}
		if(bodyTop>1179){
			_is_show_800_nav=true;
		}
		if(bodyTop<=1179){
			_is_hidden_800_nav=true;
		}	
		if(_is_show_800_nav){
				$("#right_window_backtotop").css({'display':'block','position':'fixed','right':'0','bottom':'0'});
				_is_show_800_nav=false;
		}
		if(_is_hidden_800_nav){
			$("#right_window_backtotop").css({'display':'none','position':'fixed','right':'0','bottom':'0'});
			_is_hidden_800_nav=false;
		}
	};
}
 
