function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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_closeImages() { //v1.0
  proimg.style.display = "none";open1.style.display = "none";
  proimg1.style.display = "none";open2.style.display = "none";
  proimg2.style.display = "none";open3.style.display = "none";
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function mover(st) {
st.style.backgroundColor = '#FFCCCC';
}

function sover(st) {
st.style.backgroundColor = '#ECECE3';
}

function mout(st) {
st.style.backgroundColor = '';
}

function ImageMovie(){	
  this.width=100;
  this.height=100;
  this.textHeight=0;
  this.flashHeight=0;
  this.pics='';
  this.links='';
  this.texts='';

  this.add=function(pic,link,text){
	  if(this.pics!='')this.pics+='|';
	  this.pics+=pic;

	  if(this.links!='')this.links+='|';
	  this.links+=link;

	  if(this.texts!='')this.texts+='|';
	  this.texts+=text;
  }

  this.play = function(){	 
    this.flashHeight=this.height + this.textHeight;
	document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ this.width +'" height="'+ this.flashHeight +'">');
	document.writeln('<param name="allowScriptAccess" value="sameDomain">');
	document.writeln('<param name="movie" value="focus.swf">');
	document.writeln('<param name="quality" value="high">');
	document.writeln('<param name="bgcolor" value="#fffff">');
	document.writeln('<param name="menu" value="false">');
	document.writeln('<param name=wmode value="transparent">');
	document.writeln('<param name="FlashVars" value="pics='+this.pics+'&links='+this.links+'&texts='+this.texts+'&borderwidth='+this.width+'&borderheight='+this.height+'&textheight='+this.textHeight+'">');
	document.writeln('<embed src="focus.swf" wmode="opaque" FlashVars="texts='+this.texts+'&pics='+this.pics+'&links='+this.links+'&borderwidth='+this.width+'&borderheight='+this.height+'&textheight='+this.textHeight+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ this.width +'" height="'+ this.flashHeight +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
    document.writeln('</object>');
  }
}

//Author:Daviv
//Blog:http://blog.163.com/jxdawei
//Date:2006-10-28
//Email:jxdawei@gmail.com
function sAlert(str){
	var msgw,msgh,bordercolor;
	msgw=400;//提示窗口的宽度
	msgh=100;//提示窗口的高度
	bordercolor="#336699";//提示窗口的边框颜色
	titlecolor="#99CCFF";//提示窗口的标题颜色
	
	var sWidth,sHeight;
	sWidth=document.body.offsetWidth;
	sHeight=document.body.offsetHeight;
	
	
	var bgObj=document.createElement("div");
	bgObj.setAttribute('id','bgDiv');
	bgObj.style.position="absolute";
	bgObj.style.top="0";
	bgObj.style.background="#777";
	bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
	bgObj.style.opacity="0.6";
	bgObj.style.left="0";
	bgObj.style.width=sWidth + "px";
	bgObj.style.height=sHeight + "px";
	document.body.appendChild(bgObj);
	var msgObj=document.createElement("div")
	msgObj.setAttribute("id","msgDiv");
	msgObj.setAttribute("align","center");
	msgObj.style.position="absolute";
	msgObj.style.background="white";
	msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
	msgObj.style.border="1px solid " + bordercolor;
	msgObj.style.width=msgw + "px";
	msgObj.style.height=msgh + "px";
	msgObj.style.top=(document.documentElement.scrollTop + (sHeight-msgh)/2) + "px";
	msgObj.style.left=(sWidth-msgw)/2 + "px";
	var title=document.createElement("h4");
	title.setAttribute("id","msgTitle");
	title.setAttribute("align","right");
	title.style.margin="0";
	title.style.padding="3px";
	title.style.background=bordercolor;
	title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
	title.style.opacity="0.75";
	title.style.border="1px solid " + bordercolor;
	title.style.height="18px";
	title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
	title.style.color="white";
	title.style.cursor="pointer";
	title.innerHTML="關閉";
	title.onclick=function(){
	document.body.removeChild(bgObj);
	document.getElementById("msgDiv").removeChild(title);
	document.body.removeChild(msgObj);
	}
	document.body.appendChild(msgObj);
	document.getElementById("msgDiv").appendChild(title);
	var txt=document.createElement("p");
	txt.style.margin="1em 0"
	txt.setAttribute("id","msgTxt");
	txt.innerHTML=str;
	document.getElementById("msgDiv").appendChild(txt);
}
/*
function ajaxcount(urlRequestString){
	var countPage = new CallBackObject();
	//countPage.OnComplete = countPage_Complete;
	//countPage.onError = countPage_Error;
	countPage.DoCallBack(urlRequestString);						
}

function countPage_Complete(responseText, responseXML){
	alert(responseText);
}

function countPage_Error(status, statusText, responseText){
	alert(responseText);
}

function CallBackObject(){
  this.XmlHttp = this.GetHttpObject();
}
 
CallBackObject.prototype.GetHttpObject = function(){ 
  var xmlhttp;
	if (window.ActiveXObject) {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} 
	else if (window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
	}
  return xmlhttp;
}
 
CallBackObject.prototype.DoCallBack = function(URL){ 
  if( this.XmlHttp ) {
	if( this.XmlHttp.readyState == 4 || this.XmlHttp.readyState == 0 ){
	  var oThis = this;
	  this.XmlHttp.open('GET', URL);
	  this.XmlHttp.onreadystatechange = function(){ oThis.ReadyStateChange(); };
	  this.XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	  this.XmlHttp.send('');
	}
  }
}
 
CallBackObject.prototype.ReadyStateChange = function(){
  if( this.XmlHttp.readyState == 4 ){
  	if( this.XmlHttp.status == 200 ){
		this.OnComplete(this.XmlHttp.responseText, this.XmlHttp.responseXML);
	}else{
		this.OnError(this.XmlHttp.status, this.XmlHttp.statusText, this.XmlHttp.responseText);
	}
  }	
}
*/
function createFCKeditor(selecteditArea,selecteditType){	
	var oFCKeditor = new FCKeditor(selecteditArea) ;
	oFCKeditor.BasePath = "FCKeditor/" ;
	oFCKeditor.Width = "98%" ;
	oFCKeditor.Height = "300" ;
	oFCKeditor.ToolbarSet = selecteditType ;
	oFCKeditor.ReplaceTextarea() ;
}


function InsertReMessage(selecteditArea,selectName,selectedObj){
	var oEditor = FCKeditorAPI.GetInstance(selecteditArea) ;
	var insertContent = document.getElementById(selectedObj).innerHTML;
	var insertStr = selectName+" 說到：<br>"+insertContent;
	if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG ){
		oEditor.SetHTML('<table cellspacing="0" cellpadding="4" width="100%" border="0"><tbody><tr><td>'+insertStr+'</td></tr></tbody></table><br />') ;
	}else{
		alert( 'You must be on WYSIWYG mode!' ) ;
	}
}

function InsertMessage(selecteditArea){
	var oEditor = FCKeditorAPI.GetInstance(selecteditArea) ;	
	var insertStr = "";
	if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG ){
		oEditor.SetHTML(insertStr) ;
	}else{
		alert( 'You must be on WYSIWYG mode!' ) ;
	}
}

function showhideArea(areaName,status){
	document.getElementById(areaName).style.display = status;
}	

//FCKEditor 結合 Spry 表單檢查並送出
function submitForm(formName, selecteditArea){	
	var oEditor = FCKeditorAPI.GetInstance(selecteditArea) ;
	document.getElementById(selecteditArea).value = oEditor.GetXHTML();
	var sForm = document.getElementById(formName);
	if (Spry.Widget.Form.validate(sForm) != false){
		//sForm.submit();
		//setTimeout("sForm.submit()", 1000); //延遲送出留言
		//sForm.style.display = "none";		
		//window.location.reload();
		return true;
	}
	return false;
}