
function initPage()
{
	var nav = document.getElementById("navigation-main");
	if (nav)
	{
		var nodes = nav.getElementsByTagName("li");
		for (var i = 0; i < nodes.length; i++)
		{
				var uls = nodes[i].getElementsByTagName("ul");
				if (uls[0])
				{
					nodes[i]._ul = uls[0];
				}
				nodes[i].onmouseover = function ()
				{
					if (this.className.indexOf("hover") == -1)
					{
						this.className += " hover";
					}
				}
				nodes[i].onmouseout = function ()
				{
					this.className = this.className.replace(" hover", "");
				}
		}
	}
}

if (window.attachEvent && !window.opera) {
	window.attachEvent("onload", initPage);
}

function setInput(obj, default_txt) {
    if(obj.value == "") {
        obj.value = default_txt;
    } else {
        if(obj.value == default_txt){
            obj.value = "";
        }
    }
}
function clearInput(obj, default_txt) {
    if(obj.value == default_txt){
        obj.value = "";
    }

}

function getInput(obj, default_txt)
{


    if(obj.value == default_txt){
        return "";
    }
    
    return obj.value;
}

function resetInput(obj, default_txt) {
    if(obj.value == "") {
        obj.value = default_txt;
    } 
}

function collectOccs(col)
{
    var result = "";
    
    for (var i = 0; i < col.length; i++)
    {
        if (col[i].type.toLowerCase() == "checkbox" && col[i].name.toLowerCase() == "occ" && col[i].checked == true)
        {
            result += "&occ=" + col[i].value;
        }
    }
    
    return result;
}

function doSearch(url)
{
    
    var keywords = "?q=" + getInput(document.getElementById("gq"), "Enter Keywords");
    var jto = document.getElementById("gjto").checked == true ? "&jto=1" : "";

    //var occs = collectOccs(document.getElementById("gwgtOccupation").getElementsByTagName("input"));
    
    
    var location = "";
	if (document.getElementById("gt1").className.indexOf("active") >= 0)
	{
		var city = getInput(document.getElementById("gcnme"), "Enter City");
		var state = getInput(document.getElementById("gsid"), "State");
		if (city + state != "")
		{
		    location = "&where=" + city;
		    if (city != "" && state != "") { location += ", "; }
		    location += state;
		    
		    var rad = getInput(document.getElementById("gradcs"), "Radius");
		    if (rad != "")
		    {
		        location += "&rad=" + rad + "&rad_units=miles";
		    }
		}
	}
	
	else if (document.getElementById("gt2").className.indexOf("active") >= 0)
	{ 
		location = getInput(document.getElementById("gzip"), "Enter Postal Code");
    	if (location != "")
    	{
    	    location = "&where=" + location;

		    var rad = getInput(document.getElementById("grad"), "Radius");
		    if (rad != "")
		    {
		        location += "&rad=" + rad + "&rad_units=miles";
		    }
    	}
	}
	
	else if (document.getElementById("gt3").className.indexOf("active") >= 0)
	{
		location = "&lid=" + document.getElementById("tabLocation").value + "&rad=20&rad_units=miles";
	}
    
    document.location.href = url + keywords + jto + location + "&re=130&cy=us&brd=1";
}




function HideShowAdvancedSearch(id){
	var e = document.getElementById(id);
	var lnkTxt = document.getElementById('lnk_adv_search');
	
	if(e.style.display == 'none'){
		e.style.display = 'block';
		lnkTxt.innerHTML = "<span class='mnst_advanced_link'>&laquo; Hide advanced search</span>";		
	}	else {
		e.style.display = 'none';
		lnkTxt.innerHTML = "<span class='mnst_advanced_link'>Advanced search &raquo;</span>";			
	}
}

// /js/tabs.js
function initTabs()
{
	var sets = document.getElementsByTagName("div");
	for (var i = 0; i < sets.length; i++)
	{
		if (sets[i].className.indexOf("mnst_tabset") != -1)
		{
			var tabs = [];
			var links = sets[i].getElementsByTagName("a");
			for (var j = 0; j < links.length; j++)
			{
				if (links[j].className.indexOf("tab") != -1)
				{							
					tabs.push(links[j]);
					links[j].tabs = tabs;					

					if (links[j].className.indexOf("active") != -1)
					{
						var c = document.getElementById(links[j].href.substr(links[j].href.indexOf("#") + 1));
						if (c)
							c.style.display = "block";
					}

					links[j].onclick = function ()
					{
						var c = document.getElementById(this.href.substr(this.href.indexOf("#") + 1));
						if (c)
						{
							
							//reset all tabs
							for (var i = 0; i < this.tabs.length; i++)
							{
								document.getElementById(this.tabs[i].href.substr(this.tabs[i].href.indexOf("#") + 1)).style.display = "none";
								this.tabs[i].className = this.tabs[i].className.replace("active", "");
							}
							this.className += " active";
							c.style.display = "block";							

							return false;
						}
					}
				}
			}
		}
	}
}

if (window.addEventListener)
	window.addEventListener("load", initTabs, false);
else if (window.attachEvent)
	window.attachEvent("onload", initTabs);



function _System()
{
	String.prototype.Trim = function() {
		return this.replace(/^\s+|\s+$/g,"");
	}

	String.prototype.LTrim = function() {
		return this.replace(/^\s+/,"");
	}

	String.prototype.RTrim = function() {
		return this.replace(/\s+$/,"");
	}

	String.prototype.Contains = function(somestring)
	{
		return (this.indexOf(somestring) != -1 ? true : false);
	}

	String.prototype.Trunc = function(len)
	{
		
		return this.substring(0, len) + (this.length > len ? "..." : "");
		
	}
}

function _XML()
{
	this.selectSingleNode = function (XmlDocument, Xpath)
	{
		if (System.OS.Browser == BT_IE)
		{
			return XmlDocument.selectSingleNode(Xpath);
		} else {
			try
			{
				var XResult = XmlDocument.evaluate(Xpath, XmlDocument, null, XPathResult.ANY_TYPE, null);
				var result = XResult.iterateNext();
				result.text = result.textContent;
				return result;
			}
			catch (e)
			{
				return null;
			}
		}
	}

	this.selectNodes = function(XmlDocument, Xpath)
	{
		if (System.OS.Browser == BT_IE)
		{
			return XmlDocument.selectNodes(Xpath);
		} else {
			try
			{
				var XResult = XmlDocument.evaluate(Xpath, XmlDocument, null, XPathResult.ANY_TYPE, null);
				if (XResult != null)
				{
					var result = new Array();
					var item = XResult.iterateNext();
					
					while(item != null)
					{
						item.text = item.textContent;
						result.push(item);
						item = XResult.iterateNext();
					}
					return result;
				} else return null;
			}
			catch (e)
			{
				return null;
			}
		}
	}

	this.HttpRequest = function()
	{
		var request = null;
		if (System.OS.Browser == BT_IE)
		{
			request = new ActiveXObject("Microsoft.XMLHTTP");
		} else {
			request = new XMLHttpRequest();
		}
		

		return request;
	}

	this.LoadXml = function(request, filename, readystatefunc)
	{
		//var request = this.HttpRequest();
		request.onreadystatechange = readystatefunc;
		request.open("GET", filename, true);
		request.send(null);
	}
}


