function FoldersBuild(){

}		

function FolderSubFoldersHTML(){
	var sClass;
	var sImg = "" 
	var sStartTable;
	var sEndTable;

	if(this.level==0){
		sStartTable = '<table cellpadding="0" cellspacing="0" border="0"><tr>';
		for(var i=0; i< this.subfolderArray.length; i++) {
			sClass = (this.subfolderArray[i].selected==1||this.subfolderArray[i].IsParent(eval("folder"+currentFolderID)))? "mL0Selected":"mL0Normal";
			this.subFoldersHTML = (!is.ns4)? 
				this.subFoldersHTML + '<td id="'+this.subfolderArray[i].name+'" align="center" class="'+sClass+'TD" height="14" title="'+this.subfolderArray[i].title+'"><a href="javascript:'+this.subfolderArray[i].name+'.loadLocation()" class="'+sClass+'">&nbsp;'+this.subfolderArray[i].title+'&nbsp;</a></td>':
					this.subFoldersHTML + '<td id="'+this.subfolderArray[i].name+'" align="center" class="'+sClass+'TD" height="14"><a href="javascript:'+this.subfolderArray[i].name+'.loadLocation()" class="'+sClass+'">&nbsp;'+this.subfolderArray[i].title+'&nbsp;</a></td>';
					//this.subFoldersHTML + '<td><ilayer name="Ilayer_'+this.subfolderArray[i].id+'"><layer name="'+this.subfolderArray[i].name+'" left="0" top="0" width="14" height="11"><a href="javascript:'+this.subfolderArray[i].name+'.loadLocation()"><img src="images/bandera_'+this.subfolderArray[i].title+'.gif" width="14" height="11" border="0" alt=""></a></layer></ilayer></td>';
			if(i<this.subfolderArray.length-1) this.subFoldersHTML = this.subFoldersHTML + '<td width="1" bgcolor="#000000"><img src="images/pixel.gif" border="0" width="1" height="1"></td>';
		}
		sEndTable = '</tr><tr><td colspan="5" height="4"><img src="images/pixel.gif" border="0" width="1" height="4"></td></tr></table>';
		this.subFoldersHTML = sStartTable + this.subFoldersHTML + sEndTable;
	}
	if(this.level==1){
		sStartTable = '<table cellpadding="0" cellspacing="0" border="0" class="topmenuTD" height="20"><tr>';
		for(var i=0; i< this.subfolderArray.length; i++) {
			sClass = (this.subfolderArray[i].selected==1||this.subfolderArray[i].IsParent(eval("folder"+currentFolderID)))? "tmSelected":"tmNormal";
			sBgColor = (this.subfolderArray[i].selected==1||this.subfolderArray[i].IsParent(eval("folder"+currentFolderID)))? FoldersLevel1BGSelected:FoldersLevel1BGNormal;
			if(i==0) this.subFoldersHTML = this.subFoldersHTML + '<td width="3"><img src="images/topmeny_left.gif" border="0" width="3" height="20"></td>';	
			this.subFoldersHTML = (!is.ns4)? 
				this.subFoldersHTML + '<td nowrap id="'+this.subfolderArray[i].name+'" background="images/topmeny_bg.gif" bgcolor="'+sBgColor+'"  class="tmIE" align="center" onclick="'+this.subfolderArray[i].name+'.loadLocation()"><span class="'+sClass+'">&nbsp;&nbsp;&nbsp;' + this.subfolderArray[i].title + '&nbsp;&nbsp;&nbsp;</span></td>':
					this.subFoldersHTML + '<td nowrap><ilayer name="Ilayer_'+this.subfolderArray[i].id+'" height="20"><layer name="'+this.subfolderArray[i].name+'" left="0" top="0" height="20" class="tm"><a href="javascript:'+this.subfolderArray[i].name+'.loadLocation()" class="'+sClass+'">&nbsp;&nbsp;&nbsp;' + this.subfolderArray[i].title + '&nbsp;&nbsp;&nbsp;</a></layer></ilayer></td>';
			this.subFoldersHTML = this.subFoldersHTML + '<td width="5" height="20"><img src="images/topmeny_spacer.gif" border="0" width="5" height="20"></td>';	
		}
		sEndTable = "</tr></table>";
		this.subFoldersHTML = sStartTable + this.subFoldersHTML + sEndTable;
	}
}		

