//------------------------------------------------------------------------------------------
//
//                init_func.js    ( version    v1.0.6 )
//
//                function  
//                              init, img load, onload
//		    	           layer  setup      
//                 
//                																  prg by pyc 
//------------------------------------------------------------------------------------------
//---------------- ÀÌ¹ÌÁö object ----------------------------------------------
function showLayer(idObj){
	if( eval(idObj).style.visibility != "visible" )  {
         	eval(idObj).style.visibility = "visible";  
       }  	
}

function hiddenLayer(idObj){
         eval(idObj).style.visibility = "hidden";
}


function showTag(idObj){     //showTag("");
	if( eval(idObj).style.display != "" )
         	eval(idObj).style.display = "";
}


function hiddenTag(idObj){
         eval(idObj).style.display = "none";
}


function pageObj(){
         this.loaded = false;
         this.img = new Image();
}


function imgLoadError(){
	g_ImgLoadFalse = true;
	debugcount++;
	g_MiddleImgLoading++;
	 
//           window.status = "image loading error : [" + g_cpage +"]" ;
}



function FillDigitPage(Num){
    var Result = "" ;
    if ( g_fhead ) {
	    if (( Num > -1 ) && ( Num < 10 )) {
	        Result = "0000" + Num ;
	    } else if ((Num >= 10 ) && ( Num < 100 )) {
	        Result = "000" + Num ;
	    } else if ((Num >= 100 ) && ( Num < 1000 )) {
	        Result = "00" + Num ;
	    } else if ((Num >= 1000 ) && ( Num < 10000 )) {
	        Result = "0"+Num ;
	    } else Result = Num ;
   }else Result = Num;
	
    return Result ;
}

function fileName(mode,sp){   // mode 's','m', ''
         var retV ="";
         if(mode =='m' && g_width>1200) mode='m2';
         
         if ( g_pMenu[12] == 't' && sp == g_annpos) {
                 retV = "annimg/ezeba"+g_pSkin[12]+".jpg";
         }else{	
                    if(g_pageName[sp])	
                    		retV = ImgUrl+filedir+mode+'/'+g_pageName[sp];
                    else		
                    		retV = ImgUrl+filedir+mode+'/'+g_fhead+FillDigitPage(sp+1)+'.mcd';
	  }    
         return retV;
}

function fileOName(sp){   
         var retV ="";
         
         if(g_pageName[sp]){	
                    		retV = ImgUrl+filedir+'/o/'+g_pageName[sp].split(".mcd")[0]+'.jpg';
         }else{		
                    		retV = ImgUrl+'../cabinet/title/lasttitle.jpg';
         }           		
         return retV;
        
}


var g_albumBroEx = 0;


function initdata(bx,by,ix,iy,dir,openm,skin,iurl){    // ¸¶Á÷¸· °´Ã¼ ÀúÀå
         filedir = dir+'/';
         g_openMode = openm;
         g_bx = bx;
         g_by = by;
         g_imgX = ix;
         g_imgY = iy;
         if ( ix == 0 ) {
	         g_imgX = Math.ceil(bx*1.3);
	         g_imgY = Math.ceil(by*1.3);
         	  g_LargeImgFlag = false;
         }	
         ImgUrl = iurl;
         var i=0;
         for (i=0; i<skin.length; i++){
            g_pSkin[i] = skin.substr(i,1);
         }    
         for (i=0; i<openm.length; i++){
            g_pMenu[i] = openm.substr(i,1);
         }    
}


function pageMessInfo(mess){   // ¸Þ¼¼Áö Ãâ·Â
         this.x = parseInt(mess.split(";")[0])*g_mtom2ratioX;
         this.y = parseInt(mess.split(";")[1])*g_mtom2ratioY;
         this.font = mess.split(";")[2];
         this.size = parseInt(mess.split(";")[3])*g_mtom2ratioX;
         this.color = mess.split(";")[4];
         this.mess = mess.split(";")[5];
}


function pageMess(subject,mess,price){
	  var dispMess = new Array();
	  if(subject) dispMess[0] = new pageMessInfo(subject);
	  if(mess) dispMess[1] = new pageMessInfo(mess);
	  if(price) dispMess[2] = new pageMessInfo(price);
	  return dispMess;
}



