﻿<!---- 검색창 클릭하면 이미지 사라짐 ----->
var backimg=false;
function searchbackimg() {
	if ( backimg ) return;
		document.Searchform.searchtext.style.backgroundImage="";
		backimg=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];}}
}
<!---- 이미지 클릭하면 점선 안보임 ----->
function autoBlur(){ 

if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") 

document.body.focus(); 
} 
document.onfocusin=autoBlur;


//플래시 파일경로,가로크기,세로크기
function Flash_View(furl,fwidth,fheight){
	var tag_Str = "";
	tag_Str = '<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='+fwidth+' height='+fheight+'>';
	tag_Str += '<param name="movie" value="'+furl+'">';
	tag_Str += '<param name="quality" value="high">';
	tag_Str += '<param name="wmode" value="transparent">';
	tag_Str += '<embed src="'+furl+'.swf" width='+fwidth+' height='+fheight+' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed>';
	tag_Str += '</object>';
	document.write(tag_Str);
}

//locaiton.href (새창띄우기)
function go_Blankpage(fUrl) {
	var openpageWindow = window.open("about:blank");
	openpageWindow.location.href = fUrl;
}

//로그인체크
function logincheck(usernum) {
	if (usernum==0) {
		alert('로그인 하셔야 이용하실 수 있습니다. ');
		top.location.href = "/member/login.asp";
		return;
	}	
}
function fnKeywordclick(keywordtxt) {
	var re = /@/g;
	var keywordtxt
	keywordtxt = keywordtxt.replace(re,"'");	
	document.bform.Searchkind.value = '1';   
    document.bform.bsearchText.value = keywordtxt;   
  	document.bform.submit();
} 
	
//도서상세보기 이동
function book_view(bcode,kind) {
	location.href = '/search/list_view.asp?bcode='+bcode;
}

//도서상세보기 오디오 듣기
function audio_view(a_title,a_url) { 
	var goURL;
	var winl = (screen.width - 368) / 2;
	var wint = (screen.height - 165) / 2;
	winprops = 'width='+368+',height='+165+',top='+wint+',left='+winl+',scrollbars='+scroll
	goURL = "/edu/aod.asp?a_title="+a_title+"&a_url="+a_url;
	window.open(goURL,'audiopup',winprops);
}

//도서상세보기 비디오 보기
function video_view(v_title,v_url) { 
	var goURL;
	var winl = (screen.width - 394) / 2;
	var wint = (screen.height - 444) / 2;
	winprops = 'width='+394+',height='+444+',top='+wint+',left='+winl+',scrollbars='+scroll
	goURL = "/edu/mov.asp?v_title="+v_title+"&v_url="+v_url;
	window.open(goURL,'videopup',winprops);
}

//오디오 파일명,가로크기,세로크기
function Media_View_Script(furl,wsize,hsize){
	var tag_Str = "";
	tag_Str = '<Embed src="' + furl + '" width="' + wsize + '" height="' + hsize + '" autostart="true" border="0" hspace="0" vspace="0"></EMBED>';
	document.write(tag_Str);
}

//비디오 파일명,가로크기,세로크기
function Video_View(furl){
	var tag_Str = "";
	tag_Str = '<Embed src="' + furl + '" width=333 height=300 autostart="true" border="0" hspace="0" vspace="0"></EMBED>';
	document.write(tag_Str);
}

//시리즈 페이지 이동
function go_serisePage(scode) {
	location.href = '/search/category.asp?scode='+scode;
}

//카테고리 이동(분류코드,대상코드)
function go_catePage(dcode,ycode) {
	if (ycode == undefined) {
		location.href = '/search/category.asp?dcode='+dcode;
	}	
	else {
		location.href = '/search/category.asp?dcode='+dcode+'&ycode='+ycode;
	}		
}

//카테고리 페이지 새창 이동 POST (통합검색페이지에서 연결시사용)
function go_catePage_searchText(dcode) {
	document.cateform.dcode.value = dcode;  	
	document.cateform.target = dcode;	
	document.cateform.submit();	
}

//에듀 페이지 새창 이동 POST (통합검색페이지에서 연결시사용)
function go_eduPage_searchText(ecode) {
	document.eduform.ecode.value = ecode;  	
	document.eduform.target = ecode;	
	document.eduform.submit();	
}

//에듀상세세보기 이동
function edu_view(ecode,idx,page,ucode){
	location.href = "/edu/list_read.asp?ecode="+ecode+"&idx="+idx+"&page="+page+"&ucode="+ucode;
}


//커뮤니티 페이지 새창 이동 POST (통합검색페이지에서 연결시사용)
function go_comuPage_searchText(tcode) {
	var nUrl;
	if (tcode==1) {
		nUrl = "/community/list.asp";
	}
	else if (tcode==2)  {
		nUrl = "/community/list01.asp";
	}
	else if (tcode==3)  {
		nUrl = "/community/list02.asp";
	}
	else {
		alert('올바른 접근이 아닙니다. ');
		return;
	}
	document.comuform.target = tcode;	
	document.comuform.action = nUrl;	
	document.comuform.submit();	
}

