var CURRENT_MENU = 7; //hyphen gnb sequence
//var CURRENT_MENU = 3; //hyphen gnb sequence

function toDay(){
	var current_date = new Date();
	var year = current_date.getFullYear().toString();
	var month = current_date.getMonth() + 1;
	var day = current_date.getDate();
	month = (month < 10 ? "0" : "") + month;
	day = (day < 10 ? "0" : "") + day;
	return year + month + day;
}

function copyToClipboard(val) { 
	window.clipboardData.setData("Text", val);
    var url = "http://youthvoice.daum.net/yv3/common/pop_copy_url_to_clipboard.do?url="+val;
    window.open(url,'winOfConfirmationURLCopy','scrollbars=no,resizable=no,width=350,height=200');
}

function play_topSchool(){
document.getElementById("top_school_div").style.display="none";
document.getElementById("top_school").style.display="block";
daumFlash_general("http://image.mediaschool.daum.net/swf/main_mediaschool.swf","","182","158","top_school");
}

document.write("<script type='text/javascript' src='http://image.mediaschool.daum.net/js/activex.js'><"+"/script>");

function top_movie(){
document.write("<div id='main_menu'></div>");
daumFlash_general("http://image.mediaschool.daum.net/swf/main_tab.swf?root=http://image.mediaschool.daum.net/swf/","","978","336","main_menu");
}
function top_rolling(){
document.write("<div id='top_rolling'></div>");
daumFlash_general("http://image.mediaschool.daum.net/swf/main_rolling.swf","","544","194","top_rolling");
}
function top_map(){
document.write("<div id='top_map'></div>");
daumFlash_general("http://image.mediaschool.daum.net/swf/main_map.swf","","200","300","top_map");
}
function top_school(){
document.write("<div id='top_school_div'><a href='javascript:play_topSchool();' title='미디어스쿨 소개영상 PLAY'><img src='http://image.mediaschool.daum.net/img/play_first.jpg' width='182' height='158' alt='' /></a></div>");
document.write("<div id='top_school' style='display:none;'></div>");
}

function school_intro(){
document.write("<div id='school_intro'></div>");
daumFlash_general("http://image.mediaschool.daum.net/swf/mediaschool.swf","","269","264","school_intro");
}

function school_bus(){
document.write("<div id='school_bus'></div>");
daumFlash_general("http://image.mediaschool.daum.net/swf/bus.swf","","331","70","school_bus");
}


function top_navi(){
	var currentMenuId = currentMenuNo;
	if(currentMenuId <= 8){
	document.getElementById("mimg"+currentMenuId).src="http://image.mediaschool.daum.net/img/nav/m"+currentMenuId +"_on.gif";
	document.getElementById("mlist"+currentMenuId).className = "mnavs" ;
	//else document.getElementById("mlist"+currentMenuId).className = "fr" ;
	}
}

//다미 FAQ 답변레이어
var old_menu = '';
function menuclick(submenu) {
	if( old_menu != submenu ) {
	if( old_menu !='' ) {
		old_menu.style.display = 'none';
}
	submenu.style.display = 'block';
	old_menu = submenu;
	} else {
		submenu.style.display = 'none';
		old_menu = '';
	}
}


/*BBS*/
function setopenOp(){document.getElementById('setopenWap').style.display="block";}
function setopenCl(){document.getElementById('setopenWap').style.display="none";}
function setopenChk(n){
	if(n=="1") document.getElementById('allow_cmt').style.display="none";
	else document.getElementById('allow_cmt').style.display="inline";
}

function editor_br(obj){obj.className="editor_br";}
function editor_br_on(obj){obj.className="editor_br_on";}

function yv20_viewact(flag) {
	closeLayers();
	/* ? */
	if(flag == "2") {
		if ( editFrm.srcedit.value == "1" ) {
			editFrm.write_edit1.src = "http://image.youthvoice.daum.net/yv2/site_img/editor/write_edit1_d.gif";
			editFrm.write_html1.src = "http://image.youthvoice.daum.net/yv2/site_img/editor/write_html1.gif";		
			document.getElementById("EditCtrl").contentWindow.document.body.innerText = document.getElementById("EditCtrl").contentWindow.document.body.innerHTML;
			editFrm.srcedit.value = "2";
		}
	/* html? */	
	} else if (flag == "1") {
		if ( editFrm.srcedit.value == "2" ) {
			editFrm.write_edit1.src = "http://image.youthvoice.daum.net/yv2/site_img/editor/write_edit1.gif";
			editFrm.write_html1.src = "http://image.youthvoice.daum.net/yv2/site_img/editor/write_html1_d.gif";
			document.getElementById("EditCtrl").contentWindow.document.body.innerHTML = document.getElementById("EditCtrl").contentWindow.document.body.innerText;
			editFrm.srcedit.value = "1";
		}		
	}
}

