function popDetail (url,w,h) {
var wwidth = w;
var wheight = h;

	if (wwidth == '') {
		wwidth =400;
	}
	if (wheight == '') {
		wheight = 300;
	}

var	LP = (screen.width) ? (screen.width-wwidth)/10 : 0;
var	TP = (screen.height) ? (screen.height-wheight)/10 : 0;

setting = 'top='+TP+',left='+LP+',width='+wwidth+',height='+wheight+'directories=no,toolbar=no,resizable=yes,scrollbars=yes,menubar=no,status=no';
var pdetail = window.open(url,"Details",setting);
//	if (pdetail.opener== null) {
//		pdetail.opener = self;
//	}
//		var selProdWnd=window.open("prod_details.phtml?mode=popup&pid="+pid, "_blank","resizable=yes,left=5,top=5,width=620,height=460,scrollbars=yes,menubar=yes,toolbar=yes,");

}

//--------------------------------------------------- For Forum (家庭會客室) form
function genTopics() {
var topic = new Array(5);
var pic = new Array(5);
	topic[0] = "隨意";
	topic[1] = "家事常識";
	topic[2] = "我的孩子";
	topic[3] = "夫妻之間";
	topic[4] = "戀愛約會";

	pic[0] = "fcr_other";
	pic[1] = "fcr_wife";
	pic[2] = "fcr_son";
	pic[3] = "fcr_couple";
	pic[4] = "fcr_half";

	var line = "<select name=\"txtTopic\">\n";
//	line += "<option value=\"\"> --------------------- Please select --------------------- \n";
	for (i=0; i<topic.length; i++) {
			line += "<option value=\""+pic[i]+"\">"+topic[i]
	}
	line += "</select>";
	document.write(line);

}

//--------------------------------------------------- For Forum (家庭會客室) form
function checkFCR(Form) {
var txtName = Form.txtName.value;
var txtMsg = Form.txtMsg.value;

	if (txtName == '' || txtName.length < 2) {
		alert("請輸入您的名字");
		Form.txtName.focus();
		return false;
	}

	if (txtMsg == '' || txtMsg.length < 4) {
		alert("請輸入您的留言");
		Form.txtMsg.focus();
		return false;
	}

}

//--------------------------------------------------- For 創作室 form
function checkCR(Form) {
var txtTitle = Form.txtTitle.value;
var txtAuthor = Form.txtAuthor.value;
var txtContent = Form.txtContent.value;

	if (txtTitle == '' || txtTitle.length < 2) {
		alert("請輸入文章標題");
		Form.txtTitle.focus();
		return false;
	}

	if (txtAuthor == '' || txtAuthor.length < 2) {
		alert("請輸入作者名稱");
		Form.txtAuthor.focus();
		return false;
	}

	if (txtContent == '' || txtContent.length < 5) {
		alert("請輸入文章內容");
		Form.txtContent.focus();
		return false;
	}

}

//--------------------------------------------------- For office map and index popup

function MAPprint(winname) {
	window.open('mappop.asp', winname,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=430,height=575');
}

function indexpop(winname) {
	window.open('indexpop.asp', winname,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=565,height=700');
}

//--------------------------------------------------- For 親子讀書會 童書推介 popup

function RMprint(winname) {
	window.open('RMpop.asp', winname,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=370,height=590');
}

function rmprod() {
	rmphoto = window.name
	document.images["product"].src = 'images_product/'+rmphoto+'l.jpg';
	document.images["product"].useMap = '#'+rmphoto+'';
}


function RMpopupresize() {

rmbook = window.name

	if (window.name == "book15") {
	resizeTo(359,479);
	}
	if (window.name == "book16") {
	resizeTo(359,607)
	}
	if (window.name == "book17") {
	resizeTo(358,546)
	}
	if (window.name == "book18") {
	resizeTo(359,497)
	}
	if (window.name == "book19") {
	resizeTo(362,544)
	}
}


var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac") != -1); 

function printPage(frame, arg) {
  if (frame == window) {
    printThis();
  } else {
    link = arg;
    printFrame(frame);
  }
  return false;
}

function printThis() {
  if (pr) {
    window.print();
  } else if (da && !mac) {
    vbPrintPage();
  } else {
    alert("Sorry, your browser doesn't support this feature.");
  }
}

function printFrame(frame) {
  if (pr && da) {
    frame.focus();
    window.print();
    link.focus();
  } else if (pr) {
    frame.print();
  } else if (da && !mac) {
    frame.focus();
    setTimeout("vbPrintPage(); link.focus();", 100);
  } else {
    alert("Sorry, your browser doesn't support this feature.");
  }
}

if (da && !pr && !mac) with (document) {
  writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
  writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
  writeln('Sub window_onunload');
  writeln('  On Error Resume Next');
  writeln('  Set WB = nothing');
  writeln('End Sub');
  writeln('Sub vbPrintPage');
  writeln('  OLECMDID_PRINT = 6');
  writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
  writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
  writeln('  On Error Resume Next');
  writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
  writeln('End Sub');
  writeln('<' + '/SCRIPT>');
}


function bannerstop() {
var NumberOfAds = 8;
var now = new Date()
var sec = now.getSeconds()
var AdNumber = sec % NumberOfAds;
AdNumber +=1;

if (AdNumber==1) {
 url="bp.asp?cat=NEW";
 Graphic="images/banner20.gif";
 width = "460"
 height = "62"
}

if (AdNumber==2) {
 url="bp.asp?cat=NEW";
 Graphic="images/banner21.gif";
 width = "460"
 height = "62"
}

if (AdNumber==3) {
 url="bp.asp?cat=NEW";
 Graphic="images/banner22.gif";
 width = "460"
 height = "62"
}

if (AdNumber==4) {
 url="bp.asp?cat=NEW";
 Graphic="images/banner23.gif";
 width = "460"
 height = "62"
}

if (AdNumber==5) {
 url="bp.asp?cat=NEW";
 Graphic="images/banner24.gif";
 width = "460"
 height = "62"
}

if (AdNumber==6) {
 url="bp.asp?cat=NEW";
 Graphic="images/banner25.gif";
 width = "460"
 height = "62"
}

if (AdNumber==7) {
 url="bp.asp?cat=NEW";
 Graphic="images/banner25.gif";
 width = "460"
 height = "62"
}

if (AdNumber==8) {
 url="bp.asp?cat=NEW";
 Graphic="images/banner25.gif";
 width = "460"
 height = "62"
}

document.write('<a href=\"' + url + '\">');
document.write('<img src=\"' + Graphic + '\" width=')
document.write(width + ' height=' + height + ' ');
document.write('border=0><br>');
document.write('</a>');

}