System = new _System();
_System.prototype.Xml = new _XML();
// /js/namespaces/dom.js
/**************************
** System.DOM namespace
**
** Rev Date: 27 Nov 2007
** Prog: Gabriel Nica
**************************/

_System.prototype.DOM = new function()
{
	/*

	Generic HELPER functions

	*/




	// Return DOM element using a string ID
	this.ObjPointer = function (Obj) {
		if (typeof Obj == "object")
		{
			return Obj;
		} else return document.getElementById(Obj);
	}

	// Generate a unique ID string used to create elements at runtime
	// Parameter is optional. If not provided, returns "objXXX", XXX number

	this.uniqueID = function(optionalBaseString) {
		var base = "";
		var uidcounter = 0;

		if (typeof optionalBaseString != "undefined")
		{
			base = optionalBaseString;
		} else base = "obj";

		var uidcounter=0;

		while (document.getElementById(base + uidcounter) != null) uidcounter++;

		return (base + uidcounter);
	}

		
	this.getAbsoluteDivs = function()
	{
		var arr = new Array();
		var all_divs = document.body.getElementsByTagName("DIV");
		var j = 0;

		for (i = 0; i < all_divs.length; i++)
			if (all_divs.item(i).style.position=='absolute')
			{
				arr[j] = all_divs.item(i);
				j++;
			}

		return arr;
	}

	this.bringToFront = function(obj)
	{
		var divs = System.DOM.getAbsoluteDivs();
		var max_index = 0;
		var cur_index;

		// Compute the maximal z-index of
		// other absolute-positioned divs
		for (i = 0; i < divs.length; i++)
		{
			var item = divs[i];
			if (item == obj ||
				item.style.zIndex == '')
				continue;

			cur_index = parseInt(item.style.zIndex);
			if (max_index < cur_index)
			{
				max_index = cur_index;
			}
		}

		obj.style.zIndex = max_index + 1;
	}



	/*

	CLASS Handling functions

	*/

	this.AddClass = function (Obj, NewClassName)
	{
		Obj = System.DOM.ObjPointer(Obj);
		sClass = Obj.className;
		if (!sClass.Contains(NewClassName))
		{
			sClass = sClass.RTrim() + " " + NewClassName;
			Obj.className = sClass;
			return true;
		} else return false;
	}

	this.RemoveClass = function (Obj, OldClassName)
	{
		Obj = System.DOM.ObjPointer(Obj);
		sClass = Obj.className;
		if (sClass.Contains(OldClassName))
		{
			var regExp = new RegExp(OldClassName + "\s*", "gi");
			sClass = sClass.replace(regExp, "").Trim();
			Obj.className = sClass;
			return true;
		} else return false;
	}

	this.ToggleClass = function(Obj, ClassName)
	{
		Obj = System.DOM.ObjPointer(Obj);
		sClass = Obj.className;
		if (sClass.Contains(ClassName))
		{
			return System.DOM.RemoveClass(Obj, ClassName);
		} else return System.DOM.AddClass(Obj, ClassName);
	}

	this.ReplaceClass = function(Obj, ClassName, NewClassName)
	{
		Obj = System.DOM.ObjPointer(Obj);
		sClass = Obj.className;
		if (sClass.Contains(ClassName))
		{
			if (System.DOM.RemoveClass(Obj, ClassName))
				return System.DOM.AddClass(Obj, NewClassName);
		} else return false;
	}


	/*

	--- END --- CLASS Handling functions

	*/


	/*

	STYLE Handling functions

	*/

	this.AddStyle = function (Obj, NewStyleName)
	{
		Obj = System.DOM.ObjPointer(Obj);
		NewStyleName = NewStyleName.toUpperCase();
		sStyle = Obj.style.cssText.toUpperCase();
		if (!sStyle.Contains(NewStyleName))
		{
			sStyle = sStyle.RTrim() + "; " + NewStyleName;
			Obj.style.cssText = sStyle;
			return true;
		} else return false;
	}

	this.RemoveStyle = function (Obj, OldStyleName)
	{
		Obj = System.DOM.ObjPointer(Obj);
		OldStyleName = OldStyleName.toUpperCase();
		sStyle = Obj.style.cssText.toUpperCase();
		if (sStyle.Contains(OldStyleName))
		{
			var regExp = new RegExp(OldStyleName + "\s*", "gi");
			sStyle = sStyle.replace(regExp, "").Trim();
			Obj.style.cssText = sStyle;
			return true;
		} else return false;
	}

	this.ToggleStyle = function(Obj, StyleName)
	{
		StyleName = StyleName.toUpperCase();
		Obj = System.DOM.ObjPointer(Obj);
		sStyle = Obj.style.cssText.toUpperCase();
		if (sStyle.Contains(StyleName))
		{
			return System.DOM.RemoveStyle(Obj, StyleName);
		} else return System.DOM.AddStyle(Obj, StyleName);
	}

	this.ReplaceStyle = function(Obj, StyleName, NewStyleName)
	{
		NewStyleName = NewStyleName.toUpperCase();
		StyleName = StyleName.toUpperCase();
		Obj = System.DOM.ObjPointer(Obj);
		sStyle = Obj.style.cssText.toUpperCase();
		if (sStyle.Contains(StyleName))
		{
			if (System.DOM.RemoveStyle(Obj, StyleName))
				return System.DOM.AddStyle(Obj, NewStyleName);
		} else return false;
	}


	/*

	--- END --- CLASS Handling functions

	*/

}

// /js/namespaces/os.js
// Constants
BT_MAJOR_VERSION = 0;
BT_COMPLETE_VERSION = 1;

BT_IE = new CBrowserType("Internet Explorer");
BT_FIREFOX = new CBrowserType("Firefox");
BT_OPERA = new CBrowserType("Opera");
BT_SAFARI = new CBrowserType("Safari");
BT_OTHER = new CBrowserType("Other");


// Objects

_System.prototype.OS = new function()
{
	this.Browser = (new CBrowserType()).Detect();
	this.Browser.Analyze(BT_COMPLETE_VERSION);
}

