﻿/*
------setHome(obj)设为主页
------addToFav(name)加为收藏
------rtrim(str),ltrim(str),trim(str)去掉空白
------wordcount(obj)字数统计 汉字占两位，
------isemail(str)判断是否Email
------isurl(str)判断是滞URL
------resize(imgobj,imgwidth,imgheight)重置图片长、宽
------show_flash(filepath,w,h,key)FLASH显示、key==1时透明显示
------showDate()显示日期(中)
------showDate_en()显示日期(英)
------selectFriend(selObj,restore)有情连接Select
*/
function setHome(obj){var url="http://"+document.location.host+"/";obj.style.behavior="url(#default#homepage)";obj.setHomePage(url);};function addToFav(name){url="http://"+document.location.host+"/";window.external.AddFavorite(url,name);};function rtrim(str){returnstr.replace(/^\s+/,"");};function ltrim(str){returnstr.replace(/\s+$/,"");};function trim(str){returnstr.replace(/^\s+/,"").replace(/\s+$/,"");};function wordcount(obj){var aa=obj;var n=0;if(aa.value==""||aa.value==null)returnn;for(i=0;i<aa.value.length;i++){if(aa.value.charCodeAt(i)>127)n+=2;elsen++;}returnn;};function isemail(str){var re=/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/gi;returnre.test(str);};function isurl(str){var re=/^[a-zA-z]+:\/\/(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$/;returnre.test(str);};function resize(imgobj,imgwidth,imgheight){if(imgobj){if(imgobj.width>imgwidth){imgobj.width=imgwidth;}if(imgobj.height>imgheight){imgobj.height=imgheight;}}};function show_flash(filepath,w,h,key){if(/^\S+\.swf$/i.test(filepath)==false)return;document.writeln("<objectclassid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=7,0,19,0\"width=\""+w+"\"height=\""+h+"\">");document.writeln("<paramname=\"movie\"value=\""+filepath+"\"\/>");document.writeln("<paramname=\"quality\"value=\"high\"\/>");if(key==1){document.writeln("<paramname=\"wmode\"value=\"transparent\"\/>");document.writeln("<embedsrc=\""+filepath+"\"quality=\"high\"pluginspage=\"http:\/\/www.macromedia.com\/go\/getflashplayer\"type=\"application\/x-shockwave-flash\"width=\""+w+"\"height=\""+h+"\"wmode=\"transparent\"><\/embed>");}elsedocument.writeln("<embedsrc=\""+filepath+"\"quality=\"high\"pluginspage=\"http:\/\/www.macromedia.com\/go\/getflashplayer\"type=\"application\/x-shockwave-flash\"width=\""+w+"\"height=\""+h+"\"><\/embed>");document.writeln("<\/object>");};function showDate(){var tmp="";var date=newDate();var weekday=newArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六");tmp=date.getFullYear()+"年"+(date.getMonth()+1)+"月"+date.getDate()+"日"+""+weekday[date.getDay()];document.write(tmp);};function showDate_en(){var tmp="";var date=newDate();var weekday=newArray("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");tmp=weekday[date.getDay()]+"&nbsp;&nbsp;"+date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getFullYear();document.write(tmp);};function selectFriend(selObj,restore){if(selObj.options[selObj.selectedIndex].value!=""){window.open(selObj.options[selObj.selectedIndex].value);}if(restore){selObj.selectedIndex=0;}};
