document.write('<div style=" line-height:15px;background-color:#FFFFFF; width:350px; height:200px; border:#ccc 1px solid; padding:10px; text-align:left; color:#666666; position:absolute; z-index:1000; left: 12px; display:none;" id="s_div"><div style="float:right; width:40px; height:20px; border:#ccc 1px solid; line-height:20px; text-align:center "><a href="javascript:hiden_div();" style="color:#990033;">關 閉</a></div><br /><strong style="color:#990033">索取更多優惠方案</strong><br />------------------------------------------------------------------<br />如果您具備老師或學生資格者，想知道更多相關優惠方案，請提供您的E-mail，我們將儘速回覆您。<br /><br />請填入您的E-mail:<br /><form method="post" action="send_email.php?type=1" onsubmit="return check_email();" ><input type="hidden" name="member" id="member" />E-mail:<input name="email" id="email" type="text" style="width:250px; border:#ccc 1px solid; "/><br /><br /><br /><div align="right"><input type="submit" value="確定送出" style="border:#333 1px solid; background:#990000; line-height:20px;height:23px; color:#fff;" />  <input name="button" type="reset" value="取消" onclick="hiden_div()" style="border:#333 1px solid; background:#666; line-height:20px;height:23px; color:#fff;"  /></div></form></div><div style="background-color:#CCCCCC; position:absolute; top:0px; left:0px; z-index:88; display:none;-moz-opacity:0.5;filter:alpha(opacity=50);opacity:0.5;" id="bg" onclick="hiden_div()"></div>');
function getPageSize(){      
  var xScroll, yScroll;      
  if (window.innerHeight && window.scrollMaxY) {      
    xScroll = document.body.scrollWidth;    
    yScroll = window.innerHeight + window.scrollMaxY;    
  } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac    
    xScroll = document.body.scrollWidth;    
    yScroll = document.body.scrollHeight;    
  } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari    
    xScroll = document.body.offsetWidth;    
    yScroll = document.body.offsetHeight;    
  }    
   
  var windowWidth, windowHeight;    
  if (self.innerHeight) {  // all except Explorer    
    windowWidth = self.innerWidth;    
    windowHeight = self.innerHeight;    
  } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode    
    windowWidth = document.documentElement.clientWidth;    
    windowHeight = document.documentElement.clientHeight;    
  } else if (document.body) { // other Explorers    
    windowWidth = document.body.clientWidth;    
    windowHeight = document.body.clientHeight;    
  }      
      
  // for small pages with total height less then height of the viewport    
  if(yScroll < windowHeight){    
    pageHeight = windowHeight;    
  } else {     
    pageHeight = yScroll;    
  }    
   
  if(xScroll < windowWidth){      
    pageWidth = windowWidth;    
  } else {    
    pageWidth = xScroll;    
  }    
   
  arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)     
  return arrayPageSize;    
}
function getPageScroll() {
			var xScroll, yScroll;
			if (self.pageYOffset) {
				yScroll = self.pageYOffset;
				xScroll = self.pageXOffset;
			} else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
				yScroll = document.documentElement.scrollTop;
				xScroll = document.documentElement.scrollLeft;
			} else if (document.body) {// all other Explorers
				yScroll = document.body.scrollTop;
				xScroll = document.body.scrollLeft;	
			}
			arrayPageScroll = new Array(xScroll,yScroll);
			return arrayPageScroll;
		};

a=getPageSize();
var bg = document.getElementById("bg");

bg.style.height=a[1]+'px';
bg.style.width=a[0]+'px';

bgObj = document.getElementById("s_div");
function show_div(member)
{
  bgObj.style.display = "none";
  bg.style.display = "none";
  
  document.getElementById("email").value = '';
  document.getElementById("member").value = member;
  a=getPageSize();
  var b = getPageScroll();
  
  bg.style.height=a[1]+'px';
  bg.style.width=a[0]+'px';
  bgObj.style.top=(a[3]-150)/2+b[1]+'px';
  bgObj.style.left=(a[2]-350)/2+b[0]+'px';
  bgObj.style.display = "";
  bg.style.display = "";
  document.getElementById("email").focus();
}
function hiden_div()
{
  bgObj.style.display = "none";
  bg.style.display = "none";
}
function check_email()
{
  var email = document.getElementById("email").value;
  if(email == "")
  {
    alert("請輸入 E-mail。");
   document.getElementById("email").focus();
    return false;
  }

  re = new RegExp("(.+)@(.+[.].+)");

  if(email.search(re) == -1)
  {
    alert("E-mail 格式錯誤。");
    document.getElementById("email").focus();
	document.getElementById("email").select();
    return false;
  }
   return true;
}