function CBrowserType(SID)
{
	if (arguments.length == 0)
	{
		this.Detect = function() {

			var ieVersion;
			/*@cc_on
			   /*@if (@_jscript_version > 5.8)
					ieVersion = 9;
				@elif (@_jscript_version == 5.8)
					ieVersion = 8;
			    @elif (@_jscript_version == 5.7)
					ieVersion = 7;
				@elif (@_jscript_version == 5.6)
					ieVersion = 6;
				@elif (@_jscript_version == 5.5)
					ieVersion = 5.5;
				@elif (@_jscript_version == 5.1)
					ieVersion = 5.1;
				@elif (@_jscript_version == 5)
					ieVersion = 5;
				@elif (@_jscript_version == 4)
					ieVersion = 4;
				@else @*/
				  ieVersion = 0;
			   /*@end
			@*/
			BT_IE.Version = ieVersion;
			return (ieVersion > 0 ? BT_IE : (typeof document.all == "object" ? BT_OPERA : (document.getElementById ? (document.implementation.createDocument.prototype ? BT_FIREFOX : BT_SAFARI) : BT_OTHER)));
		}
	} else {

		// Protected
		this.SID = SID;

		// Public
		this.toString = function() { return this.SID; };
		this.Analyze = function(versionType) {
			// Get Version

			// Internet Explorer

			if (typeof this.Version == "undefined")
			{
				if (this == BT_OPERA)
				{
					if(window.opera) {
						if(window.opera.version) {
							this.Version = window.opera.version();
						} else {
							this.Version = navigator.userAgent.substring(navigator.userAgent.indexOf("Opera/")+6, navigator.userAgent.indexOf(" ("));
						}
					}
				} else if (this == BT_FIREFOX)
				{
					this.Version = navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox/")+8);
				} else if (this == BT_SAFARI)
				{
					this.Version = navigator.userAgent.substring(navigator.userAgent.indexOf("Version/")+8, navigator.userAgent.indexOf("Safari"));

				} else this.Version = "Unknown";

				if (versionType == BT_MAJOR_VERSION)
				{
					if (this.Version.indexOf(".") != -1 && this.Version.lastIndexOf(".") != -1)
					{
						if (this.Version.indexOf(".") != this.Version.lastIndexOf("."))
						{
							this.Version = this.Version.substring(0, this.Version.indexOf(".")+2) * 1;
						}
					}
				}
			}

		}
	}
}// /js/namespaces/nsmonster.js
function CMonsterComponents()
{

}

function CjsUI()
{
	this.Components = new CMonsterComponents();
}

function CMonster()
{
	this.jsUI = new CjsUI();
}

Monster = new CMonster();
// /js/namespaces/components/basic.js

/* Function to mimic inheritance */

function IContainer(Caller)
{
	Caller.ContentHolder = null;
	Caller.Container = null;


	Caller.Skin = null;
	Caller.Parameters = new Array();

	Caller.AddParameter = function(TopObject)
	{
		return function(ParamName, ParamValue) {
			TopObject.Parameters.push(new Parameter(ParamName, ParamValue));
		}
	} (Caller);


	Caller.GetParameter = function(TopObject)
	{
		return function(ParamName) {
			TopObject.Parameters.push(new Parameter(ParamName, ParamValue));
		}
	} (Caller);

}

// /js/namespaces/components/combobox.js
function ComboGlobals()
{


	this.MCCImagesPath = "http://media.monster.com/mm/cup/";


}

var MCCGlobals = new ComboGlobals();

function locationsVisible()
{
	return this.DropDownContent.style.visibility == "hidden" ? false : true;
}




var MCC__SELECTANDGO = 0;
var MCC__SELECTANDSTOP = 1;




////////////////
// This function scrolls exactly one item up or down
// so that the last item in the list is not partially shown
// - Buggy on IE
///////////////
function MCCOnComboScroll()
{
	var x = this.scrollTop;
	var y = 17;

	fpart = Math.round(((x / 17) * 10) % 10);
	ipart = Math.floor(x/17);

	if (fpart >= 5)
	{
		this.scrollTop = 17 * (ipart+1);
	} else this.scrollTop = 17 * ipart;
}
// /js/namespaces/components/jcombobox.js
var ComboBoxSkins = {
	XPRoyale : {
		Border: "1px solid #7f9db9",
		BorderOver: "1px solid #335ea8",
		ButtonOver: "http://media.monster.com/mm/homepage/qs/xpbtn_o.gif",
		ButtonNormal: "http://media.monster.com/mm/homepage/qs/xpbtn_n.gif",
		ButtonPressed: "http://media.monster.com/mm/homepage/qs/xpbtn_p.gif",
		ssWidth: "9px",
		ssHeight: "9px",
		isWidth: 9,
		isHeight: 9,
		FaceBackgroundColor: "white",
		ContentBackgroundColor: "white",
		Cursor: "pointer",
		FontFamily: "Verdana",
		FontSize: "11px",
		FontColor: "#333333"
	},
	AlphaChannel: "http://media.monster.com/mm/homepage/qs/spacer.png",
	MaxHeight : 17,
	HolderHeight: 120,
	ApplyIEFilter: function (El)
	{
		El.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + El.src + "', sizingMethod='image')";
		El.src = this.AlphaChannel;
	}
}; // ComboBoxSkins class



