// JavaScript Document

//ie fix for category dropdown

		function fixIeDropDown(select){

			var select = (typeof select == "string") ? document.getElementById(select) : select;

			// THIS FUNCTION IS ONLY CONCERNED WITH INTERNET EXPLORER NON-MULTIPLE SELECT NODES THAT HAVE A SPECIFIC WIDTH DEFINED
			if(!select.attachEvent || navigator.userAgent.indexOf("Opera") > -1 || select.multiple || select.currentStyle.width == "auto") { return; }

			var body = document.getElementsByTagName("body").item(0);

			var si = select.selectedIndex;

			var clone = select.cloneNode(true);
			clone.style.position = "absolute";
			clone.style.visibility = "hidden";
			clone.style.width = "auto";
			body.appendChild(clone);

			clone._initialOffsetWidth = select.offsetWidth;
			clone._initialOffsetHeight = select.offsetHeight;
			clone._autoWidth = clone.offsetWidth;

			clone = body.removeChild(clone);
			clone.style.visibility = "visible";
			clone.style.width = clone._initialOffsetWidth + "px";

			var span = document.createElement("span");
			span._isIeDropDownContainer = true;
			span.style.position = "relative";
			span.style.width = clone._initialOffsetWidth + "px";
			span.style.height = clone._initialOffsetHeight + "px";
			span.style.marginBottom = "-4"; //hmm...quirky...
			span.appendChild(clone);

			if (select.parentNode._isIeDropDownContainer){
				select.parentNode.parentNode.replaceChild(span, select.parentNode);
			}else{
				select.parentNode.replaceChild(span, select);
			}

			if (clone._autoWidth > clone._initialOffsetWidth){
				var expand = function(){
					event.srcElement.parentNode.style.zIndex = 1;
					event.srcElement.style.width = "auto";
					if (event.srcElement.offsetWidth > event.srcElement._initialOffsetWidth){
						event.srcElement.style.width = "auto";
					}else{
						event.srcElement.style.width = event.srcElement._initialOffsetWidth + "px";
					}
				};
				var contract = function(){
					event.srcElement.parentNode.style.zIndex = 0;
					event.srcElement.style.width = event.srcElement._initialOffsetWidth + "px";
				};
				clone.attachEvent("onactivate", expand);
				clone.attachEvent("ondeactivate", contract);
			}
			clone.selectedIndex = si;
		}

		window.onload = function(){
			fixIeDropDown("category");
		};



function doLoc(loc)
{
	var loc = encodeURIComponent(document.forms.catsel.category.value);
	if (document.forms.catsel.category.value == "0"){
			//window.location	= "Please select a category";
	}
	else{
		//alert (loc);
	window.location	= loc;
	}

}

function dofadein(id)

{
new Effect.Appear(document.getElementById(id), { duration: 1.0 });
}
function dofadeout(id)

{
new Effect.Fade(document.getElementById(id), { duration: 1.0 });
}

 function toggle_off(id) {
       var e = document.getElementById(id);
          e.style.display = 'none';
    }
 function toggle_on(id) {
       var e = document.getElementById(id);
          e.style.display = 'block';
    }
	
	function doSearch()
{
		document.forms.jsearch.action = "manwalksintoajoke_jokeresults.asp";
					document.jsearch.method = "post";
					document.jsearch.submit();
}
	function doRandom()
{
		document.jsearch.action = "manwalksintoajoke_jokestart.asp";
					document.jsearch.method = "post";
					document.jsearch.submit();
}
	function doJOTDemail()
{
		document.forms.jotdh.action = "manwalksintoajoke_jokeoftheday.asp";
					document.jotdh.method = "post";
					document.jotdh.submit();
}