
//ÇÃ·¡½¬ Ãâ·Â
function flash_print( flash_file, w, h){

	var object = "";

	object  = "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='" + w + "' height='" + h + "'>";
	object += "<PARAM name='movie' value='" + flash_file + "'>";
	object += "<PARAM name='quality' value='high'>";
	object += "<PARAM name='menu' value='false'>";
	object += "<PARAM name='wmode' value='transparent'>";
	object += "<EMBED src='" + flash_file + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + w + "' height='" + h + "' menu='false'></EMBED>";
	object += "</OBJECT>";

	document.write (object);

}//end of flash_print()


function flash_print1( flash_file, w, h){

	var object = "";

	object  = "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='" + w + "' height='" + h + "'>";
	object += "<PARAM name='movie' value='" + flash_file + "'>";
	object += "<PARAM name='quality' value='high'>";
	object += "<PARAM name='menu' value='false'>";
	object += "<PARAM name='wmode' value='transparent'>";
	object += "<EMBED src='" + flash_file + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + w + "' height='" + h + "' menu='false'></EMBED>";
	object += "</OBJECT>";

	document.write (object);

}

//OnmouseOver OR OnmouseOut
function Ch_img( file_name, img_name ){

	var img = eval("document." + img_name );

	img.src = file_name;

}//end of Ch_img()


//ÁÖ¹Î¹øÈ£ Ã¼Å©
function Jumin_Ck(f, ju1, ju2){

	var jumin_no=ju1 + ju2;

	fmt = /^\d{6}[12]\d{6}$/;

	if (!fmt.test(jumin_no)) {
		return false;
	}

	birthYear = '19' + jumin_no.substr(0, 2);
	birthMonth = jumin_no.substr(2, 2) - 1;
	birthDate = jumin_no.substr(4, 2);
	birth = new Date(birthYear, birthMonth, birthDate);

	if( birth.getYear() % 100 != jumin_no.substr(0, 2) || birth.getMonth() != birthMonth || birth.getDate() != birthDate){
		return false;
	}

	buf = new Array(13);
	for( i=0; i < 13; i++ ) buf[i] = parseInt(jumin_no.charAt(i));

	multipliers = [2,3,4,5,6,7,8,9,2,3,4,5];

	for( i=0, sum=0; i < 12; i++ ) sum += (buf[i] *= multipliers[i]);

	if ( (11 - (sum % 11)) % 10 != buf[12] ) {
		return false;
	}

	return true;

}//end of Jumin_Ck()


//ÀÌº¥Æ®¹ß»ý½Ã ¼ýÀÚÃ¼Å©
function Num_ck(){

	if( ( event.keyCode != 9 && event.keyCode != 13 ) && ( (event.keyCode < 48) || (event.keyCode > 57) ) ){
		alert('¼ýÀÚ¸¸ ÀÔ·ÂÇÏ¼¼¿ä');
		event.returnValue = false;
	}

}//end of Num_ck()


//¿µ¹® + ¼ýÀÚÃ¼Å© , ±æÀÌ 4 ~ 15
function alnum_ck(v){

	if( v.length < 4 || v.length > 15 ) return false;

	for( var i=0; i < v.length; i++ ){
		var chr=v.substr(i,1);
		if( (chr<'0' || chr>'9') && (chr<'a' || chr>'z') && (chr<'A' || chr>'Z') ) return false;
	}

	return true;

}//end of alnum_ck()


//ÇØ´ç ±æÀÌÀÏ¶§ Æ÷Ä¿½º ÀÌµ¿
function focus_move( now_focus, next_focus, move_len ){

	if( now_focus.value.length == move_len ) next_focus.focus();

}

//µû¿ÈÇ¥Ã¼Å©
function dot_ck(v){

	for( var i=0; i<v.length; i++ ){

		var chr=v.substr(i,1);

		if( chr == "\"" || chr == "'" ) return false;
	}

	return true;

}//end of dot_ck()