function CjComboBox(Skin)
{
	IContainer(this); // Inherit IContainer

	this.Skin = Skin;
	this.hasEvent = false; // Has the outside click event handler = false

	this.Width = 200; //default width
	this.getWidth = function() { return this.Width; }
	this.setWidth = function(w) { this.Width = w; }
	
	this.charCount = 30;
	this.getCharCount = function() {return this.charCount; }
	this.setCharCount = function(c) { this.charCount = c; }

	this.ContentHeight = ComboBoxSkins.HolderHeight; //default width
	this.getHeight = function() { return this.ContentHeight; }
	this.setHeight = function(h) { this.ContentHeight = h; }

	this.Float = "left";

	this.setFloat = function(f)
	{
		this.Float = f;
	}

	this.Caption = "";
	this.FirstCaption = "";
	this.setCaption = function(newText) {
		this.Caption = newText;
		if (this.ComboCaption)
		{
			this.ComboCaption.innerHTML = this.Caption;
		}

		if (this.FirstCaption == "")
		{
			this.FirstCaption = this.Caption;
		}
	}

	this.AttachTo = function (Container)
	{
		this.Container = Container;
		// override default AttachTo
		if (typeof this.Container == "string")
		{
			System.DOM.ObjPointer(this.Container).appendChild(this.ComboFace);
			System.DOM.ObjPointer(this.Container).appendChild(this.ContentHolder);
		}
	}
	
	this.IE6Fix = function(show)
	{
		if (System.OS.Browser == BT_IE)
		{
			if (this.Container == "combo1") { //occupations
				if (BT_IE.Version < 7) {  //this is the only fix nec. for IE6 only
					if (document.getElementById("sid")) document.getElementById("sid").style.display=(show)?"none":"inline";
					if (document.getElementById("radcs")) document.getElementById("radcs").style.display=(show)?"none":"inline";
					if (document.getElementById("rad")) document.getElementById("rad").style.display=(show)?"none":"inline";
				}
				if (document.getElementById("comboLocations")) document.getElementById("comboLocations").style.display=(show)?"none":"block";
				if (document.getElementById("jComboContentHolder1") && document.getElementById("comboLocations") && document.getElementById("jComboContentHolder1").style.display=="block" && document.getElementById("comboLocations").style.display=="block")
					if (document.getElementById("comboIndustries")) document.getElementById("comboIndustries").style.display="none";	
				else
					if (document.getElementById("comboIndustries")) document.getElementById("comboIndustries").style.display="block";	
			} else if (this.Container == "comboLocations") {
				if (document.getElementById("comboIndustries")) document.getElementById("comboIndustries").style.display=(show)?"none":"block";			
			}
		}
	}

	this.Create = function()
	{
		this.ComboFace = document.createElement("div");
		this.ComboFace.id = System.DOM.uniqueID("CjComboBox");
		this.ComboFace.style.width = this.Width + "px";
		this.ComboFace.style.height = ComboBoxSkins.MaxHeight + "px";
		this.ComboFace.style.border = this.Skin.Border;
		this.ComboFace.style.lineHeight = ComboBoxSkins.MaxHeight + "px";
		this.ComboFace.style.backgroundColor = this.Skin.FaceBackgroundColor;
		this.ComboFace.style.cursor = this.Skin.Cursor;
		this.ComboFace.style.zIndex = 10000;
		this.ComboFace.style.styleFloat = this.Float;
		this.ComboFace.style.cssFloat = this.Float;




		// Create Caption bar
		this.ComboCaption = document.createElement("div");
		this.ComboCaption.id = System.DOM.uniqueID("jComboCaption");
		this.ComboCaption.style.FontFamily = this.Skin.FontFamily;
		this.ComboCaption.style.FontSize = this.Skin.FontSize;
		this.ComboCaption.style.FontColor = this.Skin.FontColor;
		this.ComboCaption.style.styleFloat = "left";
		this.ComboCaption.style.cssFloat = "left";
		this.ComboCaption.style.backgroundColor = this.Skin.FaceBackgroundColor;
		this.ComboCaption.style.cursor = this.Skin.Cursor;
		this.ComboCaption.style.lineHeight = ComboBoxSkins.MaxHeight + "px";
		this.ComboCaption.style.paddingLeft = "2px";
		this.setCaption(this.Caption);


		// Create Button Holder
		this.ComboButtonHolder = document.createElement("div");
		this.ComboButtonHolder.style.styleFloat = "right";
		this.ComboButtonHolder.style.cssFloat = "right";
		this.ComboButtonHolder.style.width = ComboBoxSkins.MaxHeight + "px";
		this.ComboButtonHolder.style.height = ComboBoxSkins.MaxHeight + "px";

		// Create Button
		this.ComboButton = document.createElement("img");
		this.ComboButton.alt = this.Caption;
		this.ComboButton.id = System.DOM.uniqueID("jComboButton");
		this.ComboButton.src = this.Skin.ButtonNormal;

		var brclr = document.createElement("br");
			brclr.style.clear = "both";
			brclr.style.cssFloat = "none";
			brclr.style.styleFloat = "none";

		this.ContentHolder = document.createElement("div");
		this.ContentHolder.style.height = this.ContentHeight + "px";
		this.ContentHolder.style.width = this.Width + "px";
		this.ContentHolder.style.backgroundColor = this.Skin.ContentBackgroundColor;
		this.ContentHolder.style.border = this.Skin.Border;
		this.ContentHolder.style.position = "absolute";
		this.ContentHolder.style.overflow = "hidden";
		this.ContentHolder.style.overflowX = "hidden";
		this.ContentHolder.style.display = "none";
		this.ContentHolder.style.zIndex = this.ComboFace.style.zIndex - 1;
		this.ContentHolder.style.clear = "both";
		this.ContentHolder.id = System.DOM.uniqueID("jComboContentHolder");



		this.ComboFace.appendChild(this.ComboCaption);
		this.ComboButtonHolder.appendChild(this.ComboButton);

		this.ComboFace.appendChild(this.ComboButtonHolder);
		this.ComboFace.appendChild(brclr);
		//var markerid=System.DOM.uniqueID("marker");
		//document.write("<span id='" + markerid + "' style='display: none'></span>");

		//System.DOM.ObjPointer(markerid).parentNode.appendChild(this.ComboFace);
		document.body.appendChild(this.ComboFace);

		document.body.appendChild(this.ContentHolder);
		System.DOM.bringToFront(this.ComboFace);
		//document.body.removeChild(this.ComboFace);
		//document.body.appendChild(this.ComboFace);




		// Adding Events
		this.ComboButton.onmouseover = this.BtnMouseOver;
		this.ComboButton.onmouseout = this.BtnMouseOut;
		this.ComboButton.onmousedown = this.BtnMouseDown;
		this.ComboButton.onclick = this.BtnMouseUp;

		this.ComboFace.onmouseover = this.BtnMouseOver;
		this.ComboFace.onmouseout = this.BtnMouseOut;
		this.ComboFace.onclick = this.MCCOpen;
		this.ComboCaption.onmouseover = this.BtnMouseOver;
		this.ComboCaption.onmouseout = this.BtnMouseOut;
		this.ComboCaption.onclick = this.MCCOpen;

	}

	this.ContentVisible = function() { return this.ContentHolder.style.display == "none" ? false : true; }
	this.ShowContent = function() {this.IE6Fix(true); this.ContentHolder.style.display = "block"; }
	this.HideContent = function() {this.IE6Fix(false); this.ContentHolder.style.display = "none"; }

	this.BtnMouseOver = function (CallerObject)
						{
							return function ()
							{
								CallerObject.ComboButton.src = CallerObject.Skin.ButtonOver;
								CallerObject.ComboFace.style.border = CallerObject.Skin.BorderOver;
							}
						} (this);

	this.BtnMouseOut = function (CallerObject)
						{
							return function ()
							{
								CallerObject.ComboButton.src = CallerObject.Skin.ButtonNormal;
								CallerObject.ComboFace.style.border = CallerObject.Skin.Border;
							}
						} (this);

	this.BtnMouseDown = function (CallerObject)
						{
							return function ()
							{
								CallerObject.ComboButton.src = CallerObject.Skin.ButtonPressed;
							}
						} (this);

	this.BtnMouseUp = function (CallerObject)
						{
							return function (e)
							{
								CallerObject.ComboButton.src = CallerObject.Skin.ButtonOver;

								if (System.OS.Browser == BT_IE)
								{
									window.event.cancelBubble = true;
									if (CallerObject.hasEvent)
									{
										document.body.detachEvent("onclick", CallerObject.ClickHandler);
									} else document.body.attachEvent("onclick", CallerObject.ClickHandler);
								} else {
									if (CallerObject.hasEvent)
									{
										document.body.removeEventListener("click", CallerObject.ClickHandler, false);
									} else document.body.addEventListener("click", CallerObject.ClickHandler, false);
									e.stopPropagation();
								}

								CallerObject.hasEvent = !CallerObject.hasEvent;

								if (CallerObject.ContentVisible())
								{
									CallerObject.HideContent();
								} else {
									CallerObject.ShowContent();
								}
							}
						} (this);

	this.ClickHandler = function (CallerObject)
						{
							return function(mevent)
							{
								src = System.OS.Browser == BT_IE ? window.event.srcElement : mevent.srcElement;
								if (!src) src = System.OS.Browser == BT_IE ? window.event.target : mevent.target;

								inside = false;
								while (src.nodeName != "BODY")
								{
									if (src.id.indexOf("jCombo") > -1)
									{
										inside = true;
										break;
									}
									src = src.parentNode;
								}

								if (!inside)
								{
									CallerObject.MCCOpen();
								}
							}

						} (this);


	this.MCCOpen = function(CallerObject)
					{
						return function (e)
						{
							if (System.OS.Browser == BT_IE)
							{
								window.event.cancelBubble = true;
								if (CallerObject.hasEvent)
								{
									document.body.detachEvent("onclick", CallerObject.ClickHandler);
								} else document.body.attachEvent("onclick", CallerObject.ClickHandler);
							} else {
								if (CallerObject.hasEvent)
								{
									document.body.removeEventListener("click", CallerObject.ClickHandler, false);
								} else document.body.addEventListener("click", CallerObject.ClickHandler, false);
								if (e) e.stopPropagation();
							}

							CallerObject.hasEvent = !CallerObject.hasEvent;



							if (CallerObject.ContentVisible())
							{
								CallerObject.HideContent();

							} else {
								CallerObject.ShowContent();
							}


						}
				} (this);

}


