function removehtml(html){
var html_stripped = html.replace(/(<.*?>)/ig,"");
return html_stripped;
}
function cutstr(str,len){
var str_length = 0;
var str_len = 0;
str_cut = new String();
str_len = str.length;
for(var i = 0;i<str_len;i++){
a = str.charAt(i);
str_length++;
if(escape(a).length > 4){
str_length++;
}
str_cut = str_cut.concat(a);
if(str_length>=len){
if((i+1)==len){
str_cut = str_cut.concat("");
}else{
str_cut = str_cut.concat("...");
}
return str_cut;
}
}
if(str_length<len){
return  str;
}
}
//
function discString(disc){
if(disc.length==1){
return "0." + disc;
}else if(disc.length==2){
if(disc.substring(1,2)=="0") return disc.substring(0,1);
}
return disc;
}
//table模式
function bindString_A(saleDisc, salePrice, typeString){
var reValue;
if(saleDisc=="100"||saleDisc.length==0){
reValue = typeString + "<span style=\"color:#e2007e;\">" + salePrice + "</span>元";
}else{
reValue = typeString + "<span style=\"color:#e2007e;\">" + discString(saleDisc) + "</span>折<span style=\"color:#e20080;\">" + salePrice + "</span>元";
}
return reValue;
}
//list模式
function bindString_B(listPrice, saleDisc, salePrice, typeString){
var reValue;
if(saleDisc=="100"||saleDisc.length==0){
reValue = "<span style=\"color:#666666; font-weight:normal;\">定價：";
reValue += "<span style=\"color:#666666; font-weight:normal;\">" + listPrice + "</span>元</span>&nbsp;";
reValue += "<span style=\"color:#666666; font-weight:normal;\">" + typeString + "：";
reValue += "<span style=\"color:#e2007e; font-weight:bold;\">" + salePrice + "</span>元</span>";
}else{
reValue = "<span style=\"color:#666666; font-weight:normal;\">定價：";
reValue += "<span style=\"color:#666666; font-weight:normal;\">" + listPrice + "</span>元，</span>";
reValue += "<span style=\"color:#666666; font-weight:normal;\">" + typeString + "：";
reValue += "<span style=\"color:#e2007e; font-weight:bold;\">" + discString(saleDisc) + "</span>折&nbsp;";
reValue += "<span style=\"color:#e2007e; font-weight:bold;\">" + salePrice + "</span>元</span>";
}
return reValue;
}

