
if(!String.trim)String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };
var DHTMLSuite_funcs = new Object();
if(!window.DHTML_SUITE_THEME)var DHTML_SUITE_THEME = 'blue';
if(!window.DHTML_SUITE_THEME_FOLDER) var DHTML_SUITE_THEME_FOLDER = 'themes/';



/************************************************************************************************************
*
* Global variables
*
************************************************************************************************************/

	// {{{ DHTMLSuite.createStandardObjects()

var DHTMLSuite = new Object();

var standardObjectsCreated = false;	
DHTMLSuite.eventEls = new Array();	

var widgetDep = new Object();
	// Widget dependencies




var depCache = new Object();

DHTMLSuite.include = function(widget)
{
	if(!widgetDep[widget]){
		alert('Cannot find the files for widget ' + widget + '. Please verify that the name is correct');
		return;
	}
	var files = widgetDep[widget];
	for(var no=0;no<files.length;no++){
		if(!depCache[files[no]]){
		    document.write('<' + 'script');
		    document.write(' language="javascript"');
		    document.write(' type="text/javascript"');
		    document.write(' src="' + DHTML_SUITE_JS_FOLDER + files[no] + '">');
		    document.write('</' + 'script' + '>');
		    depCache[files[no]] = true;
		}
	}
}

DHTMLSuite.discardElement = function(element) { 
	element = DHTMLSuite.commonObj.getEl(element);
    var gBin = document.getElementById('IELeakGBin'); 
    if (!gBin) { 
        gBin = document.createElement('DIV'); 
        gBin.id = 'IELeakGBin'; 
        gBin.style.display = 'none'; 
        document.body.appendChild(gBin); 
    } 
    // move the element to the garbage bin 
    gBin.appendChild(element); 
    gBin.innerHTML = ''; 
} 


DHTMLSuite.createStandardObjects = function()
{
	DHTMLSuite.clientInfoObj = new DHTMLSuite.clientInfo();	// Create browser info object
	DHTMLSuite.clientInfoObj.init();	
	if(!DHTMLSuite.configObj){	// If this object isn't allready created, create it.
		DHTMLSuite.configObj = new DHTMLSuite.config();	// Create configuration object.
		DHTMLSuite.configObj.init();
	}
	DHTMLSuite.commonObj = new DHTMLSuite.common();	// Create configuration object.
	DHTMLSuite.variableStorage = new DHTMLSuite.globalVariableStorage();;	// Create configuration object.
	DHTMLSuite.commonObj.init();
	DHTMLSuite.domQueryObj = new DHTMLSuite.domQuery();

	
	DHTMLSuite.commonObj.addEvent(window,'unload',function(){ DHTMLSuite.commonObj.__clearMemoryGarbage(); });
	
	standardObjectsCreated = true;	
}

    


/************************************************************************************************************
*	Configuration class used by most of the scripts
*
*	Created:			August, 19th, 2006
* 	Update log:
*
************************************************************************************************************/



DHTMLSuite.config = function()
{
	var imagePath;	// Path to images used by the classes. 
	var cssPath;	// Path to CSS files used by the DHTML suite.	

	var defaultCssPath;
	var defaultImagePath;
}


DHTMLSuite.config.prototype = {
	// {{{ init()
	/**
	 * 	Initializes the config object - the config class is used to store global properties used by almost all widgets
	 *
	 * @public
	 */
	init : function()
	{
		this.imagePath = 'imagens/';	// Path to images		
		this.cssPath = 'css/';	// Path to images	
		
		this.defaultCssPath = this.cssPath;
		this.defaultImagePath = this.imagePath;
			
	}	
	// }}}
	,
	// {{{ setCssPath()

    	
	setCssPath : function(newCssPath)
	{
		this.cssPath = newCssPath;
	}
	// }}}
	,
	// {{{ resetCssPath()
   	
	resetCssPath : function()
	{
		this.cssPath = this.defaultCssPath;
	}
	// }}}
	,
	// {{{ resetImagePath()
  	
	resetImagePath : function()
	{
		this.imagePath = this.defaultImagePath;
	}
	// }}}
	,
	// {{{ setImagePath()

	setImagePath : function(newImagePath)
	{
		this.imagePath = newImagePath;
	}
	// }}}
}



DHTMLSuite.globalVariableStorage = function()
{
	var menuBar_highlightedItems;	// Array of highlighted menu bar items
	this.menuBar_highlightedItems = new Array();
	
	var arrayDSObjects;	// Array of objects of class menuItem.
	var arrayOfDhtmlSuiteObjects;
	this.arrayDSObjects = new Array();
	this.arrayOfDhtmlSuiteObjects = this.arrayDSObjects;
	var ajaxObjects;
	this.ajaxObjects = new Array();
}

DHTMLSuite.globalVariableStorage.prototype = {
	
}




DHTMLSuite.common = function()
{
	var loadedCSSFiles;	// Array of loaded CSS files. Prevent same CSS file from being loaded twice.
	var cssCacheStatus;	// Css cache status
	var eventEls;
	var isOkToSelect;	// Boolean variable indicating if it's ok to make text selections
	
	this.okToSelect = true;
	this.cssCacheStatus = true;	// Caching of css files = on(Default)
	this.eventEls = new Array();	
}