function appendcoPage(i,page,mess){        //Ã¥°¥ÇÇ
         g_coPage[i] = parseInt(page);
  	  coLeftInfoHtml = coLeftInfoHtml+"<tr>"+
  	  	"<td id=lpageInfo"+i.toString()+ " onmousedown=\"coGoInfoPage("+i+",'l')\" title='Å¬¸¯ÇÏ¸é "+page+" page·Î ÀÌµ¿' background='icon2/bmrkleft2.gif' width=95 height=27 style='cursor:hand; display:none' align=center>\n"+
  	  	"<font color=#72724b>"+mess+"</font></td></tr>\n"+
  	  	"<tr height=3><td></td></tr>\n";
  	  coRightInfoHtml = coRightInfoHtml+"<tr>"+
  	  	"<td id=rpageInfo"+i.toString()+ " onmousedown=\"coGoInfoPage("+i+",'r')\" title='Å¬¸¯ÇÏ¸é "+page+" page·Î ÀÌµ¿' background='icon/bmrkright2.gif' width=95 height=27 style='cursor:hand; display:none' align=center>\n"+
  	  	"<font color=#72724b>"+mess+"</font></td></tr>\n"+
 	  	"<tr height=3><td></td></tr>\n";
}


//------------------------------ book ÆäÀÌÁö --------------------------------------------------

function wPagelink(page,mode,order,URL,coords){

         this.page = page;
         this.mode = mode;
         if ( order == 'after' ) this.after = true;
         else this.after = false;
         switch (mode) {
         	case 'web1' :
         				this.web = true;
         				this.skin = '1';
         				break; 
         	case 'web2' :
         				this.web = true;
         				this.skin = '2';
         				break; 
         	case 'audio' :
         				this.web = false;
         				this.skin = '0';
         				break; 
         	case 'video' :
         				this.web = false;
         				this.skin = '0';
         				break; 
         }	
		 this.url = URL;
         this.left = parseInt(coords.split(",")[0])*g_mtom2ratioX;
         this.top = parseInt(coords.split(",")[1])*g_mtom2ratioY;
         this.right = parseInt(coords.split(",")[2])*g_mtom2ratioX;
         this.bottom = parseInt(coords.split(",")[3])*g_mtom2ratioY;
}

	
		

function isWebPage(sp){
	if( g_bookPage[sp] ){
		for (var i=0; i< 	g_bookPage[sp].length; i++) {
	    		if (g_bookPage[sp][i].web) return true;
	    	}	
	}  
	return false;  
}	


function info1plink(cpage,page,Shape,coords){		//Â÷·Ê
         this.page = cpage;
         this.gopage = page;
         this.type = Shape;
         this.left = parseInt(coords.split(",")[0])*g_mtom2ratioX;
         this.top = parseInt(coords.split(",")[1])*g_mtom2ratioY;
         this.width = parseInt(coords.split(",")[2])*g_mtom2ratioX;
         this.height = parseInt(coords.split(",")[3])*g_mtom2ratioY;
}


function info3plink(cpage,Shape,coords,URL,para,Method,wopen,mess){		//À¥¸µÅ©
         this.page = cpage;
         this.type = Shape;
         this.left = parseInt(coords.split(",")[0])*g_mtom2ratioX;
         this.top = parseInt(coords.split(",")[1])*g_mtom2ratioY;
         this.width = parseInt(coords.split(",")[2])*g_mtom2ratioX;
         this.height = parseInt(coords.split(",")[3])*g_mtom2ratioY;
         this.pwsize = parseInt(coords.split(",")[4]);
         this.phsize = parseInt(coords.split(",")[5]);
		 this.url = URL;
         this.para = para;
         this.method = Method;
         this.wopen = wopen;
         this.mess = mess;
}


		
	



//------------ middle image load -----------------------------------------------
function eraserZeroValue(val){
		var i=0;
		var retV="";
		for (i=0; i<val.length; i++) 
			if (val.charAt(i) !='0' || val.charAt(i) !='m')  retV += val.charAt(i);
		return retV;	
}	


function  Book_MpageDisp(idNum,lay,part) {
	       var imgelem = eval('imgid'+idNum);
	       imgelem.src = preLoadm[lay][part].img.src;
	       imgelem.style.width = g_bx;
	       imgelem.style.height = g_by;
	       preLoadm[lay][part].loaded = true;	       /*
	       if( preLoadm[lay][part].img.width > g_bx ) {
	       	 	imgelem.style.width = g_bx;
	       	}else{ imgelem.style.width =  preLoadm[lay][part].img.width; }
	       if( preLoadm[lay][part].img.height > g_by ) {
	       	 	imgelem.style.height = g_by;
	       	}else{ imgelem.style.height = preLoadm[lay][part].img.height; }
	       	*/
}



function addmPageObj(lay){
         var newPage = new Array(2);
         newPage[0] = new pageObj();
         newPage[1] = new pageObj();
         preLoadm[lay] = newPage;
}


function clearmPage(lay,part){
         preLoadm[lay][part].loaded = false;
}



function clearmPage(lay,part){
         preLoadm[lay][part].loaded = false;
}