// /js/namespaces/components/treeview.js
var TreeViewSkins = {
	XPRoyale : {
		Collapsed: "http://media.monster.com/mm/homepage/qs/xproyale/treeview-collapsed-sign.png",
		Expanded: "http://media.monster.com/mm/homepage/qs/xproyale/treeview-expanded-sign.png",
		Normal: "http://media.monster.com/mm/homepage/qs/xproyale/radio-unselected.png",
		NormalHover: "http://media.monster.com/mm/homepage/qs/xproyale/radio-over.png",
		NormalPressed: "http://media.monster.com/mm/homepage/qs/xproyale/radio-unselected-pressed.png",
		Selected: "http://media.monster.com/mm/homepage/qs/xproyale/radio-selected.png",
		SelectedHover: "http://media.monster.com/mm/homepage/qs/xproyale/radio-selected-over.png",
		SelectedPressed: "http://media.monster.com/mm/homepage/qs/xproyale/radio-selected-pressed.png",
		Disabled: "http://media.monster.com/mm/homepage/qs/xproyale/radio-disabled.png",
		ssWidth: "9px",
		ssHeight: "9px",
		isWidth: 9,
		isHeight: 9,
		ContentBackgroundColor: "white",
		Cursor: "pointer",
		FontFamily: "Verdana",
		FontSize: "11px",
		FontColor: "#333333"
	},

	VistaAero : {
		Collapsed: "http://media.monster.com/mm/homepage/qs/vista/treeview-collapsed-sign.png",
		Expanded: "http://media.monster.com/mm/homepage/qs/vista/treeview-expanded-sign.png",
		Normal: "http://media.monster.com/mm/homepage/qs/vista/radio-unselected.png",
		NormalHover: "http://media.monster.com/mm/homepage/qs/vista/radio-over.png",
		NormalPressed: "http://media.monster.com/mm/homepage/qs/vista/radio-over.png",
		Selected: "http://media.monster.com/mm/homepage/qs/vista/radio-selected.png",
		SelectedHover: "http://media.monster.com/mm/homepage/qs/vista/radio-unselected-pressed.png",
		SelectedPressed: "http://media.monster.com/mm/homepage/qs/vista/radio-selected.png",
		Disabled: "http://media.monster.com/mm/homepage/qs/xproyale/radio-disabled.png",
		ssWidth: "9px",
		ssHeight: "9px",
		isWidth: 9,
		isHeight: 9
	},

	AlphaChannel: "http://media.monster.com/mm/homepage/qs/spacer.png",
	MaxHeight : 17,
	ApplyIEFilter: function (El)
	{
		El.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + El.src + "', sizingMethod='image')";
		El.src = this.AlphaChannel;
	}
}; // TreeViewSkins class

var TextNodeSkins = {
	XPRoyale : {
		Name: "XPRoyale",
		ContentBackgroundColor: "white",
		Cursor: "pointer",
		FontFamily: "Verdana",
		FontSize: "11px",
		FontColor: "#333333",
		Height: 17,
		Padding: "0px 0px 0px 3px",
		OnOverStyle: "text-decoration: underline",
		OnOutStyle: "text-decoration: none"
	},

	VistaAero : {
		Name: "VistaAero",
		ContentBackgroundColor: "white",
		Cursor: "pointer",
		FontFamily: "Verdana",
		FontSize: "11px",
		FontColor: "#333333",
		Height: 17,
		Padding: "0px 0px 0px 3px",
		OnOverStyle: "text-decoration: underline",
		OnOutStyle: "text-decoration: none"
	},

	AlphaChannel: "http://media.monster.com/mm/homepage/qs/spacer.png",
	MaxHeight : 17,
	ApplyIEFilter: function (El)
	{
		El.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + El.src + "', sizingMethod='image')";
		El.src = this.AlphaChannel;
	}
}; // TextNodeSkins class

var TVCheckBoxMenuSkins = {
	XPRoyale : {
		ContentBackgroundColor: "#AEC350",
		Cursor: "pointer",
		FontFamily: "Verdana",
		FontSize: "11px",
		FontColor: "#4B590E",
		Height: 17,
		Padding: "0px 3px 0px 3px",
		OnOverStyle: "text-decoration: underline",
		OnOutStyle: "text-decoration: none"
	},

	VistaAero : {
		ContentBackgroundColor: "white",
		Cursor: "pointer",
		FontFamily: "Verdana",
		FontSize: "11px",
		FontColor: "#333333",
		Height: 17,
		Padding: "0px 3px 0px 3px",
		OnOverStyle: "text-decoration: underline",
		OnOutStyle: "text-decoration: none"
	},

	AlphaChannel: "http://media.monster.com/mm/homepage/qs/spacer.png",
	MaxHeight : 17,
	ApplyIEFilter: function (El)
	{
		El.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + El.src + "', sizingMethod='image')";
		El.src = this.AlphaChannel;
	}
}; // TVCheckBoxMenuSkins class

function Parameter(paramName, paramValue)
{
	this.Name = paramName;
	this.Value = paramValue;
}



