// JavaScript Document
function isEmpty(elem, helperMsg){
	if(elem.value.length == 0){
		alert(helperMsg); elem.focus(); return false;
	}else{
		return true;
	}
}

function isNumeric(elem, helperMsg){
	var numericExpression = /^[0-9]+$/;
	if(elem.value.match(numericExpression)){
		return true;
	}else{
		alert(helperMsg); elem.focus(); return false;
	}
}

function isAlphabet(elem, helperMsg){
	var alphaExp = /^[a-zA-Z]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg); elem.focus(); return false;
	}
}

function isAlphanumeric(elem, helperMsg){
	var alphaExp = /^[0-9a-zA-Z]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg); elem.focus(); return false;
	}
}

function lengthRestriction(elem, descript, min, max){
	var uInput = elem.value;
	if(uInput.length >= min && uInput.length <= max){
		return true;
	}else{
		alert("¡ÃÍ¡"+descript+"¤ÇÒÁÂÒÇ "+min+" - " +max+ " µÑÇÍÑ¡ÉÃ"); elem.focus(); return false;
	}
}

function madeSelection(elem, helperMsg){
	if(elem.value == "0"){
		alert(helperMsg); elem.focus(); return false;
	}else{
		return true;
	}
}

function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg); elem.focus(); return false;
	}
}

function PopUpWindow(theURL,winName,features){
	window.open(theURL,winName,features);
}
function MM_openBrWindow1(theURL,winName,features) {//2.0
	if(window.confirm("¤Ø³µéÍ§¡ÒÃÅº¢éÍÁÙÅàÃ¤¤ÍÃì´¹ÕéãªèËÃ×ÍäÁè?")==true) {
		window.open(theURL,winName,features);
	}else{
		return false
	}
}
function fullscreen(url,windowname,width,height) {

	var isWin=(navigator.appVersion.indexOf("Win")!=-1)? true : false;
	var isIE=(navigator.appVersion.indexOf("MSIE")!=-1)? true : false;
	var notIE7 = (navigator.appVersion.indexOf("MSIE 7.0")!=-1)? false : true;
	var windowwidth =screen.availWidth;
	var windowheight =screen.availheight;
	
	if (width != null && height != null) {
		windowwidth = width;windowheight =height;
		isWin = false;
	}


	if(isWin&&isIE&&notIE7){
		var fullwindow = window.open(url,windowname,"fullscreen=1, scrollbars=0");
		fullwindow.focus();
	}else{
	// for non-ie browsers, specify width and height instead of using fullscreen 
		var fullwindow = window.open(url,windowname,"width="+windowwidth +",height="+windowheight);
		fullwindow.moveTo(0,0);
		fullwindow.focus();
	}

}
function popup(url,name,windowWidth,windowHeight){    
	myleft=(screen.width)?(screen.width-windowWidth)/2:100;	
	mytop=(screen.height)?(screen.height-windowHeight)/2:100;	
	properties = "width="+windowWidth+",height="+windowHeight;
	properties +=",scrollbars=yes, top="+mytop+",left="+myleft;   
	window.open(url,name,properties);
}
function changeme(id, action) {
       if (action=="hide") {
            document.getElementById(id).style.display = "none";
       } else {
            document.getElementById(id).style.display = "block";
       }
}
