var nm=navigator.appName;
NS=((nm.indexOf("Netscape")>-1||nm.indexOf("Netscape")>-1)?1:0);
var IE4 = (document.all);

//设为Browser Home Page
function Homepage(th) {
  th.style.behavior="url(#default#homepage)"; 
  th.setHomePage("http://www.AutoMailSender.com") 
  }

//添加到"我的最爱"
function addfavorite() {
  if (IE4) {window.external.AddFavorite(location.href, document.title);}
  if (NS) {alert("For Netscape users, please press <Ctrl + D> to add this page to your bookmarks.");}
  }

//去空格函数
function trim(str, type) {
//Description: str - 目标串, type - 类型. 0 - 去除前后空格; 1 - 去前导空格; 2 - 去尾部空格

  var sTmpStr = ' '
  var i = -1

  if(type == 0 || type == 1) {
	 while(sTmpStr == ' ') {
		++i
		sTmpStr = str.substr(i,1)
	 }
	 str = str.substring(i)
  }

  if(type == 0 || type == 2) {
	 sTmpStr = ' '
	 i = str.length
	 while(sTmpStr == ' ') {
		--i
		sTmpStr = str.substr(i,1)
	 }
	 str = str.substring(0,i+1)
  }
  return str
}


function checkAddress() {
   var strAddress = trim(document.sendmail.address.value, 0);
	if(strAddress.length != 0) {
	   if(strAddress.charAt(0) == "." ||        
		   strAddress.charAt(0) == "@" ||       
		   strAddress.indexOf('@', 0) == -1 || 
		   strAddress.indexOf('.', 0) == -1 || 
		   strAddress.lastIndexOf("@") == strAddress.length - 1 || 
		   strAddress.lastIndexOf(".") == strAddress.length - 1) {
         alert("Please input a VALID EMAIL ADDRESS.") 
         document.sendmail.address.value = ""
         document.sendmail.address.focus()   
         return false  
      }
	}
	else {
	   alert("Please input the EMAIL ADDRESS.");
   	document.sendmail.address.focus();
	   return false;
	}
	return true;
} 

function doCopy(id)
{
	id.select();
	rgn = id.createTextRange();
	rgn.execCommand("Copy");
}

// 实作mailto协议链接.
function mailTo() {  
	var url = "?subject=Recommend software - Auto Mail Sender Standard Edition: sends emails automatically (from 'your name here').&body=Hi," +		escape('\n') + escape('\n') + "I'm using Auto Mail Sender Standard Edition, it's a powerful email sender and provides the Free license for your use, you can use it to send automatic email conveniently." + escape('\n') + escape('\n') + "You should have a test!" + escape('\n') + escape('\n') + "Official website: http://www.AutoMailSender.com" + escape('\n') + "Direct download URL: http://www.AutoMailSender.com/auto-mail-sender.exe";
  window.location.href = "mailto:" + url
}

function CouponMail() {  
   var url = "sales@AutoMailSender.com?subject=Coupon code request for AMSSE.&body=Hi, I am an AMSSE paid user and can not get the coupon code by using the self-service on the web, some important information about identification as below:" +		escape('\n') + escape('\n') + "Order ID:" + escape('\n') + "Name:" + escape('\n') + "Address:" + escape('\n') + "Phone No.:" + escape('\n') + "Other useful information:" + escape('\n') + escape('\n') + "Please verify them and send the coupon code to me a.s.a.p, thank you.";
   window.location.href = "mailto:" + url
}

function SupportMail() {
   var url = "support@AutoMailSender.com?subject=Support request for AMSSE.&body=Hi, I have several questions about using AMSSE as below, and want to get your support as soon as possible, thank you.";
   window.location.href = "mailto:" + url
}

function KeyMail() {
   var url = "sales@AutoMailSender.com?subject=License key request for AMSSE.&body=Hi, I am an AMSSE paid user and can get the license key by using the self-service on the web, some important information about identification as below:" + escape('\n') + escape('\n') + "Order ID:" +  escape('\n') + "Name:" + escape('\n') + "Address:" + escape('\n') + "Phone No.:" + escape('\n') + "Other useful information:" + escape('\n') + escape('\n') + "Please verify them and send the license key to me a.s.a.p, thank you.";
   window.location.href = "mailto:" + url
}