function CTextNode(Skin, Caption, Variable, TreeView)
{
	this.Caption = "";
	this.Element = null;
	this.Skin = Skin;
	this.Value = "";
	this.TreeView = TreeView;
	this.Variable = Variable;

	this.setCaption = function (caption)
	{
		this.Caption = caption;
		if (this.Element != null)
		{
			this.Element.innerHTML = this.Caption;
			this.Element.title = this.Caption;
		}
	}

	this.setValue = function(newValue)
	{
		this.Value = newValue;
		//this.Checkbox.value = this.Value;
	}

	this.Create = function()
	{
		this.Element = document.createElement("div");
		this.Element.style.padding = this.Skin.Padding;
		this.Element.style.styleFloat = "left";
		this.Element.style.cssFloat = "left";
		//this.Element.style.height = this.Skin.Height + "px";
		this.Element.style.height = "auto";
		this.Element.style.width = (this.TreeView.Container.Width - 40) + "px";
		this.Element.style.fontFamily = this.Skin.FontFamily;
		this.Element.style.fontSize = this.Skin.FontSize;
		this.Element.style.color = this.Skin.FontColor;
		this.Element.style.cursor = this.Skin.Cursor;
		this.Element.style.lineHeight = this.Skin.Height + "px";
		this.Element.innerHTML = this.Caption.Trunc(this.TreeView.Container.charCount + 5);
		this.Element.title = this.Caption;

		// Events
		this.Element.onmouseover = function(Caller) { return function() { System.DOM.AddStyle(Caller.Element, Caller.Skin.OnOverStyle); } } (this)
		this.Element.onmouseout = function(Caller) { return function() { System.DOM.ReplaceStyle(Caller.Element, Caller.Skin.OnOverStyle, Caller.Skin.OnOutStyle); } } (this)
		this.Element.onclick = function(Caller) { return function() { 
			
			if (this.previousSibling.innerHTML.indexOf(TreeViewSkins[Caller.Skin.Name].Expanded) > -1)
			{
				this.nextSibling.nextSibling.style.display = "none";
				this.previousSibling.innerHTML = this.previousSibling.innerHTML.replace(TreeViewSkins[Caller.Skin.Name].Expanded,TreeViewSkins[Caller.Skin.Name].Collapsed);
			} else {
				this.nextSibling.nextSibling.style.display = "block";
				this.previousSibling.innerHTML = this.previousSibling.innerHTML.replace(TreeViewSkins[Caller.Skin.Name].Collapsed,TreeViewSkins[Caller.Skin.Name].Expanded);
			}
		
		} } (this);
		//Caller.Checkbox.checked = !Caller.Checkbox.checked;	Caller.Checkbox.onclick();
	}

	if (typeof Caption != "undefined")
	{
		this.Caption = Caption;
		this.Create();
	}
}

function CCheckBoxTextNode(Skin, Caption, Variable, TreeView)
{
	this.Caption = "";
	this.Element = null;
	this.Skin = Skin;
	this.Value = "";
	this.TreeView = TreeView;
	this.Checkbox = null;
	this.Variable = Variable;

	this.FirstCaption = "";
	this.setCaption = function (caption)
	{
		this.Caption = caption;
		if (this.Element != null)
		{
			this.Element.innerHTML = this.Caption;
		}
		if (this.FirstCaption == "")
		{
			this.FirstCaption = this.Caption;
		}
	}

	this.setValue = function(newValue)
	{
		this.Value = newValue;
		this.Checkbox.value = this.Value;
	}

	this.Create = function()
	{
		this.Element = document.createElement("div");
		this.Element.style.padding = this.Skin.Padding;
		this.Element.style.styleFloat = "left";
		this.Element.style.cssFloat = "left";
		//this.Element.style.height = this.Skin.Height + "px";
		this.Element.style.height = "auto";
		this.Element.style.fontFamily = this.Skin.FontFamily;
		this.Element.style.fontSize = this.Skin.FontSize;
		this.Element.style.color = this.Skin.FontColor;
		this.Element.style.cursor = this.Skin.Cursor;
		this.Element.style.lineHeight = this.Skin.Height + "px";
		this.Element.style.overflow = "hidden";

		this.Checkbox = document.createElement("input");
		this.Checkbox.type = "checkbox";
		this.Checkbox.style.styleFloat = "left";
		this.Checkbox.style.cssFloat = "left";
		this.Checkbox.style.lineHeight = this.Skin.Height + "px";
		this.Checkbox.value = this.Value;
		this.Checkbox.name = this.Variable;

		this.TextNode = document.createElement("div");
		this.TextNode.style.padding = this.Skin.Padding;
		this.TextNode.style.styleFloat = "left";
		this.TextNode.style.cssFloat = "left";
		//this.TextNode.style.height = this.Skin.Height + "px";
		this.TextNode.style.height = "auto";
		this.TextNode.style.fontFamily = this.Skin.FontFamily;
		this.TextNode.style.fontSize = this.Skin.FontSize;
		this.TextNode.style.color = this.Skin.FontColor;
		this.TextNode.style.cursor = this.Skin.Cursor;
		this.TextNode.style.lineHeight = this.Skin.Height + "px";
		this.TextNode.style.width = "auto";
		this.TextNode.innerHTML = this.Caption.Trunc(this.TreeView.Container.charCount);
		this.TextNode.title = this.Caption;

		this.Element.appendChild(this.Checkbox);
		this.Element.appendChild(this.TextNode);



		// Events
		this.TextNode.onmouseover = function(Caller) { return function() { System.DOM.AddStyle(Caller.TextNode, Caller.Skin.OnOverStyle);  } } (this);
		this.TextNode.onmouseout = function(Caller) { return function() { System.DOM.ReplaceStyle(Caller.TextNode, Caller.Skin.OnOverStyle, Caller.Skin.OnOutStyle); } } (this);
		this.TextNode.onclick = function(Caller) { return function() {
			Caller.Checkbox.checked = !Caller.Checkbox.checked;

			Caller.Checkbox.onclick();

			} } (this);

		this.Checkbox.onclick = function(Caller) { return function() {
			var inc = (Caller.Checkbox.checked ? 1 : (Caller.TreeView.Tag == 0 ? 0 : -1));
			if (Caller.TreeView.Tag == "")
			{
				Caller.TreeView.Tag = 0;
			}
			Caller.TreeView.Tag += inc;
			if (Caller.TreeView.Tag < 21)
			{
				if (Caller.TreeView.Tag == 0)
				{
					Caller.TreeView.Container.setCaption(Caller.TreeView.Container.FirstCaption);
				} else Caller.TreeView.Container.setCaption(Caller.TreeView.Tag + Caller.TreeView.SelectionChange);
			} else
			{
				Caller.TreeView.Container.setCaption(Caller.TreeView.MaximumSelection);
				Caller.Checkbox.checked = false;
				Caller.TreeView.Tag--;
			}
			} } (this);

	}

	if (typeof Caption != "undefined")
	{
		this.Caption = Caption;
		this.Create();
	}
}