DHTMLSuite.common.prototype = {
	
	// {{{ init()
  	
	init : function()
	{
		this.loadedCSSFiles = new Array();
	}	
	// }}}
	,
	// {{{ loadCSS()

	loadCSS : function(cssFile,prefixConfigPath)
	{
		if(!prefixConfigPath && prefixConfigPath!==false)prefixConfigPath=true;
		if(!this.loadedCSSFiles[cssFile]){
			this.loadedCSSFiles[cssFile] = true;
			var lt = document.createElement('LINK');
			if(!this.cssCacheStatus){
				if(cssFile.indexOf('?')>=0)cssFile = cssFile + '&'; else cssFile = cssFile + '?';
				cssFile = cssFile + 'rand='+ Math.random();	// To prevent caching
			}
			if(prefixConfigPath){
				lt.href = DHTMLSuite.configObj.cssPath + cssFile;
			}else{
				lt.href = cssFile;
			}
			lt.rel = 'stylesheet';
			lt.media = 'screen';
			lt.type = 'text/css';
			document.getElementsByTagName('HEAD')[0].appendChild(lt);				
		}
	}		
	// }}}
	,
	// {{{ __setTextSelOk()
	
	__setTextSelOk : function(okToSelect){
		this.okToSelect = okToSelect;
	}
	// }}}
	,
	// {{{ __setTextSelOk()
	
	__isTextSelOk : function()
	{
		return this.okToSelect;
	}
	// }}}	
	,	
	// {{{ setCssCacheStatus()

	setCssCacheStatus : function(cssCacheStatus)
	{		
	  this.cssCacheStatus = cssCacheStatus;
	}
	// }}}	
	,
	// {{{ getEl()
	
	getEl : function(elRef)
	{
		if(typeof elRef=='string'){
			if(document.getElementById(elRef))return document.getElementById(elRef);
			if(document.forms[elRef])return document.forms[elRef];
			if(document[elRef])return document[elRef];
			if(window[elRef])return window[elRef];
		}
		return elRef;	// Return original ref.
		
	}
	// }}}
	,
	// {{{ isArray()
	
	isArray : function(el)
	{
		if(el.constructor.toString().indexOf("Array") != -1)return true;
		return false;
	}
	// }}}
	,
	// {{{ getStyle()
	
	getStyle : function(el,property)
	{		
		el = this.getEl(el);
	    if (document.defaultView && document.defaultView.getComputedStyle) {
            var retVal = null;	            
            var comp = document.defaultView.getComputedStyle(el, '');
            if (comp){
                retVal = comp[property];
            }	            
            return el.style[property] || retVal;
	    }
		if (document.documentElement.currentStyle && DHTMLSuite.clientInfoObj.isMSIE){	
	        var retVal = null;
	        if(el.currentStyle)value = el.currentStyle[property];
	        return (el.style[property] || retVal);                    		
		}
		return el.style[property];				
	}
	// }}}
	,
	// {{{ getLeftPos()

	getLeftPos : function(el)
	{	 

		if(document.getBoxObjectFor){
			if(el.tagName!='INPUT' && el.tagName!='SELECT' && el.tagName!='TEXTAREA')return document.getBoxObjectFor(el).x
		}		 
		var returnValue = el.offsetLeft;
		while((el = el.offsetParent) != null){
			if(el.tagName!='HTML'){
				returnValue += el.offsetLeft;
				if(document.all)returnValue+=el.clientLeft;
			}
		}
		return returnValue;
	}
	// }}}
	,
	// {{{ getTopPos()

	getTopPos : function(el)
	{	

		if(document.getBoxObjectFor){
			if(el.tagName!='INPUT' && el.tagName!='SELECT' && el.tagName!='TEXTAREA')return document.getBoxObjectFor(el).y
		}
		
		var returnValue = el.offsetTop;
		while((el = el.offsetParent) != null){
			if(el.tagName!='HTML'){
				returnValue += (el.offsetTop - el.scrollTop);
				if(document.all)returnValue+=el.clientTop;
			}
		} 
		return returnValue;
	}
	// }}}
	,	
	// {{{ getCookie()

	getCookie : function(name) { 
	   var start = document.cookie.indexOf(name+"="); 
	   var len = start+name.length+1; 
	   if ((!start) && (name != document.cookie.substring(0,name.length))) return null; 
	   if (start == -1) return null; 
	   var end = document.cookie.indexOf(";",len); 
	   if (end == -1) end = document.cookie.length; 
	   return unescape(document.cookie.substring(len,end)); 
	} 	
	// }}}
	,	
	// {{{ setCookie()

	setCookie : function(name,value,expires,path,domain,secure) { 
		expires = expires * 60*60*24*1000;
		var today = new Date();
		var expires_date = new Date( today.getTime() + (expires) );
	    var cookieString = name + "=" +escape(value) + 
	       ( (expires) ? ";expires=" + expires_date.toGMTString() : "") + 
	       ( (path) ? ";path=" + path : "") + 
	       ( (domain) ? ";domain=" + domain : "") + 
	       ( (secure) ? ";secure" : ""); 
	    document.cookie = cookieString; 
	}
	// }}}
	,
	// {{{ deleteCookie()

	deleteCookie : function( name, path, domain ) 
	{
		if ( this.getCookie( name ) ) document.cookie = name + "=" +
		( ( path ) ? ";path=" + path : "") +
		( ( domain ) ? ";domain=" + domain : "" ) +
		";expires=Thu, 01-Jan-1970 00:00:01 GMT";
	}
	// }}}
	,
	// {{{ cancelEvent()

    	
	cancelEvent : function()
	{
		return false;
	}
	// }}}	
	,
	// {{{ addEvent()

	addEvent : function( obj, type, fn,suffix ) {
		if(!suffix)suffix = '';
		if ( obj.attachEvent ) {
			if ( typeof DHTMLSuite_funcs[type+fn+suffix] != 'function') {
				DHTMLSuite_funcs[type+fn+suffix] = function() {
					fn.apply(window.event.srcElement);
				};
				obj.attachEvent('on'+type, DHTMLSuite_funcs[type+fn+suffix] );
			}
			obj = null;
		} else {
			obj.addEventListener( type, fn, false );
		}
		this.__addEventEl(obj);
	}	

	// }}}	
	,	
	// {{{ removeEvent()
	
	removeEvent : function(obj,type,fn,suffix)
	{ 
		if ( obj.detachEvent ) {
		obj.detachEvent( 'on'+type, DHTMLSuite_funcs[type+fn+suffix] );
			DHTMLSuite_funcs[type+fn+suffix] = null;
			obj = null;
		} else {
			obj.removeEventListener( type, fn, false );
		}
	} 
	// }}}
	,
	// {{{ __clearMemoryGarbage()

    __clearMemoryGarbage : function()
    {

    	if(!DHTMLSuite.clientInfoObj.isMSIE)return;
   	
    	for(var no=0;no<DHTMLSuite.eventEls.length;no++){
    		try{
    			var el = DHTMLSuite.eventEls[no];
	    		el.onclick = null;
	    		el.onmousedown = null;
	    		el.onmousemove = null;
	    		el.onmouseout = null;
	    		el.onmouseover = null;
	    		el.onmouseup = null;
	    		el.onfocus = null;
	    		el.onblur = null;
	    		el.onkeydown = null;
	    		el.onkeypress = null;
	    		el.onkeyup = null;
	    		el.onselectstart = null;
	    		el.ondragstart = null;
	    		el.oncontextmenu = null;
	    		el.onscroll = null;   
	    		el = null; 		
    		}catch(e){
    		}
    	}    	
    	
    	for(var no in DHTMLSuite.variableStorage.arrayDSObjects){
    		DHTMLSuite.variableStorage.arrayDSObjects[no] = null;    			
    	}
    	
    	window.onbeforeunload = null;
    	window.onunload = null;
    	DHTMLSuite = null;
    }		
    // }}}
    ,
	// {{{ __addEventEl()
    
    __addEventEl : function(el)
    {
    	DHTMLSuite.eventEls[DHTMLSuite.eventEls.length] = el;    
    }
    // }}}
    ,
	// {{{ getSrcElement()
     
    getSrcElement : function(e)
    {
    	var el;
		if (e.target) el = e.target;
			else if (e.srcElement) el = e.srcElement;
			if (el.nodeType == 3) // defeat Safari bug
				el = el.parentNode;
		return el;	
    }	
    // }}}
    ,
	// {{{ getKeyFromEvent()
    
    getKeyFromEvent : function(e)
    {
		var code = this.getKeyCode(e);   	
    	return String.fromCharCode(code);
    }
    // }}}
    ,
	// {{{ getKeyCode()
     
    getKeyCode : function(e)
    {
    	if (e.keyCode) code = e.keyCode; else if (e.which) code = e.which;  
    	return code;
    }
    // }}}	
    ,
	// {{{ isObjectClicked()
    /**
     *
     *  Returns true if an object is clicked, false otherwise. This method will also return true if you clicked on a sub element
     *	@param Object obj = Reference to HTML element
     *	@param Event e = Event object
     *
     * 
     * @public
     */	      
	isObjectClicked : function(obj,e)
	{
		var src = this.getSrcElement(e);
		var string = src.tagName + '(' + src.className + ')';
		if(src==obj)return true;
		while(src.parentNode && src.tagName.toLowerCase()!='html'){
			src = src.parentNode;
			string = string + ',' + src.tagName + '(' + src.className + ')';
			if(src==obj)return true;			
		}		
		return false;		
	}
	// }}}
	,
	// {{{ getObjectByClassName()
    /**
     *
     *  Walks up the DOM tree and returns first found object with a given class name
     *
     *	@param Event e = Event object
     *	@param String className = CSS - Class name
     *
     * 
     * @public
     */	 	
	getObjectByClassName : function(e,className)
	{
		var src = this.getSrcElement(e);
		if(src.className==className)return src;
		while(src && src.tagName.toLowerCase()!='html'){
			src = src.parentNode;	
			if(src.className==className)return src;
		}
		return false;
	}
	//}}}
	,
	// {{{ getObjectByAttribute()
    /**
     *
     *  Walks up the DOM tree and returns first found object with a given attribute set
     *
     *	@param Event e = Event object
     *	@param String attribute = Custom attribute
     *
     * 
     * @public
     */	 	
	getObjectByAttribute : function(e,attribute)
	{
		var src = this.getSrcElement(e);
		var att = src.getAttribute(attribute);
		if(!att)att = src[attribute];
		if(att)return src;
		while(src && src.tagName.toLowerCase()!='html'){
			src = src.parentNode;	
			var att = src.getAttribute('attribute');
			if(!att)att = src[attribute];		
			if(att)return src;
		}
		return false;
	}
	//}}}
	,
	// {{{ getUniqueId()
    /**
     *
     *  Returns a unique numeric id
     *
     *
     * 
     * @public
     */		
	getUniqueId : function()
	{
		var no = Math.random() + '';
		no = no.replace('.','');		
		var no2 = Math.random() + '';
		no2 = no2.replace('.','');		
		return no + no2;		
	}
	// }}}
	,
	// {{{ getAssociativeArrayFromString()
    /**
     *
     *  Returns an associative array from a comma delimited string
     *  @param String propertyString - commaseparated string(example: "id:myid,title:My title,contentUrl:includes/tab.inc")
     *
     *	@return Associative array of keys + property value(example: key: id, value : myId)
     * @public
     */		
	getAssociativeArrayFromString : function(propertyString)
	{
		if(!propertyString)return;
		var retArray = new Array();
		var items = propertyString.split(/,/g);
		for(var no=0;no<items.length;no++){
			var tokens = items[no].split(/:/);	
			retArray[tokens[0]] = tokens[1];			
		}	
		return retArray;	
	}
	// }}}
	,
	// {{{ correctPng()
    /**
     *
     *  Correct png for old IE browsers
     *  @param Object el - Id or direct reference to image
     *
     * @public
     */	
	correctPng : function(el)
	{
		el = DHTMLSuite.commonObj.getEl(el);	
		var img = el;
		var width = img.width;
		var height = img.height;
		var html = '<span style="display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + img.src + '\',sizingMethod=\'scale\');width:' + width + ';height:' + height + '"></span>';
		img.outerHTML = html;	
					
	}
	,	
	// {{{ __evaluateJs()
    /**
     * Evaluate Javascript in the inserted content
     *
     * @private
     */	
	__evaluateJs : function(obj)
	{
		obj = this.getEl(obj);
		var scriptTags = obj.getElementsByTagName('SCRIPT');
		var string = '';
		var jsCode = '';
		for(var no=0;no<scriptTags.length;no++){	
			if(scriptTags[no].src){
		        var head = document.getElementsByTagName("head")[0];
		        var scriptObj = document.createElement("script");
		
		        scriptObj.setAttribute("type", "text/javascript");
		        scriptObj.setAttribute("src", scriptTags[no].src);  	
			}else{
				if(DHTMLSuite.clientInfoObj.isOpera){
					jsCode = jsCode + scriptTags[no].text + '\n';
				}
				else
					jsCode = jsCode + scriptTags[no].innerHTML;	
			}			
		}
		if(jsCode)this.__installScript(jsCode);
	}
	// }}}
	,
	// {{{ __installScript()
    /**
     *  "Installs" the content of a <script> tag.
     *
     * @private        
     */		
	__installScript : function ( script )
	{		
		try{
		    if (!script)
		        return;		
	        if (window.execScript){        	
	        	window.execScript(script)
	        }else if(window.jQuery && jQuery.browser.safari){ // safari detection in jQuery
	            window.setTimeout(script,0);
	        }else{        	
	            window.setTimeout( script, 0 );
	        } 
		}catch(e){
			
		}
	}	
	// }}}
	,
	// {{{ __evaluateCss()
    /**
     *  Evaluates css
     *
     * @private        
     */	
	__evaluateCss : function(obj)
	{
		obj = this.getEl(obj);
		var cssTags = obj.getElementsByTagName('STYLE');
		var head = document.getElementsByTagName('HEAD')[0];
		for(var no=0;no<cssTags.length;no++){
			head.appendChild(cssTags[no]);
		}	
	}	
}

/************************************************************************************************************
*	Client info class
*
*	Created:			August, 18th, 2006
* 	Update log:
*
************************************************************************************************************/

/**
* @constructor
* @class Purpose of class: Provide browser information to the classes below. Instead of checking for
*		 browser versions and browser types in the classes below, they should check this
*		 easily by referncing properties in the class below. An object("DHTMLSuite.clientInfoObj") of this 
*		 class will always be accessible to the other classes. * @version 1.0
* @author	Alf Magne Kalleland(www.dhtmlgoodies.com)
**/


DHTMLSuite.clientInfo = function()
{
	var browser;			// Complete user agent information
	
	var isOpera;			// Is the browser "Opera"
	var isMSIE;				// Is the browser "Internet Explorer"
	var isOldMSIE;			// Is this browser and older version of Internet Explorer ( by older, we refer to version 6.0 or lower)	
	var isFirefox;			// Is the browser "Firefox"
	var navigatorVersion;	// Browser version
	var isOldMSIE;
}
	
DHTMLSuite.clientInfo.prototype = {
	
	// {{{ init()
    /**
     *  This method initializes the clientInfo object. This is done automatically when you create a widget object.
     *
     * @public
     */	    	
	init : function()
	{
		this.browser = navigator.userAgent;	
		this.isOpera = (this.browser.toLowerCase().indexOf('opera')>=0)?true:false;
		this.isFirefox = (this.browser.toLowerCase().indexOf('firefox')>=0)?true:false;
		this.isMSIE = (this.browser.toLowerCase().indexOf('msie')>=0)?true:false;
		this.isOldMSIE = (this.browser.toLowerCase().match(/msie\s[0-6]/gi))?true:false;
		this.isSafari = (this.browser.toLowerCase().indexOf('safari')>=0)?true:false;
		this.navigatorVersion = navigator.appVersion.replace(/.*?MSIE\s(\d\.\d).*/g,'$1')/1;
		this.isOldMSIE = (this.isMSIE&&this.navigatorVersion<7)?true:false;
	}	
	// }}}		
	,
	// {{{ getBrowserWidth()
    /**
     *
	 *
     *  This method returns the width of the browser window(i.e. inner width)
     *
     * 
     * @public
     */		
	getBrowserWidth : function()
	{
		if(self.innerWidth)return self.innerWidth;
		return document.documentElement.offsetWidth;		
	}
	// }}}
	,
	// {{{ getBrowserHeight()
    /**
     *
	 *
     *  This method returns the height of the browser window(i.e. inner height)
     *
     * 
     * @public
     */		
	getBrowserHeight : function()
	{
		if(self.innerHeight)return self.innerHeight;
		return document.documentElement.offsetHeight;
	}
}



/************************************************************************************************************
*	DOM query class 
*
*	Created:			August, 31th, 2006
*
* 	Update log:
*
************************************************************************************************************/

/**
* @constructor
* @class Purpose of class:	Gives you a set of methods for querying elements on a webpage. When an object
*		 of this class has been created, the method will also be available via the document object.
*		 Example: var elements = document.getElementsByClassName('myClass');
* @version 1.0
* @author	Alf Magne Kalleland(www.dhtmlgoodies.com)
**/

DHTMLSuite.domQuery = function()
{
	// Make methods of this class a member of the document object. 
	document.getElementsByClassName = this.getElementsByClassName;
	document.getElementsByAttribute = this.getElementsByAttribute;
}



	
DHTMLSuite.domQuery.prototype = {
}




