﻿//fs01공용스크립트
function sleep(idc,total,layer,img,src,type) {
	for(r=1;r<=total;r++){
	if(r==idc){
	document.all[layer+r].style.display="";
    if(type=='b') document.all['font_co0'+r].style.display="";
	}else{
	document.all[layer+r].style.display="none";
    if(type=='b') document.all['font_co0'+r].style.display="none"; 
	}
	}
	if(type=='a') document.all[img].src=src;  else if(type=='b') document.all[img].style.backgroundImage="url('"+src+"')"; 
}
//공용스크립트
function sleep01(idc,total,layer,img,src) {
	for(r=1;r<=total;r++){
	if(r==idc){
	document.all[layer+r].style.display="";
    document.all[img+r].src=src+r+'_over.gif';
	}else{
	document.all[layer+r].style.display="none";
    document.all[img+r].src=src+r+'.gif';
	}
	}
}
//롤오버
function sleep02(idc,total,img,src) {
	for(r=1;r<=total;r++){
	if(r==idc){
    document.all[img+r].src=src+r+'_over.gif';
	}else{
    document.all[img+r].src=src+r+'.gif';
	}
	}
}
//레이어뷰
function sleep03(idc,total) {
	for(r=1;r<=total;r++){
	    if(r==idc) {
	        document.all['fs05_title0'+r].style.display="";
	    }
	    else {
	        document.all['fs05_title0'+r].style.display="none";
	    }
	    
	    if(idc == 1) {
	        document.all['itemFocus01'].style.display="";
	        document.all['itemFocus02'].style.display="none";
	    }
	    else if(idc == 2) {
	        document.all['itemFocus01'].style.display="none";
	        document.all['itemFocus02'].style.display="";
	    }
	}
}

//레이어뷰
function sleep03_1(idc,total) {
	for(r=1;r<=total;r++){
	    if(r==idc) {
	        document.all['fs05_title0'+r].style.display="";
	    }
	    else {
	        document.all['fs05_title0'+r].style.display="none";
	    }
	}
}

//레이어뷰
function sleep04(idc, objId) {
    //document.all[objId].src='/images/subtitle_bestitem_tab'+idc+'.gif';
    document.all['bestitem'].src='/images/subtitle_bestitem_tab'+idc+'.gif';
    
    if(idc=="01") {
        document.all['bestitem01'].style.display="";
        document.all['bestitem02'].style.display="none";
        document.all['bestitem03'].style.display="none";
    }
    else if(idc =="02") {
        document.all['bestitem01'].style.display="none";
        document.all['bestitem02'].style.display="";
        document.all['bestitem03'].style.display="none";
    }
    else if(idc =="03") {
        document.all['bestitem01'].style.display="none";
        document.all['bestitem02'].style.display="none";
        document.all['bestitem03'].style.display="";
    }
    
}

//레이어뷰_1
function sleep04_1(idc, objId) {
    //document.all[objId].src='/images/subtitle_bestitem_tab'+idc+'.gif';
    document.all['bestitem'].src='/images/om_subtitle_bestitem_tab'+idc+'.gif';
    
    if(idc=="01") {
        document.all['bestitem01'].style.display="";
        document.all['bestitem02'].style.display="none";
        document.all['bestitem03'].style.display="none";
    }
    else if(idc =="02") {
        document.all['bestitem01'].style.display="none";
        document.all['bestitem02'].style.display="";
        document.all['bestitem03'].style.display="none";
    }
    else if(idc =="03") {
        document.all['bestitem01'].style.display="none";
        document.all['bestitem02'].style.display="none";
        document.all['bestitem03'].style.display="";
    }
    
}