function imgLoadedmleft(){
//    	preLoadm[g_hiddenPage][0].loaded = true;
	++g_MiddleImgLoading;
	Book_MpageDisp("l"+g_hiddenPage,g_hiddenPage,0);
}

function imgLoadedmright(){
//    	preLoadm[g_hiddenPage][1].loaded = true;
	++g_MiddleImgLoading;
	Book_MpageDisp("r"+g_hiddenPage,g_hiddenPage,1);
}



function load_mPage(sp,part,lay){
    if( 0<= sp &&  sp < g_page ){
    	 preLoadm[lay][part].loaded = false;
    	 if (part=='0')
	             preLoadm[lay][part].img.onload = imgLoadedmleft;
        else     
	             preLoadm[lay][part].img.onload = imgLoadedmright;
        preLoadm[lay][part].img.onerror = imgLoadError;
	 
        if (isWebPage(sp)) {
        	 if(g_bookPage[sp].top<21)
	    	 	preLoadm[lay][part].img.src =  g_bookPageBGImg;	    	
	    	 else	
	    	 	preLoadm[lay][part].img.src =  fileName('m',sp);
		 if(part=='0') {  
		 	parent_bpLDiv = document.all['layerl'+lay];
		 }else{
		 	parent_bpRDiv = document.all['layerr'+lay];
		 }  	
		 if (!g_bookPage[sp].after) webPageView(sp,part);
        }else{	
	    	 preLoadm[lay][part].img.src =  fileName('m',sp);
    	 }
    }else{
    	++g_MiddleImgLoading;
    }
}

function load_premPage(sp,part,lay){
    if( 0<= sp &&  sp < g_page ){
        if (isWebPage(sp)) {
        	 if(g_bookPage[sp].top<21)
	    	 	preLoadm[lay][part].img.src =  g_bookPageBGImg;	    	
	    	 else	
	    	 	preLoadm[lay][part].img.src =  fileName('m',sp);
        }else{	
	    	preLoadm[lay][part].loaded = false;
	    	if (part=='0')
	             preLoadm[lay][part].img.onload = imgLoadedmleft;
	       else     
	             preLoadm[lay][part].img.onload = imgLoadedmright;
	
	        preLoadm[lay][part].img.onerror = imgLoadError;
	    	 preLoadm[lay][part].img.src =  fileName('m',sp);
	 }   	 
    }else{
    	++g_MiddleImgLoading;
    }
}


//------------ large image load -----------------------------------------------

function imglLoadedChk(){
         g_LargeImgPreLoading--;
         preLoadedl[g_lloadlay] = true;
}


function load_lpPage(sp,lay){
    
    if( 0<= sp &&  sp < g_page ){
             g_LargeImgPreLoading++;
             g_LargeImgPLCount++;
             g_lloadlay = lay;
             preLoadedl[g_lloadlay] = false;
             preLoadl[lay].onload = imglLoadedChk;
             if (g_LargeImgFlag)      preLoadl[lay].src =  fileName('l',sp);
             else     preLoadl[lay].src =  fileName('m',sp);
    }
}



function LargeimgLoadedShow(){
	Fullimg.src = preLoadl[0].src;
//	Fullimg.width = preLoadl[0].width;
//	Fullimg.height = preLoadl[0].height;
}

function onLargeImgErrors() {
        if(fullViewFlag){
           layerfull.style.visibility = "hidden";
           layerjbutton.style.visibility = "hidden";
           fullViewFlag = false;
           alert('Å« ÀÌ¹ÌÁö ·Îµå ºÒ°¡ÇÕ´Ï´Ù.');
        }
}

function load_lPage(sp,part,lay){
    if( 0<= sp &&  sp < g_page ){
        preLoadl[0].onload =  LargeimgLoadedShow;
        preLoadl[0].onerror = onLargeImgErrors;
        if (g_LargeImgFlag)      preLoadl[0].src =  fileName('l',sp);
        else     preLoadl[0].src =  fileName('m',sp);
    }
}

