<!--//

function PopUpWindow(URL, N, W, H, S) { // name, width, height, scrollbars
	var winleft	=	(screen.width - W) / 2;
	var winup	=	(screen.height - H) / 2;
	winProp		=	'width='+W+',height='+H+',left='+winleft+',top='+winup+',scrollbars='+S+',resizable'
	Win			=	window.open(URL, N, winProp)
	if (parseInt(navigator.appVersion) >= 4) { Win.window.focus(); }
}




//-------------- Admin --------------//
function TrainingBoardExclusiveUser(URL) {
  PopUpWindow(URL,'TCENG1',500,250,'no');
}

function EditUser(URL) {
  PopUpWindow(URL,'TCENG1',778,600,'yes');
}


function DelUser(URL) {
  PopUpWindow(URL,'TCENG2',500,200,'no');
}

function ActiveUser(URL) {
  PopUpWindow(URL,'TCENG1',500,200,'no');
}

function BankUser(URL) {
  PopUpWindow(URL,'TCENG1',500,400,'no');
}

function ShippingUser(URL) {
  PopUpWindow(URL,'TCENG4',650,550,'yes');
}

function SerialGeneraterUser(URL) {
  PopUpWindow(URL,'TCENG1',700,500,'yes');
}

function DonateUser(URL) {
  PopUpWindow(URL,'TCENG1',500,600,'yes');
}

function EditTrainer(URL) {
  PopUpWindow(URL,'TCENG1',778,600,'yes');
}


function DelTrainer(URL) {
  PopUpWindow(URL,'TCENG2',500,200,'no');
}

function ActiveTrainer(URL) {
  PopUpWindow(URL,'TCENG1',500,200,'no');
}

function ShoppingUser(URL) {
  PopUpWindow(URL,'TCENG41',600,600,'no');
}

function TrainingUser(URL) {
  PopUpWindow(URL,'TCENG42',600,600,'no');
}


function EditTraining(URL) {
  PopUpWindow(URL,'TCENG1',1000,600,'yes');
}


function DelTraining(URL) {
  PopUpWindow(URL,'TCENG2',500,200,'no');
}

function ActiveTraining(URL) {
  PopUpWindow(URL,'TCENG1',500,200,'no');
}

function TicketTrainingUpdate(URL) {
  PopUpWindow(URL,'TCENG5',500,550,'yes');
}

function TicketTraining(URL) {
  PopUpWindow(URL,'TCENG5',500,450,'yes');
}


function EditFaq(URL) {
  PopUpWindow(URL,'TCENG1',500,600,'no');
}

function DelFaq(URL) {
  PopUpWindow(URL,'TCENG2',500,200,'no');
}

function ActiveFaq(URL) {
  PopUpWindow(URL,'TCENG1',500,200,'no');
}




function EditSerialGenerator(URL) {
  PopUpWindow(URL,'TCENG1',700,700,'yes');
}

function DelSerialGenerator(URL) {
  PopUpWindow(URL,'TCENG2',500,200,'no');
}

function ActiveSerialGenerator(URL) {
  PopUpWindow(URL,'TCENG1',500,200,'no');
}



function ViewApproveRegister(URL) {
  PopUpWindow(URL,'TCENG1',700,600,'yes');
}


function BoardDel(URL) {
  PopUpWindow(URL,'TCENG6',500,200,'no');
}

function BoardHelpDel(URL) {
  PopUpWindow(URL,'TCENG46',450,400,'yes');
}

function NewsEdit(URL) {
  PopUpWindow(URL,'TCENG10',778,600,'yes');
}

function NewsDel(URL) {
  PopUpWindow(URL,'TCENG11',500,200,'no');
}

function NewsActive(URL) {
  PopUpWindow(URL,'TCENG12',500,200,'no');
}


function DonateEdit(URL) {
  PopUpWindow(URL,'TCENG10',778,600,'yes');
}

function DonateDel(URL) {
  PopUpWindow(URL,'TCENG11',500,200,'no');
}

function DonateActive(URL) {
  PopUpWindow(URL,'TCENG12',500,200,'no');
}

function DonateDetail(URL) {
  PopUpWindow(URL,'TCENG10',600,450,'yes');
}


function AlbumEdit(URL) {
  PopUpWindow(URL,'TCENG10',500,200,'yes');
}

function AlbumDel(URL) {
  PopUpWindow(URL,'TCENG11',500,200,'no');
}

function AlbumActive(URL) {
  PopUpWindow(URL,'TCENG12',500,200,'no');
}

