function ReplaceAll(str, sptr, sptr1){
    while (str.indexOf(sptr) >= 0){
        str = str.replace(sptr, sptr1);
    }
    return str;
}
function val(){
    var ct=document.getElementsByName("tcc");
    var strsum="|";
    for(var c=0;c<ct.length;c++){
        if(ct[c].checked){
          strsum+=ct[c].value+"|";
        }
    }
    document.getElementById("hid_stypeid").value=strsum;
}
function val2(){
    var title=ReplaceAll(document.getElementById("txt_title").value," ","");
    var price=ReplaceAll(document.getElementById("txt_price").value," ","");
    var num=ReplaceAll(document.getElementById("txt_num").value," ","");
    var inc=ReplaceAll(document.getElementById("fck").value," ","");
    if(title.length>60){
        document.getElementById("title_msg").innerHTML="标题不能超过60个字符！";
        return false;
    }if(title.length==0){
        document.getElementById("title_msg").innerHTML="标题不能为空！";
        return false;
    }
    if(price=="0"){
        document.getElementById("price_msg").innerHTML="商品价格不能为0元！";
        return false;
    }
    if(price.length==0){
        document.getElementById("price_msg").innerHTML="商品价格不能为空！";
        return false;
    }
    if(num=="0"){
        document.getElementById("num_msg").innerHTML="数量不能为0！";
        return false;
    }
    if(num.length==0){
        document.getElementById("num_msg").innerHTML="数量不能为空！";
        return false;
    }
    var flag = false;
    var ftext="";
    var radioc=document.getElementById("Radio2");
    if(radioc.checked){
        var py=document.getElementById("txt_py").value;  
        var kd=document.getElementById("txt_kd").value;  
        var ems=document.getElementById("txt_ems").value;  
        if(py==""&&kd==""&&ems==""){
        document.getElementById("youfei").innerHTML="邮费不能为空！";
            return false;
        }
    }
    if(document.all){
        ftext = ReplaceAll(ReplaceAll(window.frames[1].document.frames[0].document.body.innerText," ",""),"\r\n","");
        if(ftext == "")
            flag = true;
    }
    else{
        ftext = window.frames[0].window.frames[0].document.body.innerText;
        if(ftext == "")
            flag = true;
    }   
    if(flag){
        document.getElementById("inc_msg").innerHTML="内容描述不能为空！";
        return false;
    }else{
        return true;
    }
}