//---------------------------- onload ------------------------------------------
function openBookLayer(){
   
   if ( b_direct == '0'){
       showBackgroundObj('l');
       showTag("posright");
   }else{
       showBackgroundObj('r');
       showTag("posleft");
   }    
   hiddenTag('bgddummyc');
   showTag('poscenter');

   
   
   

    layerbk.style.top = g_top-1;
    layerbk.style.left = g_bxl1-20;

   if(g_bxl1-76 < 0) laycoleft.style.left=-2;
   else laycoleft.style.left = g_bxl1-97;
   laycoleft.style.top = g_top+5;

   if( g_bxl2+g_bx+6 + 70 > g_width)  laycoright.style.left = g_width-62;
   else laycoright.style.left = g_bxl2+g_bx-2;
   laycoright.style.top = g_top+5;


   if(g_bxl1-76 < 0) laycoleftCur.style.left = -2+67;
   else laycoleftCur.style.left = g_bxl1-76+67;
 
   if( g_bxl2+g_bx+6 + 70 > g_width)  laycorightCur.style.left = g_width-62-49;
   else laycorightCur.style.left = g_bxl2+g_bx+8-50;

   if(g_pSkin[7]=='1') {
   	   laycoleft2.style.top = g_top + g_by-105;
	   if(g_bxl1-46 < 0) laycoleft2.style.left = 2;
	   else laycoleft2.style.left = g_bxl1-48;
   }else if(g_pSkin[7]=='2'){
        	laycoleft2.style.left = g_bxl1-2;
	 	laycoleft2.style.top = g_top + g_by+7-46;
   }else if(g_pSkin[7]=='3'){
   	   laycoleft2.style.top = g_top + g_by-105;
	   if(g_bxl1-35 < 0) laycoleft2.style.left = 2;
	   else laycoleft2.style.left = g_bxl1-35;
   }
   if(g_pSkin[7]=='1') {
  	   laycoright2.style.top = g_top + g_by-106;
	   if( g_bxl2+g_bx+6 + 40 > g_width)  laycoright2.style.left = g_width-38;
	   else laycoright2.style.left = g_bxl2+g_bx+8;
   }else if(g_pSkin[7]=='2'){
		laycoright2.style.left = g_bxl2+g_bx+2-27;
		laycoright2.style.top = g_top + g_by+7-46;
   }else if(g_pSkin[7]=='3'){
  	   laycoright2.style.top = g_top + g_by-106;
	   if( g_bxl2+g_bx+6 + 27 > g_width)  laycoright2.style.left = g_width-25;
	   else laycoright2.style.left = g_bxl2+g_bx+8;
   }


   layerl1.style.left = g_bxl1;
   layerl2.style.left = g_bxl1;
   layerr1.style.left = g_bxl2;
   layerr2.style.left = g_bxl2;



   layerl1.style.top = g_top;
   layerl2.style.top = g_top;
   layerr1.style.top = g_top;
   layerr2.style.top = g_top;
}


function closeBookBacktag(){
   hiddenLayer('layercleft');
   hiddenLayer('layercright');
   if ( b_direct == '0'){
	hiddenLayer(laycoleft2);
	showLayer(laycoright2);
	
	showTag("posright");
	hiddenTag("posleft");
   }else{
	showLayer(laycoleft2);
	hiddenLayer(laycoright2);
	hiddenTag("posright");
	showTag("posleft");
   }

   if (ad_key == 'admin')  showTag("adminid");
}