/************************************************************************************************************
*	Table widget class
*
*	Created:		August, 18th, 2006
*	Purpose of class:	Make HTML tables sortable
*			Apply application look to the table
*			Create one object for each HTML table.
*
*	CSS used:		listagem.css
*	images used:	arrow_up.gif
* 			arrow_down.gif
*
* 	Update log:
*
************************************************************************************************************/

/**

* @version 1.0
* @author	Alf Magne Kalleland(www.dhtmlgoodies.com)
**/

DHTMLSuite.tableWidget=function(){
	var tableWidget_okToSort;		
	// Variable indicating if it's ok to sort. This variable is "false" when sorting is in progress
	var activeColumn;			
	// Reference to active column, i.e. column currently beeing sorted	
	var idOfTable;				
	// Id of table, i.e. the <table> tag
	var tableObj;				
	// Reference to <table> tag.
	var widthOfTable;			
	// Width of table	(Used in the CSS)
	var heightOfTable; 			
	// Height of table	(Used in the CSS)
	var columnSortArray;			
	// Array of how table columns should be sorted
	var layoutCSS;				
	// Name of CSS file for the table widget.
	var noCssLayout;			
	// true or false, indicating if the table should have layout or not, if not, it would be a plain sortable table.
	var serversideSort;			
	// true or false, true if the widget is sorted on the server.
	var serversideSortAscending;
	var tableCurrentlySortedBy;
	var serversideSortFileName;		
	// Name of file on server to send request to when table data should be sorted
	var serversideSortNumberOfRows;		
	// Number of rows to receive from the server
	var serversideSortCurrentStartIndex;	
	// Index of first row in the dataset, i.e. if you move to next page, this value will be incremented
	var serversideSortExtraSearchCriterias;	
	// Extra param to send to the server, example: &firstname=Alf&lastname=Kalleland
	var pageHandler;			
	// Object of class DHTMLSuite.tableWidgetPageHandler
	var rowClickCallBackFunction;		
	// Row click call back function.
	var objectIndex;			
	// Index of this object in the DHTMLSuite.variableStorage.arrayDSObjects array
	
	this.serversideSort=false;		
	// Default value for serversideSort(items are sorted in the client)
	this.serversideSortAscending=true;	
	// Current sort ( ascending or descending)
	this.tableCurrentlySortedBy=false;
	this.serversideSortFileName=false;
	this.serversideSortCurrentStartIndex=0;
	this.serversideSortExtraSearchCriterias='';
	this.rowClickCallBackFunction=false;
	this.setRowDblClickCallBackFunction=false;
	try{
		if(!standardObjectsCreated)DHTMLSuite.createStandardObjects();	
		// This line starts all the init methods
	}catch(e){
		alert('You need to include the dhtmlSuite-common.js file');
	}

	this.objectIndex=DHTMLSuite.variableStorage.arrayDSObjects.length;
	DHTMLSuite.variableStorage.arrayDSObjects[this.objectIndex]=this;
}

