function radioVar(obj)
{
    var o=document.getElementsByName(obj);
    var len=o.length;
    for (var i=0;i<len;i++)
    {
        if( o[i].checked==true )
        {
            return o[i].value;
        }
    }
}

function quicksearch()
{
    if ($('#keyword').val() == "" || $('#keyword').val() == "输入品牌机型") {
        alert("关键字不能为空！");
        return false;
    }
	
    $('#Vgooo_Form_top').submit();
}

function _findCheckVar(obj){
    /*
	*Ver 1.5
	*Note: find out which Checkbox true value
	*Created: 17:30 10/17/07
	*Modified: 15:29 01/22/08
	*Author :Edison tsai
	*/
    var elements=document.Vgooo_Form.elements;
    var counter=elements.length;
    var seltext="";
    for(i=0;i<counter;i++){
        var element=elements[i];
        if((element.type=="checkbox")&&(element.checked==true)&&(element.name==obj)){
            seltext = seltext+element.value+",";
        }
    }
    return seltext.substr(seltext,seltext.length-1);
}

function getchat(){
	var strs = ["我是肿么了，心情不好，也睡不着觉，只有来打酱油了！","你爸才是打酱油的，你们全家都是打酱油的！","我是来躲猫猫的，顺带边打酱油边做俯卧撑~！","轻轻的我走了，正如我轻轻的来。","亲，一起打酱油吧！","我是来打酱油的，顺带做个俯卧撑！","酱油帝前排强力插入！","自从喜欢了打酱油 ，这腰不酸 ，腿不疼 ，差点连气都不喘了！","这个很棒啊...............真的很不错......","这个消息似乎在哪里看到过。。。","支持楼主的强烈表现。。。","OH,ＭＹＧＯＤ！！","有这样的人，就有这样的心。","喜欢中....哈哈哈?~！","才华真不是盖的。","这个资源我找了好久好久，终于发现了这里，下载吧，还多说什么了。","哇靠，楼主是流氓，提供这么牛X的东西，非下不可了。"];
	$('#comment_content').val(strs[Math.floor(Math.random()*strs.length)]);
}

//function loadCartInfo()
//{
//	$.ajax({url: "/other/cart/",
//	timeout:8000,
//	type:"post",
//	dataType:"text",
//	success:function(data){
//		$("#loadCartInfo").html("<a class=\"ShoppingCart\" title=\"我的购物篮\" href=\""+baseUrl+"/cart/confirm/\">购物篮</a>(<span id=\"myCart\" title=\"您的购物篮有"+data+"件商品！\">"+data+"</span>)");
//	},
//	complete:function(){}
//	});
//}

function loadCartInfo()
{
    if($.cookie("VgoooCart") != null){
        var count =$.cookie("VgoooCartCount");
        $("#loadCartInfo").html(count);
    }else{
        $("#loadCartInfo").html('0');
    }
	

}

function memberInfo(){
    //if($.cookie("ecs_user_id")!= null && $.cookie("ecs_username")!= null)		//存在中文问题，暂时注销
	if($.cookie("ecs_user_id")!= null)
        $('.afterlogin').show()
    else {
        $(".beforelogin").show();
    }
}
$().ready(function(){
    loadCartInfo();
    memberInfo();
})


function parse_update(url) {
    $.get(url);
}

function setOpacity(obj, value) {
    if ($.browser.msie) {
        if (value == 100) {
            obj.style.filter = "";
        } else {
            obj.style.filter = "alpha(opacity="+value+")";
        }

    } else if($.browser.msie) {
        obj.style.MozOpacity = value/100;
    } else{
        obj.style.opacity = value/100;
    }
}



function changeOpacity(obj, startValue, endValue, step, speed) {

    if (step>0 && startValue<endValue || step<0 && startValue>endValue) {

        setOpacity(obj,endValue);

        return;

    }

    setOpacity(obj,startValue);

    setTimeout(function () {

        changeOpacity(obj,startValue-step,endValue,step,speed);

    },speed);

}


var seedTimeWait,settimeIntervalId = 0;
function showMsg(a,b,t,u) {
    var msg = document.getElementById(b);
    $('#'+b).css('display','block');
    if ($.browser.msie && ($.browser.version == "6.0")) {
        $('#'+b).css("position","absolute");
        $(window).scroll(function (){
            var bodyTop = 0;
            if (typeof window.pageYOffset != 'undefined') {
                bodyTop = window.pageYOffset;
            } else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
                bodyTop = document.documentElement.scrollTop;
            } else if (typeof document.body != 'undefined') {
                bodyTop = document.body.scrollTop;
            }
            var scrollpos = bodyTop + document.documentElement.clientHeight - 500;
            $('#'+b).css("top", scrollpos);
        });
    }else{
        $('#'+b).css('position','fixed');
    }
    var step =15, speed = 100;
    $("#"+b+"_1").html(a);
    changeOpacity(msg,0,100,-step,speed);
    setTimeout("closeMsg('"+b+"')",t);
    if((typeof(u) !='undefined')){
        seedTimeWait=t/1000;
        settimeIntervalId =setInterval('seed_settime("'+u+'")', 1000);
    }
}
function seed_settime(u){
    seedTimeWait = seedTimeWait-1;
    if(seedTimeWait<=0){
        clearInterval(settimeIntervalId);
        window.location.href = u;
    }
}
function closeMsg(a){
    var step =10, speed = 100;
    var msg = document.getElementById(a);
    changeOpacity(msg,100,0,step,speed);
}
