
function setLayer(prev,next,layer,tag,size,set,px){this.prevObj=BASE.$(prev);this.nextObj=BASE.$(next);this.layerObj=BASE.$(layer);this.childeTag=tag;this.nodeSize=0;this.set=parseInt(set);this.layerWidth=0;this.layerSize=size;this.px=parseInt(px);this.cnt=0;this.aniHTML=this.layerObj.innerHTML;this.newObj="";this.tmpCnt=0;for(var i=0;i<this.layerObj.childNodes.length;i++){if(this.layerObj.childNodes[i].tagName==this.childeTag){this.nodeSize++;if(this.tmpCnt==0)this.tmpCnt=i;}}
this.layerWidth=this.layerObj.childNodes[this.tmpCnt].offsetWidth;};setLayer.prototype.init=function(obj,txt,type){this.prevObj.onclick=function(){if(type=="d")obj.prev();else if(type=="a")obj.aniPrev();else if(type=="r")obj.rollPrev();}
this.nextObj.onclick=function(){if(type=="d")obj.next();else if(type=="a")obj.aniNext();else if(type=="r")obj.rollNext();}
this.layerObj.style.marginLeft="0px";this.newObjId=String(txt);};setLayer.prototype.prev=function(){if((parseInt(this.layerObj.style.marginLeft)+parseInt(this.layerWidth*this.set))<=0){this.layerObj.style.marginLeft=(parseInt(this.layerObj.style.marginLeft)+parseInt(this.layerWidth*this.set))+"px";}else{alert("처음이미지 입니다.");}};setLayer.prototype.next=function(){if((parseInt(this.layerObj.style.marginLeft)-parseInt(this.layerWidth*this.layerSize))>-(parseInt(this.layerWidth*this.nodeSize))){this.layerObj.style.marginLeft=(parseInt(this.layerObj.style.marginLeft)-parseInt(this.layerWidth*this.set))+"px";}else{alert("마지막이미지 입니다.");}};setLayer.prototype.rollPrev=function(){if((parseInt(this.layerObj.style.marginLeft)+parseInt(this.layerWidth*this.set))<=0){this.layerObj.style.marginLeft=(parseInt(this.layerObj.style.marginLeft)+parseInt(this.layerWidth*this.set))+"px";}else{this.layerObj.style.marginLeft=-(parseInt(this.layerWidth*(this.layerSize-this.set)))+"px";}};setLayer.prototype.rollNext=function(){if((parseInt(this.layerObj.style.marginLeft)-parseInt(this.layerWidth*this.layerSize))>-(parseInt(this.layerWidth*this.nodeSize))){this.layerObj.style.marginLeft=(parseInt(this.layerObj.style.marginLeft)-parseInt(this.layerWidth*this.set))+"px";}else{this.layerObj.style.marginLeft="0px";}};setLayer.prototype.aniPrev=function(obj){var frameW=this.layerWidth*this.set;if(parseInt(this.layerObj.style.marginLeft)==0){if(this.aniHTML!=""){this.layerObj.innerHTML+=this.aniHTML;this.aniHTML="";}
this.layerObj.style.marginLeft=-(this.layerWidth*this.nodeSize)+"px";}
this.layerObj.style.marginLeft=(parseInt(this.layerObj.style.marginLeft)+this.px)+"px";this.cnt+=this.px;if(this.cnt==frameW)this.cnt=0;else window.setTimeout(this.newObjId+".aniPrev()",5);if(parseInt(this.layerObj.style.marginLeft)==this.layerWidth*((this.nodeSize*2)-this.layerSize)){this.layerObj.style.marginLeft=this.layerWidth*(this.nodeSize-this.layerSize);}};setLayer.prototype.aniNext=function(obj){var frameW=this.layerWidth*this.set;this.layerObj.style.marginLeft=(parseInt(this.layerObj.style.marginLeft)-this.px)+"px";this.cnt+=this.px;if(this.cnt==frameW)this.cnt=0;else window.setTimeout(this.newObjId+".aniNext()",5);if(parseInt(this.layerObj.style.marginLeft)==this.layerWidth*-(this.nodeSize-this.layerSize)){if(this.aniHTML!=""){this.layerObj.innerHTML+=this.aniHTML;this.aniHTML="";}}
if(parseInt(this.layerObj.style.marginLeft)==this.layerWidth*-((this.nodeSize*2)-this.layerSize)){this.layerObj.style.marginLeft=(this.layerWidth*-(this.nodeSize-this.layerSize))+"px";}};
function layerBanner(bannerId,iconId,bannerTag,isClick,isAni,px){this.over=false;this.selBanner=0;this.childTag=String(bannerTag);this.BannerObj=BASE.$(String(bannerId));this.iconObj=BASE.$(String(iconId)).getElementsByTagName("A");this.bannerWidth=0;this.childLen=0;this.isAni=isAni;this.tmpCnt=0;this.px=px;this.cnt=0;this.isClick=isClick;this.newObjId=null;this.tmpObj=null;this.ranTime=0;this.timer=0;};layerBanner.prototype.init=function(obj,newObjId,timer){for(var i=0;i<this.BannerObj.childNodes.length;i++){if(this.BannerObj.childNodes[i].tagName==this.childTag){this.childLen++;if(this.tmpCnt==0)this.tmpCnt=i;}}
this.bannerWidth=parseInt(this.BannerObj.childNodes[this.tmpCnt].offsetWidth);this.newObjId=String(newObjId);this.timer=parseInt(timer);for(var i=0;i<this.iconObj.length;i++){if(this.isClick){if(this.isAni){this.iconObj[i].onclick=function(){obj.aniView(this);}}
else{this.iconObj[i].onclick=function(){obj.view(this);}}
this.iconObj[i].onmouseover=function(){obj.over=true;}
this.iconObj[i].onmouseout=function(){obj.over=false;}}else{if(this.isAni){this.iconObj[i].onmouseover=function(){obj.aniView(this);obj.over=true;}
this.iconObj[i].onmouseout=function(){obj.over=false;}}else{this.iconObj[i].onmouseover=function(){obj.view(this);obj.over=true;}
this.iconObj[i].onmouseout=function(){obj.over=false;}}}}
this.BannerObj.style.marginLeft="0px";if(this.timer>0){window.setTimeout(this.newObjId+".random(3000);",this.timer);}};layerBanner.prototype.random=function(time){if(time!=null){this.timer=time;}
if(!this.over){if(this.isAni){if(this.selBanner+1==this.childLen)this.aniView(this.iconObj[0]);else this.aniView(this.iconObj[this.selBanner+1]);}else{if(this.selBanner+1==this.childLen)this.view(this.iconObj[0]);else this.view(this.iconObj[this.selBanner+1]);}}
window.setTimeout(this.newObjId+".random();",this.timer);};layerBanner.prototype.aniView=function(obj){if(obj!=null){for(var i=0;i<this.iconObj.length;i++){if(this.iconObj[i]==obj){this.tmpObj=i;break;}}}
if(this.tmpObj!=this.selBanner){if(this.tmpObj<this.selBanner){this.BannerObj.style.marginLeft=(parseInt(this.BannerObj.style.marginLeft)+this.px)+"px";}
else if(this.tmpObj>this.selBanner){this.BannerObj.style.marginLeft=(parseInt(this.BannerObj.style.marginLeft)-this.px)+"px";}
this.cnt+=this.px;if(this.cnt==this.bannerWidth){this.cnt=0;this.iconObj[this.selBanner].getElementsByTagName("IMG")[0].src=this.iconObj[this.selBanner].getElementsByTagName("IMG")[0].src.replace("_on.gif",".gif");if(this.tmpObj<this.selBanner){this.selBanner--;}
else if(this.tmpObj>this.selBanner){this.selBanner++;}
if(this.selBanner!=this.tmpObj){window.setTimeout(this.newObjId+".aniView()",5);}else{this.iconObj[this.tmpObj].getElementsByTagName("IMG")[0].src=this.iconObj[this.tmpObj].getElementsByTagName("IMG")[0].src.replace(".gif","_on.gif");}}else{window.setTimeout(this.newObjId+".aniView()",5);}}};layerBanner.prototype.view=function(obj){for(var i=0;i<this.iconObj.length;i++){if(this.iconObj[i]==obj){this.BannerObj.style.marginLeft=(-(this.bannerWidth*i))+"px";this.iconObj[this.selBanner].getElementsByTagName("IMG")[0].src=this.iconObj[this.selBanner].getElementsByTagName("IMG")[0].src.replace("_on.gif",".gif");this.iconObj[i].getElementsByTagName("IMG")[0].src=this.iconObj[i].getElementsByTagName("IMG")[0].src.replace(".gif","_on.gif");this.selBanner=i;break;}}};
function imgTab(tabId,contId,tagName,isClick,isRan){this.tabObj=BASE.$(tabId).getElementsByTagName("A");this.contTagName=tagName;this.isClick=isClick;this.contObj=new Array();this.selTab=0;this.isRan=isRan;this.contCnt=0;if(contId!=""){var contTmp=BASE.$(String(contId)).childNodes;for(var i=0;i<contTmp.length;i++){if(contTmp[i].tagName==tagName){this.contObj[this.contCnt]=contTmp[i];this.contObj[this.contCnt].style.display="none";this.contCnt++;}}}};imgTab.prototype.init=function(obj){var tmpNum=0;for(var i=0;i<this.tabObj.length;i++){if(this.isClick){this.tabObj[i].onclick=function(){obj.view(this)};}
else{this.tabObj[i].onmouseover=function(){obj.view(this)};}}
if(this.isRan){tmpNum=parseInt(BASE.getRandom(this.contCnt));}
this.view(this.tabObj[tmpNum]);};imgTab.prototype.view=function(btn){if(this.contCnt>0){this.contObj[this.selTab].style.display="none";}
for(var i=0;i<this.tabObj.length;i++){if(this.tabObj[i]==btn){this.selTab=i;}
this.tabObj[i].getElementsByTagName("IMG")[0].src=this.tabObj[i].getElementsByTagName("IMG")[0].src.replace("_on.gif",".gif");}
btn.getElementsByTagName("IMG")[0].src=btn.getElementsByTagName("IMG")[0].src.replace(".gif","_on.gif");if(this.contCnt>0){this.contObj[this.selTab].style.display="block";}};
function layerPopup(){this.bodyW=parseInt(document.documentElement.scrollWidth);this.bodyH=parseInt(document.documentElement.scrollHeight);this.browerW=parseInt(document.documentElement.clientWidth);this.browerH=parseInt(document.documentElement.clientHeight);this.popupObj=null;this.backObj=null;this.isCenter=false;this.leftP=0;this.TopP=0;};layerPopup.prototype.openType1=function(popId,isCenter,leftP,topP,evt){if(typeof evt=="object"){this.leftP=evt.clientX;this.topP=evt.clientY;}else{this.leftP=leftP;this.topP=topP;}
this.popupObj=BASE.$(String(popId));this.isCenter=isCenter;this.popupObj.style.display="block";if(this.isCenter){this.popupObj.style.left=((this.browerW-parseInt(this.popupObj.offsetWidth))/2)+"px";this.popupObj.style.top=((this.browerH-parseInt(this.popupObj.offsetHeight))/2)+"px";}else{this.popupObj.style.left=parseInt(this.leftP)+"px";this.popupObj.style.top=parseInt(this.topP)+"px";}};layerPopup.prototype.openType2=function(popId,backId,isCenter,leftP,topP,evt){this.backObj=BASE.$(String(backId));this.popupObj=BASE.$(String(popId));this.isCenter=isCenter;if(typeof evt=="object"){this.leftP=evt.clientX;this.topP=evt.clientY;}else{this.leftP=leftP;this.topP=topP;}
if(typeof this.backObj=="object"){this.backObj.style.display="block";this.backObj.style.width=this.bodyW+"px";this.backObj.style.height=this.bodyH+"px";}
this.popupObj.style.display="block";if(this.isCenter){this.popupObj.style.left=((this.browerW-parseInt(this.popupObj.offsetWidth))/2)+"px";this.popupObj.style.top=((this.browerH-parseInt(this.popupObj.offsetHeight))/2)+"px";}else{this.popupObj.style.left=parseInt(this.leftP)+"px";this.popupObj.style.top=parseInt(this.topP)+"px";}};layerPopup.prototype.close=function(){if(this.backObj!=null){this.backObj.style.display="none";}
this.popupObj.style.display="none";this.popupObj=null;this.backObj=null;this.isCenter=false;this.leftP=0;this.TopP=0;};layerPopup.prototype.resize=function(){if(this.popupObj!=null&&this.popupObj.style.display=="block"){this.bodyW=parseInt(document.documentElement.scrollWidth);this.bodyH=parseInt(document.documentElement.scrollHeight);this.browerW=parseInt(document.documentElement.clientWidth);this.browerH=parseInt(document.documentElement.clientHeight);if(this.backObj!=null&&this.backObj.style.display!="none"){this.backObj.style.width=this.bodyW+"px";this.backObj.style.height=this.bodyH+"px";}
if(this.isCenter){this.popupObj.style.left=((this.browerW-parseInt(this.popupObj.offsetWidth))/2)+"px";this.popupObj.style.top=((this.browerH-parseInt(this.popupObj.offsetHeight))/2)+"px";}else{this.popupObj.style.left=parseInt(this.leftP)+"px";this.popupObj.style.top=parseInt(this.topP)+"px";}}};
