﻿
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 funCheckNewsletterData(){
	var objEmail = document.getElementById("texNewsletter_Mail");
	if (objEmail.value==""||objEmail.value=="請輸入您的電子信箱"){
		objEmail.focus();
		alert('請輸入您的電子信箱。');
		return false;
	}
	if( !/(\S)+[@]{1}(\S)+[.]{1}(\w)+/.test(objEmail.value) ) {
		objEmail.focus();
		alert('輸入的電子信箱的格式不正確，請重新輸入。');
		return false;
	}
	return true;
}

function funCheckLoginData(){
	var objAccount = document.getElementById("texLogin_Account");
	var objPassword = document.getElementById("texLogin_Pw");
	if (objAccount.value==""){
		objAccount.focus();
		alert('請輸入您的會員帳號。');
		return false;
	}
//	if( !/(\S)+[@]{1}(\S)+[.]{1}(\w)+/.test(objAccount.value) ) {
//		objAccount.focus();
//		alert('輸入的會員帳號的格式不正確，提醒您，會員帳號就是電子郵件格式。');
//		return false;
//	}
	if (objPassword.value==""){
		objPassword.focus();
		alert('請輸入您的密碼。');
		return false;
	}
	return true;
}