DHTMLSuite.tableWidget.prototype={	
	/**
	* Public method used to initialize the table widget script. First use the set methods to configure the script, then
	* call the init method.
	**/
	
	// {{{ init()
	 /**
	  *
	 *	Initializes the table widget object
	 *
	 *
	 *@public
	  */	 	
	init:function()
	{	
		this.tableWidget_okToSort=true;
		this.activeColumn=false;
		if(!this.layoutCSS)this.layoutCSS='listagem.css';
		DHTMLSuite.commonObj.loadCSS(this.layoutCSS);
		this.__initTableWidget();
	}
	
	// }}}	
	,
	
	// {{{ setLayoutCss()
	 /**
	  *
	 * This function updates name of CSS file. This method should be called before init().
	  *
	 *@param String newCssFile=(File name of CSS file, not path)
	 *
	 *@public
	  */	
	setLayoutCss:function(newCssFile)
	{
		this.layoutCSS=newCSSFile;		
	}
	
	// }}}	
	,	
	
	// 	
	// {{{ setRowClickCallBackFunction()
	 /**
	  *
	 * This method specifies call back function to be called when a row is clicked. A reference to that row is sent as argument to this function
	  *
	 *@param String rowClickCallBackFunction=(Row click-call back function)
	 *
	 *@public
	  */	
	setRowClickCallBack:function(rowClickCallBackFunction)
	{
		this.rowClickCallBackFunction=rowClickCallBackFunction;		
	}
	
	// }}}	
	,
	
	// 	
	// {{{ setRowDblClickCallBackFunction()
	 /**
	  *
	 * This method specifies call back function to be called when a row is double clicked. A reference to that row is sent as argument to this function
	  *
	 *@param String setRowDblClickCallBackFunction=(Row click-call back function)
	 *
	 *@public 
	  */	
	setRowDblClickCallBack:function(setRowDblClickCallBackFunction)
	{
		this.setRowDblClickCallBackFunction=setRowDblClickCallBackFunction;		
	}
	
	// }}}	
	,	
	
	// {{{ setServerSideSort()
	 /**
	  *
	 * This method is used to specify if you want to your tables to be sorted on the server or not.
	  *
	 *@param Boolean serversideSort=Sort items on the server? (true=yes, false=no). 
	 *
	 *@public
	  */	
	setServerSideSort:function(serversideSort)
	{
		this.serversideSort=serversideSort;		
	}
	
	// }}}	
	,	
	
	// {{{ setServersideSearchCriterias()
	 /**
	  *
	 * This method is used to add extra params to the search url sent to the server.
	  *
	 *@param String serversideSortExtraSearchCriterias=String added to the url, example: "&firstname=John&lastname=Doe". This can be used in the sql query on the server.
	 *
	 *@public
	  */	
	setServersideSearchCriterias:function(serversideSortExtraSearchCriterias)
	{
		this.serversideSortExtraSearchCriterias=serversideSortExtraSearchCriterias;		
	}
	
	// }}}	
	,	
	
	// {{{ getServersideSortNumberOfRows()
	 /**
	  *
	 * Return numer of rows per page.
	  *
	 *@return Integer serversideSort=Number of rows
	 *
	 *@public
	  */	
	getServersideSortNumberOfRows:function(serversideSort)
	{
		return this.serversideSortNumberOfRows;	
	}
	
	// }}}	
	,	
	
	// {{{ setServersideSortNumberOfRows()
	 /**
	  *
	 * Specify how many records to receive from the server ( server side sort )
	  *
	 *@param Integer serversideSortNumberOfRows=Number of rows
	 *
	 *@public
	  */	
	setServersideSortNumberOfRows:function(serversideSortNumberOfRows)
	{
		this.serversideSortNumberOfRows=serversideSortNumberOfRows;		
	}
	
	// }}}	
	,	
	
	// {{{ setServersideSortFileName()
	 /**
	  *
	 * This method is used to specify which file to send the ajax request to when data should be sorted. (i.e. sort items on server instead of client).
	  *
	 *@param String serversideSortFileName=Path to file on server. This file will receive the request, parse it and send back new table data.
	 *
	 *@public
	  */	
	setServersideSortFileName:function(serversideSortFileName)
	{
		this.serversideSortFileName=serversideSortFileName;		
	}
	
	// }}}	
	,
	/* Start public methods */

	
	// {{{ setNoCssLayout()
	 /**
	  *
	 * No CSS layout
	  *
	 *
	 *@public
	  */	
	 setNoCssLayout:function()
	{
		this.noCssLayout=true;	
	}	
	
	// }}}	
	,	
	
	// {{{ sortTableByColumn()
	 /**
	  *
	 * This method sorts a table by a column
	  *	You can call this method after the call to init if you want to sort the table by a column when the table is beeing displayed.
	  *
	 *@param Int columnIndex=Column to sort by (0=first column)
	 *@param String howToSort How to sort the table ("ascending" or "descending"
	 *
	 *@public
	  */	
	sortTableByColumn:function(columnIndex,howToSort)
	{
		if(!howToSort)howToSort='ascending';
		var tableObj=document.getElementById(this.idOfTable);
		var firstRow=tableObj.rows[0];
		var tds=firstRow.cells;
		if(tds[columnIndex]&&this.columnSortArray[columnIndex]){
			this.__sortTable(tds[columnIndex],howToSort);
		}	
	}	
	
	// }}}	
	,	
	
	// {{{ setTableId()
	 /**
	  *
	 * Set id of table, i.e. the id of the <table> tag you want to apply the table widget to
	  *
	 *@param String idOfTable=Id of table
	 *
	 *@public
	  */	
	setTableId:function(idOfTable)
	{
		this.idOfTable=idOfTable;	
		try{
			this.tableObj=document.getElementById(idOfTable);
		}catch(e){
			
		}	
	}
	
	// }}}	
	,
	
	
	
	// {{{ setTableWidth()
	 /**
	 *
	 * Set width of table
	  *
	 *@param Mixed width=(string if percentage width, integer if numeric/pixel width)
	 *
	 *@public
	  */	
	setTableWidth:function(width)
	{
		this.widthOfTable=width;		
	}
	
	// }}}	
	,	
	
	// {{{ setTableHeight()
	 /**
	 *
	 * Set height of table
	  *
	 *@param Mixed height=(string if percentage height, integer if numeric/pixel height)
	 *
	 *@public
	  */	
	setTableHeight:function(height)
	{
		this.heightOfTable=height;
	}
	
	// }}}	
	,	
	
	// {{{ setColumnSort()
	 /**
	  *
	 * How to sort the table
	  *
	 *@param Array columnSortArray=How to sort the columns in the table(An array of the items 'N','S' or false)
	 *
	 *@public
	  */	
	setColumnSort:function(columnSortArray)
	{
		this.columnSortArray=columnSortArray;	
	}
	
	// }}}	
	,	
	
	
	// {{{ addNewRow()
	 /**
	 * Adds a new row to the table dynamically
	  *
	 *@param Array cellContent=Array of strings-cell content
	 *
	 *@public
	  */	
	addNewRow:function(cellContent)
	{
		var tObj=document.getElementById(this.idOfTable);
		var tb=tObj.getElementsByTagName('TBODY')[0];
		
		var row=tb.insertRow(-1);
		for(var no=0;no<cellContent.length;no++){
			var cell=row.insertCell(-1);
			cell.innerHTML=cellContent[no];
		}
		this.__parseDataRows(tObj);
	
	}
	
	// }}}	
	,
	
	
	
	// {{{ addNewColumn()
	 /**
	 * Adds a new row to the table dynamically
	  *
	 *@param Array columnContent=Array of strings-content of new cells.
	 *@param String headerText=Text-column header
	 *@param mixed sortMethod=How to sort the new column('N','S' or false)
	 *
	 *@public
	  */	
	addNewColumn:function(columnContent,headerText,sortMethod)
	{
		this.columnSortArray[this.columnSortArray.length]=sortMethod;
		var tableObj=document.getElementById(this.idOfTable);	
		// Reference to the <table>
		var tbody=tableObj.getElementsByTagName('TBODY')[0];	
		// Reference to the <tbody>	
		var thead=tableObj.getElementsByTagName('THEAD')[0];	
		// Reference to the <tbody>	
		
		var bodyRows=tbody.rows;	
		// Reference to all the <tr> inside the <tbody> tag
		var headerRows=thead.rows;	
		// Reference to all <tr> inside <thead>
		
		cellIndexSubtract=1;	
		// Firefox have a small cell at the right of each row which means that the new column should not be the last one, but second to last.
		if(DHTMLSuite.clientInfoObj.isMSIE)cellIndexSubtract=0;	
		// Browser does not have this cell at the right
		
		// Add new header cell	
		var headerCell=headerRows[0].insertCell(headerRows[0].cells.length-cellIndexSubtract);
		if(!this.noCssLayout)headerCell.className='DHTMLSuite_tableWidget_headerCell';
		headerCell.onselectstart=function(){ return false; };
		DHTMLSuite.commonObj.__addEventEl(headerCell);
		headerCell.innerHTML=headerText;
		if(sortMethod){
			this.__parseHeaderCell(headerCell);		
		}else{
			headerCell.style.cursor='default';	
		}	
		
		// Setting width of header cells. The last cell shouldn't have any right border
		headerRows[0].cells[headerRows[0].cells.length-1].style.borderRightWidth='0px';
		headerRows[0].cells[headerRows[0].cells.length-2].style.borderRightWidth='1px';	
		
		// Add rows to the table	
		for(var no=0;no<columnContent.length;no++){
			var dataCell=bodyRows[no].insertCell(bodyRows[no].cells.length-cellIndexSubtract);
			dataCell.innerHTML=columnContent[no];		
		}	
		this.__parseDataRows(tableObj);			
	}
	
	// }}}	
	,
	
	// {{{ setPageHandler()
	 /**
	 * Specify a reference to a page handler for this widget (in case of server side sort)
	  *
	 *@param tableWidgetPageHandler ref=Page handler reference
	 *
	 *@public
	  */	
	setPageHandler:function(ref)
	{
		this.pageHandler=ref;
	}
	,
	
	/* START PRIVATE METHODS */
	
	
	
	// {{{ __handleCallBackFromEvent()
	 /**
	 * Handle call back events for the table widget ( this method is used to find the element triggering a callback function)
	  *
	 *@param Event e=Event object-we will use this to find the element triggering the vent
	 *@param String action=What kind of callback
	 *
	 *@private
	  */	
	__handleCallBackFromEvent:function(e,action)
	{
		if(document.all)e=event;
		var src=DHTMLSuite.commonObj.getSrcElement(e);	
		if((action=='rowClick'||action=='rowDblClick')&&src.tagName.toLowerCase()!='tr'){
			while(src.tagName.toLowerCase()!='tr')src=src.parentNode;
		}	
		this.__createCallBackJavascriptString(action,src);
	
	}
	
	// }}}
	,
	
	// {{{ __createCallBackJavascriptString()
	 /**
	 * Handle call back events for the table widget
	  *
	 *@param String action=Which call back, example "rowClick"
	 *@param Object el=Reference to the element triggering the event.
	 *
	 *@private
	  */	
	__createCallBackJavascriptString:function(action,el)
	{
	var callbackString="";
	switch(action){
		case "rowClick":
		if(!this.rowClickCallBackFunction)return;
		callbackString=this.rowClickCallBackFunction+'(el)';
		break;	
		case "rowDblClick":
		if(!this.setRowDblClickCallBackFunction)return;
		callbackString=this.setRowDblClickCallBackFunction+'(el)';
		break;
	}	
	this.__executeCallBack(callbackString,el);	
	}
	
	// }}}
	,
	
	// {{{ __executeCallBack()
	 /**
	 * Execute a javascript call back string
	  *
	 *@param String callbackString=Javascript code
	 *@param Object el=Reference to the element triggering the event.
	 *
	 *@private
	  */	
	__executeCallBack:function(callbackString,el)
	{
	if(!callbackString)return;
	try{
		eval(callbackString);
	}catch(e){
		
	}	
	}	
	
	// }}}
	,
	
	// {{{ __parseHeaderCell()
	 /**
	 * Parses a header cell, i.e. add mouse events, and a arrow image to it.
	  *
	 *@param Object cellRef=Reference to <TD>
	 *
	 *@private
	  */	
	__parseHeaderCell:function(cellRef)
	{
	if(!this.noCssLayout){
		cellRef.onmouseover=this.__highlightTableHeader;
		cellRef.onmouseout= this.__removeHighlightEffectFromTableHeader;
		cellRef.onmousedown=this.__mousedownOnTableHeader;	
		cellRef.onmouseup=this.__highlightTableHeader;		
	}else{
		cellRef.style.cursor='pointer';	
	// No CSS layout -> just set cursor to pointer/hand.
	}
	
	var refToThis=this;	
	// It doesn't work with "this" on the line below, so we create a variable refering to "this".	
	cellRef.onclick=function(){ refToThis.__sortTable(this); };	
	DHTMLSuite.commonObj.__addEventEl(cellRef);

	var img=document.createElement('IMG');
	img.src=DHTMLSuite.configObj.imagePath+'listagem/arrow_up.gif';
	cellRef.appendChild(img);	
	img.style.visibility='hidden';
	}
	
	// }}}	
	,
	
	
	// {{{ __parseDataRows()
	 /**
	 * Parses rows in a table, i.e. add events and align cells.
	  *
	 *@param Object parentObj=Reference to <table>
	 *
	 *@private
	  */	
	__parseDataRows:function(parentObj)
	{
	var ind=this.objectIndex;
	
	// Loop through rows and assign mouseover and mouse out events+right align numeric cells.
	for(var no=1;no<parentObj.rows.length;no++){
		if(!this.noCssLayout){
		parentObj.rows[no].onmouseover=this.__highlightTableRow;
		parentObj.rows[no].onmouseout=this.__removeHighlightEffectFromTableRow;
		}
		parentObj.rows[no].onclick=function(e){ DHTMLSuite.variableStorage.arrayDSObjects[ind].__handleCallBackFromEvent(e,'rowClick'); };
		parentObj.rows[no].ondblclick=function(e){ DHTMLSuite.variableStorage.arrayDSObjects[ind].__handleCallBackFromEvent(e,'rowDblClick'); };
		DHTMLSuite.commonObj.__addEventEl(parentObj.rows[no]);		
		for(var no2=0;no2<this.columnSortArray.length;no2++){	/* Right align numeric cells */
		try{
			if(this.columnSortArray[no2]&&this.columnSortArray[no2]=='N')parentObj.rows[no].cells[no2].style.textAlign='right';
		}catch(e){
			alert('Error in __parseDataRows method-row: '+no+', column:'+no2);
		}		
		}
	}	
	
	// Right align header cells for numeric data
	for(var no2=0;no2<this.columnSortArray.length;no2++){	/* Right align numeric cells */
		if(this.columnSortArray[no2]&&this.columnSortArray[no2]=='N')parentObj.rows[0].cells[no2].style.textAlign='right';
	}	
	}
	
	// }}}	
	,
	
	// {{{ __initTableWidget()
	 /**
	 * Initializes the table widget script. This method formats the table and add events to the header cells.
	  *
	 *
	 *@private
	  */	
	__initTableWidget:function()
	{	
	if(!this.columnSortArray)this.columnSortArray=new Array();
	this.widthOfTable=this.widthOfTable+'';
	this.heightOfTable=this.heightOfTable+'';
	var obj=document.getElementById(this.idOfTable);
	obj.parentNode.className='DHTMLSuite_widget_tableDiv';	
	if(navigator.userAgent.toLowerCase().indexOf('safari')==-1&&!this.noCssLayout){
		if(!DHTMLSuite.clientInfoObj.isMSIE)
		obj.parentNode.style.overflow='hidden';
		else {
		obj.parentNode.style.overflowX='hidden';
		obj.parentNode.style.overflowY='scroll';
		}
	}	
	if(!this.noCssLayout){
		if(this.widthOfTable.indexOf('%')>=0){		
		obj.style.width='100%';
		obj.parentNode.style.width=this.widthOfTable;		
		}else{
		obj.style.width=this.widthOfTable+'px';
		obj.parentNode.style.width=this.widthOfTable+'px';
		}	
		if(this.heightOfTable.indexOf('%')>=0){
		obj.parentNode.style.height=this.heightOfTable;		
		}else{
		obj.parentNode.style.height=this.heightOfTable+'px';
		}
	}
	if(!DHTMLSuite.clientInfoObj.isMSIE){
		this.__addEndCol(obj);
	}else{
		obj.style.cssText='width:expression(this.parentNode.clientWidth)';
	}	
	
	obj.cellSpacing=0;
	obj.cellPadding=0;
	if(!this.noCssLayout)obj.className='DHTMLSuite_tableWidget';
	var tHead=obj.getElementsByTagName('THEAD')[0];
	var cells=tHead.getElementsByTagName('TD');
	
	var tBody=obj.getElementsByTagName('TBODY')[0];
	tBody.className='DHTMLSuite_scrollingContent';	
		
	for(var no=0;no<cells.length;no++){
		if(!this.noCssLayout)cells[no].className='DHTMLSuite_tableWidget_headerCell';
		cells[no].onselectstart=function(){ return false; };
		DHTMLSuite.commonObj.__addEventEl(cells[no]);
		if(no==cells.length-1&&!this.noCssLayout){
		cells[no].style.borderRightWidth='0px';	
		}
		if(this.columnSortArray[no]){
		this.__parseHeaderCell(cells[no]);		
		}else{
		cells[no].style.cursor='default';	
		}		
	}		
	if(!this.noCssLayout){
		var tBody=obj.getElementsByTagName('TBODY')[0];
		if(document.all&&navigator.userAgent.indexOf('Opera')<0){
		tBody.className='DHTMLSuite_scrollingContent';
		tBody.style.display='block';		
		}else{
		if(!this.noCssLayout)tBody.className='DHTMLSuite_scrollingContent';
		tBody.style.height=(obj.parentNode.clientHeight-tHead.offsetHeight)+'px';
		if(navigator.userAgent.indexOf('Opera')>=0){
			obj.parentNode.style.overflow='auto';
		}
		}
	}	
	this.__parseDataRows(obj);
	var ind=this.objectIndex;		
	}	
	
	// }}}	
	,
	
	
	// {{{ __addEndCol()
	 /**
	 * Adds a small empty cell at the right of the header row. This is done in order to make the table look pretty when the scrollbar appears.
	  *
	 *@param Object obj=Reference to <table>
	 *
	 *@private
	  */	
	__addEndCol:function(obj)
	{	
	var rows=obj.getElementsByTagName('TR');
	for(var no=0;no<rows.length;no++){
		var cell=rows[no].insertCell(rows[no].cells.length);
		cell.innerHTML='<img src="'+DHTMLSuite.configObj.imagePath+'listagem/transparent.gif" width="10" style="visibility:hidden">';
		cell.style.width='13px';
		cell.width='13';
		cell.style.overflow='hidden';
	}	
	
	}	
	
	// }}}
	,	
	
	// {{{ __highlightTableHeader()
	 /**
	 * Mouse over event: Highlights header cell on mouse over, i.e. applies an orange line at the top.
	  *
	 *
	 *@private
	  */	
	__highlightTableHeader:function()
	{
	
	// Here, "this" is a reference to the HTML tag triggering this event and not the table widget object
	this.className='DHTMLSuite_tableWigdet_headerCellOver';
	if(document.all){	
	// I.E fix for "jumping" headings
		var divObj=this.parentNode.parentNode.parentNode.parentNode;
		this.parentNode.style.top=divObj.scrollTop+'px';	
	}	
	}
	
	// }}}	
	,	
	
	// {{{ __removeHighlightEffectFromTableHeader()
	 /**
	 * Mouse out event: Remove the orange line at the top of header cells when the mouse moves away from the cell.
	  *
	 *
	 *@private
	  */	
	__removeHighlightEffectFromTableHeader:function()
	{
	this.className='DHTMLSuite_tableWidget_headerCell';	
	}	
	
	// }}}
	,	
	
	// {{{ __mousedownOnTableHeader()
	 /**
	 * Mouse down event header cells. It changes the color of the header from light gray to dark gray.
	 *
	 *@private
	  */	
	__mousedownOnTableHeader:function()
	{
	this.className='DHTMLSuite_tableWigdet_headerCellDown';
	if(document.all){	
	// I.E fix for "jumping" headings
		var divObj=this.parentNode.parentNode.parentNode.parentNode;
		this.parentNode.style.top=divObj.scrollTop+'px';
	}	
	}
	
	// }}}
	,
	
	// {{{ __sortNumeric()
	 /**
	 * Sort the table numerically
	 *	ps! If you know that your tables always contains valid numbers(i.e. digits or decimal numbers like 7 and 7.5), 
	*	then you can remove everything except return a/1-b/1; from this function. By removing these lines, the sort
	 *	process be faster.	  
	  *
	 *@param String a=first number to compare
	 *@param String b=second number to compare
	 *
	 *@private
	  */	
	__sortNumeric:function(a,b){
	
	// changing commas(,)to periods(.)
	a=a.replace(/,/,'.');
	b=b.replace(/,/,'.');
	
	// Remove non digit characters-example changing "DHTML12.5" to "12.5"
	a=a.replace(/[^\d\.\/]/g,'');
	b=b.replace(/[^\d\.\/]/g,'');
	
	// Dealing with fractions(example: changing 4/5 to 0.8)
	if(a.indexOf('/')>=0)a=eval(a);
	if(b.indexOf('/')>=0)b=eval(b);
	return a/1-b/1;
	}	
	
	// }}}
	,
	
	
	// {{{ __sortString()
	 /**
	 * Sort the table letterically
	  *
	 *@param String a=first number to compare
	 *@param String b=second number to compare
	 *
	 *@private
	  */	
	__sortString:function(a, b){	
	  if ( a.toUpperCase()< b.toUpperCase())return -1;
	  if ( a.toUpperCase()> b.toUpperCase())return 1;
	  return 0;
	}
	
	// }}}
	,
	
	// {{{ __parseDataContentFromServer()
	 /**
	 *This method parses data content from server and calls the __fillDataRow method with parsed data as argument.
	  *
	 *
	 *@private
	  */	
	__parseDataContentFromServer:function(ajaxIndex)
	{
	var content=DHTMLSuite.variableStorage.ajaxObjects[ajaxIndex].response;
	if(content.indexOf('|||')==-1&&content.indexOf('###')==-1){
		alert('Error in data from server\n'+content);
		return;
	}	
	this.__clearDataRows();	
	// Clear existing data
	var rows=content.split('|||');	
	// Create an array of each row
	for(var no=0;no<rows.length;no++){
		var items=rows[no].split('###');
		if(items.length>1)this.__fillDataRow(items);		
	}	
	this.__parseDataRows(this.tableObj);
	}
	
	
	// }}}
	,
	
	// {{{ __clearDataRows()
	 /**
	 *This method clear all data from the table(except header cells).
	  *
	 *
	 *@private
	  */	
	__clearDataRows:function()
	{
	if(!this.tableObj)this.tableObj=document.getElementById(this.idOfTable);
	while(this.tableObj.rows.length>1){
		DHTMLSuite.discardElement(this.tableObj.rows[this.tableObj.rows.length-1]);
	}
	}	
	
	// }}
	,
	
	// {{{ __fillDataRow()
	 /**
	 *Adds a new row of data to the table.
	  *
	 *@param Array data=Array of data
	 *
	 *@private
	  */	
	__fillDataRow:function(data)
	{
	if(!this.tableObj)this.tableObj=document.getElementById(this.idOfTable);
	var tbody=this.tableObj.getElementsByTagName('TBODY')[0];
	var row=tbody.insertRow(-1);
	for(var no=0;no<data.length;no++){
		var cell=row.insertCell(no);
		cell.innerHTML=data[no];
	}	
	}
	
	// }}}
	,
	
	// {{{ updateTableHeader()
	 /**
	 *Updates the header of the table,i.e. shows the correct arrow. This is a method you call if you're sorting the table on the server
	  *
	  *
	 *@param Integer columnIndex=Index of column the table is currently sorted by
	 *@param String direction=How the table is sorted(ascending or descending)
	 *
	 *@public
	  */	
	updateTableHeader:function(columnIndex,direction)
	{
	var tableObj=document.getElementById(this.idOfTable);
	var firstRow=tableObj.rows[0];
	var tds=firstRow.cells;
	var tdObj=tds[columnIndex];
	tdObj.setAttribute('direction',direction);
	tdObj.direction=direction;
	var sortBy=tdObj.getAttribute('sortBy');
	if(!sortBy)sortBy=tdObj.sortBy;
	this.tableCurrentlySortedBy=sortBy;
	this.__updateSortArrow(tdObj,direction);	
	}
	
	// }}}
	,
	
	// {{{ reloadDataFromServer()
	 /**
	 *Simply reload data from server. 
	  *
	 *
	 *@public
	  */		
	reloadDataFromServer:function()
	{
	this.__getItemsFromServer();
	if(this.pageHandler)this.pageHandler.__resetActivePageNumber();		
	}
	
	// }}}
	,
	
	// {{{ resetServersideSortCurrentStartIndex()
	 /**
	 *Reset current server side sort start index
	 *It may be useful to call this method and then the reloadDataFromServer()
	 *method in case you want to reload data from the server starting with the first row in the record set.
	  *
	 *
	 *@public
	  */		
	resetServersideSortCurrentStartIndex:function()
	{
	this.serversideSortCurrentStartIndex=0;	
	}
	
	// }}}
	,	
	
	// {{{ __updateSortArrow()
	 /**
	 *Sort table-This method is called when someone clicks on the header of one of the sortable columns
	  *
	 *@param Object obj=reference to header cell
	 *@param String direction=How the table is sorted(ascending or descending)
	 *
	 *@private
	  */	
	__updateSortArrow:function(obj,direction)
	{
	var images=obj.getElementsByTagName('IMG');	
	// Array of the images inside the clicked header cell(i.e. arrow up and down)
	if(direction=='descending'){	
	// Setting visibility of arrow image based on sort(ascending or descending)
		images[0].src=images[0].src.replace('arrow_up','arrow_down');
		images[0].style.visibility='visible';
	}else{
		images[0].src=images[0].src.replace('arrow_down','arrow_up');
		images[0].style.visibility='visible';
	}	
	if(this.activeColumn&&this.activeColumn!=obj){
		var images=this.activeColumn.getElementsByTagName('IMG');
		images[0].style.visibility='hidden';
		this.activeColumn.removeAttribute('direction');		
	}	
	
	this.activeColumn=obj;	
	// Setting this.activeColumn to the cell trigger this method 

	}
	
	// }}}
	,
	
	// {{{ __getParsedCallbackString()
	 /**
	 *__getParsedCallbackString-return call back javascript to execute. 
	  *
	 *@param String functionName=Name of call back function
	 *
	 *@private
	  */	
	__getParsedCallbackString:function(functionName)
	{
	var objIndex=this.objectIndex;	
	if(!functionName)
		functionName='true';
	else
		functionName=functionName+'(DHTMLSuite.variableStorage.arrayDSObjects['+objIndex+'])';	
	return functionName;	
	}	
	
	// }}}
	,
	
	// {{{ __getItemsFromServer()
	 /**
	 *Send ajax request to the server in order to get new data.
	  *
	 *@param String callbackFunction=Name of eventual call back function to execute when new content has been received.
	 *
	 *@private
	  */	
	__getItemsFromServer:function(callbackFunction)  
	{
	callbackFunction=this.__getParsedCallbackString(callbackFunction);		
	var objIndex=this.objectIndex;	
	// batur :: start
	var sembol = '?';	
	if ( this.serversideSortFileName.indexOf('?') > 0 )
		 sembol = '&';		
	// batur :: end
	var url=this.serversideSortFileName + sembol + 'sortBy='+this.tableCurrentlySortedBy+'&numberOfRows='+this.serversideSortNumberOfRows+'&sortAscending='+this.serversideSortAscending+'&startIndex='+this.serversideSortCurrentStartIndex+this.serversideSortExtraSearchCriterias;
	var index=DHTMLSuite.variableStorage.ajaxObjects.length;	
	try{
		DHTMLSuite.variableStorage.ajaxObjects[index]=new sack();
	}catch(e){	
	// Unable to create ajax object-send alert message and return from sort method.
		alert('Unable to create ajax object. Please make sure that the sack js file is included on your page(js/ajax.js)');	
		return;
	}
	DHTMLSuite.variableStorage.ajaxObjects[index].requestFile=url;	
	// Specifying which file to get
	DHTMLSuite.variableStorage.ajaxObjects[index].onCompletion=function(){ DHTMLSuite.variableStorage.arrayDSObjects[objIndex].__parseDataContentFromServer(index);eval(callbackFunction)};	
	// Specify function that will be executed after file has been found
	DHTMLSuite.variableStorage.ajaxObjects[index].runAJAX();	
	// Execute AJAX function	
	}	
	
	// }}}
	,	
	
	// {{{ __sortTable()
	 /**
	 *Sort table-This method is called when someone clicks on the header of one of the sortable columns
	  *
	 *@param Object obj=reference to header cell triggering the sortTable method
	 *
	 *@private
	  */	
	__sortTable:function(obj,howToSort)
	{
	
	// "this" is a reference to the table widget obj
	
	// "obj" is a reference to the header cell triggering the sortTable method.
	
	
	// Server side sort ?
	if(this.serversideSort){
		if(!this.serversideSortFileName){	
	// Server side file name defined.
		alert('No server side file defined. Use the setServersideSortFileName to specify where to send the ajax request');
		return;
		}
		var sortBy=obj.getAttribute('sortBy');
		if(!sortBy)sortBy=obj.sortBy;
		if(!sortBy){
		alert('Sort is not defined. Remember to set a sortBy attribute on the header <td> tags');
		return;
		}
		if(sortBy==this.tableCurrentlySortedBy)this.serversideSortAscending=!this.serversideSortAscending;else this.serversideSortAscending=true;
		if(howToSort)this.serversideSortAscending=(howToSort=='ascending'?true:false);
		this.tableCurrentlySortedBy=sortBy;
		this.serversideSortCurrentStartIndex =0;
		this.__getItemsFromServer();	
		
		if(this.pageHandler)this.pageHandler.__resetActivePageNumber();	
		this.__updateSortArrow(obj,this.serversideSortAscending?'ascending':'descending');
		
		return;	
	}	
	
	if(!this.tableWidget_okToSort)return;
	this.tableWidget_okToSort=false;
	/* Getting index of current column */
	var indexThis=0;	
	var tmpObj=obj;
	while(tmpObj.previousSibling){
		tmpObj=tmpObj.previousSibling;
		if(tmpObj.tagName=='TD')indexThis++;	
	}	
	if(obj.getAttribute('direction')||obj.direction){	
	// Determine if we should sort ascending or descending
		direction=obj.getAttribute('direction');
		if(navigator.userAgent.indexOf('Opera')>=0)direction=obj.direction;
		if(direction=='ascending'||howToSort=='descending'){
		direction='descending';
		obj.setAttribute('direction','descending');
		obj.direction='descending';	
		}else{
		direction='ascending';
		obj.setAttribute('direction','ascending');	
		obj.direction='ascending';	
		}
	}else{ 
	// First call to the sort method	
		var curDir='ascending';	
	// How to sort the table
		if(howToSort)curDir=howToSort; 
	// Initial sort method sent as argument to this method, call it by this method.
		direction=curDir;
		obj.setAttribute('direction',curDir);
		obj.direction=curDir;
	}	

	this.__updateSortArrow(obj,direction);		
	var tableObj=obj.parentNode.parentNode.parentNode;
	var tBody=tableObj.getElementsByTagName('TBODY')[0];	
	var widgetIndex=tableObj.id.replace(/[^\d]/g,'');
	var sortMethod=this.columnSortArray[indexThis]; 
	// N=numeric, S=String
	var cellArray=new Array();
	var cellObjArray=new Array();
	for(var no=1;no<tableObj.rows.length;no++){
		var content= tableObj.rows[no].cells[indexThis].innerHTML+'';
		cellArray.push(content);
		cellObjArray.push(tableObj.rows[no].cells[indexThis]);
	}
	
	// Calling sort methods
	if(sortMethod=='N'){
		cellArray=cellArray.sort(this.__sortNumeric);
	}else{
		cellArray=cellArray.sort(this.__sortString);
	}
	if(direction=='descending'){
		for(var no=cellArray.length;no>=0;no--){
		for(var no2=0;no2<cellObjArray.length;no2++){
			if(cellObjArray[no2].innerHTML==cellArray[no]&&!cellObjArray[no2].getAttribute('allreadySorted')){
			cellObjArray[no2].setAttribute('allreadySorted','1');	
			tBody.appendChild(cellObjArray[no2].parentNode);		
			}		
		}		
		}
	}else{
		for(var no=0;no<cellArray.length;no++){
		for(var no2=0;no2<cellObjArray.length;no2++){
			if(cellObjArray[no2].innerHTML==cellArray[no]&&!cellObjArray[no2].getAttribute('allreadySorted')){
			cellObjArray[no2].setAttribute('allreadySorted','1');	
			tBody.appendChild(cellObjArray[no2].parentNode);		
			}		
		}		
		}		
	}	
	for(var no2=0;no2<cellObjArray.length;no2++){
		cellObjArray[no2].removeAttribute('allreadySorted');	
	}	
	this.tableWidget_okToSort=true;	
	}	
	
	// }}}
	,	
	
	// {{{ __highlightTableRow()
	 /**
	 * Highlight data row on mouse over, i.e. applying css class tableWidget_dataRollOver
	  *	To change the layout, look inside listagem.css
	  *
	 *
	 *@private
	  */	
	__highlightTableRow:function()
	{
	if(DHTMLSuite.clientInfoObj.isOpera)return;
	this.className='DHTMLSuite_tableWidget_dataRollOver';
	if(document.all){	
	// I.E fix for "jumping" headings
		var divObj=this.parentNode.parentNode.parentNode;
		var tHead=divObj.getElementsByTagName('TR')[0];
		tHead.style.top=divObj.scrollTop+'px';		
	}	
	}
	
	// }}}
	,
	
	// {{{ __removeHighlightEffectFromTableRow()
	 /**
	 *Reset data row layout when mouse moves away from it.
	 *
	 *@private
	  */	
	__removeHighlightEffectFromTableRow:function()
	{
	if(DHTMLSuite.clientInfoObj.isOpera)return;
	this.className=null;
	if(document.all){	
	// I.E fix for "jumping" headings
		var divObj=this.parentNode.parentNode.parentNode;
		var tHead=divObj.getElementsByTagName('TR')[0];
		tHead.style.top=divObj.scrollTop+'px';
	}		
	}	
	
	// }}}	
}




