//Global version ID

var TableRenderVersion;

TableRenderVersion = '2.1';



//Excel Cell object

function ExcelCell(sName,sType,sText,sValue)

{

	this.Name = sName;

	this.Type = sType;

	this.Text = sText;

	this.Value = sValue;

	return this;

};



//Excel Sheet object

function ExcelSheet()

{

	this.Name = 'unnamed';

	this.Width = 1;

	this.Height = 1;

	this.DataGrid = new Array(10);

	

	this.ResizeGrid = function()

	{

		this.DataGrid = new Array(this.Height);

		for(i=0; i < this.Height; i++)

		{

			this.DataGrid[i] = new Array(this.Width);

		}

	};

	this.ResizeGrid2 = function(strText)

	{

		alert('resizing: ' +  strText);

		this.DataGrid = new Array(10,10);

	};

};



function Trim(TRIM_VALUE)

{

	if(TRIM_VALUE.length < 1)

	{

		return "";

	}

	TRIM_VALUE = RTrim(TRIM_VALUE);

	TRIM_VALUE = LTrim(TRIM_VALUE);

	if(TRIM_VALUE=="")

	{

		return "";

	}

	else

	{

		return TRIM_VALUE;

	}

} 



function RTrim(VALUE)

{

	var w_space = String.fromCharCode(32);

	var v_length = VALUE.length;

	var strTemp = "";

	if(v_length < 0)

	{

		return "";

	}

	var iTemp = v_length -1;



	while(iTemp > -1)

	{

		if(VALUE.charAt(iTemp) == w_space){}

		else

		{

			strTemp = VALUE.substring(0,iTemp +1);

			break;

		}

		iTemp = iTemp-1;



	} 

	return strTemp;

} 



function LTrim(VALUE)

{

	var w_space = String.fromCharCode(32);

	if(v_length < 1)

	{

		return "";

	}

	var v_length = VALUE.length;

	var strTemp = "";



	var iTemp = 0;



	while(iTemp < v_length)

	{

		if(VALUE.charAt(iTemp) == w_space)

		{

		}

		else

		{

			strTemp = VALUE.substring(iTemp,v_length);

			break;

		}

	iTemp = iTemp + 1;

	} 

	return strTemp;

} 



function InSemiColonSepString(strVar, strCommaString)

{

	var strArray = strCommaString.split(';');

	for(i=0; i < strArray.length; i++)

	{

		if(strVar.toLowerCase() == strArray[i].toLowerCase())	

		{

			return true;

		}

	}

	return false;

}



function CSSFormatObject(varObject, Class_Name)

{

	varObject.style.fontFamily = 'verdana,arial';

	varObject.style.fontSize = '11';

	

	switch(Class_Name.toLowerCase())

	{

		case 'pagename':

			varObject.style.fontFamily = 'verdana,arial';

			varObject.style.fontSize = '12';

			varObject.style.fontWeight = 'bold';

			varObject.style.width = '590px';

			break;

		case 'pagetext':

			//varObject.style.fontFamily = 'verdana,arial';

			//varObject.style.fontSize = '11';

			//varObject.style.width = '590px';

			//varObject.style.height = '35px';

			break;

		case 'header':

			varObject.style.fontFamily = 'verdana,arial';

			varObject.style.fontSize = '11';

			varObject.style.fontWeight = 'bold';

			varObject.style.paddingTop = '10px';

			varObject.style.paddingBottom = '6px';

			break;

		case 'subheader':

			varObject.style.fontFamily = 'verdana,arial';

			varObject.style.fontSize = '11';

			varObject.style.fontWeight = 'bold';

			varObject.style.color = '#003366';

			//varObject.style.paddingTop = '10px';

			//varObject.style.paddingBottom = '6px';

			break;

		case 'total':

			varObject.style.fontFamily = 'verdana,arial';

			varObject.style.fontSize = '11';

			varObject.style.fontWeight = 'bold';

			varObject.style.color = '#003366';

			break;

		case 'subtotal1':

			varObject.style.fontFamily = 'verdana,arial';

			varObject.style.fontSize = '11';

			varObject.style.fontWeight = 'bold';

			varObject.style.color = '#003366';

			break;

		case 'subtotal2':

			varObject.style.fontFamily = 'verdana,arial';

			varObject.style.fontSize = '11';

			varObject.style.fontWeight = 'bold';

			varObject.style.color = '#003366';

			break;

		case 'standard':

			varObject.style.fontFamily = 'verdana,arial';

			varObject.style.fontSize = '11';

			varObject.style.color = '#003366';			
			
			varObject.style.width = '260px';

			break;
			
		case 'standard2':

			varObject.style.fontFamily = 'verdana,arial';

			varObject.style.fontSize = '11';
			
			varObject.style.fontWeight = 'bold';

			varObject.style.color = '#003366';			
			
			varObject.style.width = '260px';

			break;

		case 'numeric':

			varObject.style.fontFamily = 'verdana,arial';

			varObject.style.fontSize = '11';

			varObject.style.color = '#000000';

			varObject.style.textAlign = 'right';

			varObject.style.width = '85px';

			break;


		case 'period':

			varObject.style.fontFamily = 'verdana,arial';

			varObject.style.fontSize = '11';

			varObject.style.color = '#000000';

			varObject.style.textAlign = 'right';

			varObject.style.width = '85px';

			break;

		case 'empty':

			varObject.style.fontFamily = 'verdana,arial';

			varObject.style.fontSize = '11';

			varObject.style.color = '#000000';

			varObject.style.textAlign = 'right';

			varObject.style.width = '0px';

			break;

	}

}