// Custom class for checkbox menu
function CCheckBoxMenu(Skin, TreeView)
{
	this.Item1Caption = "Deselect All";
	this.Item2Caption = "Close";
	this.Element = null;
	this.Skin = Skin;
	this.TreeView = TreeView;





	this.Create = function()
	{
		this.Item1 = document.createElement("div");
		this.Item1.style.padding = this.Skin.Padding;
		this.Item1.style.styleFloat = "left";
		this.Item1.style.cssFloat = "left";
		this.Item1.style.height = this.Skin.Height + "px";
		this.Item1.style.fontFamily = this.Skin.FontFamily;
		this.Item1.style.fontSize = this.Skin.FontSize;
		this.Item1.style.color = this.Skin.FontColor;
		this.Item1.style.cursor = this.Skin.Cursor;
		this.Item1.style.lineHeight = this.Skin.Height + "px";
		this.Item1.style.backgroundColor = this.Skin.ContentBackgroundColor;
		this.Item1.innerHTML = this.Item1Caption;

		// Events
		this.Item1.onmouseover = function(Caller) { return function() { System.DOM.AddStyle(Caller.Item1, Caller.Skin.OnOverStyle);} } (this);
		this.Item1.onmouseout = function(Caller) { return function() { System.DOM.ReplaceStyle(Caller.Item1, Caller.Skin.OnOverStyle, Caller.Skin.OnOutStyle); } } (this);
		this.Item1.onclick = function(Caller) { return function() {
				for (var i=0; i < Caller.TreeView.rootNode.Count; i++)
				{
					// 1 tier only - to edit in the future (recursive)
					if (Caller.TreeView.rootNode.children[i].Count > 0)
					{
						for (var j=0; j < Caller.TreeView.rootNode.children[i].Count; j++)
						{
							Caller.TreeView.rootNode.children[i].children[j].nodeItem.Checkbox.checked = false;
							Caller.TreeView.rootNode.children[i].children[j].nodeItem.Checkbox.onclick();
						}

					} else {
						Caller.TreeView.rootNode.children[i].nodeItem.Checkbox.checked = false;
						Caller.TreeView.rootNode.children[i].nodeItem.Checkbox.onclick();
					}

				}
				Caller.TreeView.Container.setCaption(Caller.TreeView.Container.FirstCaption);
			} } (this);

		this.Item2 = document.createElement("div");
		this.Item2.style.padding = this.Skin.Padding;
		this.Item2.style.styleFloat = "right";
		this.Item2.style.cssFloat = "right";
		this.Item2.style.height = this.Skin.Height + "px";
		this.Item2.style.fontFamily = this.Skin.FontFamily;
		this.Item2.style.fontSize = this.Skin.FontSize;
		this.Item2.style.color = this.Skin.FontColor;
		this.Item2.style.cursor = this.Skin.Cursor;
		this.Item2.style.lineHeight = this.Skin.Height + "px";
		this.Item2.style.backgroundColor = this.Skin.ContentBackgroundColor;
		this.Item2.innerHTML = this.Item2Caption;


		// Events
		this.Item2.onmouseover = function(Caller) { return function() { System.DOM.AddStyle(Caller.Item2, Caller.Skin.OnOverStyle); } } (this)
		this.Item2.onmouseout = function(Caller) { return function() { System.DOM.ReplaceStyle(Caller.Item2, Caller.Skin.OnOverStyle, Caller.Skin.OnOutStyle); } } (this);
		this.Item2.onclick = function(Caller) { return function() { Caller.TreeView.Container.MCCOpen(); } } (this);

		this.Element = document.createElement("div");
		this.Element.style.width = "100%";
		this.Element.style.height = this.Skin.Height + "px";
		this.Element.style.backgroundColor = this.Skin.ContentBackgroundColor;

		this.Element.appendChild(this.Item1);
		this.Element.appendChild(this.Item2);
	}
}


function CTreeViewNode(nodeValue, nodeItem)
{
	this.nodeValue = (typeof nodeValue == "undefined" ? null : nodeValue);
	this.nodeItem = (typeof nodeItem == "undefined" ? null : nodeItem);

	if (this.nodeItem != null)
	{
		if (this.nodeItem.Value == "") // exists but not set
		{
			this.nodeItem.setValue(this.nodeValue);
		}
	}
	this.children = null;
	this.Count = 0; // children count
	this.nodeParent = null;

	this.AddNode = function(nodeValue, nodeItem)
	{
		var t = new CTreeViewNode(nodeValue, nodeItem);
		t.nodeParent = this;
		if (this.children == null)
		{
			this.children = new Array();
		}

		this.children.push(t);
		this.Count = this.children.length;
		return t;
	}


} // CTreeViewNode()