//»õÃ¢
function NewWin(url,w,h,t,l,sr){
	window.open(url,"newWin","height=" + h + ", width=" + w + ", top=" + t + ", left=" + l + ", scrollbars=" + sr + ""); return;
}//end of NewWin()


//»õÃ¢2
function NewWin2(url,w_name,w,h,t,l,sr){
	window.open(url,w_name,"height=" + h + ", width=" + w + ", top=" + t + ", left=" + l + ", scrollbars=" + sr + ""); return;
}//end of NewWin2()


//ÆË¾÷
function Popup(num, pWidth, pHeight, pLeft, pTop, pScroll) {
	var strValue1 = "Input_" + num;
	var strValue2 = "Output_" + num;

	// ½ºÅ©·Ñ¹Ù »ç¿ë½Ã ±âº» ³ÐÀÌ¿¡¼­ ½ºÅ©·Ñ¹Ù ³ÐÀÌ(18) Æ÷ÇÔ
	if (pScroll == "Y") {
		pHeight = pHeight + 18;
	}

	if (getCookie(strValue1) != strValue2 ) {
		NewWin2("/popup.htm?num=" + num, "Popup_" + num, pWidth, pHeight, pTop, pLeft, pScroll);
	}
}

//ÆË¾÷2-googleÀü¿ë
function Popup2(num, pWidth, pHeight, pLeft, pTop, pScroll) {
	var strValue1 = "Input_" + num;
	var strValue2 = "Output_" + num;

	// ½ºÅ©·Ñ¹Ù »ç¿ë½Ã ±âº» ³ÐÀÌ¿¡¼­ ½ºÅ©·Ñ¹Ù ³ÐÀÌ(18) Æ÷ÇÔ
	if (pScroll == "Y") {
		pHeight = pHeight + 18;
	}

	if (getCookie(strValue1) != strValue2 ) {
		NewWin2("/popup.htm?num=" + num, "Popup_" + num, pWidth, pHeight, pTop, pLeft, pScroll);
	}
}

function getCookie(name) {

	var nameOfCookie = name + "=";
	var x = 0;

	while (x <= document.cookie.length)     {

		var y = (x + nameOfCookie.length);
        if (document.cookie.substring(x, y) == nameOfCookie) {
        	if ((endOfCookie=document.cookie.indexOf(";", y)) == -1) endOfCookie = document.cookie.length;
            return unescape(document.cookie.substring(y, endOfCookie));
        }

		x = document.cookie.indexOf(" ", x) + 1;

		if (x == 0) break;

  	}

	return "";

}


// start of loadXMLDoc(url:ÆÄÀÏ°æ·Î, lay:·¹ÀÌ¾îID, p_lay[1:ºÎ¸ðÃ¢·¹ÀÌ¾î, 0:ÇöÀçÃ¢·¹ÀÌ¾î])
var xmlhttp = null;
var mDate = 0;

function loadXMLDoc(url, lay, p_lay) {
    if (window.XMLHttpRequest) {
    	try {
			xmlhttp = new XMLHttpRequest();
        }catch(e) {
			xmlhttp = false;
        }
    }
    else if (window.ActiveXObject) {
       	try {
        	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
      	}catch(e) {
        	try {
          		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        	}catch(e) {
          		xmlhttp = false;
        	}
		}
    }

	xmlhttp.open("POST", url, true);
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

	xmlhttp.onreadystatechange = function(){
		if(xmlhttp.readyState == '4'){
			if(xmlhttp.status == 200) {
				var data = xmlhttp.responseText;
				if(data){
					if(p_lay){ parent.opener.document.getElementById(lay).innerHTML = data; }
					else{	if(lay)	document.getElementById(lay).innerHTML = data; }
				}
			}
		}
	}

	xmlhttp.send("uTime=" + new Date().getTime() + "&iDate=" + mDate + "");
	return false;
}
// end of loadXMLDoc


