﻿function ClearFormObjText(formobj,obj)
{if(document.forms[formobj].elements[obj].value=='請輸入部落格名稱')
document.forms[formobj].elements[obj].value='';}
function goUrl(formobj,url){var isIe=(window.ActiveXObject)?true:false;if(isIe){if(url.search("http://")>=0)
window.open(url,'BOgoUrl');else if(document.getElementById(url).value.length>0)
window.open(document.getElementById(url).value,'BOgoUrl');else
alert('部落格網址請勿空白');}
else{if(url.search("http://")>=0)
window.open(url,'BOgoUrl');else if(document.forms[formobj].BlogAddress.value.length>0)
window.open(document.forms[formobj].BlogAddress.value,'BOgoUrl');else
alert('部落格網址請勿空白');}}
function ContentCopy(ob){var obj=MM_findObj(ob);if(obj){obj.select();js=obj.createTextRange();js.execCommand("Copy");}}
function MM_findObj(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);if(!x&&document.getElementById)x=document.getElementById(n);return x;}
function noenter()
{if(event.keyCode==13)
{event.cancelBubble=true;event.returnValue=false;}}
function appendWord(formobj,show_obj,str)
{var isIe=(window.ActiveXObject)?true:false;if(isIe){document.getElementById(show_obj).innerHTML=document.getElementById(show_obj).innerHTML+' '+str;}else{document.forms[formobj].vip_req_word.value=document.forms[formobj].vip_req_word.value+' '+str;}}
function wordsLeft(formobj,amount,count_obj,show_obj)
{var wordLeft=amount-characCount(formobj,count_obj);if(wordLeft<0){wordLeft='超過儲存限制';}
document.getElementById(show_obj).innerHTML=wordLeft;}
function characCount(formobj,obj)
{var countMe;countMe=document.forms[formobj].elements[obj].value;var escapedStr=encodeURI(countMe);if(escapedStr.indexOf("%")!=-1){var count=escapedStr.split("%").length-1;if(count==0)count++;var tmp=escapedStr.length-(count*3);count=count+tmp;}else{count=escapedStr.length;}
return count;}
function SetColor(target_obj,from_obj)
{var color=document.getElementById(from_obj).value;if(color.length>0&&color.charAt(0)!='#')
color='#'+AddZero(color,6);document.getElementById(target_obj).style.backgroundColor=color;}
function SetColorDirect(target_obj,clr)
{if(clr.length>0&&clr.charAt(0)!='#')
clr='#'+AddZero(clr,6);document.getElementById(target_obj).style.backgroundColor=clr;}
function SetColorText(target_obj,clr)
{if(clr.length>0&&clr.charAt(0)!='#')
clr='#'+AddZero(clr,6);var isIe=(window.ActiveXObject)?true:false;if(isIe)
document.getElementById(target_obj).value=clr;else
document.config_save.BgColor.value=clr;}
function AddZero(str,len)
{var i,ret='';for(i=0;i<(len-str.length);i++)
ret=ret+'0'
return(ret+str);}
function GetByte(str)
{var cArr=str.match(/[^\x00-\xff]/ig);return str.length+(cArr==null?0:cArr.length);}
function iFrameHeightAuto(obj)
{var isIe=(window.ActiveXObject)?true:false;var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1?16:0
if(isIe)
h=parent.frames(obj).document.body.scrollHeight;else
h=parent.document.getElementById(obj).contentDocument.body.offsetHeight+FFextraHeight;parent.document.getElementById(obj).style.display="block";parent.document.getElementById(obj).height=h;}
function TopiFrameHeight(id,height)
{parent.document.getElementById(id).style.display="block";parent.document.getElementById(id).height=height;}
function Top2iFrameHeight(obj,h)
{parent.parent.document.getElementById(obj).style.display="block";parent.parent.document.getElementById(obj).height=h;}
function SetFrameWidth(id,wid)
{document.getElementById(id).style.display="block";document.getElementById(id).width=wid;}
function TopiFrameWidth(id,wid)
{parent.document.getElementById(id).style.display="block";parent.document.getElementById(id).width=wid;}
function Top2iFrameWidth(id,wid)
{parent.parent.document.getElementById(id).style.display="block";parent.parent.document.getElementById(id).width=wid;}
function TopHideObject(id)
{parent.document.getElementById(id).style.display="none";}
function TopShowObject(id)
{parent.document.getElementById(id).style.display="block";}
function SetTableWidth(id,wid)
{document.getElementById(id).width=wid;}
function TopTableWidth(id,wid)
{parent.document.getElementById(id).width=wid;}