var rotateMsg = true;
var vod_no;
var type;
var product_no;
var lesson_no;
var book_no;
var bu;
var chap;
var q_no;




function MsgStatus() {
	if(rotateMsg) {
		window.status = '';
		window.defaultStatus = "´ëÇÑ¹Î±¹ ±¹¾î ¾ð¾î ³í¼ú ÃÖ°­! ÀÏ±³½Ã´åÄÄ!";
	}
	if(!rotateMsg) {
		window.status = '';
		window.defaultStatus = "´ëÇÑ¹Î±¹ ±¹¾î ¾ð¾î ³í¼ú ÃÖ°­! ÀÏ±³½Ã´åÄÄ!";
	}
	setTimeout("MsgStatus();rotateMsg=!rotateMsg", 0);
}
MsgStatus();

function swf(src,w,h){
	html = '';
	html += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id="param" width="'+w+'" height="'+h+'">';
	html += '<param name="movie" value="'+src+'">';
	html += '<param name="quality" value="high">';
	html += '<param name="wmode" VALUE="transparent">';
	html += '<param name="bgcolor" value="#ffffff">';
	html += '<param name="swliveconnect" value="true">';
	html += '<embed src="'+src+'" quality=high bgcolor="#ffffff" width="'+w+'" height="'+h+'" swliveconnect="true" id="param" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';
	html += '<\/object>';
	document.write(html);
}

/*
µ¿¿µ»ó ÇÃ·¹ÀÌ 
@param vod_no µ¿¿µ»ó ¹øÈ£
@type   È­Áú ±¸ºÐ : 1 °íÈ­Áú, 2 ÀÏ¹ÝÈ­Áú
*/
function vod_play(vod_no, type, product_no) {

    var url = "/vod/vodPlayer.asp?vod_gb=" + type + "&vPvodNo="+vod_no + "&product_no=" + product_no;
    if (type == '2')
        window.open(url,"vod_win","width=384 ,height=550,status=no,resizable=no,scrollbars=no,left=100,top=30") ;	    
    else
	    window.open(url,"vod_win","width=654 ,height=779,status=no,resizable=no,scrollbars=no,left=100,top=100") ;	    

//		GoPlay4Web(vod_no);	    
}

function vod_play_lesson(type, product_no, lesson_no) {
    var url = "/vod/vodPlayer.asp?vod_gb=" + type + "&lesson_no="+lesson_no + "&product_no=" + product_no;
    if (type == 'L')
        window.open(url,"vod_win","width=384 ,height=550,status=no,resizable=no,scrollbars=no,left=100,top=100") ;	    
    else
	    window.open(url,"vod_win","width=654 ,height=779,status=no,resizable=no,scrollbars=no,left=100,top=30") ;	    
}
function vod_play_lesson2(type, product_no, lesson_no) {
    var url = "/vod/vodPlayer.asp?vod_gb=" + type + "&lesson_no="+lesson_no + "&JM=ok&product_no=" + product_no;
	    window.open(url,"vod_win","width=654 ,height=779,status=no,resizable=no,scrollbars=no,left=100,top=30") ;	    
}


function vod_play_sample(vod_no, type, product_no) {


    var url = "/vod/vodPlayer.asp?vod_gb=" + type + "&vPvodNo="+vod_no + "&product_no=" + product_no;
    if (type == '2')
        window.open(url,"vod_win","width=384 ,height=550,status=no,resizable=no,scrollbars=no,left=100,top=30") ;	    
    else
	    window.open(url,"vod_win","width=654 ,height=779,status=no,resizable=no,scrollbars=no,left=100,top=100") ;	

}



function selectValue(formName, formValue) {
	formName.value = formValue;
}


/** ¿À¸¥ÂÊ °ø¹é Á¦°Å */
function  funcRtrim( str ) {
    var src = new String(str);
    var tmp = new String();
    var i,lastnum, len = src.length;

    for(i = len;i >= 0;i--) {
        tmp = src.substring(i,i-1);
        if (tmp != ' ' ) {
            lastnum = i;
            break;
        }
    }
    tmp = src.substring(0,lastnum);
    return tmp;

}

/** ¿ÞÂÊ °ø¹é Á¦°Å */
function  funcLtrim( str ) {
    var src = new String( str );
    var tmp = new String();
    var i,firstnum, len = src.length;

    for(i = 0;i < len ;i++) {
        tmp = src.substring(i,i+1);
        if (tmp != ' ' ) {
            firstnum = i;
            break;
        }
    }
    tmp = src.substring(firstnum);
    return tmp;

}

 /** °ø¹é Á¦°Å */