var req = null;
var iDate = new Date().getTime();

function xmlHttpReq(url){
	if (window.XMLHttpRequest) {
		try {
			req = new XMLHttpRequest();
		}catch(e) {
			req = false;
		}
	}
	else if (window.ActiveXObject) {
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e) {
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e) {
				req = false;
			}
		}
	}

	req.open("POST", url, true);
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	req.onreadystatechange = processXMLResponse;
	req.send("uTime=" + new Date().getTime() + "&iDate=" + iDate + "");
	return false;

}//end of xmlHttpReq



//ÅØ½ºÆ®¹Ú½º ³ôÀÌ Á¶Àý
function textareaHight(act, elmt_id, limit){

	var f = document.getElementById(elmt_id);
	var f_h = parseInt(f.style.height);

	if( act == "up" )			{	if( f_h > limit )	f.style.height = ( f_h - 50 ) + 'px';	}
	else if( act == "down" )	{	f.style.height = ( f_h + 50 ) + 'px';	}
	else						{	f.style.height = '55px';	}

}//end of textareaHight


//±¸¸Å¼ö·® Ã¼Å©
function saleCntCk(cnt)
{
	if( cnt.search(/[^\d]/) != -1 )
	{
		alert('±¸¸Å¼ö·®Àº ¼ýÀÚ¸¸ °¡´ÉÇÕ´Ï´Ù.');
		return false;
	}

	if( eval(cnt) <= 0)
	{
//		alert('±¸¸Å¼ö·®Àº 1ÀÌ»ó ¼ýÀÚ¸¸ °¡´ÉÇÕ´Ï´Ù.');
		return false;
	}

	return true;
}//end of saleCntCheck


//¼ýÀÚÃ¼Å©
function checkNum(v){

	if( v.search(/[^\d]/) != -1 )	return true;

	return false;

}//end of checkNum


///////////////////////////////////////////////////////////////////////
// µ¿ÀÛ°¡´ÉÇÑ ºê¶ó¿ìÀú ÆÇÁ¤
//
// @sample        if(chkAjaBrowser()){ location.href='nonajax.htm' }
// @sample        oj = new chkAjaBrowser();if(oj.bw.safari){ /* Safari ÄÚµå */ }
// @return        ¶óÀÌºê·¯¸®°¡ µ¿ÀÛ°¡´ÉÇÑ ºê¶ó¿ìÀú¸¸ true  true|false
//
//  Enable list (v038ÇöÀç)
//   WinIE 5.5+
//   Konqueror 3.3+
//   AppleWebKit°è(Safari,OmniWeb,Shiira) 124+
//   Mozilla°è(Firefox,Netscape,Galeon,Epiphany,K-Meleon,Sylera) 20011128+
//   Opera 8+
//
function chkAjaBrowser()
{
	var a,ua = navigator.userAgent;
	this.bw= {
	  safari    : ((a=ua.split('AppleWebKit/')[1])?a.split('(')[0]:0)>=124 ,
	  konqueror : ((a=ua.split('Konqueror/')[1])?a.split(';')[0]:0)>=3.3 ,
	  mozes     : ((a=ua.split('Gecko/')[1])?a.split(" ")[0]:0) >= 20011128 ,
	  opera     : (!!window.opera) && ((typeof XMLHttpRequest)=='function') ,
	  msie      : (!!window.ActiveXObject)?(!!createHttpRequest()):false
	}
	return (this.bw.safari||this.bw.konqueror||this.bw.mozes||this.bw.opera||this.bw.msie)
}