function InsertDateShow() {	
	var strContentDate = document.cm_form.content_date.value;
	var arrContentDate = strContentDate.split("/");
	var strContentDateStart = strContentDate;
	var strContentDateStop = "";
	var strContentDateStopHilight = "";
	var intContentYear = parseFloat(arrContentDate[2]) + 10;
	var intContentMonthHilight = parseFloat(arrContentDate[1]) + 3;
	var intContentYearHilightFix = parseFloat(arrContentDate[2]) + 1;
	var intContentYearHilight = parseFloat(arrContentDate[2]);
	
	if (intContentYear > 0) {
		strContentDateStop = arrContentDate[0] + "/" + arrContentDate[1] + "/" + intContentYear;

		if (intContentMonthHilight > 12) {
			intContentMonthHilight = intContentMonthHilight - 12;
			intContentYearHilight = intContentYearHilightFix;
		}
		if (intContentMonthHilight < 10) {
			intContentMonthHilight = "0" + intContentMonthHilight;
		}
		strContentDateStopHilight = arrContentDate[0] + "/" + intContentMonthHilight + "/" + intContentYearHilight;
	}	

	document.cm_form.content_date_start.value = strContentDateStart;
	document.cm_form.content_date_stop.value = strContentDateStop;

	document.cm_form.content_date_start_hilight.value = strContentDateStart;
	document.cm_form.content_date_stop_hilight.value = strContentDateStopHilight;
}

function TrainingSlip(URL) {
  PopUpWindow(URL,'TCENG6',650,480,'yes');
}

function ScoreStatement(URL) {
  PopUpWindow(URL,'TCENG7',770,480,'yes');
}

function ScoreManage(URL) {
  PopUpWindow(URL,'TCENG8',500,350,'no');
}

function SendSms(URL) {
  PopUpWindow(URL,'TCENG9',700,450,'yes');
}

//-------------- / Admin --------------//






//-------------- Trainer --------------//
function ArticleEdit(URL) {
  PopUpWindow(URL,'TCENG3',1000,600,'yes');
}


function ArticleDel(URL) {
  PopUpWindow(URL,'TCENG4',500,200,'no');
}


function ArticleActive(URL) {
  PopUpWindow(URL,'TCENG5',500,200,'no');
}
//-------------- / Trainer --------------//





//-- User --//
function UpdateEmail () {
	document.register.email1.value = document.register.email.value;
}


function ProfilePhoto(URL) {
  PopUpWindow(URL,'TCENG6',500,200,'no');
}


function OrderInfo(strUrl) {
  PopUpWindow(strUrl,'SH09',850,600,'yes');
}

//-- / User --//




//-------------- User-Non --------------//
function UsernameCheck(URL) {
  PopUpWindow(URL,'TCENG',500,200,'no');
}


function ConfirmUsername(username) {
	window.opener.document.register.username_temp.value=username;
	window.opener.document.register.username.value=username;
	window.close();
}
//-------------- / User-Non  --------------//





//-------------- Web --------------//
function RegisterNoAgree () {
	if (window.confirm("ขออภัยไม่สามารถให้บริการกับท่านได้")) {
		window.location.href = "/"
	}
}


function ViewProfile(TYPE,ID) {
  PopUpWindow('/engfanatic/profile.php?type=' + TYPE +'&id=' + ID,'TCENG11',790,600,'yes');
}



function FuncPrintPage() {
  //PopUpWindow('/engfanatic/function/print.php','TCENG9',700,600,'yes');
  location.href = '/engfanatic/function/print.php';
}


function FuncSend2Friend() {
  PopUpWindow('/engfanatic/function/send2friend.php','TCENG10',500,450,'no');
}


function TrainingMap(URL) {
  PopUpWindow('/engfanatic/training_map.php?training_map=' + URL,'TCENG99',500,500,'yes');
}



function AlbumView(URL) {
  PopUpWindow(URL,'TCENG99',800,500,'yes');
}
//-------------- / Web --------------//




function ConfirmGo(strText,strGo) {
	var agree = confirm(strText);
	if (agree) {
		location.href = strGo;
	}
}



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



function Check_All(){
	for (var i=0;i<frm.elements.length;i++) {
		var e=frm.elements[i];
		if ((e.name != 'allbox') && (e.type=='checkbox')) {
			e.checked=frm.allbox.checked;
		}
	}
}


/* สั่งโดย link */
function CheckAllByHit(frm){
	if (frm.allbox.checked == true) {
		frm.allbox.checked = false;
	}
	else {
		frm.allbox.checked = true;
	}
	//alert(frm.allbox.checked);
	CheckAll(frm);
}

/* สั่งโดยปุ่ม checkbox */
function CheckAll(frm){
	for (var i=0;i<frm.elements.length;i++) {
		var e=frm.elements[i];
		if ((e.name != 'allbox') && (e.type=='checkbox')) {
			e.checked=frm.allbox.checked;
		}
	}
}


/* webboard delete */
function CheckAllDelete(frm){
	for (var i=0;i<frm.elements.length;i++) {
		var e=frm.elements[i];
		if ((e.name != 'allbox') && (e.name != 'move_id[]') && (e.type=='checkbox')) {
			e.checked=frm.allbox.checked;
		}
	}
}



function ControlOrderInfo(strUrl) {
  PopUpWindow(strUrl,'SH06',650,600,'yes');
}
//-->