/**
 *Filename:      o_table.js
 *Version:       1.0.0(2009-03-02)
 *Website:       http://
 *Author:        S.S.L
**/

function x_table(){
	var self = this;
	var o,on,off,table1,type;
	
	function $( id ){ return document.getElementById( id );}

	function setListener(){
		var tr = table1.getElementsByTagName( "tr" );		
		var pre_cname;
		
		for( var i = 0; i < tr.length; i++ ){
			tr[i].onmouseover = function(){
				pre_cname = this.className;
				this.className = on;
			};
			tr[i].onmouseout = function(){
				this.className = pre_cname;
			};
		}
	}
	function setTable(){
		var tr = table1.getElementsByTagName( "tr" );		
		
		for( var i = 0; i < tr.length; i++ ){
			if( type == 0 && (i%2) == 0 ){
				tr[i].className = off;
			} else if( type == 1 && (i%2) == 1 ){
				tr[i].className = off;
			}
		}
	}
	this.init = function( tableid1,off1,on1,type1 ){
		on = on1;
		off = off1;
		type = type1;
		
		table1 = $( tableid1 ).getElementsByTagName( "table" )[0];
		
		setTable();
		setListener();
	}
}
