
//ÇÃ·¡½¬ Ãâ·Â
function flash_print( flash_file, w, h){

	var object = "";

	object  = "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='" + w + "' height='" + h + "'>";
	object += "<PARAM name='movie' value='" + flash_file + "'>";
	object += "<PARAM name='quality' value='high'>";
	object += "<PARAM name='wmode' value='transparent'>";
	object += "<PARAM name='menu' value='false'>";
	object += "<EMBED src='" + flash_file + "' quality='high' type='application/x-shockwave-flash' width='" + w + "' height='" + h + "' menu='false'></EMBED>";
	object += "</OBJECT>";

	document.write (object);

}//end of flash_print()

// ÇÑ±ÛÀÚ¸£±â
String.prototype.cut = function(len) {
	var str = this;
	var s = 0;
	for (var i=0; i<str.length; i++){
	     s += (str.charCodeAt(i) > 128) ? 2 : 1;
	     if (s > len) return str.substring(0,i) + "...";
	}        
	return str;
}//end of String.prototype.cut()

// ¼ýÀÚÃ¼Å©
function num_ck(v){

	for( var i=0; i < v.length; i++ ){
		var chr=v.substr(i,1);
		if( chr<'0' || chr>'9' ) return false;
	}

	return true;

}//end of num_ck()


function zipcode_ck(form_name){

	var w		= 430;
	var h		= 300;
	var left	= screen.width/2 - w/2;
	var top		= screen.height/2 - h/2;

	window.open("/config/zipcode.htm?form_name=" + form_name, "zipcode_win", "width=" + w + ", height=" + h + ", top=" + top + ", left=" + left + ", scrollbars=yes");

}//end of zipcode_ck()


// ·£´ý ¼¯±â
function shuffleRandom(n){
    var ar = new Array();
    var temp;
    var rnum;

    for( var i=1; i<=n; i++ ){
        ar.push(i);
    }

    for( var i=0; i< ar.length ; i++ ){
        rnum = Math.floor(Math.random() *n);
        temp = ar[i];
        ar[i] = ar[rnum];
        ar[rnum] = temp;
    }
    return ar;
}

//¿µ¹® + ¼ýÀÚÃ¼Å© , ±æÀÌ
function alnum_ck(v, st_v, ed_v){

	if( v.length < st_v || v.length > ed_v ) 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();
		    
}//end of focus_move()


// ÁÖ¹Î¹øÈ£ Ã¼Å©
function Jumin_Ck( ju1, ju2 ){

	var sum = 0;
	var srcNumeric = ju1 + ju2;

	if ( srcNumeric.length < 13 ) return false;

	for( nIndex = 0; nIndex < 8; nIndex++ ){ sum += srcNumeric.substring( nIndex, nIndex + 1 ) * ( nIndex + 2 ); }
	for( nIndex = 8; nIndex < 12; nIndex++ ){ sum += srcNumeric.substring( nIndex, nIndex + 1 ) * ( nIndex - 6 ); }

	sum = 11 - ( sum % 11 );

	if ( sum >= 10 ) { sum -= 10; }
	if ( srcNumeric.substring( 12, 13 ) != sum || ( srcNumeric.substring( 6, 7 ) != 1 && srcNumeric.substring( 6, 7 ) != 2 ) ) { return false; }

	return true;

}//end of Jumin_Ck()


// »õÃ¢
function NewWin(url, winname, w, h, top, left, sr){

	/*
	if( top == 0 )	var top		= 100;
	if( left == 0 )	var left	= screen.width/2 - w/2;
	*/

	if( top == 0 )	var top = ( parseInt(screen.availHeight) / 2 ) - ( h / 2 );
	if( left == 0 )	var left = ( parseInt(screen.availWidth) / 2) - ( w / 2 );

    
	window.open(url, winname, "width=" + w + ", height=" + h + ", top=" + top + ", left=" + left + ", scrollbars=" + sr); return;

}//end of NewWin()