function  funcTrim( str ) {
    var src = new String(str);
    var tmp = new String();
    tmp = funcLtrim(funcRtrim(str));
    return tmp;
}

// ¹®ÀÚ¿­À» Á¤ÇØÁØ pixel·Î Àß¶óÁÖ°í .. ºÙ¿©ÁØ´Ù.
function getDisplayString(string_value,pixel){
    var ascii_code;
    var string_value_length = string_value.length;
    var character;
    var character_width;
    var total_width = 0;
    var total_length = 0;

    var special_char_size = 6;
    var multibyte_char_size = 12;
    var base_char_start = 32;
    var base_char_end = 127;
    var ascii_char_size = Array(4,4,4,6,6,10,8,4,5,5,6,6,4,6,4,6,6,6,6,6,6,6,6,6,6,6,4,4,8,6,8,6,12,8,8,9,8,8,7,9,8,3,6,8,7,11,9,9,8,9,8,8,8,8,8,10,8,8,8,6,11,6,6,6,4,7,7,7,7,7,3,7,7,3,3,6,3,11,7,7,7,7,4,7,3,7,6,10,7,7,7,6,6,6,9,6);
 
    var displayString  = "";
    var endStringWidth;
    endStringWidth =  getStringPixelWidth("...");

    for(i=0; i<string_value_length; i++) {
        character = string_value.substring(i,(i+1));
        ascii_code = character.charCodeAt(0);

        if(ascii_code < base_char_start){
            character_width = special_char_size;
        }else if(ascii_code <= base_char_end){
            idx = ascii_code - base_char_start;
            character_width = ascii_char_size[idx];
        }else if(ascii_code > base_char_end){
            character_width = multibyte_char_size;
        }
        total_width += character_width;
        var tot_width = total_width+endStringWidth;
        if( tot_width >= pixel){      
            displayString = string_value.substring(0,i);   
            displayString+="..";
            break;
        }
    }

    if(displayString == "") displayString = string_value;

    return displayString;
} 


//ÇÑ±ÛÀÌ µé¾î°£ ¹®ÀÚ¿­ÀÇ ±æÀÌ
function getLength(str) { 
  return(str.length+(escape(str)+"%u").match(/%u/g).length-1); 
} 

