function getobj(id){
	return document.getElementById(id);	
}

function selecttab(obj, act, def, special, areaname){
	var node = childs(obj.parentNode.parentNode.childNodes);
	for(var i=0;i<node.length;i++){
		if(node[i].className != special){
			node[i].className = def;	
			if(getobj(areaname + "_" + i))
				getobj(areaname + "_" + i).style.display = "none";
		}
	}
	obj.parentNode.className = act;
	for(var i=0;i<node.length;i++){
		if(node[i].className != special){
			if(node[i].className == act){
				if(getobj(areaname + "_" + i))
					getobj(areaname + "_" + i).style.display = "";
			}
		}
	}
}
//兼容FF下的childNodes
function childs(nodes)
{
    if(!nodes.length) 
        return [];
    var ret=[];
    for(var i=0;i<nodes.length;i++)
    {
        if(nodes[i].nodeType!=1) 
            continue;
        ret.push(nodes[i]);
    }
    return ret;
} 
function ChangeVerifyImgNew(url){
	document.getElementById("verifyimg").src = url + 'UserCenter/verifyimg.aspx?d=' + Date();
}
var oldTextAreaValue=new Array();
function checkTextAreaMaxLen(obj,maxlength,num)
  {
  // alert("1");
        if(obj.value.length>maxlength)
        {
            obj.value=oldTextAreaValue[num];
        }
        else
        {
            oldTextAreaValue[num]=obj.value;
        }
}
function GetCheckedBoxInPage(){
     var tagname="";
    var ids = "0";
     totalprice=0; 
    var InputList = document.getElementsByTagName("input");
    for(var j = 0 ; j < InputList.length ; j++){
        if(InputList[j].type == "checkbox" && InputList[j].id.indexOf('CheckBoxID') != -1){
            if(InputList[j].checked == true){
                ids += "," + InputList[j].value;
                tagname="zhprice"+InputList[j].value;
               totalprice+=parseFloat(document.getElementById(tagname).innerText);
         
            }
            
        }
    }
    return ids;
} 
function CheckSelectOneInPage(){
    count = 0; 
    var ids = GetCheckedBoxInPage();
     
    if(ids == "0"){ 
     document.getElementById("zhtotalprice").innerText = totalprice.toFixed(2)  ;     
        getobj("CheckedIDS").value = ids.replace('0,',''); 
           var url="/cart.aspx?act=buy&bindingid=1&strChecked="+ids.replace('0,','');
       getobj("frmzh").action=url; 
       return false;
    }else{ 
        getobj("CheckedIDS").value = ids.replace('0,',''); 
        document.getElementById("zhtotalprice").innerText = totalprice.toFixed(2)  ; 
        var url="/cart.aspx?act=buy&bindingid=1&strChecked="+ids.replace('0,','');
       getobj("frmzh").action=url; 
        return true;
    }
}
totalLgPrice=0.00
function CheckLargessInPage(isSingle,strID){
       var tagname="";
    var ids = "0";
     totalLgPrice=0.00; 
    var InputList = document.getElementsByTagName("input");
    for(var j = 0 ; j < InputList.length ; j++){
        if(InputList[j].type == "checkbox" && InputList[j].id.indexOf('ChkLargessID') != -1){
           
            if (InputList[j].checked == true) 
            {
                if ((isSingle=="true") &&   ( InputList[j].value != strID ))
                {
                    InputList[j].checked =0;
                }
                else
                {
                    if ((isSingle=="false") && ( InputList[j].value != strID ) && (InputList[j].id.indexOf('true') !=-1))
                    {
                        InputList[j].checked =0;
                    }
                    else
                    { 
                        ids += "," + InputList[j].value;
                        tagname="LargessPrice"+InputList[j].value;
                        totalLgPrice+=parseFloat(document.getElementById(tagname).innerText);
                    }
                }
            }
            
        }
    }
    return ids;
} 
function CheckSelectLargessInPage(isSingle,strID){
    count = 0; 
     var ids = CheckLargessInPage(isSingle,strID); 
  
    if(ids == "0"){ 
    totalLgPrice=0;
        getobj("CheckedLargess").value = ids.replace('0,','');          
     
     document.getElementById("Largesstotalprice").innerText = totalLgPrice.toFixed(2)  ;
       return false;
    }else{     
          getobj("CheckedLargess").value = ids.replace('0,','');          
        document.getElementById("Largesstotalprice").innerText = totalLgPrice.toFixed(2)  ; 
        
        var url="/cart.aspx?act=buy&bindingid=1&strChecked="+ids.replace('0,','');
       getobj("frmLargess").action=url; 
        return true;
    }
} 
