﻿function oc(ii) {
	var alldivTitle = document.getElementById("alltitle").getElementsByTagName("li");
	var alldiv = document.getElementById("all").getElementsByTagName("div");
	for ( var i = 0; i < alldiv.length; i++) {
		if ((i + 1) == parseInt(ii)) {
			alldivTitle[i].className = "tab_menu_li1";
			alldiv[i].style.display = "block";
		} else {
			alldivTitle[i].className = "tab_menu_li2";
			alldiv[i].style.display = "none";
		}
	}
}

function fillNum(){
 	var selected_num = jQuery('#selected_num option:selected').text();
 	var selected_price = jQuery("#last_price").val();
	if (selected_num.length == 0) selected_num = '0';
 	jQuery("#last_selected_price").html((parseInt(selected_num) * parseFloat(selected_price)).toFixed(2));
 }
 
 function loadQuantity(){
 	var selected_num = jQuery("#last_num").val();
 	var blank = "&nbsp;&nbsp;"
 	jQuery("#selected_num").html("");
 	if(selected_num > 0){
 		if(selected_num > 10) selected_num = 10;
 		for(var i = 1;i < (parseInt(selected_num) + 1);i++){
 			if(i == 10) blank = "";
 			jQuery("#selected_num").append("<option value=" + i + ">" + i + blank + "</option>");
 		}
 		window.setTimeout('fillNum()', 200);
 	}else{
 		jQuery("#selected_num").append("<option>0&nbsp;&nbsp;</option>");
 	}
 }
 
 function small_size_onmouseout(obj,p_size){
 	if(p_size != before_small_size)
 		obj.className = "product_n_hui";
 }
 
 function small_size_onmouseover(obj){
 	obj.className = "product_n_red";
 }
 
 function small_image_onmouseout(obj,small_image_skuid){
	 	if(small_image_skuid != before_small_image_skuid){
	 		obj.className = "product_n_hui";
	 		loadBigImage(before_small_image_skuid);
	 		loadBigImageS();
	 	}
	 }
	 
 //只是切换大图 其他不做变化
 function small_image_onmouseover(obj,small_image_skuid){
 	obj.className = "product_n_red";
 	loadBigImage(small_image_skuid);
 }
 
var target_end=[];
var time_id=[];
var end_date;
function show_date_time_0(){
    setTimeout("show_date_time_0()", 1000);
	//标识 是否已经到期
	jQuery("#last_time_0").val(0);
    var today = new Date();
    var timeold = target_end[0] - today.getTime();
    
    var sectimeold = timeold/1000;
    var secondsold = Math.floor(sectimeold);
    var msPerDay = 24 * 60 * 60 * 1000;
    var e_daysold = timeold/msPerDay;
    var daysold = Math.floor(e_daysold);
    var e_hrsold = (e_daysold-daysold) * 24;
    var hrsold = Math.floor(e_hrsold);
    var e_minsold = (e_hrsold-hrsold) * 60;
    var minsold = Math.floor((e_hrsold - hrsold) * 60);
    var seconds = Math.floor((e_minsold - minsold) * 60);
    
   	if (daysold < 0) {
      		jQuery("#" + time_id[0]).html("已经到期");
    }else {
        if (daysold < 10) {daysold = daysold}
        if (daysold < 100) {daysold = "0" + daysold}
        if (hrsold < 10) {hrsold = "0" + hrsold}
        if (minsold < 10) {minsold = "0" + minsold}
        if (seconds < 10) {seconds = "0" + seconds}
        if (daysold < 3) {
            jQuery("#" + time_id[0]).html("<font color='red'><strong>"
            + daysold+"</strong></font>天<font color='red'><strong>"
            + hrsold+"</strong></font>时<font color='red'><strong>"
            + minsold+"</strong></font>分<font color='red'><strong>"
            + seconds+"</strong></font>秒");
        } else {
            jQuery("#" + time_id[0]).html("<font color='red'><strong>"
            + daysold+"</strong></font>天<font color='red'><strong>"
            + hrsold+"</strong></font>时<font color='red'><strong>"
            + minsold+"</strong></font>分<font color='red'><strong>"
            + seconds+"</strong></font>秒");
        }
        
        jQuery("#last_time_0").val(1);
    }
}
setTimeout("show_date_time_0()", 100);
