// JavaScript Document

//hide and show category lists on click

$(document).ready(function() {
  $('div#cContent> div').hide();  
  $('div#cContent> div.current').show();
  $('div#cContent> h3').click(function() {
    $(this).next('div').slideToggle()
    .siblings('div:visible').slideUp();
  });
});


//open external links in new window
function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank"; 
 } 
} 
window.onload = externalLinks;

//dropdown menu
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


//slide in email form 
$(document).ready(function(){

	$("#box-button").click(function(){
		if ($("#signUp").is(":hidden")){
			$("#signUp").slideDown("slow");
		}
		else{
			$("#signUp").slideUp("slow");
		}
	});
	
});

function closeForm(){
    setTimeout('$("#signUp").slideUp("slow")', 2000);
}


//hide and show bid form
$(document).ready(function(){

	$("div.bid-form").css("display","none");
	  
	$("div.bid a").click(function(){
		if ($("div.bid-form").is(":hidden")){
			$("div.bid-form").slideDown("slow");
		}
		else{
			$("div.bid-form").slideUp("slow");
		}
	});
	
});
