mainPhtNums=12;mainPhtUsingAry=$rdmNumAry(1,mainPhtNums);mainPhtUsingAry.length=6;mainPhtCache=new Image();for(cc in mainPhtUsingAry){mainPhtCache.src="images/top_photoset/top_pht_"+$numColumns(mainPhtUsingAry[cc],2)+".jpg";}usingPhtNum=999;contviewOpened=false;contviewH=650;nowContNum=999;newContNum=999;nowMoving=false;movingCount=1;function setuptop(){cngPht();setNews1st();$setRightsWithTxt("copyright",2005,"ISA homes Co.,Ltd. All rights reserved.");reLayout();$addEL(window,'resize',reLayout);contviewAry=$getWithClass("cont-block");loopPhoto();}function setNews1st(){newsDataAry=$getWithClass("news-data");newsDataAry[0].style.display="block";newsLoop();}function reLayout(){$("photo").style.height="650px";$("photocover").style.height="650px";$("menus").style.padding="54px 50px 20px";$("copyright").style.paddingTop="15px";containerH=$("container").offsetHeight;bsrH=$innerSize2("H");if(bsrH>containerH){halfTop=Math.ceil((bsrH-containerH)/2);halfBtm=(bsrH-containerH)-halfTop;$("menus").style.padding=(54+halfTop)+"px 50px 20px";$("copyright").style.paddingTop=(15+halfBtm)+"px";}else{workH=containerH-bsrH;newH=650-workH;minLimit=540;if(newH<=minLimit){newH=minLimit;}$("photo").style.height=newH+"px";$("photocover").style.height=newH+"px";}contviewH=$("photo").offsetHeight;contviewH+=$("news").offsetHeight;if(contviewOpened){$("contview").style.height=contviewH+"px";contviewLayout(nowContNum);}$("news-tolist").style.height=$("news").offsetHeight+"px";newsBtnImg=new Image();newsBtnImg.src="images/top_btn_news_list_on.gif";}function contviewLayout(tarNum){contviewAry=$getWithClass("cont-block");workAry=$getWithClass("viewitem",contviewAry[tarNum]);maxH=0;for(zz in workAry){workAry[zz].style.paddingTop="0px";workAry[zz].style.paddingBottom="0px";workAry[zz].style.height="auto";maxH=Math.max(maxH,workAry[zz].offsetHeight);}for(hh=0;hh<workAry.length;hh++){nowH=workAry[hh].offsetHeight;addH=maxH-workAry[hh].offsetHeight;workAry[hh].style.height=nowH+addH+"px";}boxH=contviewAry[tarNum].offsetHeight;freeH=contviewH-boxH;if(workAry.length==1){freeNum=Math.floor(freeH/2);for(nn=0;nn<workAry.length;nn++){workAry[nn].style.paddingTop=freeNum+"px";workAry[nn].style.paddingBottom=freeNum+"px";workAry[nn].style.borderBottom="none";}}else if(workAry.length==2){freeNum=Math.floor(freeH/4);for(nn=0;nn<workAry.length;nn++){workAry[nn].style.paddingTop=freeNum+"px";workAry[nn].style.paddingBottom=freeNum+"px";if(nn==1){workAry[nn].style.borderBottom="none";}}}else if(workAry.length==3){freeNum=Math.floor(freeH/6);for(nn=0;nn<workAry.length;nn++){workAry[nn].style.paddingTop=freeNum+"px";workAry[nn].style.paddingBottom=freeNum+"px";if(nn==2){workAry[nn].style.borderBottom="none";}}}else if(workAry.length==4){freeNum=Math.floor(freeH/4);for(nn=0;nn<workAry.length;nn++){workAry[nn].style.paddingTop=freeNum+"px";workAry[nn].style.paddingBottom=freeNum+"px";if(nn>=2){workAry[nn].style.borderBottom="none";}}}else if(workAry.length>=5){freeNum=Math.floor(freeH/6);for(nn=0;nn<workAry.length;nn++){workAry[nn].style.paddingTop=freeNum+"px";workAry[nn].style.paddingBottom=freeNum+"px";if(nn>=4){workAry[nn].style.borderBottom="none";}}}}phtChanging=false;function loopPhoto(){cngPht();loopPhtTimer=setTimeout("loopPhoto()",8000);}function cngPht(){if(!phtChanging){phtChanging=true;do{getNewPhtNum=Math.floor(Math.random()*6);}while(usingPhtNum==getNewPhtNum);usingPhtNum=getNewPhtNum;cngPhtAct1();}}function cngPhtAct1(){nowAlpha=Math.floor($getAlpha("photocover"));if(nowAlpha+4<100){$setAlpha("photocover",nowAlpha+4);cngPhtTimer=setTimeout("cngPhtAct1()",25);}else{$setAlpha("photocover",100);$("photo").style.backgroundImage="url(images/top_photoset/top_pht_"+$numColumns(mainPhtUsingAry[usingPhtNum],2)+".jpg)";cngPhtAct2();}}function cngPhtAct2(){nowAlpha=Math.floor($getAlpha("photocover"));if(nowAlpha-1>0){$setAlpha("photocover",nowAlpha-1);cngPhtTimer=setTimeout("cngPhtAct2()",25);}else{$setAlpha("photocover",0);phtChanging=false;}}function onmenu(tarNum){menuAry=$getWithClass("menu-item");menuAry[tarNum].style.borderBottom="4px solid #fff";}function offmenu(tarNum){if(tarNum!=nowContNum&&!nowMoving){menuAry=$getWithClass("menu-item");menuAry[tarNum].style.borderBottom="4px solid #e8eaec";}}function cngcont(tarNum){if(!nowMoving){nowMoving=true;if(!contviewOpened){contviewOpened=true;nowContNum=tarNum;cngMenuStatus(tarNum);openContview();$scrToPT();}else{if(nowContNum==tarNum){contviewOpened=false;cngMenuStatus(999);closeContview();}else{cngMenuStatus(tarNum);newContNum=tarNum;fadeoutNowCont();$scrToPT();}}}}function cngMenuStatus(tarNum){menuAry=$getWithClass("menu-item");for(xx in menuAry){menuAry[xx].style.borderBottom="4px solid #e8eaec";}if(tarNum!=999){menuAry[tarNum].style.borderBottom="4px solid #fff";$("nowarrow").style.display="block";arrowPos=menuAry[tarNum].offsetLeft+Math.floor(menuAry[tarNum].offsetWidth/2)-23;$("nowarrow").style.left=arrowPos+"px";}else{$("nowarrow").style.display="none";}}function openContview(){$("contview").style.height=$("news").offsetHeight+"px";$("contview").style.top=$("photo").offsetHeight+"px";$("contview").style.display="block";$("contview"+nowContNum).style.display="block";contviewLayout(nowContNum);openAct1();}function openAct1(){movingCount=movingCount*1.5;speed=Math.ceil(movingCount*2);nowH=$("contview").offsetHeight;if(nowH+speed<=contviewH){$("contview").style.height=nowH+speed+"px";$("contview").style.top=contviewH-(nowH+speed)+"px";openAct1Timer=setTimeout("openAct1()",25);}else{$("contview").style.height=contviewH+"px";$("contview").style.top="0px";cngPht();movingCount=1;nowMoving=false;}}function closeContview(){speed=150;newsH=$("news").offsetHeight;nowH=$("contview").offsetHeight;if(nowH-speed>=newsH){$("contview").style.height=nowH-speed+"px";$("contview").style.top=contviewH-(nowH-speed)+"px";closeTimer=setTimeout("closeContview()",25);}else{$("contview"+nowContNum).style.display="none";$("contview").style.display="none";nowContNum=999;nowMoving=false;}}function fadeoutNowCont(){nowAlpha=Math.floor($getAlpha("contview"+nowContNum));if(nowAlpha-20>0){$setAlpha("contview"+nowContNum,nowAlpha-20);fadeTimer=setTimeout("fadeoutNowCont()",25);}else{$setAlpha("contview"+nowContNum,100);$("contview"+nowContNum).style.display="none";$setAlpha("contview"+newContNum,0);$("contview"+newContNum).style.display="block";contviewLayout(newContNum);fadeinNewCont();}}function fadeinNewCont(){nowAlpha=$getAlpha("contview"+newContNum);if(nowAlpha+20<100){$setAlpha("contview"+newContNum,nowAlpha+20);fadeTimer=setTimeout("fadeinNewCont()",25);}else{$setAlpha("contview"+newContNum,100);nowContNum=newContNum;nowMoving=false;}}changingNews=false;nowNewsNum=-1;function newsLoop(){if(nowNewsNum==-1){nowNewsNum=0;}else{cngNews();}newsTimer=setTimeout("newsLoop()",7000);}function cngNews(){if(!changingNews){changingNews=true;cngNewsActOut();}}function cngNewsActOut(){newsAry=$getWithClass("news-data");nowAlpha=$getAlpha(newsAry[nowNewsNum]);if(nowAlpha-20>=1){$setAlpha(newsAry[nowNewsNum],nowAlpha-20);newsAlphaTimer=setTimeout("cngNewsActOut()",25);}else{$setAlpha(newsAry[nowNewsNum],0);newsAry[nowNewsNum].style.display="none";if(nowNewsNum==newsAry.length-1){nowNewsNum=0;}else{nowNewsNum++;}$setAlpha(newsAry[nowNewsNum],0);newsAry[nowNewsNum].style.display="block";cngNewsActIn();}}function cngNewsActIn(){newsAry=$getWithClass("news-data");nowAlpha=$getAlpha(newsAry[nowNewsNum]);if(nowAlpha+10<=99){$setAlpha(newsAry[nowNewsNum],nowAlpha+10);newsAlphaTimer=setTimeout("cngNewsActIn()",25);}else{$setAlpha(newsAry[nowNewsNum],100);changingNews=false;}}