function FolderSubFoldersTree(oFolder){
	var tableWidth = 159;
	var tdWidth = 5
	oFolder = (oFolder==null)? this:oFolder
	if(oFolder.subfolders>1){
		var sSeparator = '<tr><td class="hLine" colspan="2"><img src="images/pixel.gif" width="10" height="1" alt=""border="0"></td></tr>';	
		var sStartTable = '<table cellpadding="0" cellspacing="0" border="0" width="'+tableWidth+'">'+sSeparator;
			for(var i=0; i< oFolder.subfolderArray.length; i++) {
				if(oFolder.subfolderArray[i]!=null){
					sBgColor = (oFolder.subfolderArray[i].selected)? FoldersLevel2BGSelected:FoldersLevel2BGNormal;
					sClass = (oFolder.subfolderArray[i].selected)? "smSelected":"smNormal";
					oFolder.subFoldersHTML = (!is.ns4)? 
						oFolder.subFoldersHTML + '<tr><td id="'+oFolder.subfolderArray[i].name+'" class="'+SubFoldersSubClass+'" height="20"  colspan="2"  bgcolor="'+sBgColor+'" onmouseover="'+oFolder.subfolderArray[i].name+'.setBgColor(FoldersLevel3BGHover); " onmouseout="'+oFolder.subfolderArray[i].name+'.setBgColor(FoldersLevel3BGNormal)" onclick="'+oFolder.subfolderArray[i].name+'.loadLocation()" title="'+oFolder.subfolderArray[i].description+'"><span class="'+sClass+'">' + oFolder.subfolderArray[i].title + '</span></td></tr>':
							oFolder.subFoldersHTML + '<tr><td colspan="2"><ilayer name="Ilayer_'+oFolder.subfolderArray[i].id+'"><layer name="'+oFolder.subfolderArray[i].name+'" left="0" top="0" width="'+tableWidth+'" height="20" bgcolor="'+sBgColor+'" class="'+SubFoldersSubClass+'" onmouseover="setBgColorNS(this,'+oFolder.subfolderArray[i].id+',FoldersLevel3BGHover)" onmouseout="setBgColorNS(this,'+oFolder.subfolderArray[i].id+',FoldersLevel3BGNormal)"><a href="javascript:'+oFolder.subfolderArray[i].name+'.loadLocation()" class="'+sClass+'">' + oFolder.subfolderArray[i].title + '</a></layer></ilayer></td></tr>';
					
				}
				if(oFolder.subfolderArray[i].subfolders>0&&oFolder.subfolderArray[i].selected) {
						for(var j=0; j< oFolder.subfolderArray[i].subfolderArray.length; j++) {
							if(oFolder.subfolderArray[i].subfolderArray[j]!=null){
								sBgColor = (oFolder.subfolderArray[i].subfolderArray[j].selected)? FoldersLevel3BGSelected:FoldersLevel3BGNormal;
								sClass = (oFolder.subfolderArray[i].subfolderArray[j].selected)? "smSelected2":"smNormal2";
								subSeparator = '<tr><td height="1"><img src="images/pixel.gif" width="10" height="1" alt="" border="0"></td></tr>';
								oFolder.subFoldersHTML = (!is.ns4)? 
									oFolder.subFoldersHTML + subSeparator +'<tr><td width="'+tdWidth+'" height="16">&nbsp;</td><td id="'+oFolder.subfolderArray[i].subfolderArray[j].name+'" class="'+SubFoldersSubClass2+'" height="14" width="'+(tableWidth-tdWidth)+'"  bgcolor="'+sBgColor+'" onmouseover="'+oFolder.subfolderArray[i].subfolderArray[j].name+'.setBgColor(FoldersLevel3BGHover)" onmouseout="'+oFolder.subfolderArray[i].subfolderArray[j].name+'.setBgColor(FoldersLevel3BGNormal)" onclick="'+oFolder.subfolderArray[i].subfolderArray[j].name+'.loadLocation()" title="'+oFolder.subfolderArray[i].description+'"><span class="'+sClass+'">' + oFolder.subfolderArray[i].subfolderArray[j].title + '</span></td></tr>':
										oFolder.subFoldersHTML + subSeparator +'<tr><td width="'+tdWidth+'">&nbsp;</td><td><ilayer name="Ilayer_'+oFolder.subfolderArray[i].subfolderArray[j].id+'"  height="16"><layer name="'+oFolder.subfolderArray[i].subfolderArray[j].name+'" left="0" top="0" width="'+(tableWidth-tdWidth)+'" height="16" bgcolor="'+sBgColor+'" class="'+SubFoldersSubClass2+'" onmouseover="setBgColorNS(this,'+oFolder.subfolderArray[i].subfolderArray[j].id+',FoldersLevel3BGHover)" onmouseout="setBgColorNS(this,'+oFolder.subfolderArray[i].subfolderArray[j].id+',FoldersLevel3BGNormal)"><a href="javascript:'+oFolder.subfolderArray[i].subfolderArray[j].name+'.loadLocation()" class="'+sClass+'">&raquo;' + oFolder.subfolderArray[i].subfolderArray[j].title + '</a></layer></ilayer></td></tr>';
							}
							
						}
					oFolder.subFoldersHTML = oFolder.subFoldersHTML + subSeparator
				}
				oFolder.subFoldersHTML = oFolder.subFoldersHTML + sSeparator;
			}
			var sEndTable = '</table>';
			oFolder.subFoldersHTML = sStartTable + oFolder.subFoldersHTML + sEndTable;
	}
	return oFolder.subFoldersHTML
}

