//Tell-a-friend script
//Carl Dimmer    //本程式作者

var initialsubj="嗨！我是您的好友某某人"    //將某某人換成自己名為
var initialmsg="介紹一個不錯又好用的[轉寄好友JavaScript程式]給您 "+window.location   //中文部份可換成您想要字句
var good;
function checkEmailAddress(field) {       //偵測信箱是否合法

var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
if (goodEmail) {
good = true;
}
else {
alert('此處請輸入您朋友的有效電子信箱');   //中文部份可換成您想要字句
field.focus();
field.select();
good = false;
   }
}
u = window.location;
function mailThisUrl() {   //呼叫本程式
good = false
checkEmailAddress(document.eMailer.email);
if (good) {

//window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+document.title+" "+u;    //選擇其一使用便可
window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+initialmsg    //選擇其一使用便可
   }
}


//Print script
function printpage(contents){ //contents是指需列印的divID  
    var newstr = document.getElementById(contents).innerHTML;
    var oldstr = document.body.innerHTML; 
    document.body.innerHTML = newstr; 
    window.print(); 
    document.body.innerHTML = oldstr; 
	history.go(0);
	return;	
} 