function closeBookLayer(){

   if ( b_direct == '0'){

	   laycoleft.style.visibility = "hidden";
	   if( g_pMenu[1]=='f' ||  (g_pSkin[2]=='p'  && !g_colrbgdDisplay) )  laycoright.style.visibility = "hidden";
	   laycoleft2.style.visibility = "hidden";
	   layerl1.style.visibility = "hidden";
	   layerl2.style.visibility = "hidden";
   
	   laycoright.style.left = g_bxl2+g_bx/2;
	   laycoright.style.top = g_top+5;
	   laycoright.style.width = 95;
	   laycoright.style.height =  g_by;

          switch (g_pSkin[7]) {
          	case '0' :
			   	laycoright2.style.visibility = "hidden";
				break;
          	case '1' :
	   			laycoright2.style.top = g_top + g_by-105;
	   			laycoright2.style.left = g_bxl2+g_bx/2;
				break;
          	case '2' :
	   			laycoright2.style.top = g_top + g_by+7-46;
	   			laycoright2.style.left = g_bxl2+g_bx/2-7-27;
	   			break;
          	case '3' :
	   			laycoright2.style.top = g_top + g_by-105;
	   			laycoright2.style.left = g_bxl2+g_bx/2;
	   			break;
          	default :
          			break;
          }	

   	  // layerr1.style.visibility = "visible";
   }else{
	   laycoright.style.visibility = "hidden";
	   if( g_pMenu[1]=='f' ||  (g_pSkin[2]=='p'  && !g_colrbgdDisplay) )   laycoleft.style.visibility = "hidden";
	   laycoright2.style.visibility = "hidden";
	   layerr1.style.visibility = "hidden";
	   layerr2.style.visibility = "hidden";
	   
	   laycoleft.style.left = g_bxl1+g_bx/2;
	   laycoleft.style.top = g_top+5;
	   laycoleft.style.width = 95;
	   laycoleft.style.height =  g_by;
          switch (g_pSkin[7]) {
          	case '0' :
			   	laycoleft2.style.visibility = "hidden";
				break;
          	case '1' :
	   			laycoleft2.style.top = g_top + g_by-105;
          			laycoleft2.style.left = g_bxl1+g_bx/2-42;
				break;
          	case '2' :
	   			laycoleft2.style.top = g_top + g_by+7-46;
          			laycoleft2.style.left = g_bxl1+g_bx/2+6;
	   			break;
          	case '3' :
 	   			laycoleft2.style.top = g_top + g_by-105;
         	 	laycoleft2.style.left = g_bxl1+g_bx/2-27;
	   			break;
          	default :
          			break;
          }	
   	  // layerl1.style.visibility = "visible";
   }
   
     layerbk.style.top = g_top-1;
    layerbk.style.left = g_bxl1 + g_bx/2;
    if(g_top+g_by+45<g_height)
    	layerbkb.style.top = g_top+g_by+14;
    else	
    	layerbkb.style.top = g_height-35;
    layerbkb.style.left = g_bxl1-15;


    if(g_top+g_by+45<g_height)
	   layerb.style.top = g_top+g_by+14;
    else	   
	   layerb.style.top = g_height-35;
   layerb.style.left = g_bxl1-15;
   p_oldLayer = layerb.style.left;


   layerbkb_2.style.top = g_top+g_by+10;
   layerbkb_2.style.left = g_bxl1-20;
   layerb_2.style.left = g_bxl1;
   layerb_2.style.top = g_top+g_by+16;

   

   layerl1.style.left = g_bxl1+g_bx/2;
   layerl1.style.top = g_top;
   layerl2.style.left = g_bxl1+g_bx/2;
   layerl2.style.top = g_top;
   
   layerr1.style.left = g_bxl1+g_bx/2;
   layerr1.style.top = g_top;
   layerr2.style.left = g_bxl1+g_bx/2;
   layerr2.style.top = g_top;


   layerl1.style.width = g_bx;
   layerr1.style.width = g_bx;
   layerl2.style.width = g_bx;
   layerr2.style.width = g_bx;

   layerl1.style.height = g_by;
   layerr1.style.height = g_by;
   layerl2.style.height = g_by;
   layerr2.style.height = g_by;


   layerplist.style.left = g_bxl1;
   layerplist.style.top = g_top+7;

   layersearch.style.left = g_bxl1;
   layersearch.style.top = g_top+7;



   layercleft.style.left = g_bxl1+g_bx+g_bcl-29;
   layercleft.style.top = g_top;

   layercright.style.left = g_bxl2-g_bcr;
   layercright.style.top = g_top;
   
   layerjbutton.style.left = g_width - 200;
   layerjbutton.style.top = g_height-200;


   layercol.style.left = 20;
   layercol.style.top = g_height/2;

   layercot.style.left = g_width/2;
   layercot.style.top = 20;

   layercor.style.left = g_width - 29-20;
   layercor.style.top = g_height/2;

   layercob.style.left = g_width/2;
   layercob.style.top = g_height-29 - 59;
  //alert(g_height+','+layercob.style.top);



//9 63 x 70
   laycolClip.style.top = g_top+g_by/2 - 30;
   laycorClip.style.top = g_top+g_by/2 - 30;
   if(g_bxl1 < 75) {
	     laycolClip.style.left = 5;
	     laycorClip.style.left = g_width-68;
   }else{	   
	   laycolClip.style.left = g_bxl1-68;
	   laycorClip.style.left = g_bxl2+g_bx+5;
   }



   layerhelp.style.left = Math.ceil((g_width-445)/2);
   layerhelp.style.top = Math.ceil((g_height-536)/2);

}


function StartimgLoadedShow(){
	if (b_direct == '0')  var simg = eval("imgidr1");
	else			      var simg = eval("imgidl1");
	simg.style.filter=transitions[filterNum];
	simg.filters[0].Apply();
	simg.src = simg.src;
       simg.filters[0].Play();
}

function preOpenMiddle(sp){     // ÀÛÀº ÀÌ¹ÌÁö ÇÁ·Î ·Îµå ÇÔ.
           if  (b_direct == '0')   load_premPage(sp,1,1);
	    else	                   load_premPage(sp,0,1);
//	    StartimgLoadedShow();
}




function BgdtimgLoadedShow(){
	bgdimgid.style.filter=transitions[filterNum];
	bgdimgid.filters[0].Apply();
	bgdimgid.src = bgdimgid.src;
       bgdimgid.filters[0].Play();
}  
 

