$(document).ready(function() {
	if($("div#side_content li a[@href="+document.location+"]")) {
	   	$("div#side_content li a[@href="+document.location+"]").click(function() {
			return false;
		}).each(function() {
			var p = $(this).parent("li");
			if (p.hasClass('ask-seller')) return;
			p.addClass("current");
			setTimeout(function() {p.css("height", "2.5em");}, 0);
		});
	}

	// text-overflow fix for firefox
	if (document.getBoxObjectFor && window.openDialog && $(".trimSingle")) {
		var textOverflowNS = 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul';
		var textOverflowXML =  document.createElementNS(textOverflowNS, 'window');
		var textOverflowLabel = document.createElementNS(textOverflowNS, 'description');

		textOverflowLabel.setAttribute('crop','end');
		textOverflowXML.appendChild(textOverflowLabel);
		textOverflowTarget = function(e, over, text) {
			(e.firstChild && e.firstChild.innerHTML == text)
				? textOverflowTarget(e.firstChild, over, text)
				: $(e).html('').append(over);
		}
		$(".trimSingle").each(function() {
			if ($(this).attr("trimmed") == "true") return;
			var over = textOverflowXML.cloneNode(true);
			var text = $(this).text();
			over.firstChild.setAttribute('value', text);
			textOverflowTarget(this, over, text);
			$(this).attr("trimmed", "true").attr("title", text);
		});
	}
	
	// table-text overflow width fix
	$('table.overflow').each(function(){
		$('td.rightWidth', this).width($('td.rightWidth span', this).outerWidth(true));
	});
	
	var lb = $(".lightbox");
	if (lb && lb.length) lb.lightbox();
});

function findChild(element, tagName, classSearch){
			
	var children = element.getElementsByTagName(tagName)
	var className
	for (var i = 0; i < children.length; i++) {
	
	
		var child = children[i]
		
		if (child.getAttribute("class")){
			className = child.getAttribute("class")
		}else if(child.getAttribute("className")){
			className = child.getAttribute("className")
		}else{
			continue
		}
			
		if(className.indexOf(classSearch) >= 0)
			return child
	}
	return null
}

function hideSuccessBox(){
	var suc = document.getElementById('success')
	if(suc)
		document.getElementById('success').style['display'] = 'none';
}

