function selectRow(a){a.offsetParent.parentNode.style.backgroundColor=a.checked?"#E1E1E1":""}function selectAllRow(a,d,b){if(d!=undefined){a=d.length;if(a==null){d.checked=b.checked;selectRow(d)}else if(b.checked)for(i=0;i<a;i++){d[i].checked=true;selectRow(d[i])}else for(i=0;i<a;i++){d[i].checked=false;selectRow(d[i])}}}var flagForLin=true; function onPreview(a,d){var b=document.getElementById(a),c=document.getElementById(a+"Div");if(b.value==""||trimStr(b.value)==""){c.innerHTML="\u5fc5\u586b\u9879";c.className="afail"}else{c.innerHTML=document.getElementById(a+"Desc").value;if(a==100&&getLength(b.value)>26)c.className="afail";else if(a==100)c.className="adcontent";if(a==101&&getLength(b.value)>36)c.className="afail";else if(a==101)c.className="adcontent";if(a==102&&getLength(b.value)>36)c.className="afail";else if(a==102)c.className= "adcontent";if(a==103&&getLength(b.value)>30)c.className="afail";else if(a==103)c.className="adcontent";if(a==104&&getLength(b.value)>1024)c.className="afail";else if(a==104)c.className="adcontent";var e=document.getElementById(105);if(b.value!="")if(d==14){c=document.getElementById(10);if(c!=null)c.href=e.value+b.value;flagForLin=false}else if(d==13){c=document.getElementById(104);var f=document.getElementById(13);if(flagForLin)c.value=b.value;if(f != null)f.innerHTML=b.value;if(document.getElementById(10) != null)document.getElementById(10).href=e.value+b.value}else{c= document.getElementById(d);if(c != null)c.innerHTML=b.value;}}}function getLength(a){var d=0;a=a.replace(/{\u5173\u952e\u8bcd}/g,"-");for(var b=0;b<a.length;b++)if(a.charCodeAt(b)>127||a.charCodeAt(b)==94)d+=2;else d++;return d}function addZero(a,d){var b=a.indexOf("."),c=a.length;if(b==-1){a+=".";j=0}else j=c-b-1;for(;j<d;j++)a+="0";return a};

function onPreviewForLeft(a,d){var b=document.getElementById(a),c=document.getElementById(a+"Div");if(b.value==""||trimStr(b.value)==""){c.innerHTML="\u5fc5\u586b\u9879";c.className="afailLeft"}else{c.innerHTML=document.getElementById(a+"Desc").value;if(a==100&&getLength(b.value)>50)c.className="afailLeft";else if(a==100)c.className="adcontentLeft";if(a==101&&getLength(b.value)>36)c.className="afailLeft";else if(a==101)c.className="adcontentLeft";if(a==102&&getLength(b.value)>36)c.className="afailLeft";else if(a==102)c.className= "adcontentLeft";if(a==103&&getLength(b.value)>30)c.className="afailLeft";else if(a==103)c.className="adcontentLeft";if(a==104&&getLength(b.value)>1024)c.className="afailLeft";else if(a==104)c.className="adcontentLeft";var e=document.getElementById(105);if(b.value!="")if(d==14){c=document.getElementById(10);if(c!=null)c.href=e.value+b.value;flagForLin=false}else if(d==13){c=document.getElementById(104);var f=document.getElementById(13);if(flagForLin)c.value=b.value;if(f != null)f.innerHTML=b.value;if(document.getElementById(10) != null)document.getElementById(10).href=e.value+b.value}else{c= document.getElementById(d);if(c != null)c.innerHTML=b.value;}}}

/**
 * 根据起价信息，更新指定ID的关键词的状态
 * @param id 关键词ID
 * @param price 用户购买该关键词价格，单位：元，如：1.86
 * @param basePrice 关键词起价，单位：分，如：300
 */
function updateKeywordStatus(id, price, basePrice) {
	var kwStatus = document.getElementById("kwStatus" + id);
	if(!kwStatus.getAttribute("mutable")) return; // invalid status, not audited yet etc.
	
	price = parseFloat(price) * 100;
	basePrice = parseInt(basePrice);

    if(price >= basePrice) {
       document.getElementById("kwStatus" + id).style.display = "";
       document.getElementById("kwInvalidStatus" + id).style.display = "none";
    }
    else {
       document.getElementById("kwStatus" + id).style.display = "none";
       document.getElementById("kwInvalidStatus" + id).style.display = "";
    }
}