function sleep05(idc) {
    document.all['arrivals'].src='/images/trend/tab_'+idc+'.gif';
    
    for(var i=1; i<7; i++) {
        var chk = "0" + i;
        if(idc == chk) {
            document.all['newArrivals'+ chk].style.display="";
        }
        else {
            document.all['newArrivals' + chk].style.display="none";
        }
    }
    
    
}
function sleep06(idc) {
    document.all['itemshop'].src='/images/itemshop/tab_'+idc+'.gif';
    
    if(idc=="01") {
        document.all['musthave01'].style.display="";
        document.all['musthave02'].style.display="none";
        document.all['musthave03'].style.display="none";
        document.all['musthave04'].style.display="none";
        document.all['musthave05'].style.display="none";
        document.all['musthave06'].style.display="none";
        document.all['musthave07'].style.display="none";
    }
    else if(idc =="02") {
        document.all['musthave01'].style.display="none";
        document.all['musthave02'].style.display="";
        document.all['musthave03'].style.display="none";
        document.all['musthave04'].style.display="none";
        document.all['musthave05'].style.display="none";
        document.all['musthave06'].style.display="none";
        document.all['musthave07'].style.display="none";
    }
    else if(idc =="03") {
        document.all['musthave01'].style.display="none";
        document.all['musthave02'].style.display="none";
        document.all['musthave03'].style.display="";
        document.all['musthave04'].style.display="none";
        document.all['musthave05'].style.display="none";
        document.all['musthave06'].style.display="none";
        document.all['musthave07'].style.display="none";
    }
    else if(idc =="04") {
        document.all['musthave01'].style.display="none";
        document.all['musthave02'].style.display="none";
        document.all['musthave03'].style.display="none";
        document.all['musthave04'].style.display="";
        document.all['musthave05'].style.display="none";
        document.all['musthave06'].style.display="none";
        document.all['musthave07'].style.display="none";
    }
    else if(idc =="05") {
        document.all['musthave01'].style.display="none";
        document.all['musthave02'].style.display="none";
        document.all['musthave03'].style.display="none";
        document.all['musthave04'].style.display="none";
        document.all['musthave05'].style.display="";
        document.all['musthave06'].style.display="none";
        document.all['musthave07'].style.display="none";
    }
    else if(idc =="06") {
        document.all['musthave01'].style.display="none";
        document.all['musthave02'].style.display="none";
        document.all['musthave03'].style.display="none";
        document.all['musthave04'].style.display="none";
        document.all['musthave05'].style.display="none";
        document.all['musthave06'].style.display="";
        document.all['musthave07'].style.display="none";
    }
    else if(idc =="07") {
        document.all['musthave01'].style.display="none";
        document.all['musthave02'].style.display="none";
        document.all['musthave03'].style.display="none";
        document.all['musthave04'].style.display="none";
        document.all['musthave05'].style.display="none";
        document.all['musthave06'].style.display="none";
        document.all['musthave07'].style.display="";
    }
    
    
    
    
}
function sleep07(idc) {
    document.all['itemshop01'].src='/images/itemshop/itemlist_tab_'+idc+'.gif';
}
function sleep08(idc) {
	if(idc==2) {
	document.all['fs22_img02'].style.display="";
	document.all['fs22_img01'].style.display="none";
	document.all['fs22_layer'].style.display="";
	} else {
	document.all['fs22_img02'].style.display="none";
	document.all['fs22_img01'].style.display="";
	document.all['fs22_layer'].style.display="none";
	}
}
//스크룰
function drScroll() {

    this.version = "0.1";
    this.name = "drScroll";
    this.item = new Array();
    this.itemcount = 0;
    this.itemoffset = 0;
    
    this.currentspeed = 0;
    this.scrollspeed = 50;
    this.pausedelay = 1000;
    this.pausemouseover = false;
    this.stop = 0;
    this.height = 100;
    this.heightGap = 0;
    this.width = 100;
    this.height_i = 100;
    this.width_i = 100;
    this.stopHeight=0;
    this.count=0;
    this.flag=true;
    this.position="absolute";
    this.item_position="absolute";

    this.add = function () {
        var text = arguments[0];
        this.item[this.itemcount] = text;
        this.itemcount = this.itemcount + 1;
    };
    this.start = function () {
        this.display();
        this.currentspeed = this.scrollspeed;
        obj = document.getElementById(this.name+'item0').style;
        obj.display='block';
        this.count++;
        setTimeout(this.name+'.scroll()',this.currentspeed);
    };

    this.display = function () {    
        document.write('<div id="'+this.name+'" style="height:'+this.height+';width:'+this.width+';position:'+this.position+';overflow:hidden;" OnMouseOver="'+this.name+'.onmouseover();" OnMouseOut="'+this.name+'.onmouseout();">');
        for(var i = 0; i < this.itemcount; i++) {

                document.write('<div id="'+this.name+'item'+i+'"style="left:0px; width:'+this.width+';position:'+this.item_position+'; display:none; ">');
                document.write(this.item[i]);
                document.write('</div>');
        }
        document.write('</div>');
    };

    this.scroll = function () {
        this.currentspeed = this.scrollspeed;
        if ( !this.stop ) {
            this.imageChange();
        }
        window.setTimeout(this.name+".scroll()",this.currentspeed);
    };


    this.imageChange = function ()
    {
        for (k = 0; k < this.itemcount; k++) {
            obj = document.getElementById(this.name+'item'+k).style;
            if (this.count % this.itemcount == k) {
                obj.display = 'block';
            } else {
                obj.display = 'none';
            }
        }
        this.count++;
    }

    this.onmouseover = function ()
    {
        if ( this.pausemouseover ) {
            this.stop = 1;
        }
    };
  for (k = 0; k < this.item_icount; k++) {
    obj_i = document.getElementById(this.name+'item_i'+k).style;
    if (this.count % this.item_icount == k) {
      obj_i.display = 'block';
    } else {
      obj_i.display = 'none';
    }
  }

    this.onmouseout = function ()
    {
        if ( this.pausemouseover ) {
            this.stop = 0;
        }
    };

    this.up = function ()
    {
        var i;
        this.stop++;


        if ( this.itemcount <= this.itemoffset )
            this.itemoffset = this.itemoffset % this.itemcount;
        /*
        for (i = 0; i < this.item_icount; i++) {
            obj_i = document.getElementById(this.name+'item_i'+i).style;
            if ( obj_i.display == "block" ) {this.item_ioffset = i+1;obj_i.display="none";}
        }

        if (this.item_icount > 0) {
            if (this.item_ioffset < this.item_icount) {
                obj_i = document.getElementById(this.name+'item_i'+this.item_ioffset).style;
                obj_i.display = "block";
            } else {
                obj_i = document.getElementById(this.name+'item_i0').style;
                obj_i.display = "block";
            }
        }
        */
        for (i = 0; i < this.itemcount; i++) {
            obj = document.getElementById(this.name+'item'+i).style;
            if ( obj.display == "block" ) {this.itemoffset = i+1;obj.display="none";}
        }
        if (this.itemoffset < this.itemcount) {
            obj = document.getElementById(this.name+'item'+this.itemoffset).style;
            obj.display = "block";
        } else {
            obj = document.getElementById(this.name+'item0').style;
            obj.display = "block";
        }
        window.setTimeout(this.name + ".stop--;",this.pausedelay);
        //this.stop--;
    }
    this.down = function ()
    {
        var i;        
        this.stop--;
        
        if ( this.itemcount <= this.itemoffset )
            this.itemoffset = this.itemoffset % this.itemcount;


        for (i = 0; i < this.itemcount; i++) {
            
            num = (this.itemcount - i ) % this.itemcount;
            num2 = (this.itemcount - i -1) % this.itemcount;

            obj = document.getElementById(this.name+'item'+num).style;

            if ( obj.display == "block" ) {
                this.itemoffset =  num2; 
                obj.display="none";
            }
        }

        
        if (this.itemoffset < this.itemcount) {

            obj = document.getElementById(this.name+'item'+this.itemoffset).style;
            obj.display = "block";
        } else {
            obj = document.getElementById(this.name+'item0').style;
            obj.display = "block";
        }
        window.setTimeout(this.name + ".stop--;",this.pausedelay);
        //this.stop--;
    }
}


//아이템샵 레이어
curlayer = '';
function showLayer(n) {
	if (curlayer!='')	eval("document.all.s"+curlayer+".style.visibility='hidden'");
	eval("document.all.s"+n+".style.visibility='visible'");
	curlayer = n;
}

function hideLayer() {
	eval("document.all.s"+curlayer+".style.visibility='hidden'");
	curlayer='';
}