/*
 * Filename      : Xtab_menu.js
 * Class         : 
 * Comment       : »ó¼¼ÆäÀÌÁö TabÇüÅÂ ½º¸¶Æ®·¹ÀÌ¾î ±¸¼º 
 * History       : 2006/06/07, È« ½Ä(indigo), Created
                 : 2006/06/07, È« ½Ä(indigo), Updated(°øÅëÇÔ¼öÈ­)
 * @version      : 1.0
 * @author       : Copyright (c) 2006 by m2mGlobal Corp. All Rights Reserved.
*/

//±ÔÄ¢::::
//XTabPage ¸¦ »ç¿ëÇÏ·Á¸é ¸ÕÀú stlyeÀ» ¼³Á¤ÇØ¾ßÇÔ.
//4°³ÀÇ Å¬·¡½ºÁØºñ..(ÀÓ½Ã test_indigo·Î ÇÏ¿´À½..)
//		.test_indigo_[Çìµå]_nCell : ÅÇ ³ª¸ÓÁö ºó°ø°£ ½ºÅ¸ÀÏ
//		.test_indigo_[Çìµå]_Content1 : ¸ÅÀÎ Å×ÀÌºí ¼¿ ½ºÅ¸ÀÏ(td)
//		.test_indigo_[Çìµå]_Content2 : ¸ÅÀÎ Å×ÀÌºí ¼¿ ¾ÈÂÊ ½ºÅ¸ÀÏ(td ¾È¿¡ div)
//		.test_indigo_[Çìµå]_Cell : ¾È°ñ¶óÁø ÅÇ
//		.test_indigo_[Çìµå]_sCell : °ñ¶óÁø ÅÇ ½ºÅ¸ÀÏ
//		¿©±â¼­ [Çìµå]´Â ¿øÇÏ´Â °°Àº ÀÌ¸§À¸·Î ÇÑ´Ù.(ºó°ø°£À¸·Î ³Ö¾îµµ µÊ.)

//		ÃÊ±â¼³Á¤Àº
//		test_tab=new obxTabPage(°¡·Î±æÀÌ,¼¼·Î±æÀÌ,'[Çìµå]');
//		°¡·Î±æÀÌ¿Í ¼¼·Î±æÀÌ´Â ²À ÇÈ¼¿´ÜÀ§·Î Ç¥ÇöÇØ¾ßÇÔ.<br>
//		%·Î ÇÒ °æ¿ì µû¿ÈÇ¥·Î ¹­¾îÁà¾ß ÇÔ "100%","100%"Ã³·³..

//		Ãß°¡ ÆäÀÌÁö¸¦ ¸¸µé¶§´Â
//		test_tab.addStart("ÆäÀÌÁö ¾ÆÀÌµð","ÅÇ¿¡Ç¥½Ã µÉ ÅØ½ºÆ®" [,ÀÎµ¦½º]);
//		ÆäÀÌÁö ³»¿ë
//		test_tab.addEnd();

//		ÀÌ·±½ÄÀ¸·Î ±¸¼º. ÆäÀÌÁö ¾ÆÀÌµð´Â Áßº¹µÇÁö¾Ê´Â °ªÀ¸·Î ³Ö´Â´Ù.
//		¶Ç ÀÎµ¦½º´Â ÅÇÀÇ À§Ä¡¸¦ ÁöÁ¤ÇØÁÖ´Â°Çµ¥ ¾ÈÇØÁàµµ µÇ°í
//		±âº»Àº ¿ÞÂÊºÎÅÍ ½×ÀÌ´Â°ÍÀÓ

	function XTabPage(sizex , sizey, cssHead){
	
	    if(!cssHead) this.cssHead='';
	    else this.cssHead=cssHead;
	    document.write(
	        '<table cellpadding="0" border="0"  cellspacing="0" style="table-layout:fixed;padding:1;height:'+sizey+';width:'+sizex+'">' +
	        '<tr><td class=TEST_'+this.cssHead+'_NCELL width=*>&nbsp;</td></tr>'+
	        '<tr><td class=TEST_'+this.cssHead+'_CONTENT1 width=100%> </td></tr>'+ 
	        '</table>'
	    );
	    this.height=sizey;
	    this.width=sizex;
	
		//document.write(
	    //    '<table cellpadding="0" border="0"  cellspacing="0" style="table-layout:fixed;padding:1;height:500;width:500">' +
	    //    '<tr><td class=TEST_'+this.cssHead+'_NCELL width=*>&nbsp;</td></tr>'+
	    //    '<tr><td class=TEST_'+this.cssHead+'_CONTENT1 width=100%> </td></tr>'+ 
	    //    '</table>'
	    //);
		//this.height=500;
	    //this.width=500;
	
		var tables=document.getElementsByTagName("table");
		this.table=tables[tables.length-1];
	    this.titleRow=this.table.rows[0];
	    this.nullCell = this.titleRow.cells[0];
	    this.contentRow = this.table.rows[1];
	    this.contentCell = this.contentRow.cells[0];
	    this.item= new Object();
	
	    this.length=0;
	
	    var re=new RegExp("\\bobxtp=(\\w+)\\b",'i');
	    if(location.search.match(re)) this.defaultView = RegExp.$1;
	
	    this.addStart= function (id,title,idx,action) {
	
			var iIndex=(idx) ? idx-1 : this.length;
	        
	        this.item[id] = this.titleRow.insertCell(iIndex);
	
			this.item[id].className='TEST_'+this.cssHead+'_CELL';
	        this.item[id].parentObject=this;
	        this.item[id].onclick=Function("this.parentObject.show('"+id+"');");
	        if(action) this.item[id].action = action;
	        this.item[id].height=25;
	        this.item[id].innerHTML=title;
	        document.write('<div style="display:none;width:100%;height:100%">');
			var divs=document.getElementsByTagName("div");
	        this.item[id].content = divs[divs.length-1];
	        this.item[id].content.className='TEST_'+this.cssHead+'_CONTENT2';
	        this.DrawingID=id;
	        this.length++;
	        this.contentCell.colSpan=this.length+1;
	
	    }
	    
	    this.addEnd = function () {
	        document.write("</div></div>");
	        this.contentCell.appendChild(this.item[this.DrawingID].content);
	        if(!this.LastShownItemID) this.show(this.DrawingID,1);
	        else if(this.defaultView==this.DrawingID) this.show(this.defaultView,1);
	    }
	    
	    this.show = function (id,runtime){
	
	        if (this.LastShownItemID) this.hide(this.LastShownItemID);
	        this.LastShownItemID = id;
	        this.item[id].className='TEST_'+this.cssHead+'_SCELL';
	        this.item[id].content.style.display='';
	        if(this.item[id].action) {
	            try{eval(this.item[id].action);}catch(e){}}
	    }
	
	    this.hide = function (id){
	        this.item[id].className='TEST_'+this.cssHead+'_CELL';;
	        this.item[id].content.style.display="none";
	    }
  
	} 