/*[FILE_START:dhtmlSuite-tabView.js] */	
/************************************************************************************************************
*	Tab view class
*
*	Created:			August, 21st, 2006
*
* 	Update log:
*
************************************************************************************************************/

	
if(!window.DHTMLSuite)var DHTMLSuite=new Object();/************************************************************************************************************ 
*	Tab view class 
* 
*	Created:		August, 21st, 2006 
* 
*	 Update log: 
* 
************************************************************************************************************/ 

	 
var refToTabViewObjects=new Array();	 
// Reference to objects of this class. 
				
// We need this because the script doesn't allways know which object to use 

/** 
* @constructor 
* @class Purpose of class:	Tab view class-transfors plain HTML into tabable layers.<br> 
* (See <a target="_blank" href="../../demos/demo-tabs-1.html">demo 1</A> and <a target="_blank" href="../../demos/demo-tabs-2.html">demo 2</A>) 
* @version 1.0 
* @author	Alf Magne Kalleland(www.dhtmlgoodies.com) 
**/ 

DHTMLSuite.tabView=function(){ 
	var textPadding;		 
	// Tab spacing 
	var strictDocType ;		
	// Using a strict document type, i.e. <!DOCTYPE> 

	var DHTMLSuite_tabObj;	 
	// Reference to div surrounding the tab set 
	var activeTabIndex;		 
	// Currently displayed tab(index-0=first tab) 
	var initActiveTabIndex;		 
	// Initially displayed tab(index-0=first tab) 
	var ajaxObjects;		 
	// Reference to ajax objects 
	var tabView_countTabs; 
	var tabViewHeight; 
	var tabSetParentId;		 
	// Id of div surrounding the tab set. 
	var tabTitles;			 
	// Tab titles 
	var width;			 
	// width of tab view 
	var height;			 
	// height of tab view 
	var layoutCSS; 
	var outsideObjectRefIndex;	 
	// Which index of refToTabViewObjects refers to this object. 
	var maxNumberOfTabs; 
	var dynamicContentObj;	 
	var closeButtons; 
	var refActiveTabContent; 
	 
	var callbackOnTabSwitch; 
	 
	this.initActiveTabIndex=0; 
	this.callbackOnTabSwitch=''; 
	this.refActiveTabContent=''; 
	 
	// Default variable values 
	this.textPadding=3; 
	this.strictDocType=true;	
	this.ajaxObjects=new Array(); 
	this.tabTitles=new Array(); 
	this.layoutCSS='abas.css'; 
	this.maxNumberOfTabs=6; 
	this.dynamicContentObj=false; 
	this.closeButtons=new Array(); 
	this.width='100%'; 
	this.height='500'; 
	 
	try{ 
		if(!standardObjectsCreated)DHTMLSuite.createStandardObjects();	 
		// This line starts all the init methods 
	}catch(e){ 
		alert('You need to include the dhtmlSuite-common.js file'); 
	} 
} 

