/**
* Visit Bath - Primary functions to be included in the header
* Functions that need to be available earlier, i.e. they are included in the displays.xml 
*
*/
NewMind.registerNameSpace("NewMind.Site");

/**
* Dirty hack to remove the "Any" option from Category
* dropdown lists. To use this, insert a method call into the displays.xml - eg.
*			<filter id="customhtml">
*				<![CDATA[<script language="javascript">NewMind.Site.HideCategoryAnyOption();</script>]]>
*			</filter>
*
**/
NewMind.Site.HideCategoryAnyOption = function() {
	var strId = "AdjCatOpt" + parseInt(Math.random() * 1000000000, 10);
	document.write("<div id=\"" + strId + "\"><!-- --></div>");
	setTimeout(function() {

		var objEle = document.getElementById(strId);
		if (!objEle) {
			return;
		}

		$(objEle).parents('div.sys_control').find("select#src_category").each(function() {
			if (this.options.length > 1 && this.options.length <= 3) {
				this.remove(0);
			}
			if (this.options.length >= 1 && this.options.length <= 3) {
				this.selectedIndex = 0;
			}
		});

	}, 1);
};