//이미지 리사이즈
function imgcheck(imgcnt,wsize,hsize) {
	var imgobj;
	var imgWidth = wsize;
	var imgHeight = hsize;
	
	var O_Width,O_Height;
	var ReWidth,ReHeight;
	
	for (var i = 0; i < imgcnt; i++) {
		imgobj = eval("document.spImg"+wsize+"_"+i);
		
		O_Width = imgobj.width;
		O_Height = imgobj.height;
		
		if (O_Width > O_Height) {
			ReWidth = imgWidth;
			ReHeight = Math.round((O_Height * imgWidth) / O_Width);
		}
		else {
			ReWidth = Math.round((O_Width * imgHeight) / O_Height);
			ReHeight = imgHeight;			
		}
		imgobj.width = ReWidth;
		imgobj.height = ReHeight;		
	}
}

//팝업 중앙 오픈
function Popup_Center(pname,wsize,hsize,purl) {
	var winl = (screen.width - wsize) / 2;
	var wint = (screen.height - hsize) / 2;
	winprops = 'width='+wsize+',height='+hsize+',top='+wint+',left='+winl+',scrollbars='+scroll
	window.open(purl,pname,winprops);
}

//공백/숫자/특수문자 체크 하는 부분
function strBlank_Chk(strValu,strName) {
	var vStr=strValu.value;
	if(!isDigitEng(vStr)) {
		alert(strName+ " 문자와 숫자만을 사용하실수 있습니다. 특수문자나 공백은 사용하실 수 없습니다. ");
		strValu.value="";
		strValu.focus();
		return false;
	}
	return true;
}

//특수 문자 체크 하는 부분임
function isDigitEng(s) {
	var strVal = s;
	var deny_pattern = /[^(a-z|A-Z|0-9|ㄱ-ㅎ|ㅏ-ㅣ|가-힝)]/;
	return (!deny_pattern.test(strVal));
}

//페이지 네비게이트 공통사용 (POST방식)
function Pagenavigate(pageNumber,pageUrl) {
	document.listform.page.value = pageNumber;  	
	document.listform.action = pageUrl;
	document.listform.submit();	
}

//진열개수 변경(도서리스트 페이지 공통사용)
function Pagesize_Chg(pagesize,pageUrl) {
	document.listform.page.value = 1;  		
	document.listform.intPageSize.value = pagesize;  	
	document.listform.action = pageUrl;
	document.listform.submit();	
}

//도서정렬순서 변경
function Sort_Chg(sortcode,pageUrl) {
	document.listform.page.value = 1;  			
	document.listform.sortcode.value = sortcode;  	
	document.listform.action = pageUrl;
	document.listform.submit();	
}

//쿠폰다운로드
function Coupon_Download(cnum,cupon_enddate) {
	document.couponform.cnum.value=cnum;  		
	document.couponform.cupon_enddate.value=cupon_enddate;  		
	document.couponform.submit();	
}

//텍스트박스 컨트롤+V 금지
function textbox_KeyDown() {
	if (event.keyCode == 86 && event.ctrlKey) {
    	event.keyCode = 0; 
		event.cancelBubble = true; 
	}
}

//글자수 체크
function fncCheckStrLen(val,maxlen){
	var temp; 
	var msglen;
  	msglen  =  maxlen*2;
	var nvalue = val.value;
  	l = val.value.length;  
	tmpstr  =  ""  ;
	if (l==0){
   		nvalue  =  maxlen*2;
  	}
  	else {
   		for(k=0;k<l;k++){
    		temp = nvalue.charAt(k);
    		if  (escape(temp).length  >  4) {
    			msglen -= 2;
    		}	
    		else {
    			msglen--;
    		}
    		if(msglen < 0)  {
     			//alert("한글 " + (maxlen/2) + "자 까지 입력하실 수 있습니다.");
     			alert((maxlen)+ "자 까지 입력하실 수 있습니다.");
     			val.value= tmpstr;
     			break;
    		}
    		else {
     			tmpstr  +=  temp;
    		}
   		}
	}
}

function Print_ifrm() {
	//alert("익스플로러 메뉴중 도구-인터넷 옵션-고급-인쇄에서 이미지 및 배경화면 인쇄에 체크");
	window.print();
}

//쿠폰다운로드
function Coupon_Send(cnum) {
	document.mform.cnum.value = cnum;
	document.mform.submit();
}

//E-BOOK 연결
function fncEBookView(bcode,screenType) {
	var wsize = 1024, hsize = 768;        
	var winl = (screen.width - wsize) / 2;
	var wint = (screen.height - hsize - 27) / 2;
	if  (screenType==1) {
		screenType = 'width='+1024+',height='+768+',top=' +(wint)+ ',left=' +(winl)+ ',resizable=yes';	
	}
	else {
		screenType = 'Fullscreen'; //풀스크린
	}
	var pUrl = 'http://www.englishplus.co.kr/search/ebook.htm?code='+bcode;
	window.open(pUrl,'englishplusBookview',screenType);
}

function fncEBookView2(bcode){
  	var newBook = null;
    var defW = 1024, defH = 768;           
	var viewOk = false;
	var pURL = 'http://www.englishplus.co.kr/search/ebook.htm?code='+bcode;
	if(newBook!=null){
		try{
			newBook.location.href = pURL;
			newBook.focus();
			viewOk = true;
		}catch(dd){
			viewOk = false;
		}
	}
		
	if(!viewOk){
		if(window.screen.width>defW && window.screen.height>defH){
			newBook = window.open(pURL, 'englishplusBookview', 'scrollbars=no,menubars=no, width=' +(defW)+ ', height=' +(defH)+ ', top=' +parseInt((window.screen.height-defH-27)/2)+ ', left=' +parseInt((window.screen.width-defW-8)/2)   );
		}else{
			newBook = window.open(pURL, 'englishplusBookview', 'fullscreen,noscrollbars');
		}
	}
}