// MP3±¸¸Å
function MP3_Buy(mp3_list){
    window.open("/mp3buy/mp3buy.htm?mp3_list=" + mp3_list, "mp3buy_win", "width=520, height=580, top=100, left=300, scrollbars=no, status=no, toolbar=no, menubar=no, resizable=0"); return;
}//end of MP3_Buy()


// ´Ù¿î·Î´õ, mp3_list=123|123ÀÎ ¹è¿­, ÃÖ´ë 50°³±îÁö °¡´É
function DownLoader(mp3_list){
    window.open("/webprogram/downloader/downloader.htm?mp3_list=" + mp3_list, "downloader_win", "width=730, height=497, top=100, left=300, scrollbars=no, status=no, toolbar=no, menubar=no, resizable=0"); return;
}//end of DownLoader()


// ÇÃ·¹ÀÌ¾î, mp3_list=123|123ÀÎ ¹è¿­, ÃÖ´ë 50°³±îÁö °¡´É
function KPlayer2(mp3_list){

	var w		= 360;
	var h		= 500;
	var left	= screen.width/2 - w/2;
	var top		= screen.height/2 - h/2;

	kwindow = window.open("", "kplayer_win", "width=" + w + ", height=" + h + ", top=" + top + ", left=" + left + ", scrollbars=no, status=no, toolbar=no, menubar=no, resizable=0");

	if( kwindow.document.body.innerHTML.length > 100 ){
		kwindow.List_Add(mp3_list);
	}else{
		kwindow = window.open("/webprogram/player/player2.htm?mp3_list=" + mp3_list, "kplayer_win", "width=" + w + ", height=" + h + ", top=" + top + ", left=" + left + ", scrollbars=no, status=no,toolbar=no, menubar=no, resizable=0");
	}

	kwindow.focus();
	
}//end of KPlayer()

// ÇÃ·¹ÀÌ¾î, mp3_list=123|123ÀÎ ¹è¿­, ÃÖ´ë 50°³±îÁö °¡´É
function KPlayer(mp3_list){

	var w		= 430;
	var h		= 571;
	var left	= screen.width/2 - w/2;
	var top		= screen.height/2 - h/2;

	kwindow = window.open("", "kplayer_win", "width=" + w + ", height=" + h + ", top=" + top + ", left=" + left + ", scrollbars=no, status=no, toolbar=no, menubar=no, resizable=0");

	if( kwindow.document.body.innerHTML.length > 100 ){
		kwindow.List_Add(mp3_list);
	}else{
		kwindow = window.open("/webprogram/player/player.htm?mp3_list=" + mp3_list, "kplayer_win", "width=" + w + ", height=" + h + ", top=" + top + ", left=" + left + ", scrollbars=no, status=no,toolbar=no, menubar=no, resizable=0");
	}

	kwindow.focus();
	
}//end of KPlayer2()



// °î ¾Öµå ¿Ï·á Ã³¸®
var response_ck = 0;

function getResponse(){
	response_ck = 1;
	return response_ck;
}

// ÀüÃ¼µè±â¹öÆ° Å¬¸¯½Ã³ª ¼±ÅÃµè±â ¹öÆ° Å¬¸¯½Ã
// listen_type: ÀüÃ¼µè±â=1, ¼±ÅÃµè±â=2
function Listen_Btn(f, listen_type){

	var mp3_list = "";

	// ÀüÃ¼µè±â
	if( listen_type == '1' ){

		all_ck_btn(f, 1);
		for( i=0; i < f.length; i++ ) if ( f[i].name == 'list[]' && f[i].type == 'checkbox' ) mp3_list += f[i].value + "|";

	// ¼±ÅÃµè±â
	}else{
		for( i=0; i < f.length; i++ ) if ( f[i].name == 'list[]' && f[i].type == 'checkbox' && f[i].checked ) mp3_list += f[i].value + "|";

		if( !mp3_list ){ alert('°îÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä'); return; }
	}

	mp3_list_v = mp3_list.substring(0, mp3_list.length - 1);

	KPlayer(mp3_list_v);

}//end of Listen_Btn()


