var currentObj = null;  //ÇÏ³ª¸¸ ¼±ÅÃÇÏ±â À§ÇÑ °Í.
var colorOn = '#EEEEEE'; //
var colorOut = ''; //

//Å¬¸¯ÇÒ °æ¿ì ¹è°æ»öÀ» È¸»öÀ¸·Î ¹Ù²Ù°í ´Ù½Ã Å¬¸¯ÇÏ¸é ¿ø·¡´ë·Î ÇÑ´Ù.
function mouseClick(obj) {
	if(currentObj != null){
		currentObj.style.background=colorOut;
	}
   if(obj != currentObj){
		obj.style.background=colorOn;
		currentObj = obj;
   }
   else{
   	currentObj = null;
   }
}

//¸¶¿ì½º¸¦ °®´Ùµ¨ ¶§ ¹è°æ»öÀÌ ¹Ù²îµµ·Ï ÇÑ´Ù.
function mouseOut(obj) {
	obj.style.background=colorOut;
   if(currentObj != null){
      currentObj.style.background=colorOn;      
   }
}

//¸¶¿ì½º¸¦ ¶ª ¶§ ¹è°æ»öÀÌ µ¹¾Æ¿Àµµ·Ï ÇÑ´Ù.
function mouseOn(obj) {
	obj.style.background=colorOn;
}



//¹Ø¿¡ °ÍµéÀº ÇÑ¹ø¿¡ µÎ°³°¡ ¼±ÅÃµÇµµ·Ï ÇÏ±â À§ÇÔÀÌ´Ù. 
function mouseClick2_top(obj) {
		
	if(currentObj != null){
		currentObj.style.background=colorOut;
		currentObj.parentElement.rows[currentObj.rowIndex+1].style.background = colorOut;
	}
   if(obj != currentObj){
   	//alert(obj);
		obj.style.background=colorOn;
		obj.parentElement.rows[obj.rowIndex+1].style.background = colorOn;
		currentObj = obj;
   }
   else{
   	currentObj = null;
   }
   /*
   if(obj == currentObj){
      if(currentObj.style.background==colorOut){
         obj.style.background=colorOn;
         obj.parentElement.rows[obj.rowIndex+1].style.background = colorOn;
      }
      else{
         obj.style.background=colorOut;
         obj.parentElement.rows[obj.rowIndex+1].style.background = colorOn;
      }
   }
   else{
      if(currentObj != ''){
         currentObj.style.background = colorOn;
         obj.parentElement.rows[obj.rowIndex+1].style.background = colorOn;
      }
      obj.style.background = colorOut;
      obj.parentElement.rows[obj.rowIndex+1].style.background = colorOn;
      currentObj = obj;
   }
   */
}

function mouseClick2_bottom(obj) {
   if(currentObj != null){
		currentObj.style.background=colorOut;
		currentObj.parentElement.rows[currentObj.rowIndex+1].style.background = colorOut;
	}
   if(obj.parentElement.rows[obj.rowIndex-1] != currentObj){
		obj.style.background=colorOn;
		obj.parentElement.rows[obj.rowIndex-1].style.background = colorOn;
		currentObj = obj.parentElement.rows[obj.rowIndex-1];
   }
   else{
   	currentObj = null;
   }
   /*
   if(obj == currentObj){
      if(currentObj.style.background==colorOut){
         obj.style.background=colorOn;
         obj.parentElement.rows[obj.rowIndex-1].style.background = colorOn;
      }
      else{
         obj.style.background=colorOut;
         obj.parentElement.rows[obj.rowIndex-1].style.background = colorOn;
      }
   }
   else{
      if(currentObj != null){
         currentObj.style.background = colorOn;
         obj.parentElement.rows[obj.rowIndex-1].style.background = colorOn;
      }
      obj.style.background = colorOut;
      obj.parentElement.rows[obj.rowIndex-1].style.background = colorOn;
      currentObj = obj;
   }
   */
}

function mouseOn2_top(obj) {
   //if(obj != currentObj){
      obj.style.background = colorOn;
      //alert(obj.parentElement.rows[]);
      //alert(document.all[(obj.sourceIndex + 2)]).tagName;
      obj.parentElement.rows[obj.rowIndex+1].style.background = colorOn;
   //}
}

function mouseOn2_bottom(obj) {
   //if(obj != currentObj){
      obj.style.background = colorOn;
     // alert(obj.rowIndex);
      //alert(document.all[(obj.sourceIndex + 2)]).tagName;
      //document.all[(obj.sourceIndex + 1)].style.background = colorOn;
   	obj.parentElement.rows[obj.rowIndex-1].style.background = colorOn;
   //}
}

function mouseOut2_top(obj) {
	if(obj != currentObj){
      obj.style.background = colorOut;
      obj.parentElement.rows[obj.rowIndex+1].style.background = colorOut;
   }
}
function mouseOut2_bottom(obj) {
	if(obj.parentElement.rows[obj.rowIndex-1] != currentObj){
      obj.style.background = colorOut;
      obj.parentElement.rows[obj.rowIndex-1].style.background = colorOut;
   }
}