function FolderLoadLocation(){
	if(this.link!=""){
		var newLoc = hostPath + this.link;
		if(this.target=="") document.location.href =  newLoc;
		else{
			if(this.target=="_blank") window.open(newLoc);
			if(this.target=="_top") top.location.href =  newLoc;
			if(this.target=="_parent") parent.location.href =  newLoc;
		}
	}
}

function FolderSetBgColor(vColor){
	if(!this.selected){
		if (is.ns){
			if (is.ns4) this.css.bgColor = vColor;
			else this.css.backgroundColor = vColor;
		} 
		else{
			this.css.backgroundColor = vColor;
		}
	}
}

function FoldersActivate(){
	if (is.ns) {
		if (is.ns4) {
			this.css = eval("document.Ilayer_"+this.id+".document."+this.name)
			this.elm = this.event = this.css
			this.doc = this.css.document
		}
		else if (is.ns5) {
			this.elm = document.getElementById(this.name)
			this.css = this.elm.style
			this.doc = document
		}
	}
	else {
		this.elm = this.event = (is.ie4)? document.all[this.name]:document.getElementById(this.name)
		this.css = this.elm.style;
		this.doc = document
	}
}

	var foldersObjArray = new Array();
	var foldersObjArrayCount = 0;
	
	var sHTML = "";

	var currentTopFolderID = "";
	var TopFoldersSubBGNormal = "#013366";	
	var SubFoldersSubBorderColor = "#000000";
	
	var FoldersLevel1BGNormal = "#81ACD6";	
	var FoldersLevel1BGHover = "#81ACD6";		
	var FoldersLevel1BGSelected = "#81ACD6";	
	
	var FoldersLevel2BGNormal = "#FFFFFF";	
	var FoldersLevel2BGHover = "#ECF6FF";		
	var FoldersLevel2BGSelected = "#81ACD6";	
	
	var FoldersLevel3BGNormal = "#FFFFFF";
	var FoldersLevel3BGHover = "#ECF6FF";
	var FoldersLevel3BGSelected = "#A2C2E1";
	
	var emptyImg ="images/pixel.gif"
	var TopFolderWidthsArray = new Array('50','56','74','66','76','110','120','120','100');
	var SubFolderLeftsArray = new Array();
	var SubFoldersSubClass = "smPadding";
	var SubFoldersSubClass2 = "smPadding2";	

	// BrowserCheck Object
	function BrowserCheck() {
		var u = navigator.userAgent.toLowerCase();
		this.u = u
		var b = navigator.appName
		if (b=="Netscape") this.b = "ns"
		else if (b=="Microsoft Internet Explorer") this.b = "ie"
		else this.b = b
		if(this.b=="ie" && this.u.indexOf('opera')!=-1) 
		this.b = "op"
		this.version = navigator.appVersion
		this.v = parseInt(this.version)
		this.op = (this.b=="op")
		//alert(this.op)
		this.op4 = (this.b=="op" && this.v==4)
		this.ns = (this.b=="ns" && this.v>=4)
		this.ns4 = (this.b=="ns" && this.v==4)
		this.ns5 = (this.b=="ns" && this.v==5)
		this.ie = (this.b=="ie" && this.v>=4)
		this.ie4 = (this.version.indexOf('MSIE 4')>0)
		this.ie5 = (this.version.indexOf('MSIE 5')>0)
		this.ie6 = (this.version.indexOf('MSIE 6')>0)			
		this.min = (this.ns||this.ie)
	}
	is = new BrowserCheck();
	
	//Netscape
	function setBgColorNS(oLayer,id,vColor){
		if(!eval("folder"+id).selected) oLayer.bgColor = vColor;
	}
	
