﻿
function funChangeImage(obj) {
	var imgUrl = obj.src.toLowerCase();
	if ( imgUrl.indexOf("over.") > 0 ) {
		obj.src = imgUrl.replace("over.","out.");
	} else {
		obj.src = imgUrl.replace("out.","over.");
	}
}

function funOpenWindow(theURL,WinName,width,height,scrollbars) {
	var DateTime = new Date();
	var windowName = 'Windows' + DateTime.getTime()
	var screenW = (screen.width - width) / 2
	var screenH = (screen.height - height) / 3
	features = 'width=' + width + ',height=' + height + ',left=' + screenW + ',top=' + screenH + ',scrollbars=' + scrollbars + ',resizable=yes',
	objWindow = window.open(theURL,WinName,features);
	objWindow.focus();
}

function funShowFlash(objID, objSource, objWidth, objHeight, objQuality, objWmode, objBgcolor) {

	var pageUrl = self.window.location.href;
	if(pageUrl.substring(0,5) == 'https') {
		swfUrl = "https";
	} else {
		swfUrl = "http";
	}
	if (objID == "") objID = 'ShockwaveFlash1';
	if (objWidth == "") objWidth = '0';
	if (objHeight == "") objHeight = '0';
	if (objQuality == "") objQuality = 'best';
	if (objWmode == "") {
		objWmode = 'transparent';
	} else {
		objWmode = '';
	}
	document.write('<object id="' + objID + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" type="application/x-shockwave-flash" data="' + objSource + '" codebase="' + swfUrl +'://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" width="' + objWidth + '" height="' + objHeight + '">');
	document.write('<param name=menu value=false>');
	document.write('<param name=allowScriptAccess value=always>');
	document.write('<param name=wmode value="'+ objWmode +'">');
	document.write('<param name=movie VALUE="'+ objSource +'">');
	document.write('<param name=quality VALUE="'+ objQuality +'">');
	document.write('<param name=bgcolor VALUE="'+ objBgcolor +'">');
	document.write('<embed allowScriptAccess="always" swLiveConnect="true" src="' + objSource + '" menu="false" quality="' + objQuality + '" wmode="' + objWmode + '" bgcolor="' + objBgcolor + '" width="' + objWidth + '" height="' + objHeight + '" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer">');
	document.write('</object>');
}

function funCheckReplyData(){
	var objInput = document.getElementById("tbeReply").getElementsByTagName("input");
	if ( objInput[0].value == "" ) { alert("請輸入您的暱稱。"); objInput[0].focus(); return false; }
	var obj = document.getElementById("tbeReply").getElementsByTagName("textarea")
	if ( obj[0].value == "" ) { alert("請輸入回應內容。"); obj[0].focus(); return false; }
	if ( objInput[3].value == "" ) { alert("請輸入驗證碼。"); objInput[3].focus(); return false; }
	return true;
	
}