// XMLHttpRequest ¿ÀºêÁ§Æ® »ý¼º
//
// @sample        oj = createHttpRequest()
// @return        XMLHttpRequest ¿ÀºêÁ§Æ®(ÀÎ½ºÅÏ½º)
//
function createHttpRequest()
{
	if(window.ActiveXObject){
		 //Win e4,e5,e6¿ë
		try {
			return new ActiveXObject("Msxml2.XMLHTTP") ;
		} catch (e) {
			try {
				return new ActiveXObject("Microsoft.XMLHTTP") ;
			} catch (e2) {
				return null ;
			}
		}
	} else if(window.XMLHttpRequest){
		 //Win Mac Linux m1,f1,o8 Mac s1 Linux k3¿ë
		return new XMLHttpRequest() ;
	} else {
		return null ;
	}
}

////
// ¼Û¼ö½Å ÇÔ¼ö
//
// @sample         sendRequest(onloaded,'&prog=1','POST','./about2.php',true,true)
// @param callback ¼Û¼ö½Å½Ã¿¡ ±âµ¿ÇÏ´Â ÇÔ¼ö ÀÌ¸§
// @param data	   ¼Û½ÅÇÏ´Â µ¥ÀÌÅÍ (&ÀÌ¸§1=°ª1&ÀÌ¸§2=°ª2...)
// @param method   "POST" ¶Ç´Â "GET"
// @param url      ¿äÃ»ÇÏ´Â ÆÄÀÏÀÇ URL
// @param async	   ºñµ¿±â¶ó¸é true µ¿±â¶ó¸é false
// @param sload	   ¼öÆÛ ·Îµå true·Î °­Á¦¡¢»ý·«¶Ç´Â false´Â ±âº»
// @param user	   ÀÎÁõ ÆäÀÌÁö¿ë »ç¿ëÀÚ ÀÌ¸§
// @param password ÀÎÁõ ÆäÀÌÁö¿ë ¾ÏÈ£
//
function sendRequest(callback,data,method,url,async,sload,user,password)
{
	//XMLHttpRequest ¿ÀºêÁ§Æ® »ý¼º
	var oj = createHttpRequest();
	if( oj == null ) return null;

	//°­Á¦ ·ÎµåÀÇ ¼³Á¤
	var sload = (!!sendRequest.arguments[5])?sload:false;
	if(sload || method.toUpperCase() == 'GET')url += "?";
	if(sload)url=url+"uTime="+(new Date()).getTime();

	//ºê¶ó¿ìÀú ÆÇÁ¤
	var bwoj = new chkAjaBrowser();
	var opera	  = bwoj.bw.opera;
	var safari	  = bwoj.bw.safari;
	var konqueror = bwoj.bw.konqueror;
	var mozes	  = bwoj.bw.mozes ;

	//¼Û½Å Ã³¸®
	//opera´Â onreadystatechange¿¡ Áßº¹ ÀÀ´äÀÌ ÀÖÀ» ¼ö ÀÖ¾î onload°¡ ¾ÈÀü
	//Moz,FireFox´Â oj.readyState==3¿¡¼­µµ ¼ö½ÅÇÏ¹Ç·Î º¸ÅëÀº onload°¡ ¾ÈÀü
	//Win ie¿¡¼­´Â onload°¡ µ¿ÀÛÇÏÁö ¾Ê´Â´Ù
	//KonquerorÀº onload°¡ ºÒ¾ÈÁ¤
	//Âü°í http://jsgt.org/ajax/ref/test/response/responsetext/try1.php
	if(opera || safari || mozes){
		oj.onload = function () { callback(oj); }
	} else {

		oj.onreadystatechange =function ()
		{
			if ( oj.readyState == 4 ){
				callback(oj);
			}
		}
	}

	//URL ÀÎÄÚµù
	data = uriEncode(data)
	if(method.toUpperCase() == 'GET') {
		url += data;
	}

	//open ¸Þ¼Òµå
	oj.open(method,url,async,user,password);

	//Çì´õ application/x-www-form-urlencoded ¼³Á¤
	setEncHeader(oj)

	//µð¹ö±×
	//alert("////jslb_ajaxxx.js//// \n data:"+data+" \n method:"+method+" \n url:"+url+" \n async:"+async);

	//send ¸Þ¼Òµå
	oj.send(data);

	//URI ÀÎÄÚµù Çì´õ ¼³Á¤
	function setEncHeader(oj){

		//Çì´õ application/x-www-form-urlencoded ¼³Á¤
		// @see  http://www.asahi-net.or.jp/~sd5a-ucd/rec-html401j/interact/forms.html#h-17.13.3
		// @see  #h-17.3
		//   ( enctypeÀÇ ±âº»°ªÀº "application/x-www-form-urlencoded")
		//   h-17.3¿¡ ÀÇÇØ¡¢POST/GET »ó°ü¾øÀÌ ¼³Á¤
		//   POST¿¡¼­ "multipart/form-data"À» ¼³Á¤ÇÒ ÇÊ¿ä°¡ ÀÖ´Â °æ¿ì¿¡´Â Ä¿½ºÅÍ¸¶ÀÌÁî ÇØÁÖ¼¼¿ä.
		//
		//  ÀÌ ¸Þ¼Òµå°¡ Win Opera8.0¿¡¼­ ¿¡·¯°¡ ³ª¹Ç·Î ºÐ±â(8.01Àº OK)
		//var contentTypeUrlenc = 'application/x-www-form-urlencoded; charset=UTF-8';
		var contentTypeUrlenc = 'application/x-www-form-urlencoded';
		if(!window.opera){
			oj.setRequestHeader('Content-Type',contentTypeUrlenc);
		} else {
			if((typeof oj.setRequestHeader) == 'function')
				oj.setRequestHeader('Content-Type',contentTypeUrlenc);
		}
		return oj
	}

	//URL ÀÎÄÚµù
	function uriEncode(data){

		if(data!=""){
			//&¿Í=·Î ÀÏ´Ü ºÐÇØÇØ¼­ encode
			var encdata = '';
			var datas = data.split('&');
			for(i=1;i<datas.length;i++)
			{
				var dataq = datas[i].split('=');
				encdata += '&'+encodeURIComponent(dataq[0])+'='+encodeURIComponent(dataq[1]);
//				encdata += '&'+dataq[0]+'='+dataq[1];
			}
		} else {
			encdata = "";
		}
		return encdata;
	}

	return oj
}
///////////////////////////////////////////////////////////////////////