/*
* login focus
* @param memberno È¸¿ø¹øÈ£ 
* @return boolean
*/
function checkLogin (memberno) {
    var obj = document.login_form;
    if (obj && memberno.length == 0) {
        alert("·Î±×ÀÎÀ» ÇØÁÖ¼¼¿ä.");
        obj.vPmemberId.focus();
        return false;
    }
    return true;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

// left menu layer hide action 
var old_menu = '';
var old_cell = '';
function menuclick(submenu, cellbar) {
    if( old_menu != submenu ) {
        if( old_menu !='' )
            document.getElementById(old_menu).style.display = 'none';

        document.getElementById(submenu).style.display = 'block';
        old_menu = submenu;
        old_cell = cellbar;
    } else {
        document.getElementById(submenu).style.display = 'none';
        old_menu = '';
        old_cell = '';
    }
} 


function focusLogin() {
	document.getElementById('vPmemberId').focus();
}


function browserCheck() {
	if(document.all) {
		return 'ie';
	} else {
		return 'ns';
	}
}


/////////////////////µ¿¿µ»ó ·¹ÀÌ¾î·Î º¸ÀÌ°Ô ÇÏ´Â ºÎºÐ ////////////////////////


	html = '';
	html += '<div id="p_class_ok" style="position:absolute; left:0; top:0; width:100; height:150; visibility: hidden; z-index:100; ">';
	html += '<table border="0" cellpadding="0" cellspacing="0" bgcolor=blue align=center>';
	html += '	<tr height=40>';
	html += '		<td valign="top">';
	html += '		<iframe id="iSamePKList" name="kkab05" width=350 height=280 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no></iframe>';

	html += '		</td>';
	html += '	</tr>';
	html += '	<tr height=25>';
	html += '		<td valign="top" align=center>';
	html += '			<input type=button name=submit2 value="  ´Ý  ±â  " style="border:1px;border-width:1 1 1 1; border-color:#FED3DF; background-color:#C6C6C6; color:#000000; width:100%; height:25px;" onclick=hideLayer2("p_class_ok");>';
	html += '		</td>';
	html += '	</tr>';
	html += '</table>';
	html += '</div>';
document.write(html);







function vod_play_vista(vod_no2, type2, product_no2) {

	vod_no=vod_no2;
	type=type2;
	product_no=product_no2;
//	lesson_no=lesson_no2;

    var url = "/vod/player_Download.asp?vod_gb=" + type + "&vPvodNo="+vod_no + "&product_no=" + product_no;
    if (type == '2'){

		callPKList(url);
	}
    else{
	
		callPKList(url);
	}


}
function vod_play_sample2() {

	hideLayer2("p_class_ok");
    var url = "/vod/vodPlayer.asp?vista=1&vod_gb=" + type + "&vPvodNo="+vod_no + "&product_no=" + product_no;
    if (type == '2')
        window.open(url,"vod_win","width=384 ,height=550,status=no,resizable=no,scrollbars=no,left=100,top=30") ;	    
    else
	    window.open(url,"vod_win","width=654 ,height=779,status=no,resizable=no,scrollbars=no,left=100,top=100") ;	

}










	var posClientX, posClientY, S=0;	
	function callPKList(url) {	
		
		var left, top;

					left	=	posClientX;		//getAbsLeft(objImg);  
					top		=	posClientY;		//getAbsTop(objImg)+objImg.height+1;

		if(document.all['p_class_ok'].style.visibility=="visible") { 
			hideLayer2('p_class_ok');
		} else {
			openLayer(iSamePKList, url, 'p_class_ok', left, top);
		}	
	}
	document.onclick = function () {	
		posClientX	= event.clientX;
		posClientY	= document.body.scrollTop + event.clientY + 20;	
	}


function chkBrowser(){
		this.ver=navigator.appVersion;
		this.dom=document.getElementById?1:0;
		this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
		this.ie4=(document.all && !this.dom)?1:0;
		this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
		this.ns4=(document.layers && !this.dom)?1:0;
		this.bVer=(this.ie5 || this.ie4 || this.ns4 || this.ns5);
		return this;
}
//////// º¸ÀÌ°Ô ÇÏ´ÂºÎºÐ //////	
function show(idLayer,idParent){	
	bVer=new chkBrowser();	
	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;
	cLayer=bVer.dom?document.getElementById(idLayer).style:bVer.ie4?document.all[idLayer].style:bVer.ns4?idParent?document[idParent].document[idLayer]:document[idLayer]:0;
	
	
	if(cLayer.visibility){
		cLayer.visibility='visible';
	}else { //if(cLayer.display){
		cLayer.display='block';
	}
	divLinksForm=(ns4)?document.divLinks.document.divLinks:document.divLinks;	
}
function moveLayer(idLayer, left, top) {
	bVer=new chkBrowser();
	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;
	cLayer=bVer.dom?document.getElementById(idLayer).style:bVer.ie4?document.all[idLayer].style:bVer.ns4?idParent?document[idParent].document[idLayer]:document[idLayer]:0;
	if(cLayer) {
		cLayer.left = left;
		cLayer.top = top;
	}
}
function openLayer(win, surl, strlayer, left, top) {	
	win.location.href=surl
	moveLayer(strlayer, left, top);
	show(strlayer)	
}
//////// º¸ÀÌ°Ô ÇÏ´ÂºÎºÐ ³¡ //////

//////// ¾È º¸ÀÌ°Ô ÇÏ´ÂºÎºÐ //////
function hide2(idLayer,idParent){
	bVer=new chkBrowser();
	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;
	
	cLayer=bVer.dom?document.getElementById(idLayer).style:bVer.ie4?document.all[idLayer].style:bVer.ns4?idParent?document[idParent].document[idLayer]:document[idLayer]:0;
	if(cLayer.visibility){
		cLayer.visibility='hidden';
	}else{// if(cLayer.display){
		cLayer.display='none';
	}
	//alert('a');
}
function hideLayer2(strlayer) {
	hide2(strlayer)
}


//////// ¾È º¸ÀÌ°Ô ÇÏ´ÂºÎºÐ ³¡ //////


/////////////////////µ¿¿µ»ó ·¹ÀÌ¾î·Î º¸ÀÌ°Ô ÇÏ´Â ºÎºÐ ³¡ ////////////////////////
