﻿//mailCHK PATTERN - 정규표현식 CHK
var mail_pattern ="^[-_a-zA-Z0-9]+@[\.a-zA-Z0-9-]+\.[a-zA-Z]+$ ";
function mailCheck(emailad) { 
  var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/; 
  var check=/@[\w\-]+\./; 
  var checkend=/\.[a-zA-Z]{2,3}$/; 

    if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1)){ 
  	   return true;
    }else { 
		
		return false;
    } 
}	

// 화면 이동 자바스크립트용
function xgo(url) {
	location.replace(url);
}
 // 
function goPageLink1(list_count,link_count,num_str,enc_str,fname){
//	Frm = document.+fname;
//alert(Frm);
	Frm.list_count.value = list_count; 
	Frm.link_count.value = link_count;
	Frm.num_str.value = num_str;
	Frm.enc_str.value = enc_str;
	Frm.submit();
}
  // 
  
//창내리기  스크립트
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//

//스크롤따라다니는 AOD
function scroll(){    
	if(document.body.scrollTop < 110){
 		document.all.menu.style.pixelTop=110; //IE에서 상단으로 올라가는 상한값
 	}else{
		if((document.body.scrollHeight - document.body.scrollTop) < menu.clientHeight)
			document.all.menu.style.pixelTop = document.body.scrollHeight - menu.clientHeight
		else document.all.menu.style.pixelTop = document.body.scrollTop;
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// Search Keyword Click
function Search_Click(){
	document.Search.KeyWord.value="";
}

function menu_Search_Click(){
	document.menu_Search.menu_KeyWord.value="";
}
// 이미지 사이즈맞춰서 팝업띄우기////////////////////////////////////////////////////////////////////////////////////////////////
function view(what) { 
		var imgwin = window.open("",'WIN','scrollbars=no,status=no,toolbar=no,resizable=no,location=no,menu=no,top=0, left=0,width=10,height=10'); 
		imgwin.focus(); 
		imgwin.document.open(); 
		
		imgwin.document.write("<html>\n"); 
		imgwin.document.write("<head>\n"); 
		imgwin.document.write("<title>KBS WORLD Radio</title>\n"); //오픈창 타이틀 이름 지정하는 부분
		imgwin.document.write("<sc"+"ript>\n"); 
		imgwin.document.write("function resize() {\n"); 
		imgwin.document.write("pic = document.il;\n"); 
		//imgwin.document.write("alert(eval(pic).height);\n"); 
		imgwin.document.write("if (eval(pic).height) { var name = navigator.appName\n"); 
		imgwin.document.write(" if (name == 'Microsoft Internet Explorer') { myHeight = eval(pic).height + 30; myWidth = eval(pic).width + 10;\n"); 
		imgwin.document.write(" } else { myHeight = eval(pic).height + 36; myWidth = eval(pic).width + 10; }\n"); 
		imgwin.document.write(" clearTimeout();\n"); 
		imgwin.document.write(" var height = screen.height;\n"); 
		imgwin.document.write(" var width = screen.width;\n"); 
		imgwin.document.write(" var leftpos = width / 2 - myWidth / 2;\n"); 
		imgwin.document.write(" var toppos = height / 2 - myHeight / 2; \n"); 
		imgwin.document.write(" self.moveTo(leftpos, toppos);\n"); 
		imgwin.document.write(" self.resizeTo(myWidth, myHeight);\n"); 
		imgwin.document.write("}else setTimeOut(resize(), 100);}\n"); 
		imgwin.document.write("</sc"+"ript>\n");
		imgwin.document.write("</head>\n"); 
		
		imgwin.document.write('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" bgcolor="#FFFFFF">\n');
		imgwin.document.write("<img border=0 src="+what+" xwidth=100 xheight=9 name=il onload='resize();'>"); 
		imgwin.document.write("</body>\n");
		
		imgwin.document.write("</html>\n"); 
		imgwin.document.close(); 
}

// 이미지 사이즈맞춰서 팝업띄우기////////////////////////////////////////////////////////////////////////////////////////////////
function view_plus(what, height, width, scrollbars) { 
		var imgwin = eval("window.open('','WIN','scrollbars="+scrollbars+",status=no,toolbar=no,resizable=no,location=no,menu=no,top=0, left=0,width="+width+",height="+height+"');");
		imgwin.focus(); 
		imgwin.document.open(); 
		
		imgwin.document.write("<html>\n"); 
		imgwin.document.write("<head>\n"); 
		imgwin.document.write("<title>KBS WORLD Radio</title>\n"); //오픈창 타이틀 이름 지정하는 부분
		/*imgwin.document.write("<sc"+"ript>\n"); 
		imgwin.document.write("function resize() {\n"); 
		imgwin.document.write("pic = document.il;\n"); 
		//imgwin.document.write("alert(eval(pic).height);\n"); 
		imgwin.document.write("if (eval(pic).height) { var name = navigator.appName\n"); 
		imgwin.document.write(" if (name == 'Microsoft Internet Explorer') { myHeight = eval(pic).height + 30; myWidth = eval(pic).width + 10;\n"); 
		imgwin.document.write(" } else { myHeight = eval(pic).height + 36; myWidth = eval(pic).width + 10; }\n"); 
		imgwin.document.write(" clearTimeout();\n"); 
		imgwin.document.write(" var height = screen.height;\n"); 
		imgwin.document.write(" var width = screen.width;\n"); 
		imgwin.document.write(" var leftpos = width / 2 - myWidth / 2;\n"); 
		imgwin.document.write(" var toppos = height / 2 - myHeight / 2; \n"); 
		imgwin.document.write(" self.moveTo(leftpos, toppos);\n"); 
		imgwin.document.write(" self.resizeTo(myWidth, myHeight);\n"); 
		imgwin.document.write("}else setTimeOut(resize(), 100);}\n"); 
		imgwin.document.write("</sc"+"ript>\n");*/
		imgwin.document.write("</head>\n"); 
		
		imgwin.document.write('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" bgcolor="#FFFFFF" onClick="self.close()">\n');
		imgwin.document.write("<img border=0 src="+what+" name=il'>"); 
		imgwin.document.write("</body>\n");
		
		imgwin.document.write("</html>\n"); 
		imgwin.document.close(); 
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////

// KBS 온에어 팝업띄우기...
function VODPlayer(file,title,type,starttime,endtime) {
	gurl = 'http://asx.kbs.co.kr/check_login.php?url='+file+'&title='+title+'&type='+type+'&starttime='+starttime+'&endtime='+endtime+'no_logon=1';
	vodplayer = window.open(gurl, 'vodplayer', 'width=350 , height=200 , resizable=no , status=0 , scrollbars=0 , menubar=no, toolbar=no, fullscreen=no, channelmode=no,location=no,directories=no,alwaysRadised=0');
}				
//

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//메뉴 슬라이딩
<!-- Hide script from older browsers 
     function toggleMenu(currMenu) { 
		 if (document.all) { 
			 thisMenu = eval("document.all." + currMenu + ".style") 
			 if (thisMenu.display == "block") { 
			 	thisMenu.display = "none" 
		 	}else { 
			 	thisMenu.display = "block" 
		 	} 
		 	return false 
		 }else { 
		 	return true 
		 } 
     } 
// End hiding script --> 

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//메뉴 롤오버 변경
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//메뉴 롤오버 -->



	function setCookie( name, value, expiredays ) {
		var todayDate = new Date();
		todayDate.setDate( todayDate.getDate() + expiredays );
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
		
		self.close();
	  }
	 function closeWin(name) {
	   if (document.frm.popCHK.checked == true) {
	 	 	setCookie( name, "done" , 1);
		} else {
	   		setCookie( name, "1" , 1);
		}
	  }
	  
	  function getCookie(name) {
	   var from_idx = document.cookie.indexOf(name+'=');
	   if (from_idx != -1) { 
		  from_idx += name.length + 1
		  to_idx = document.cookie.indexOf(';', from_idx) 
	
		  if (to_idx == -1) {
				to_idx = document.cookie.length
		  }
		  return unescape(document.cookie.substring(from_idx, to_idx))
	   }
	}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function DisplayAOD(url, width, height,contextmenu){

 var CLASSID = "22d6f312-b0f6-11d0-94ab-0080c74c7e95";

	if(navigator.appName == 'Netscape'){
		document.write('<embed  src="'+url+'" id="MPlayer" width='+width+' height='+height+' type="application/x-mplayer2" ShowDisplay="0" ShowGotoBar="0" autostart="1" ShowStatusBar="1" SHOWCONTROLS="0" SHOWPOSITIONCONTROLS="0"></embed>');
	} else {
		 document.write('<object  id="MPlayer" classid="CLSID:'+CLASSID+'" width='+width+' height='+height+' type="application/x-oleobject">'
		 +'            <param name="Filename" value="' + url + '">'
		 +'            <param name="AutoStart" value="1">'
		 +'            <param name="AnimationAtStart" value="1">'
		 +'            <param name="DisplaySize" value="0">'
		 +'            <param name="EnableContextMenu" value="'+contextmenu+'">'
		 +'            <param name="EnablePositionControls" value="-1">'
		 +'            <param name="EnableFullScreenControls" value="0">'
		 +'            <param name="Mute" value="0">'
		 +'            <param name="ShowCaptioning" value="0">'
		 +'            <param name="ShowControls" value="1">'
		 +'            <param name="ShowAudioControls" value="1">'
		 +'            <param name="ShowControls" value="1">'
		 +'            <param name="ShowDisplay" value="0">'
		 +'            <param name="ShowGotoBar" value="0">'
		 +'            <param name="ShowPositionControls" value="-1">'
		 +'            <param name="ShowStatusBar" value="1">'
		 +'            <param name="ShowTracker" value="-1">'
		 +'            <param name="Volume" value="100">'
		 +'            <param name="SendMouseClickEvents" value="-1">' 
		 +'          </object>');
	}
}

function DisplayVOD(url, width, height){

 var CLASSID = "22d6f312-b0f6-11d0-94ab-0080c74c7e95";
 var CODEBASE = "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112";

	if(navigator.appName == 'Netscape'){
		document.write('<embed  src="'+url+'" id="MPlayer" width='+width+' height='+height+' type="application/x-mplayer2" ShowDisplay="0" ShowGotoBar="0" autostart="1" ShowStatusBar="1" SHOWCONTROLS="0" SHOWPOSITIONCONTROLS="0"></embed>');
	} else {
		 document.write('<object id="MPlayer" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" type="application/x-oleobject" width="'+width+'" height="'+height+'">'
		 +'            <param name="ANIMATIONATSTART" value="0">'
		 +'            <param name="AUTOSTART" value="1">'
		 +'            <param name="BALANCE" value="0">'
		 +'            <param name="CURRENTMARKER" value="0">'
		 +'            <param name="CURRENTPOSITION" value="0">'
		 +'            <param name="DISPLAYMODE" value="4">'
		 +'            <param name="ENABLECONTEXTMENU" value="1">'
		 +'            <param name="Filename" value="'+url+'">'
		 +'            <param name="ENABLED" value="1">'
		 +'            <param name="FULLSCREEN" value="0">'
		 +'            <param name="INVOKEURLS" value="1">'
		 +'            <param name="PLAYCOUNT" value="1">'
		 +'            <param name="RATE" value="1">'
		 +'            <param name="SHOWCONTROLS" value="0">'
		 +'            <param name="SHOWPOSITIONCONTROLS" value="0">'
		 +'            <param name="SHOWSTATUSBAR" value="0">'
		 +'            <param name="STRETCHTOFIT" value="0">'
		 +'            <param name="TRANSPARENTATSTART" value="0">'
		 +'            <param name="UIMODE" value="FULL">' 
		 +'            <param name="displaybackcolor" value="0">' 
		 +'          </object>');
	}
}



function print_pop(no,lang,key){
	open_pop = window.open("/news_print.htm?lang="+lang+"&No="+no+"&Category="+key,"WORLDKBSNEWS","status=no,scrollbars=yes,toolbar=yes,resizable=yes,menubar=yes,width=600,height=445,left=20,top=20");
}



// 썸네일 포토갤러리
function big(pic, features){
wow=window.open("","",features);
wow.document.write("<HTML><head><title>image</title></head>"); 
wow.document.write("<body leftmargin=1 topmargin=1>"); 
wow.document.write("<a href='javascript:self.close();'><img src="+pic+" border='0'></a>"); 
wow.document.write("</body></HTML"); 
}
