function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}
function unblur() {
this.blur();
}

function blurLinks() {
if (!document.getElementById) return;
theLinks = document.getElementsByTagName("a");
for(i=0; i<theLinks.length; i++) {
theLinks[i].onfocus = unblur;
}
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function display(nod,num){
	var tmp = nod.parentNode.parentNode.parentNode.childNodes[num];
	if (tmp.style.display=='none'){
		tmp.style.display='block'
	}else{
		tmp.style.display='none'
	}
}
function play(num,aid){
	var winPaly = window.open('../play.asp?NO='+num+'&AID='+aid,'play','top=30,left=140,width=435,height=585,scrollbars=yes,resizable=yes,menubar=yes')
	winPaly.window.focus();
}

var timerID = null
var timerRunning = false
var charNo = 0
var charMax = 0
var lineNo = 0
var lineMax = 3
var lineArr = new Array(lineMax)
var urlArr = new Array(lineMax)
lineArr[1] = "本店更多資訊"
urlArr[1] = "index.asp?module=intro"
lineArr[2] = "本店更多資訊"
urlArr[2] = "index.asp?module=intro"
lineArr[3] = "本店更多資訊"
urlArr[3] = "index.asp?module=intro"
lineArr[4] = "本店更多資訊"
urlArr[4] = "index.asp?module=intro"

var lineText = lineArr[1];
function StartShow() {
	StopShow()
	ShowLine()
	timerRunning = true
}
function StopShow() {
	if (timerRunning) {
		clearTimeout(timerID)
		timerRunning = false
	}
}
function ShowLine() {
	if (charNo == 0) { // Next line
		if (lineNo < lineMax) 	{
			lineNo++
		}
		else {
			lineNo = 1
		}
		lineText = lineArr[lineNo]
		charMax = lineText.length
	}
	if (charNo <= charMax) { // Next char
		document.formDisplay.buttonFace.value = lineText.substring(0, charNo)
		charNo++
		timerID = setTimeout("ShowLine()", 100)
	}
	else {
		charNo = 0
		timerID = setTimeout("ShowLine()", 3000)
	}
}
function GotoUrl(url)
{
	location.href = url
}
//---------------------------------------------
//開始計時的時間
var mmStart;
//等待隱藏時間的長短
var timeout=500;
//等待隱藏的物件
var mmInTimerobj;
//目前在計時的程序
var mmHideMenuTimer=null;
//不能隱藏Div名稱
var NotHiddenDivs = new Array(); 
//---------------------------------------------
//取得絕對位置程式
function getPos(el,sProp)  
{
	var iPos = 0;
	while (el!=null)  
　　 {
		iPos+=el["offset" + sProp];
		el = el.offsetParent;
	 } 
    return iPos;
}  

//---------------------------------------------
//清除計時的程序
function MM_clearTimeout() {
	if (mmHideMenuTimer){
		clearTimeout(mmHideMenuTimer);	
		mmHideMenuTimer = null;
	}
}

//---------------------------------------------
//開始一個計時程序每500毫秒一次
function MM_startTimeout() {
	NotHiddenDivs=null;
	mmStart = new Date();
	mmHideMenuTimer = setTimeout("mmDoHide()", 500);
}

//---------------------------------------------
//判斷隱藏的程式
function mmDoHide() {
	var elapsed = new Date() - mmStart;
	if (elapsed < timeout) {
		mmHideMenuTimer = setTimeout("mmDoHide()", timeout+100-elapsed);
		return;
	}
	ToHiddenAllDiv();
	mmHideMenuTimer=null;
}
//---------------------------------------------
//發現物件
function FIND(item) {
	if( window.mmIsOpera ) return(document.getElementById(item));
	if (document.all) return(document.all[item]);
	if (document.getElementById) return(document.getElementById(item));
	return(false);
}

//---------------------------------------------
//設定不能隱藏DIV 及顯示DIV
function ShowMenu(el,NotHiddenDivStr,actMenu,isRoot){
	var ActiveMenu;
	MM_clearTimeout();	
	if (!NotHiddenDivs){
		NotHiddenDivs = NotHiddenDivStr.split(",");	
		ToHiddenAllDiv();
	}
	if (FIND(actMenu)){
		ActiveMenu=FIND(actMenu);
		if (ActiveMenu) {
			if (isRoot=='root'){
				ActiveMenu.style.pixelLeft=getPos(el.offsetParent,"Left"); 
				ActiveMenu.style.pixelTop=getPos(el.offsetParent,"Top") + el.offsetParent.offsetHeight-5;
			}else{
				ActiveMenu.style.pixelLeft=getPos(el.offsetParent,"Left")+el.offsetWidth-5;
				ActiveMenu.style.pixelTop=getPos(el.offsetParent,"Top")+5;
			}
			ActiveMenu.style.position='absolute'; 
			ActiveMenu.style.display='block'; 
		}
	}
}
//---------------------------------------------
//隱藏所有可隱藏的DIV
function ToHiddenAllDiv(){
	var Divstr,hiddenFlg;
	for (var i=0; i<50; i++) {
		Divstr="menuDiv_"+i;
		hiddenFlg=true;
		if (NotHiddenDivs){
			for (var j=0;j<NotHiddenDivs.length;j++){	
				if (NotHiddenDivs[j]==Divstr){
					hiddenFlg=false;
				}			
			}
		}
		if (hiddenFlg){
			if (FIND("menuDiv_"+i)){
				var toHiddenDiv = FIND("menuDiv_"+i);
				toHiddenDiv.style.display='none';
			}
		}
	}
}
//---------------------------------------------
//不做任何事件時
function NoEven(){
	return;
}
var nowNode;
function loadXMLDoc(node,url)
{
// code for IE
  nowNode = node;
  if (window.ActiveXObject)
  {
  //xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e){}
		}
    if (xmlhttp)
    {
    xmlhttp.onreadystatechange=xmlhttpChange
    xmlhttp.open("GET",url,true)
	//xmlhttp.setRequestHeader("Content-Type", "text/xml");
    xmlhttp.send(null)
    }
  }
// code for Mozilla, etc.
  else if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  xmlhttp.onreadystatechange=xmlhttpChange()
  xmlhttp.open("GET",url,true)
  xmlhttp.overrideMimeType('text/xml');
  xmlhttp.send(null)
  }
}
function xmlhttpChange()
{
// if xmlhttp shows "loaded"
  if (xmlhttp.readyState==4)
  {
  // if "OK"
    if (xmlhttp.status==200)
    {
		var x = xmlhttp.responseText;
		if (x.indexOf("線上：")>0)
			nowNode.innerHTML = x.substring(x.indexOf("線上：")+3,x.indexOf("&nbsp;"));
		if (x.indexOf("累計：")>0)
			nowNode.nextSibling.innerHTML = x.substring(x.indexOf("累計：")+3,x.length);
    }
    else
    {
    //alert("Problem retrieving XML data")
    }
  }
}
var tmpTid = false;
function showpic(picpath){
	if(tmpTid) clearTimeout(tmpTid)
	MemPic.style.height="1px"
	MemPic.style.width="1px"
	pic = new Image();
	pic.src =  picpath + "?tmp=" + Date.parse(new Date().toString());
	MemPic.innerHTML="";
	var XMLNode = document.createElement("img");
	//XMLNode.onclick = "'javascript:growdown(5)'"
	XMLNode.src=pic.src;
	MemPic.appendChild(XMLNode);
	tmpTid = setTimeout("growup(5)",200);
}
function growup(t){
	if (eval(pic.height))	{
		var tmpH = eval(MemPic.style.height.substr(0,MemPic.style.height.length-2))
		var tmpW = eval(MemPic.style.width.substr(0,MemPic.style.width.length-2))
		if (pic.height>tmpH){
				MemPic.style.height = (tmpH + 2*(pic.height/100)) + "px";
				MemPic.style.width = (tmpW + (2*(pic.height/100)*(pic.width/pic.height))) + "px";
				t = 2;
		}else{
			t = 0;
			if(tmpTid) clearTimeout(tmpTid)
			tmpTid = setTimeout("growdown(" + (5) + ")",3000)
		}
		timeout = 2;
	}else{
		timeout = 500;
	}
	if (t>0) {
		if(tmpTid) clearTimeout(tmpTid)
		tmpTid = setTimeout("growup(" + (t-1) + ")",timeout)
	}
}
function growdown(t){
	if (pic.height)	{
		var tmpH = eval(MemPic.style.height.substr(0,MemPic.style.height.length-2))
		var tmpW = eval(MemPic.style.width.substr(0,MemPic.style.width.length-2))
		if (((tmpH -2*(pic.height/100))>0) || (tmpW - ( 2 *(pic.height/100) * (pic.width/pic.height))>0)){
				if((tmpH -2*(pic.height/100))>0) MemPic.style.height = (tmpH -2*(pic.height/100)) + "px";
				if(tmpW - ( 2 *(pic.height/100) * (pic.width/pic.height))>0) MemPic.style.width = tmpW - ( 2 *(pic.height/100) * (pic.width/pic.height)) + "px";
				t = 2;
		}else{
			MemPic.style.height = "0px"
			MemPic.style.width = "0px"
			t = 0;
		}
		timeout = 2;
	}else{
		timeout = 500;
	}
	if (t>0) {
		if(tmpTid) clearTimeout(tmpTid);
		tmpTid = setTimeout("growdown(" + (t-1) + ")",timeout)
	}
}
function alink(src,text,target){
	this.txt = text;
	this.src = src;
	if (!target){target="_self";}
	this.target = target;
}
var menu = [];
menu[0] = [];
menu[0][0] = new alink("index.asp?module=about&blockarea=1","關於我們");
menu[0][1] = new alink("index.asp?module=about&blockarea=2","經營理念");
menu[0][2] = new alink("index.asp?module=about&blockarea=3","品牌形象");
menu[0][3] = new alink("index.asp?module=about&blockarea=4","團隊素質");
menu[0][4] = new alink("index.asp?module=about&blockarea=5","經營成果");
menu[0][5] = new alink("index.asp?module=about&blockarea=6","未來願景");
menu[1] = [];
menu[1][0] = new alink("index.asp?module=Case","國家世紀館");
menu[1][1] = new alink("index.asp?module=Case","超級F1");
menu[1][2] = new alink("index.asp?module=Case","橋峰");
menu[1][3] = new alink("index.asp?module=Case","巨蛋");
menu[1][4] = new alink("index.asp?module=Case","馥華巴黎");
menu[2] = [];
menu[2][0] = new alink("index.asp?module=ContactBuy","買屋委託");
menu[2][1] = new alink("index.asp?module=ContactSell","賣屋委託");
menu[2][2] = new alink("index.asp?module=ContactTenancy","租屋委託");
menu[2][3] = new alink("index.asp?module=ContactRent","出租委託");
menu[3] = [];
menu[3][0] = new alink("../../index.asp","員工專區","_blank");
menu[3][1] = new alink("../../member/index.asp?module=member","會員專區","_blank");
menu[4] = [];
menu[4][0] = new alink("index.asp?module=map&file=map2","以圖找屋");
menu[4][1] = new alink("index.asp?module=search","售案搜尋");
menu[4][2] = new alink("index.asp?module=Search&flag=7","售案 (案名,合約編號,經紀人電話搜尋)");
menu[4][3] = new alink("index.asp?module=search&searchTo=2","租案搜尋");
menu[4][4] = new alink("index.asp?module=Search&searchTo=2&flag=7","租案 (案名,合約編號,經紀人電話搜尋)");
menu[5] = [];
menu[5][0] = new alink("index.asp?module=news&flag=0","菁英表揚")
menu[5][1] = new alink("index.asp?module=news&flag=1","生活花絮")
function writeMenu(x,j){
		document.write('<DIV ID="menuDiv_'+x+'" STYLE="display:none;z-index:2; padding-left:25px; padding-top:5px "><table  Width="100%" border="0" align="center" cellpadding="0" cellspacing="3" class="menu-table">');
		for (var i=0;i<menu[j].length ;i++ )
		{
			document.write('<tr><td align="left"  class="menu-td" nowrap><A HREF="'+menu[j][i].src+'" onMouseOver="ShowMenu(this,\'menuDiv_'+x+'\',\'\',\'submenu\');" onFocus="ShowMenu(this,\'menuDiv_'+x+'\',\'\',\'submenu\');" onMouseOut="MM_startTimeout();" onBlur="MM_startTimeout();" target="'+menu[j][i].target+'"><div>&nbsp;'+menu[j][i].txt+'&nbsp;</div></A></td></tr>');
		}
		document.write('</table></DIV>');
}