function CTreeView(Skin)
{
	IContainer(this); //Inherit IContainer

	// CheckBox Specific
	this.ContentArea = null;
	this.Menu = null;
	//

	this.Skin = Skin;
	this.rootNode = null;
	this.Nodes = new Array();
	//temp
	this.Xpath = "";
	this.setXPath = function(s)
	{
		this.Xpath = s;
	}

	this.IdJoin = ".";
	this.setIdJoin = function(s)
	{
		this.IdJoin = s;
	}

	this.SelectionChange = " items selected";
	this.MaximumSelection = "Maximum items selected";

	//temp - may not be the best way
	this.Tag = ""; // all purpose variable

	this.AttachTo = function (Container)
	{
		this.Container = Container;
		//
	}

	this.Create = function()
	{
		this.Menu = new CCheckBoxMenu(TVCheckBoxMenuSkins.XPRoyale, this);
		this.Menu.Create();

		this.ContentArea = document.createElement("div");
		if (this.Container != null)
		{
			this.ContentArea.style.height = this.Container.ContentHeight  + "px";
		}
		this.ContentArea.style.width = "100%";
		this.ContentArea.style.backgroundColor = this.Skin.ContentBackgroundColor;

		this.ContentHolder = document.createElement("div");
		this.ContentHolder.style.height = (this.Container.ContentHeight-TVCheckBoxMenuSkins.XPRoyale.Height) + "px";
		this.ContentHolder.style.width = "100%";
		this.ContentHolder.style.backgroundColor = this.Skin.ContentBackgroundColor;
		this.ContentHolder.style.overflow = "scroll";
		this.ContentHolder.style.overflowX = "hidden";
		this.ContentHolder.style.overflowY = "scroll";

		this.ContentArea.appendChild(this.ContentHolder);
		this.ContentArea.appendChild(this.Menu.Element);

		this.Container.ContentHolder.appendChild(this.ContentArea);
		this.rootNode = new CTreeViewNode();

		this.CollapsedImg = document.createElement("img");
		this.CollapsedImg.style.width = this.Skin.ssWidth;
		this.CollapsedImg.style.height = this.Skin.ssHeight;
		this.CollapsedImg.style.verticalAlign = "middle";
		//this.CollapsedImg.style.position = "relative";
		//this.CollapsedImg.style.top = (System.OS.Browser == BT_IE ? "20%" : "25%");
		this.CollapsedImg.style.marginTop = "5px";
		//this.CollapsedImg.style.mar = "3px";
		this.CollapsedImg.src = this.Skin.Collapsed;


		this.ExpandedImg = document.createElement("img");
		this.ExpandedImg.style.width = this.Skin.isWidth;
		this.ExpandedImg.style.height = this.Skin.isHeight;
		this.ExpandedImg.style.verticalAlign = "middle";
		this.ExpandedImg.style.position = "relative";
		this.ExpandedImg.style.top = "25%";
		this.ExpandedImg.src = this.Skin.Expanded;

		this.Collapsed = document.createElement("div");
		//this.Collapsed.style.width = TreeViewSkins.MaxHeight + "px";
		this.Collapsed.style.height = TreeViewSkins.MaxHeight + "px";
		this.Collapsed.style.cssFloat = "left";
		this.Collapsed.style.styleFloat = "left";
		this.Collapsed.style.lineHeight = TreeViewSkins.MaxHeight + "px";
		this.Collapsed.style.margin = "0px 3px 0px 3px";
		this.Collapsed.appendChild(this.CollapsedImg.cloneNode(true));

		this.Expanded = document.createElement("div");
		this.Expanded.style.height = TreeViewSkins.MaxHeight + "px";
		this.Expanded.style.cssFloat = "left";
		this.Expanded.style.styleFloat = "left";
		this.Expanded.style.lineHeight = TreeViewSkins.MaxHeight + "px";
		this.Expanded.style.margin = "0px 3px 0px 3px";
		this.Expanded.appendChild(this.ExpandedImg.cloneNode(true));

	}

	this.PopulateFromXml = function(filename, variablename)
	{
		var request = System.Xml.HttpRequest();
		request.open("GET", filename, false);
		request.send(null);
		var xml = request.responseXML;
//		request.responseXML.setProperty("SelectionLanguage", "XPath");

		var TopNodes = System.Xml.selectNodes(xml, "//Items/Item");


		for (var i=0; i < TopNodes.length; i++)
		{
			var nodeTop = "";
			//alert(nodes[i].attributes[0].nodeValue);

			// title node
			var nodeVal;
			if (System.OS.Browser == BT_IE)
			{
				nodeVal = TopNodes[i].childNodes[0].nodeValue.Trim();
			} else {
				if (TopNodes[i].childNodes.length > 1)
				{
					nodeVal = TopNodes[i].childNodes[1].nodeValue.Trim(); // skip one node
				} else {
					nodeVal = TopNodes[i].childNodes[0].nodeValue.Trim(); // default to zero
				}

			}



			var SecNodes = System.Xml.selectNodes(xml, "//Items/Item[@id=" + TopNodes[i].attributes[0].nodeValue + "]/SubItem");

			if (SecNodes.length > 0)
			{

				nodeTop = this.rootNode.AddNode(TopNodes[i].attributes[0].nodeValue, new CTextNode(TextNodeSkins.XPRoyale, nodeVal, variablename, this));

				//k = 0;
				//alert(SecNodes.length);
				for (var k=0; k < SecNodes.length; k++)
				{
					nodeTop.AddNode(SecNodes[k].attributes[0].nodeValue, new CCheckBoxTextNode(TextNodeSkins.XPRoyale, SecNodes[k].text, variablename, this));
				}


			} else {
				nodeTop = this.rootNode.AddNode(TopNodes[i].attributes[0].nodeValue, new CCheckBoxTextNode(TextNodeSkins.XPRoyale, nodeVal, variablename, this));

			}

		}



	}

	this.RenderDeep = function(dNode, level)
	{
		var divC = document.createElement("div");
		divC.style.width = "100%";
		divC.style.paddingLeft = (9 * 2 + 4) + "px";

		for (var i=0; i < dNode.Count; i++)
		{
			var brclr = document.createElement("br");
			brclr.style.clear = "both";
			brclr.style.cssFloat = "none";
			brclr.style.styleFloat = "none";

			var img = this.Collapsed.cloneNode(true);

			if (dNode.children[i].Count > 0)
			{
				divC.appendChild(img);
			}

			divC.appendChild(dNode.children[i].nodeItem.Element);

			if (i < dNode.Count || dNode.children[i].Count > 0)
			{
				divC.appendChild(brclr);
			}

			if (dNode.children[i].Count > 0)
			{
				var divDeeper = this.RenderDeep(dNode.children[i], level+1);
				divDeeper.style.display = "none";
				divC.appendChild(divDeeper);
				img.onclick = function (Caller) { return function() {
					if (this.firstChild.src.indexOf(Caller.Skin.Expanded) > -1)
					{
						this.firstChild.src = Caller.Skin.Collapsed;
						this.nextSibling.nextSibling.nextSibling.style.display = "none";
					} else {
						this.firstChild.src = Caller.Skin.Expanded;
						this.nextSibling.nextSibling.nextSibling.style.display = "block";
					}
				} } (this);
			}
			//this.ContentHolder.appendChild(dNode.children[i].nodeItem.Element);
		}

		return divC;
	}



	this.Render = function()
	{


		var divC = document.createElement("div");
		divC.style.width = "100%";
		divC.style.paddingLeft = "0px";
		divC.style.paddingTop = "3px";

		var i = 0;

		for (i=0; i < this.rootNode.Count; i++)
		{
			var brclr = document.createElement("br");
			brclr.style.clear = "both";
			brclr.style.cssFloat = "none";
			brclr.style.styleFloat = "none";

			var img = this.Collapsed.cloneNode(true);

			if (this.rootNode.children[i].Count > 0)
			{
				divC.appendChild(img);
			}

			divC.appendChild(this.rootNode.children[i].nodeItem.Element);
			if (i < this.rootNode.Count-1 || this.rootNode.children[i].Count > 0)
			{
				divC.appendChild(brclr);
			}
			if (this.rootNode.children[i].Count > 0)
			{
				var divDeeper = this.RenderDeep(this.rootNode.children[i], 1);
				divDeeper.style.display = "none";
				divC.appendChild(divDeeper);
				img.onclick = function (Caller) { return function() {
					if (this.firstChild.src.indexOf(Caller.Skin.Expanded) > -1)
					{
						this.firstChild.src = Caller.Skin.Collapsed;
						this.nextSibling.nextSibling.nextSibling.style.display = "none";
					} else {
						this.firstChild.src = Caller.Skin.Expanded;
						this.nextSibling.nextSibling.nextSibling.style.display = "block";
					}
				} } (this);
			}
		}

		this.ContentHolder.appendChild(divC);
	}


} // CTreeView()// /js/namespaces/components/components.js

//CMonsterComponents.prototype.RadioButton = CRadioButton;
//CMonsterComponents.prototype.RadioSet = CRadioSet;
//CMonsterComponents.prototype.ComboBox = CComboBox;
//CMonsterComponents.prototype.TreeView = CTreeView;
//CMonsterComponents.prototype.TreeViewNode = CTreeViewNode;
CMonsterComponents.prototype.jComboBox = CjComboBox;
CMonsterComponents.prototype.TreeView = CTreeView;
//CMonsterComponents.prototype.TreeViewNode = CTreeViewNode;



