

function autotabinit(){$("#autotabinit").children().hover(function(){delaytab2(this)},function(){fodTime2=setInterval(function(){if(auto_start>2)auto_start=0;else auto_start++;tab($("#autotabinit").children().eq(auto_start).get(0))},3000)});tab($("#autotabinit").children().eq(auto_start).get(0));fodTime2=setInterval(function(){if(auto_start>2)auto_start=0;else auto_start++;tab($("#autotabinit").children().eq(auto_start).get(0))},3000)}
function tabinit(){$(".tabinit").children().hover(function(){delaytab(this)},function(){clearTimeout(fodTime);});}
function tab(A){$(A).siblings().removeClass("current");$(A).addClass("current");$("#"+A.id+"_").siblings().filter(".tab").hide();$("#"+A.id+"_").show();}
var fodTime;function delaytab(A){clearTimeout(fodTime);fodTime=setTimeout(function(){tab(A)},100)}
var fodTime2;function delaytab2(A){clearTimeout(fodTime2);auto_start=parseInt(A.id.charAt(1))-1;fodTime2=setTimeout(function(){tab(A)},100)}
function toggleinit(){$(".toggle").toggle(function(){$(this).html("↑隐藏10条");$("#"+this.id+"_show").fadeIn("slow");},function(){$(this).html("↓再显示10条");$("#"+this.id+"_show").fadeOut("slow");});}
function WriteValue(name, value, expiry) {
    var expDate = new Date();
    var oneMinute = 60 * 1000;
    if (expiry) {} else {
        expiry = 60 * 24
    }
    expDate.setTime(expDate.getTime() + expiry * oneMinute);
    document.cookie = name + "=" + escape(value) + ";expires=" + expDate.toGMTString() + ";path=/"
}
function ReadValue(CookieName) {
    var CookieString = document.cookie;
    var CookieSet = CookieString.split(';');
    var SetSize = CookieSet.length;
    var CookiePieces;
    var ReturnValue = "";
    var x = 0;
    for (x = 0; ((x < SetSize) && (ReturnValue == "")); x++) {
        CookiePieces = CookieSet[x].split('=');
        if (CookiePieces[0].substring(0, 1) == ' ') {
            CookiePieces[0] = CookiePieces[0].substring(1, CookiePieces[0].length)
        }
        if (CookiePieces[0] == CookieName) {
            ReturnValue = CookiePieces[1]
        }
    }
    return (unescape(ReturnValue))
}
function add_pk(id){
if(isNaN(id))
return;
var ids = ReadValue("MSN_PK_CARIDS");
var ida = ids.split(";");
var hasfound=false;
var len=0;
    for(var i=0;i<ida.length;i++){
      if (ida[i] ==id)hasfound=true;
      if(ida[i]>0)len++;
    }
if(len==5)alert("对比篮已满！");
 if(hasfound==false&&len<5){
        var sids = "";
        if (ids=="")sids = id;
        else sids = ids + ";" + id;
        WriteValue("MSN_PK_CARIDS",sids);
}
}
function del_pk(id){
if(isNaN(id))
return;
var sids = "";
var ids = ReadValue("MSN_PK_CARIDS");
var ida = ids.split(";");
    for(var i=0;i<ida.length;i++){
      if (!isNaN(ida[i])&&ida[i] !=id&&ida[i]!="")sids+=ida[i]+";"
    }
WriteValue("MSN_PK_CARIDS",sids);
}
function add_read(id){
if(isNaN(id))
return;
var ids = ReadValue("MSN_READ_CARIDS");
var ida = ids.split(";");
if(ida.length>=5)return; 
var hasfound=false;
    for(var i=0;i<ida.length;i++){
      if (ida[i] ==id)hasfound=true;
    }
 if(hasfound==false){
        var sids = "";
        if (ids=="")sids = id;
        else sids = ids + ";" + id;
        WriteValue("MSN_READ_CARIDS",sids);
}
}



function p_show(id){$("#"+id).toggle();}