function StarPageInit(){
	    showTag("imgidr1");
	    showTag("imgidl1");
	    showTag("imgidl2");
	    showTag("imgidr2");
	    showTag('FullImgDisp');

	    closeBookBacktag();
        
           if ( b_direct == '0'){
           		showTag("coright");
           }else{
           		showTag("coleft");
	    }       
           showTag("jbuttonDisp");
           showTag("mapDisp");
           showTag("mapDispb");
           showTag("mapDispm");
           showTag("layercolDisp");
           showTag("layercotDisp");
           showTag("layercorDisp");
           showTag("layercobDisp");
        try {
        	layercolDisp.style.filter ="alpha(Opacity=60, FinishOpacity=60,Style=1, StartX=0, FinishX=55, StartY=55, FinishY=55)" ;	
        	layercotDisp.style.filter ="alpha(Opacity=60, FinishOpacity=60,Style=1, StartX=0, FinishX=55, StartY=55, FinishY=55)" ;	
        	layercorDisp.style.filter ="alpha(Opacity=60, FinishOpacity=60,Style=1, StartX=0, FinishX=55, StartY=55, FinishY=55)" ;	
        	layercobDisp.style.filter ="alpha(Opacity=60, FinishOpacity=60,Style=1, StartX=0, FinishX=55, StartY=55, FinishY=55)" ;	
		imgjbutton.style.filter ="alpha(Opacity=60, FinishOpacity=80,Style=2)" ;	
           
		laycoleftCur.style.filter ="alpha(Opacity=0, FinishOpacity=0,Style=1, StartX=0, FinishX=0, StartY=0, FinishY=0)" ;	
		laycorightCur.style.filter ="alpha(Opacity=0, FinishOpacity=0,Style=1, StartX=0, FinishX=0, StartY=0, FinishY=0)" ;	
 
 //		layermicon.style.filter ="alpha(Opacity=90, FinishOpacity=90,Style=1, StartX=57, FinishX=0, StartY=0, FinishY=20)" ;	
        } catch (e) {}

           
            coPage_Display();
            if(g_pSkin[8]=='1'){ 
            	showTag("laybDisp");
            	showTag('posbottom');
              pageDisp();
	    	boPage_Display();
            }else if(g_pSkin[8]=='2'){
            	showTag("laybDisp_2");
            	showTag('posbottom_2');
              pageDisp2();
	    	boPage_Display2();
            }	
           g_showPage = 1;
           g_hiddenPage = 2;

}

// Áß¾Ó¶óÀÎ ¾ø¾Ö´Â ºÎºÐ
function centerFiltering(){
	 showTag("cleftImgDisp");	
	 showTag("crightImgDisp");
        try {
        	AlphaFilter = true; 
        	cleftImgDisp.style.filter ="alpha(Opacity=0, FinishOpacity=30, Style=1, StartX=0, FinishX=60, StartY=0, FinishY=0)" ;	
        	crightImgDisp.style.filter ="alpha(Opacity=30, FinishOpacity=0, Style=1, StartX=0, FinishX=60, StartY=0, FinishY=0)" ;	
        	
        	mapimg.style.filter ="alpha(Opacity=70, FinishOpacity=70,Style=1, StartX=m_width, FinishX=m_width, StartY=m_height, FinishY=m_height)" ;	
        	layerremocon.style.filter ="alpha(Opacity=90, FinishOpacity=90,Style=1)" ;
        } catch (e) {
        	 AlphaFilter = false;
        	 hiddenTag("cleftImgDisp");
        	 hiddenTag("crightImgDisp");
        }		
}           

function Open_startPage(sp){
      var i = 0;
      clearTimeout(timeid3);
      if  (g_MiddleImgLoading>0 || g_ImgLoadFalse ){
           StarPageInit();
           centerFiltering();

		   g_gopage =  g_gotoPageNum;  

		   if (g_gopage != ''){
                  g_gopage = parseInt(g_gopage);
                  if(g_gopage<g_page){
           	    	if ( b_direct == '0')   setTimeout("coGoRightPage("+g_gopage+")",10);
           	    	else 			     setTimeout("coGoLeftPage("+g_gopage+")",10);
           	    }
           	    showTag("coleft");
           	    showTag("coright");
                  g_pagemoving = false;
            }else{
                g_pagemoving = false;
				g_MiddleImgLoading = 0;
            }
      }else{
           timeid3 = setTimeout('Open_startPage('+sp+')', 50);
      }

}
  