function resizePopup() {
	var oBody = document.body;
	var width = oBody.scrollWidth + ( oBody.offsetWidth - oBody.clientWidth );
	var height = oBody.scrollHeight + ( oBody.offsetHeight - oBody.clientHeight ) ;
        var h=0;
        if (navigator.userAgent.indexOf("SV1") > 0){  h=14; } 
        else if(navigator.userAgent.indexOf("MSIE 7")>0) { h=45; }
        else if(navigator.userAgent.indexOf("Gecko")>0 && navigator.userAgent.indexOf("Firefox") <= 0 && navigator.userAgent.indexOf("Netscape") <= 0 ){ h=22; } 
        else if(navigator.userAgent.indexOf("Firefox") >0 ){  h=18; } 
        else if(navigator.userAgent.indexOf("Netscape") >0 ){ h=-2; }
        else { h=0;} 
        window.resizeTo(width,height+h);
}

function charCounter(bytesizes, fieldname){
	var strCounter = 0;
	var tempStr, tempStr2;
	for(i = 0;i < document.getElementById(fieldname).value.length;i++)
	{
		tempStr = document.getElementById(fieldname).value.charAt(i);
		if(escape(tempStr).length > 4) strCounter += 2;
			else strCounter += 1 ;
	}
	if (strCounter > bytesizes){
		bytesz = bytesizes/2;
		alert("최대 " + bytesz + "자까지 입력할 수 있습니다.");		
		strCounter = 0;		
		tempStr2 = "";
		for(i = 0; i < document.getElementById(fieldname).value.length; i++) 
		{
			tempStr = document.getElementById(fieldname).value.charAt(i);	
			if(escape(tempStr).length > 4) strCounter += 2;
			else strCounter += 1 ;
			if (strCounter > bytesizes)
			{
				if(escape(tempStr).length > 4) strCounter -= 2;
				else strCounter -= 1 ;	
				break;	      		
			}
			else tempStr2 += tempStr;
		}	    
		document.getElementById(fieldname).value = tempStr2;
		document.getElementById(fieldname).focus();
	}
}

function rand_number(n){
	var x;
	x=Math.round(Math.random()*100);
	x%=n;
	return x;
}
function rightBanner(){
	var img = new Array();
	//img[0]="<div class='media_edu1'><h3>YouthCreator 2006 작품발표회</h3><p class='ment'>오늘, 우리들의 클라이막스</p><a href='http://youthvoice.daum.net/notice/read?bbsId=Notice&articleId=17&pageIndex=1&searchKey=&searchValue=' class='btn1' title='YouthCreator 2006 작품발표회'>YouthCreator 2006 작품발표회</a></div>";
	img[0]="<div class='media_edu1'><h3>유스보이스 우수작 혜택</h3><p class='ment'>전문멘토가 작품평을? 분야별 전문가가 직접 정성어린 작품평을 해드려요 </p><a href='http://youthvoice.daum.net/yv3/screen/mentor_info.do?section=Screen' class='btn1' title='유스보이스 우수작 혜택'>유스보이스 우수작 혜택</a></div>";
	//img[0]="<div class='media_edu1'><h3>찾아가는 미디어 교육</h3><p class='ment'>미디어 교육은 원하는 단테나 이디어 교육봉사를 원하는 단체는 신청해주세요.</p><a href='javascript:alert(\"서비스 준비중입니다.\")' class='btn1' title='찾미교'>찾미교</a></div>";
	img[1]="<div class='media_edu2'><h3>유스보이스 공감 미션</h3><p class='ment'>사진으로 표현하는 Youth 공감! \"유스보이스 공감 미션\" 주제 : 우리 학교 교복 뽐내기</p><a href='http://youthvoice.daum.net/photo/mission/list?bbsId=PhotoMission&pageIndex=1' class='btn1' title='Youth 공감'>Youth 공감</a></div>";
	var n=rand_number(2); 
	document.write(img[0]);
}



