//jjk
function getParent(el, tag)
{
	if(el == null) {
		return null;
	} else if(el.nodeType == 1 && el.tagName.toLowerCase() == tag.toLowerCase())
	{
		return el;
	} else {
		return getParent(el.parentNode, tag);
	}
}

function highlightrow(e) {
	if (e != null) {
		getParent(e, "tr").className = getParent(e, "div").className+"_hl";
		//DT, 23/01/2008, TEST
		//alert("DT: The row is now highlighted!");
	}
}

function lowlightrow(e) {
	if (e != null) {
		getParent(e, "tr").className = getParent(e, "div").className+"_ll";		
	}
}

function UpdateList(Parent, Child)
{
	document.all(Child).innerHTML = "";

	if(window[Child+"_values"])
	{
		var option = document.createElement("OPTION");
			
		option.value="";
		option.text="";
		document.all(Child).add(option);
				
		for(x=0;x<window[Child+"_values"].length;x++)
		{
			//if(document.all(Parent).options[document.all(Parent).selectedIndex].text == window[Child+"_filters"][x])
			if(document.all(Parent).value == window[Child+"_filters"][x])
			{
				var option = document.createElement("OPTION");
			
				option.value=window[Child+"_values"][x];
				option.text=window[Child+"_texts"][x];
				document.all(Child).add(option);
			}
		}
	}

}

var tsp = 0;


function showHide(id){

	// To determinate if this is a tailoredsearchpanel and hide previous one.
	// Be carefull when changing the HTML as this is checking for a <DIV> tag.
	if(id != "")
	{
		if(document.all[id].innerHTML.indexOf("<DIV class=tailoredsearchpanel>")  == 0)
		{
			if (document.all[id].style.display == "block")
			{
				document.getElementById("tbl_"+id).className = "";			
			}
			else
			{
				document.getElementById("tbl_"+id).className = "quicksearchhdr";
			}	
		
			if(tsp != 0 && tsp != id)
			{
				document.getElementById("tbl_"+tsp).className = "";
				document.all[tsp].style.display = "none";
				eval("document.img" + tsp + ".src='Images/select.gif'"); 
				eval("document.img" + tsp + ".title='Click to expand'"); 
				tsp = id;
			}
			else
			{
				tsp= id;
			}
		}
	
		// determine display type & return display state to browser
		if (document.all[id].style.display == "block"){
			document.all[id].style.display = "none";
			eval("document.img" + id + ".src='Images/select.gif'"); 
			eval("document.img" + id + ".title='Click to expand'"); 
			return;
		}
		else{
			document.all[id].style.display = "block";
			eval("document.img" + id + ".src='Images/select2.gif'"); 
			eval("document.img" + id + ".title='Click to reduce'"); 
			return;
		}
	}
}


function checkConSearch(e) {
	if (e.value.length < 1) {
		alert("Please enter some text to search for.");
		return false;
	} else {
		return true;
	}
	
	//alert(trim(document.getElementById("Content").value).length);
	/*
	if (document.getElementById("Content").value.trim().length < 1) {
		alert("blah");
	} */
}