function Initialization() { 
	    //g_width =     parseInt(g_width);
	    //g_height =   parseInt(g_height);
	    //g_page =     parseInt(g_page);
	    //g_spage =   parseInt(g_spage);

           if( g_pMenu[23] ){		//Áß¾Ó ºÐ¸®¼± ¾ø¾Ø´Ù
           		bookCenterDist = 0;
			g_bc = 0; 
			g_bcl =0;
			g_bcr = 0; 
           }else{
           		bookCenterDist = 0;
			g_bc = 0; 
			g_bcl = 0;
			g_bcr = 0; 
           }		

	Disp5_2.style.width = g_bx-29 + g_bcl-10;
 	Disp7_2.style.width = g_bx-29 + g_bcl-10;
 	Disp8_2.style.width = g_bx-29 + g_bcl-10;
 	Disp10_2.style.width = g_bx-8 + g_bcr-5;
 	Disp12_2.style.width = g_bx-8 + g_bcr-5;
 	Disp13_2.style.width = g_bx-8 + g_bcr-5;
 	Disp23_2.style.width = g_bx * 2 + bookCenterDist;


	    var th = 50;
	    bx = g_bx;   // Áß¾È Ã¶½É Á¦¿Ü

           if(g_pSkin[8] =='0' )  th = 0;
           
           if(  g_height - g_by - 80 - 50 >  0 )  
	     	g_top = Math.ceil((g_height - g_by - 80 - th)/2);
           else if(  g_height - g_by - 85 >  20 )  
	     	g_top = 20;
           else
               g_top = 3;
               
           
	    if( g_pSkin[6] == 't' ){  //¸Þ´º À§¿¡ Ç¥½Ã 
	       if(g_height-g_by<120)        g_top += 58;		//58
	       else	       g_top += 70;							//80
			dispTitleName.innerHTML = g_title;
	    }else{  
	       g_top += 25;   
	       titleMessDisp.align="center";
	       titleMessDisp.width=400;
	       dispTitleName2.innerHTML = g_title;
	    }
	   
	    g_bxl1 = Math.round((g_width - (g_bx*2+15))/2);
	    g_bxl2 = g_bxl1+g_bx+bookCenterDist;
	     
	    var speed =50 - parseInt(g_pSkin[15])*5;
	    SmallNextDispDist = Math.ceil(g_bx/(speed / 5+0.5));
	    SmallNextDispDist2 = Math.ceil(g_bx/speed);
	    
	    if (g_imgX >  g_imgY ){ // m_width = 150;  m_height = 150;
			m_height = Math.round(m_height*g_imgY/g_imgX);	    	
	    }else{
			m_width = Math.round(m_width*g_imgX/g_imgY);	    	
	    		SmallNextDispDist2 *= 2.5;
	    }	
	    
	   if (b_direct == '0' ){
	   	baseStartpage.innerHTML = -g_spage;
	   	baseEndpage.innerHTML = g_page-g_spage-1;
	   }else{
	   	baseStartpage.innerHTML = g_page-g_spage-1;
	   	baseEndpage.innerHTML = -g_spage;
	   }	
           annText.innerHTML = 'www.webzinenara.com';
           
           tableid1.width = g_bx;
           tableid2.width = g_bx;
           tableid3.width = g_bx;
           tableid4.width = g_bx;
           tableid1.height = g_by;
           tableid2.height = g_by;
           tableid3.height = g_by;
           tableid4.height = g_by;


             
           switch (g_pSkin[7]) {
			case '0' :
					hiddenLayer(laycoleft2);
					hiddenLayer(laycoright2);
					break;
			case '1' :
			              colefttag.style.width = 40;
			              colefttag.style.height = 49;
			              colefttag.background = 'icon/coleft.gif'
			              corighttag.style.width = 40;
			              corighttag.style.height = 49;
			              corighttag.background = 'icon/coright.gif'
					break;
			case '2' :
			              colefttag.style.width = 27;
			              colefttag.style.height = 40;
			              colefttag.background = 'icon/coleft2.gif'
			              corighttag.style.width = 27;
			              corighttag.style.height = 40;
			              corighttag.background = 'icon/coright2.gif'
			              try {
	                      	  colefttag.style.filter ="alpha(Opacity=10, FinishOpacity=80,Style=1, StartX=0, FinishX=27, StartY=40, FinishY=40)" ;	
        	                        corighttag.style.filter ="alpha(Opacity=10, FinishOpacity=80,Style=1, StartX=0, FinishX=27, StartY=40, FinishY=40)" ;	
					 } catch (e) {}
					break;
			case '3' :
			              colefttag.style.width = 27;
			              colefttag.style.height = 46;
			              colefttag.background = 'icon/coleft3.gif'
			              corighttag.style.width = 27;
			              corighttag.style.height = 46;
			              corighttag.background = 'icon/coright3.gif'
					break;
			default :
					break;
	    }		
			

	    addmPageObj(1); 
	    addmPageObj(2); 
        layerremocon.style.top = g_top+50;
        layerremocon.style.left =  g_width - 20;
	    
	    if(g_pMenu[1] =='f' || g_pSkin[2]=='p') g_colrbgdDisplay = false;		//Ã¥°¥ÇÇ ¼öµ¿
	    
	    closeBookLayer();
	    
	    parent_plMDiv = document.all['layerMbase'];
	    parent_plLDiv = document.all['layerfull'];
	    parent_bpLarDiv = document.all['layerLbase'];
	    parent_gSound = document.all['layerbinfo'];
	    parent_AVDiv = document.all['layerLbase'];
	    initBookBorder();
		g_pulinkStyle[1][0] = "border-left:1 white solid; border-top:1 white solid; border-right: 1 black solid; border-bottom:1 black solid; background-color:"+pinfoColor+"; filter:alpha(Opacity=10)"
		g_pulinkStyle[1][1] = "border-left:1 white solid; border-top:1 white solid; border-right: 1 white solid; border-bottom:1 black solid; background-color:"+plistColor+"; filter:alpha(Opacity=10)"
	    if (g_sound !='')	    	playSound();   


	    g_cpage = -1;
	    window.offscreenBuffering = true ;
	
	    if ( b_direct == '0'){
		     g_l1page = -1;
		     g_r1page = 0;
		     g_l2page = 1;
		     g_r2page = 2;
	    }else{
		     g_l1page = 0;
		     g_r1page = -1;
		     g_l2page = 2;
		     g_r2page = 1;
	    }
       

	    if (GN_Smenu) showTag(remoconDisp);
           switch (g_pSkin[6]) {
			case 'a' :										//¸Þ´º ÀÚµ¿
					layerTitle.style.top =  0;	
					layermenu.style.top =  -57;					
					showTag("menuDisp");	           
					break;
			case 't' :
					showTag("menuDisp");	           
					layermenu.style.top =  0;					//»ó´Ü °íÁ¤callmenu(true,78);	
					layerTitle.style.top =  60;					
					g_menuFlag = true;
					menutopFlag = true;

					break;
			case 'b' :
					layerTitle.style.top =  0;					
					showTag("menuDisp");	           
					layermenu.style.top =  g_height-57				//ÇÏ´Ü °íÁ¤callmenu(true,-57);	
					g_menuFlag = true;
					menutopFlag = false;
					break;
			case 'n' :
					layerTitle.style.top =  0;					
					layermenu.style.top =  -57;					
					break;
			default :
					break;		
	}
       

}