DHTMLSuite.tabView.prototype={ 
	 
	// {{{ init() 
	 /** 
	 *Initialize the script 
	 * 
	 *@public 
	*/	 
	init:function() 
	{	 
		DHTMLSuite.commonObj.loadCSS(this.layoutCSS); 
		this.outsideObjectRefIndex=refToTabViewObjects.length; 
		refToTabViewObjects[this.outsideObjectRefIndex]=this; 
		try{ 
			this.dynamicContentObj=new DHTMLSuite.dynamicContent(); 
		}catch(e){ 
			//alert('You need to include DHTMLSuite-dynamicContent.js'); 
		} 
		this.__initializeAndParseTabs(false,false); 
	 
	} 
	 
	// }}} 
	, 
	 
	// {{{ setCallbackOnTabSwitch() 
	 /** 
	 *Set callback on tab switch 
	 * 
	 *@param String callbackOnTabSwitch=Name of function to execute when the user switches to a different tab. 
	* 
	 *@public 
	*/		 
	setCallbackOnTabSwitch:function(callbackOnTabSwitch) 
	{ 
		this.callbackOnTabSwitch=callbackOnTabSwitch; 
	} 
	 
	// }}} 
	, 
	 
	// {{{ getMaximumNumberOfTabs() 
	 /** 
	 *Return maximum number of tabs 
	 * 
	 *@return Int maximumNumberOfTabs=Maximum number of tabs 
	* 
	 *@public 
	*/	 
	getMaximumNumberOfTabs:function() 
	{ 
		return this.maxNumberOfTabs; 
	} 
	 
	// }}}	 
	, 
	 
	// {{{ setMaximumTabs() 
	 /** 
	 *Set maximum number of tabs 
	 * 
	 *@param Int maximumNumberOfTabs=Maximum number of tabs 
	* 
	 *@public 
	*/	 
	setMaximumTabs:function(maximumNumberOfTabs) 
	{ 
		this.maxNumberOfTabs=maximumNumberOfTabs; 
	}		
	 
	// }}}	 
	 , 
	 
	// {{{ setParentId() 
	 /** 
	 *Set padding on tabs 
	 * 
	 *@param String idOfParentHTMLElement=id of parent div 
	* 
	 *@public 
	*/	 
	setParentId:function(idOfParentHTMLElement) 
	{ 
		this.tabSetParentId=idOfParentHTMLElement; 
		this.DHTMLSuite_tabObj=document.getElementById(idOfParentHTMLElement); 
	}		
	 
	// }}}	 
	 , 
	 
	// {{{ setWidth() 
	 /** 
	 *Set width of tab view 
	 * 
	 *@param String Width of tab view 
	* 
	 *@public 
	*/	 
	setWidth:function(newWidth) 
	{ 
		this.width=newWidth; 
	}	 
	 
	// }}}	 
	 , 
	 
	// {{{ setHeight() 
	 /** 
	 *Set height of tab view on tabs 
	 * 
	 *@param String Height of tab view 
	* 
	 *@public 
	*/	 
	setHeight:function(newHeight) 
	{ 
		this.height=newHeight; 
	}	 
	 
	// }}}	 
	 ,	 
	 
	// {{{ setIndexActiveTab() 
	 /** 
	 *Set index of initially active tab 
	 * 
	 *@param Int indexOfNewActiveTab=Index of active tab(0=first tab) 
	* 
	 *@public 
	*/	 
	setIndexActiveTab:function(indexOfNewActiveTab) 
	{ 
		this.initActiveTabIndex=indexOfNewActiveTab; 
	}	 
	 
	 
	// }}}	 
	 ,	 
	 
	// {{{ setTabTitles() 
	 /** 
	 *Set title of tabs 
	 * 
	 *@param Array titleOfTabs=Title of tabs 
	* 
	 *@public 
	*/	 
	setTabTitles:function(titleOfTabs) 
	{ 
		this.tabTitles=titleOfTabs; 
	}	 
	 
	 
	// }}}	 
	 ,	 
	 
	// {{{ setCloseButtons() 
	 /** 
	 *Specify which tabs that should have close buttons 
	 * 
	 *@param Array closeButtons=Array of true or false 
	* 
	 *@public 
	*/	 
	setCloseButtons:function(closeButtons) 
	{ 
		this.closeButtons=closeButtons; 
	}	 
	 
	// }}} 
	 , 
	 
	// {{{ getReferenceToDivElement() 
	 /** 
	 * 
	 *Returns a reference to the div element of a tab. 
	 * 
	 *@param String tabTitle=Title of tab 
	 *@return Object Element to HTML div element for this tab. 
	 * 
	 *@public 
	*/		 
	 getReferenceToDivElementByTitle:function(tabTitle) 
	 { 
		 var index=this.getTabIndexByTitle(tabLabel);	 
		 // Get index of tab 
		 if(index!=-1){ 
		 var obj=document.getElementById('tabView'+this.tabSetParentId+'_'+index); 
		 return obj;		
		 }		 
		 return false; 
	 } 
	 
	// }}} 
	 , 
	 
	// {{{ getReferenceToDivElementById() 
	 /** 
	 * 
	 *Returns a reference to the div element of a tab. 
	* 
	 *@param String idOfTab=id of tab 
	 *@return Object Element to HTML div element for this tab. 
	* 
	 *@public 
	*/			
	 getReferenceToDivElementById:function(idOfTab) 
	 { 
		var divs=this.DHTMLSuite_tabObj.getElementsByTagName('DIV'); 
		 
		for(var no=0;no<divs.length;no++){ 
			var attr=divs[no].getAttribute('originalId'); 
			if(!attr)attr=divs[no].originalid; 
			if(attr==idOfTab)return divs[no]; 
		} 
		return false; 
			
	 } 
	 
	// }}}	 
	, 
	 
	// {{{ createNewTab() 
	 /** 
	 * 
	 *Creates new tab dynamically 
	* 
	 *@param String parentId=Id of tabset 
	 *@param String tabTitle=Title of new tab 
	 *@param String tabContent=Content of new tab(Optional) 
	 *@param String tabContentUrl=Url to content of new tab(Optional)- Ajax is used to get this content 
	* 
	 *@return Boolean Success-true if the tab was created, false otherwise, i.e. tab with same label already exists. 
	* 
	 *@public 
	*/	 
	createNewTab:function(parentId,tabTitle,tabContent,tabContentUrl,closeButton) 
	 { 
		var index=this.getTabIndexByTitle(tabTitle);	 
		// Get index of tab 
			if(index!=-1){	 
		// Tab exists if index<>-1 
				this.displayATab(tabTitle,index); 
				return false; 
			} 
			if(this.tabView_countTabs>=this.maxNumberOfTabs)return;	 
		// Maximum number of tabs reached-return 
			var div=document.createElement('DIV');	 
		// Create new tab content div. 
			div.className='DHTMLSuite_aTab';	 
		// Assign new tab to CSS class DHTMLSuite_aTab 
			this.DHTMLSuite_tabObj.appendChild(div);			 
		// Appending new tab content div to main tab view div 
			var tabId=this.__initializeAndParseTabs(true,tabTitle,closeButton);	 
		// Call the init method in order to create tab header and tab images 
			if(tabContent)div.innerHTML=tabContent;	 
		// Static tab content specified, put it into the new div 
			if(tabContentUrl){	 
		// Get content from external file 
				this.dynamicContentObj.loadContent('tabView'+parentId +'_'+tabId,tabContentUrl); 
			} 
		// update tabTitles -- batur 
		this.tabTitles[tabId] = tabTitle; 
			
		return true; 
	} 

	 
	// }}}		 
	 ,	 
	
	// {{{ deleteTab() 
	 /** 
	* 
	 *Delete a tab 
	* 
	 *@param String tabLabel=Label of tab to delete(Optional) 
	 *@param Int tabIndex=Index of tab to delete(Optional) 
	* 
	 *@public 
	*/	 
	deleteTab:function(tabLabel,tabIndex) 
	{	 
		if(tabLabel){	 
		// Delete tab by tab title 
			var index=this.getTabIndexByTitle(tabLabel);	 
		// Get index of tab 
			if(index!=-1){	 
		// Tab exists if index<>-1 
			this.deleteTab(false,index); 
			} 
			 
		}else if(tabIndex>=0){	 
		// Delete tab by tab index. 
			if(document.getElementById('tabTab'+this.tabSetParentId+'_'+tabIndex)){ 
			var obj=document.getElementById('tabTab'+this.tabSetParentId+'_'+tabIndex); 
			var id=obj.parentNode.parentNode.id; 
			DHTMLSuite.discardElement(obj); 
			var obj2=document.getElementById('tabView'+this.tabSetParentId+'_'+tabIndex); 
			DHTMLSuite.discardElement(obj2); 
			this.__resetTabIds(this.tabSetParentId); 
			this.initActiveTabIndex=-1; 
			var newIndex=0; 
			if(refToTabViewObjects[this.outsideObjectRefIndex].activeTabIndex==tabIndex)refToTabViewObjects[this.outsideObjectRefIndex].activeTabIndex=-1; 
			this.__showTab(this.tabSetParentId,newIndex,this.outsideObjectRefIndex); 
			}		 
		}	 
	} 
	 
	// }}}	 
	,		
	// {{{ addContentToTab() 
	 /** 
	 *Add content to a tab dynamically. 
	 * 
	 *@param String tabLabel=Label of tab to delete(Optional) 
	 *@param String filePath=Path to file you want to show inside the tab. 
	* 
	 *@public 
	*/	 
	addContentToTab:function(tabLabel,filePath) 
	{	 
		var index=this.getTabIndexByTitle(tabLabel);	 
		// Get index of tab 
		if(index!=-1){	 
		// Tab found 
			this.dynamicContentObj.loadContent('tabView'+this.tabSetParentId+'_'+index,filePath);	 
		} 
	} 
	 
	// }}}	 
	, 
	
	// {{{ displayATab() 
	 /** 
	 *Display a tab manually 
	 * 
	 *@param String tabTitle=Label of tab to show(Optional) 
	 *@param Int tabIndex=Index of tab to show(Optional) 
	* 
	 *@public 
	*/	 

	displayATab:function(tabLabel,tabIndex) 
	{	 
		if(tabLabel){	 
		// Delete tab by tab title 
			var index=this.getTabIndexByTitle(tabLabel);	 
		// Get index of tab 
			if(index!=-1){	 
		// Tab exists if index<>-1 
			this.initActiveTabIndex=index; 
			}else return false; 
			 
		}else{ 
			this.initActiveTabIndex=tabIndex; 
		} 
	
		this.__showTab(this.tabSetParentId,this.initActiveTabIndex,this.outsideObjectRefIndex) 
	}	 
	 
	// }}}	 
	,		
	
	// {{{ getTabIndex() 
	 /** 
	 *Return index of active tab 
	 * 
	 *@type Integer tabIndex=Index of active tab(0=first tab) 
	* 
	 *@public 
	*/	 
	getTabIndex:function() 
	{ 
		var divs=this.DHTMLSuite_tabObj.getElementsByTagName('DIV'); 
		var tabIndex=0; 
		for(var no=0;no<divs.length;no++){ 
			if(divs[no].id.indexOf('tabTab')>=0){ 
			if(divs[no].className!='tabInactive')return tabIndex; 
			tabIndex++;	 
			} 
		}	 
		 
		//tabInactive	 
		return tabIndex;	 
	}	 
	 
	// }}} 
	,	 
	 
	 
	// {{{ __setPadding() 
	 /** 
	 *Set padding on tabs 
	 * 
	 *@private 
	*/	 
	__setPadding:function(obj,padding){ 
		var span=obj.getElementsByTagName('SPAN')[0]; 
		span.style.paddingLeft=padding+'px';	 
		span.style.paddingRight=padding+'px';	 
	}	 
	 
	// }}}	 
	, 
	 
	// {{{ __showTab() 
	 /** 
	 *Set padding 
	 * 
	 *@param String parentId=id of parent div 
	 *@param Int tabIndex=Index of tab to show 
	 *@param Int objectIndex=Index of refToTabViewObjects, reference to the object of this class. 
	* 
	 *@private 
	*/	 
	__showTab:function(parentId,tabIndex,objectIndex) 
	{ 
		var parentId_div=parentId+"_"; 
		if(!document.getElementById('tabView'+parentId_div+tabIndex)){		 
			return; 
		} 
		 
		if(refToTabViewObjects[objectIndex].activeTabIndex>=0){ 
			if(refToTabViewObjects[objectIndex].activeTabIndex==tabIndex){ 
			return; 
			}	 
			var obj=document.getElementById('tabTab'+parentId_div+refToTabViewObjects[objectIndex].activeTabIndex);	 
			if(!obj){ 
			refToTabViewObjects[objectIndex].activeTabIndex=0; 
			var obj=document.getElementById('tabTab'+parentId_div+refToTabViewObjects[objectIndex].activeTabIndex);	 
			} 
			obj.className='tabInactive'; 
			obj.style.backgroundImage='url(\''+DHTMLSuite.configObj.imagePath+'abas/tab_left_inactive.gif'+'\')'; 
			var imgs=obj.getElementsByTagName('IMG'); 
			var img=imgs[imgs.length-1]; 
			img.src=DHTMLSuite.configObj.imagePath+'abas/tab_right_inactive.gif'; 
			document.getElementById('tabView'+parentId_div+refToTabViewObjects[objectIndex].activeTabIndex).style.display='none'; 
		} 
		 
		var thisObj=document.getElementById('tabTab'+ parentId_div +tabIndex);	 
			 
		thisObj.className='tabActive'; 
		thisObj.style.backgroundImage='url(\''+DHTMLSuite.configObj.imagePath+'abas/tab_left_active.gif'+'\')'; 
		var imgs=thisObj.getElementsByTagName('IMG'); 
		var img=imgs[imgs.length-1];	 
		img.src=DHTMLSuite.configObj.imagePath+'abas/tab_right_active.gif'; 
		 
		document.getElementById('tabView'+parentId_div+tabIndex).style.display='block'; 
		this.refActiveTabContent=document.getElementById('tabView'+parentId_div+tabIndex); 
		refToTabViewObjects[objectIndex].activeTabIndex=tabIndex; 
		 
		refToTabViewObjects[objectIndex].__handleCallback('tabSwitch'); 
	
		var parentObj=thisObj.parentNode; 
		var aTab=parentObj.getElementsByTagName('DIV')[0]; 
		countObjects=0; 
		var startPos=2; 
		var previousObjectActive=false; 
		while(aTab){ 
			if(aTab.tagName=='DIV'){ 
			if(previousObjectActive){ 
				previousObjectActive=false; 
				startPos-=2; 
			} 
			if(aTab==thisObj){ 
				startPos-=2; 
				previousObjectActive=true; 
				refToTabViewObjects[objectIndex].__setPadding(aTab,refToTabViewObjects[objectIndex].textPadding+1); 
			}else{ 
				refToTabViewObjects[objectIndex].__setPadding(aTab,refToTabViewObjects[objectIndex].textPadding); 
			} 
			 
			aTab.style.left=startPos+'px'; 
			countObjects++; 
			startPos+=2; 
			}		 
			aTab=aTab.nextSibling; 
		} 
		 
		return; 
	} 
	 
	// }}} 
	, 
	 
	// {{{ __handleCallback() 
	 /** 
	 *Set padding 
	 * 
	 *@param String action=Which call back action 
	* 
	 *@private 
	*/	 
	__handleCallback:function(action) 
	{	 
		var callbackString=''; 
		switch(action) 
		{ 
			case "tabSwitch": 
			callbackString=this.callbackOnTabSwitch;		 
			break;		 
		}	 
		 
		if(callbackString){ 
			callbackString=callbackString+'(this.refActiveTabContent)'; 
			eval(callbackString); 
		}	 
	} 
	 
	// }}}	 
	, 
	 
	// {{{ tabClick() 
	 /** 
	 *Set padding 
	 * 
	 *@param String parentId=id of parent div 
	 *@param Int tabIndex=Index of tab to show 
	* 
	 *@private 
	*/	 
	__tabClick:function(inputObj,index) 
	{ 
		var idArray=inputObj.id.split('_');	 
		var parentId=inputObj.getAttribute('parentRefId'); 
		if(!parentId)parentId=inputObj.parentRefId; 
		this.__showTab(parentId,idArray[idArray.length-1].replace(/[^0-9]/gi,''),index); 
	 
	}	 
	 
	// }}} 
	, 
	 
	// {{{ rolloverTab() 
	 /** 
	 *Set padding 
	 * 
	* 
	 *@private 
	*/	 
	__rolloverTab:function() 
	{ 
		if(this.className.indexOf('tabInactive')>=0){ 
			this.className='inactiveTabOver'; 
			this.style.backgroundImage='url(\''+DHTMLSuite.configObj.imagePath+'abas/tab_left_over.gif'+'\')'; 
			var imgs=this.getElementsByTagName('IMG'); 
			var img=imgs[imgs.length-1]; 
			 
			img.src=DHTMLSuite.configObj.imagePath+'abas/tab_right_over.gif'; 
		} 
	 
	}	 
	 
	// }}} 
	,	 
	 
	// {{{ rolloutTab() 
	 /** 
	 * 
	* 
	 *@private 
	*/		 
	__rolloutTab:function() 
	{ 
		if(this.className== 'inactiveTabOver'){ 
			this.className='tabInactive'; 
			this.style.backgroundImage='url(\''+DHTMLSuite.configObj.imagePath+'abas/tab_left_inactive.gif'+'\')'; 
			var imgs=this.getElementsByTagName('IMG'); 
			var img=imgs[imgs.length-1]; 
			img.src=DHTMLSuite.configObj.imagePath+'abas/tab_right_inactive.gif'; 
		}	 
	} 
	 
	// }}} 
	, 
	 
	// {{{ __initializeAndParseTabs() 
	 /** 
	 * 
	 *@param Int additionalTab=Additional tabs to the existing 
	 *@param String nameOfAdditionalTab=Title of additional tab. 
	* 
	 *@private 
	*/	 
	__initializeAndParseTabs:function(additionalTab,nameOfAdditionalTab,additionalCloseButton) 
	{ 
		this.DHTMLSuite_tabObj.className=' DHTMLSuite_tabWidget'; 
		 
		window.refToThisTabSet=this; 
		if(!additionalTab||additionalTab=='undefined'){		 
			this.DHTMLSuite_tabObj=document.getElementById(this.tabSetParentId); 
			this.width=this.width+''; 
			if(this.width.indexOf('%')<0)this.width= this.width+'px'; 
			this.DHTMLSuite_tabObj.style.width=this.width; 
				 
			this.height=this.height+''; 
			if(this.height.length>0){ 
			if(this.height.indexOf('%')<0)this.height= this.height+'px'; 
			this.DHTMLSuite_tabObj.style.height=this.height; 
			} 
			 
			var tabDiv=document.createElement('DIV');	 
			var firstDiv=this.DHTMLSuite_tabObj.getElementsByTagName('DIV')[0];	 
			 
			this.DHTMLSuite_tabObj.insertBefore(tabDiv,firstDiv);	 
			tabDiv.className='DHTMLSuite_tabContainer';		 
			this.tabView_countTabs=0; 
			var tmpTabTitles=this.tabTitles;	 
		// tmpTab titles set to current tab titles-this variable is used in the loop below 
							 
		// We don't want to loop through all the tab titles in the object when we add a new one manually. 
			 
		}else{	 
		// A new tab being created dynamically afterwards. 
			var tabDiv=this.DHTMLSuite_tabObj.getElementsByTagName('DIV')[0]; 
			var firstDiv=this.DHTMLSuite_tabObj.getElementsByTagName('DIV')[1]; 
			this.initActiveTabIndex=this.tabView_countTabs;	 
			var tmpTabTitles=Array(nameOfAdditionalTab);	 
		// tmpTab titles set to only the new tab 
		}		 
		for(var no=0;no<tmpTabTitles.length;no++){ 
			var aTab=document.createElement('DIV'); 
			aTab.id='tabTab'+this.tabSetParentId+"_"+ (no+this.tabView_countTabs); 
			aTab.onmouseover=this.__rolloverTab; 
			aTab.onmouseout=this.__rolloutTab; 
			aTab.setAttribute('parentRefId',this.tabSetParentId); 
			aTab.parentRefId=this.tabSetParentId; 
			var numIndex=window.refToThisTabSet.outsideObjectRefIndex+''; 
			aTab.onclick=function(){ window.refToThisTabSet.__tabClick(this,numIndex); }; 
			DHTMLSuite.commonObj.__addEventEl(aTab); 
			aTab.className='tabInactive'; 
			aTab.style.backgroundImage='url(\''+DHTMLSuite.configObj.imagePath+'abas/tab_left_inactive.gif'+'\')'; 
			tabDiv.appendChild(aTab); 
			var span=document.createElement('SPAN'); 
			span.innerHTML=tmpTabTitles[no]; 
			aTab.appendChild(span); 
	
			if((!additionalTab&&this.closeButtons[no])||(additionalTab&&additionalCloseButton)){		 
			var closeButton=document.createElement('IMG'); 
			closeButton.src=DHTMLSuite.configObj.imagePath+'abas/tab-view-close.gif'; 
			closeButton.style.position='absolute'; 
			closeButton.style.top='4px'; 
			closeButton.style.right='2px'; 
			closeButton.onmouseover=this.__mouseOverEffectCloseButton; 
			closeButton.onmouseout=this.__mouseOutEffectForCloseButton; 
			DHTMLSuite.commonObj.__addEventEl(closeButton); 
			span.innerHTML=span.innerHTML+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';		 
			var deleteTxt=span.innerHTML+''; 
			closeButton.onclick=function(){ refToTabViewObjects[numIndex].deleteTab( this.parentNode.innerHTML)}; 
			span.appendChild(closeButton); 
			} 
				 
			var img=document.createElement('IMG'); 
			img.valign='bottom'; 
			img.src=DHTMLSuite.configObj.imagePath+'abas/tab_right_inactive.gif'; 
			 
		// IE5.X FIX 
			if((DHTMLSuite.clientInfoObj.navigatorVersion&&DHTMLSuite.clientInfoObj.navigatorVersion<6)||(DHTMLSuite.clientInfoObj.isMSIE&&!this.strictDocType)){ 
			img.style.styleFloat='none'; 
			img.style.position='relative';	 
			img.style.top='4px' 
			span.style.paddingTop='4px'; 
			aTab.style.cursor='hand'; 
			}	 
		// End IE5.x FIX 
			aTab.appendChild(img); 
		} 
	
		var tabs=this.DHTMLSuite_tabObj.getElementsByTagName('DIV'); 
		var divCounter=0; 
		for(var no=0;no<tabs.length;no++){ 
			if(tabs[no].className=='DHTMLSuite_aTab'&&tabs[no].parentNode==this.DHTMLSuite_tabObj){ 
			if(this.height.length>0){ 
				if(this.height.indexOf('%')==-1){ 
				var tmpHeight=(this.height.replace('px','')/1-22); 
				tabs[no].style.height=tmpHeight+'px'; 
				}else 
				tabs[no].style.height=this.height; 
			} 
			tabs[no].style.display='none'; 
			if(tabs[no].id){ 
				tabs[no].setAttribute('originalId',tabs[no].id); 
				tabs[no].originalId=tabs[no].id;			 
			} 
			tabs[no].id='tabView'+this.tabSetParentId+"_"+divCounter; 
			divCounter++; 
			}		 
		}	 
		if(additionalTab){ 
			this.tabView_countTabs++; 
		}else{ 
			this.tabView_countTabs=this.tabView_countTabs+this.tabTitles.length;	 
		} 
		 
		this.__showTab(this.tabSetParentId,this.initActiveTabIndex,this.outsideObjectRefIndex); 
	
		return this.activeTabIndex; 
	} 
	 
	// }}}	 
	, 
	 
	// {{{ __mouseOutEffectForCloseButton() 
	 /** 
	 * 
	 *@private 
	*/			
	__mouseOutEffectForCloseButton:function() 
	{ 
		this.src=this.src.replace('close-over.gif','close.gif');	 
	}	 
	 
	// }}}	 
	,	 
	 
	// {{{ __mouseOverEffectCloseButton() 
	 /** 
	 * 
	 *@private 
	*/			
	__mouseOverEffectCloseButton:function() 
	{ 
		this.src=this.src.replace('close.gif','close-over.gif');	 
	}	 
	 
	// }}}	 
	,	 
	 
	// {{{ __fillTabWithContentFromAjax() 
	 /** 
	 * 
	*@param Int ajaxIndex=Index of Ajax array 
	*@param String objId=Id of element where content from Ajax should be displayed 
	*@param Int tabId=Id of element where content from Ajax should be displayed 
	* 
	 *@private 
	*/			
	__fillTabWithContentFromAjax:function(ajaxIndex,objId,tabId) 
	{ 
		var obj=document.getElementById('tabView'+objId+'_'+tabId); 
		obj.innerHTML=this.ajaxObjects[ajaxIndex].response;	 
	}	 
	 
	// }}}	 
	, 
	 
	// {{{ __resetTabIds() 
	 /** 
	 * 
	 *@private 
	*/	 
	__resetTabIds:function(parentId) 
	{ 
		var tabTitleCounter=0; 
		var tabContentCounter=0;	 
		var divs=this.DHTMLSuite_tabObj.getElementsByTagName('DIV');	 
	
		for(var no=0;no<divs.length;no++){ 
			if(divs[no].className=='DHTMLSuite_aTab'&&divs[no].parentNode==this.DHTMLSuite_tabObj){ 
			divs[no].id='tabView'+parentId+'_'+tabTitleCounter; 
			tabTitleCounter++; 
			} 
			if(divs[no].id.indexOf('tabTab')>=0&&divs[no].parentNode.parentNode==this.DHTMLSuite_tabObj){ 
			divs[no].id='tabTab'+parentId+'_'+tabContentCounter;	 
			tabContentCounter++; 
			}	 
				 
		}	 
		this.tabView_countTabs=tabContentCounter; 
	} 
	 
	// }}}	 
	, 
	 
	// {{{ getTabIndexByTitle() 
	 /** 
	 * 
	 *@private 
	*/	 
	getTabIndexByTitle:function(tabTitle) 
	{ 
		tabTitle=tabTitle.replace(/(.*?)&nbsp.*$/gi,'$1'); 
		var divs=this.DHTMLSuite_tabObj.getElementsByTagName('DIV'); 
		 
		for(var no=0;no<divs.length;no++){ 
			if(divs[no].id.indexOf('tabTab')>=0){ 
			var span=divs[no].getElementsByTagName('SPAN')[0];	 
			var spanTitle=span.innerHTML.replace(/(.*?)&nbsp.*$/gi,'$1'); 
			if(spanTitle==tabTitle){ 
				var tmpId=divs[no].id.split('_');			 
				return tmpId[tmpId.length-1].replace(/[^0-9]/g,'')/1; 
			}	 
			} 
		}	 
		return -1;	 
	} 
	, 
	// batur 
	// {{{ getTabTitle() 
	 /** 
	 * return active tab title 
	 *@public 
	*/		 
	getTabTitle:function() {					 
		return (this.tabTitles[this.activeTabIndex]);		 
	} 
		 
	// }}}		 
} 



	