// MP3 ¿©·¯°³ µ¿½Ã ±¸¸Å = ÇÏ´Ü ¹Ù·Î±¸¸Å¹öÆ°
function MP3_Buy_Btn(f){

	var mp3_list = "";

	for( i=0; i < f.length; i++ ) if ( f[i].name == 'list[]' && f[i].type == 'checkbox' && f[i].checked ) mp3_list += f[i].value + "|";

	if( !mp3_list ){ alert('°îÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä'); return; }

	mp3_list_v = mp3_list.substring(0, mp3_list.length - 1);

	MP3_Buy(mp3_list_v);

}//end of MP3_Buy_Btn()


// MP3 ¿©·¯°³ µ¿½Ã ´Ù¿î·Îµå = ÇÏ´Ü PC´Ù¿î·Îµå¹öÆ°
function MP3_Download_Btn(f){

	var mp3_list = "";

	for( i=0; i < f.length; i++ ) if ( f[i].name == 'list[]' && f[i].type == 'checkbox' && f[i].checked ) mp3_list += f[i].value + "|";

	if( !mp3_list ){ alert('°îÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä'); return; }

	mp3_list_v = mp3_list.substring(0, mp3_list.length - 1);

	DownLoader(mp3_list_v);

}//end of MP3_Download_Btn()


// ¸ðµÎ Ã¼Å©=1, 0
var list_all_ck_value = 0;
    
// ÀüÃ¼µè±â ¹öÆ°Å¬¸¯½Ã³ª ÀüÃ¼Ã¼Å©¹Ú½º Ã¼Å©½Ã - Ã¼Å©¹Ú½º Ã¼Å©ÇÏ±â
// all_listen: ÀüÃ¼µè±â ¹öÆ°Å¬¸¯½Ã=1, Ã¼Å©¹Ú½º=0
function all_ck_btn(f, all_listen){
        
	// ÀüÃ¼µè±â ¹öÆ° Å¬¸¯½Ã ¸ðµÎ °­Á¦Ã¼Å©
	if( all_listen == '1' ){	all_ck_exe(f, '1'); list_all_ck_value = 1; f.all_ck.checked = true; return; }

	// ÀüÃ¼ Ã¼Å©¹Ú½º Å¬¸¯½Ã Ã¼Å©½Ã¸¶´Ù Ã¼Å©°¡ ¹Ù²ñ
	if( list_all_ck_value ){	all_ck_exe(f, '0'); list_all_ck_value = 0; f.all_ck.checked = false; }
	else{						all_ck_exe(f, '1'); list_all_ck_value = 1; f.all_ck.checked = true; }

}//end of all_ck_btn()


// À½¾Ç ¸®½ºÆ® Ã¼Å©¹Ú½º ¸ðµÎ ¼±ÅÃ
function all_ck_exe(f, ck_type){

	for( i=0; i < f.length; i++ ){
		if ( f[i].name == 'list[]' && f[i].type == 'checkbox' && ck_type == 1 )	f[i].checked = true;
		else if( f[i].name == 'list[]' && f[i].type == 'checkbox' )				f[i].checked = false;
	}
            
}//end of all_ck_exe(f)


// ¶óµð¿À ¹öÅÏ Ã¼Å©°ª°¡Á®¿À±â 
function get_radio_ck(radioObj){

	for( i = 0; i < radioObj.length; i++ ) if( radioObj[i].checked ) return true;

	return false;

}//end of get_radio_ck()


// ÄíÅ°»ý¼º
function setCookie(name, value, expiredays){
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}//end of setCookie()


// ÄíÅ°°ª °¡Á®¿À±â
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 "";

}//end of getCookie()

// ·Î±×ÀÎ Ã¼Å©
function Login_Ck(f){

	if( !f.id.value ){ alert('¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä'); f.id.focus(); return false; }
	if( !f.pw.value ){ alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä'); f.pw.focus(); return false; }

	return true;

}//end of Login_Ck()