function mnq_display(){

//alert(GN_Skin + ' '+ mnq_left.src);
	mnq_left.src = GN_Skin+'/q_left.gif';
	mnq_base.src = GN_Skin+'/q_base.gif';
	mnq_help.src = GN_Skin+'/q_help.gif';
	mnq_right.src = GN_Skin+'/q_right.gif';
	mnq_exit.src = GN_Skin+'/q_exit.gif';

	mnq_list.src = GN_Skin+'/q_list.gif';
	if(GN_List) mnq_list.style.display='';

	mnq_slide.src = GN_Skin+'/q_slide.gif';
	if(GN_Slide) mnq_slide.style.display='';

	mnq_mail.src = GN_Skin+'/q_mail.gif';
	if(GN_Mail) mnq_mail.style.display='';

	mnq_print.src = GN_Skin+'/q_print.gif';
	if(GN_Print) mnq_print.style.display='';

}

function window.onload()  {
	if(GN_web_user) {
		var pvalue = window.location.href.split('?');
    	if(pvalue[0].toLowerCase().indexOf(x_SetUrl.toLowerCase())<0) {
		    alert(x_SetUrl+' »çÀÌÆ®¿¡¼­¸¸ ¼­ºñ½º¸¦ Çã¶ôÇÕ´Ï´Ù.');
		    onCancel();	
		}
		//alert(pvalue[0].toUpperCase()+' '+x_SetUrl.toUpperCase());
    }	
    
    clientCall();
    	
    if(g_bx<110 || g_by<110) {
	    	    alert(" Ã¥ÀÇ »çÀÌÁî( "+g_bx+" x "+g_by+" ) °¡ ³Ê¹« ÀÛ½À´Ï´Ù. \n\n ÆíÁý ¹× ¼³Á¤¿¡¼­ ±âº»Á¤º¸ÀÇ Ã¥Å©±â Á¶Á¤ÇÏ¼¼¿ä ");
	    	    onCancel();	
	    	    return;
    }	
    if ( CheckUserBrowser() ) {
	    CheckUserMoniter();	
	    if(g_page>0) {
	    	
			mnq_display();
			
	   	    Initialization();
		    preOpenMiddle(0);
		    Open_startPage(0);
	    }else{
	    	    alert('ÆäÀÌÁö ³»¿ëÀÌ ¾øÀ¸¹Ç·Î Á¾·áÇÕ´Ï´Ù');
	    	    onCancel();	
	    }
    }else     onCancel();
    
}