//¿øº»ÀÌ¹ÌÁö ·¹ÀÌ¾î·Î º¸±â
function org_view(e, onoff, img_src){
	var lay = document.getElementById('org');
	var img = document.getElementById('org_img');

	lay.style.top = e.clientY;
	lay.style.left = e.clientX;

	if( onoff == 'on' ){
		lay.style.display = 'block';
		img.src = img_src;
	}else if( onoff == 'off' ){
		lay.style.display = 'none';
	}
}


/*************************** AjaxRequest start ***************************/
var req_ob = null;
var iDate = new Date().getTime();

function AjaxRequest(url, async){
	if (window.XMLHttpRequest) {
		try {
			req_ob = new XMLHttpRequest();
		}catch(e) {
			req_ob = false;
		}
	}
	else if (window.ActiveXObject) {
		try {
			req_ob = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e) {
			try {
				req_ob = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e) {
				req_ob = false;
			}
		}
	}

	req_ob.open("POST", url, async);
	req_ob.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	req_ob.onreadystatechange = processReqChange;
	req_ob.send("uTime=" + new Date().getTime() + "&iDate=" + iDate + "");
	return false;

}//end of AjaxRequest

function processReqChange() {
    // only if req shows "loaded"
    if (req_ob.readyState == 4) {
        // only if "OK"
        eval (req_ob.responseText);
        if (req_ob.status == 200) {
            // ...processing statements go here...
        }
        else {
            alert("There was a problem retrieving the XML data:\n" + req_ob.statusText);
        }
    }
}
/*************************** AjaxRequest end ***************************/