﻿function $(b) {return typeof b == "string" ? document.getElementById(b) : b}
var tms = []; 
var hour = []; 
var minute = []; 
var second = []; 
function takeCount() 
{
    setTimeout("takeCount()", 1000); 
    for (var i = 0, j = tms.length; i < j; i++) 
    {             
        //计数减一 
        tms[i] -= 1000; 
        //计算时分秒 
        var hours = Math.floor(tms[i] / (1000 * 60 * 60)) ; 
        var minutes = Math.floor(tms[i] / (1000 * 60)) % 60; 
        var seconds = Math.floor(tms[i] / 1000) % 60;  
        if (hours < 0) 
            hours = 0; 
        if (minutes < 0) 
            minutes = 0; 
        if (seconds < 0) 
            seconds = 0; 
        //将时分秒插入到html中 
        document.getElementById(hour[i]).innerHTML = hours; 
        document.getElementById(minute[i]).innerHTML = minutes; 
        document.getElementById(second[i]).innerHTML = seconds; 
    } 
} 
setTimeout("takeCount()", 1000); 


//--------------Select值------------------------------
var getSelectValue = function(selectID)
{
    var select=$(selectID); 
    var idx = select.selectedIndex , option , value ; 
    if (idx > -1) 
    { 
        option = select.options[idx]; 
        value = option.attributes.value; 
        return (value && value.specified) ? option.value : option.text; 
    } 
    return null; 
}  
function showSelectValue(selectID,hiddenID)
{
    $(hiddenID).value=getSelectValue(selectID);
} 
function showSelectValueSpan(selectID,spanID,str)
{
    $(spanID).firstChild.nodeValue=str;
}
function CheckAll(elementsA,elementsB)
{
    var len = elementsA;
    if(len.length > 0)
    {
        for(i=0;i<len.length;i++)
        {
            elementsA[i].checked = true;
        }
        if(elementsB.checked ==false)
        {
            for(j=0;j<len.length;j++)
            {
                elementsA[j].checked = false;
            }
        }
    }
    else
    {
        len.checked = true;
        if(elementsB.checked == false)
        {
            len.checked = false;
        }
    }
}
function url(checkBoxName,ifrUrl,w,h)
{
    var checkBoxList=document.getElementsByName(checkBoxName);
    var str="";
    for(var i=0;i<checkBoxList.length;i++)
    {
         if(checkBoxList[i].checked)
         {
              str+=checkBoxList[i].value+",";          
         }
    }
    if(str=="")
    {
        art.dialog({content:'没有选中任何项'});
    }     
    if(str!="")
    {                
        art.dialog({title:'删除提示', iframe:ifrUrl+str, width:w, height:h});
    }
}
function UrlDelete(checkBoxName,url)
{
    var checkBoxList=document.getElementsByName(checkBoxName);
    var str="";
    for(var i=0;i<checkBoxList.length;i++)
    {
         if(checkBoxList[i].checked)
         {
              str+=checkBoxList[i].value+",";          
         }
    }
    if(str=="")
    {
        alert('没有选中任何项');
    }
    if(str!="")
    {
        location.href=url+str+"&IsDelete=1";
    }
}

function mShow(id)
{
    if($(id).style.display=='')
    {
        $(id).style.display='none';
    }
    else
    {
        $(id).style.display='';
    }
}
function totleMoney(count,name,showID,totleID)
{
    var totle=0;
    for(i=1;i<=count;i++)
    {
        totle=totle+parseInt($(name+'_'+i.toString()).firstChild.nodeValue);
    }
    $(showID).firstChild.nodeValue=totle;
    $(totleID).value=totle;
}
function totleCoupon(count,name,showID,totleID,coupon)
{
    var totle=0;
    for(i=1;i<=count;i++)
    {
        totle=totle+parseInt($(name+'_'+i.toString()).firstChild.nodeValue);
    }    
    $(showID).firstChild.nodeValue = coupon >= totle ? totle : coupon ;
    $(totleID).value = coupon >= totle ? totle : coupon ;
}
function selectSoftWareUpload(id_1,id_2,id_3)
{
    $(id_1).style.display="";
    $(id_2).style.display="none";
    $(id_3).style.display="none";
}
function selectSoftWareText(id_1,id_2,id_3)
{
    $(id_1).style.display="";
    $(id_3).style.display="";
    $(id_2).style.display="none";     
}


var k=0; //声明一个计数器变量
var imgname1="../Assets/Image/"; //所有图片地址的前面相同的部分，要根据实际修改这个值。
var imgname2=".jpg"; //图片的文件格式，可根据实际情修改，前面那个小点不要漏了。
var imgnub=6; //要展示的图片的张数，根据实际修改此值。
function start(){ //程序主体部分
obj=eval("img1"); //若图像标记的ID号改变，请修改括号中的字符串值。
if (obj.filters.item(0).Transition==23) // 这部分语句是用于改变切换样式，在23种样式中循环。
obj.filters.item(0).Transition=1;
else
obj.filters.item(0).transition++;
obj.filters.item(0).Apply();
if (k<imgnub) {k++; //这部分语句用于改变图像标记的src的图片地址（既含路径的文件名）。
}else {k=1;
}
obj.src=imgname1+k+imgname2;
obj.filters.item(0).Play();
setTimeout("start(1)",4000); //每三秒钟刷新一次。
}
window.onload=function()
{
	start();
}
