
function window_pop(){
if (document.getElementById('email_address').value.length > 3)
{
window.open('constant.aspx?email=' + document.getElementById('email_address').value,'','width=600, height=530')
document.getElementById('email_address').value = ''
}

return false
}

var bannercount = 0;
var xmlhttp
function content_swap(cat_guid){


if( bannercount > 1 && document.getElementById('pop_over')) {
	document.getElementById('pop_over').style.display = "none";
}

bannercount = bannercount + 1;

xmlhttp=null
// code for new browsers, FF, IE7..
if (window.XMLHttpRequest)
  {
  xmlhttp = new XMLHttpRequest()

  }
// code for old browsers, IE6
else if (window.ActiveXObject)
  {

    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

  }
if (xmlhttp!=null)
  {

  xmlhttp.open("GET","homeswap.aspx?caption=Show&cat_guid=" + cat_guid + "&moddate=" + Math.floor(Math.random()*1000),true)

 xmlhttp.onreadystatechange=state_Changer
  xmlhttp.send(null)

  }
else
  {
  //alert("Your browser does not support the Maniac Store.")
  }
}

function state_Changer()
{
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4)

  {
  // if "OK"

  if (xmlhttp.status==200)
  
  {
 //document.getElementById('image_area').value = xmlhttp.responseText
  document.getElementById('dynamic_content').innerHTML = xmlhttp.responseText;

  }
  else
  {
 // alert("Problem retrieving metadata:" + xmlhttp.statusText)

  }
  }
}


function quick_swap() {
document.getElementById('dynamic_display').innerHTML = document.getElementById('dynamic_content').innerHTML.replace("quick_swap","cancelit")
}

function cancelit(){

}

function image_swap(image_guid){
document.getElementById('mainimage').src = 'images/products/' + image_guid
}




// jQuery functions
$(document).ready(function(){
	// png fix
	$("span#overlay").ifixpng();
	$("#racing_logo").ifixpng();
	
	// drop down menus
		// we initially hide all of the menus in the style sheet with display: none	
		// then we create the buttons
		$("#btn-products, #btn-industries, #btn-news").hover(
			function() { 
				$("ul", this).show();
			},
			function() {
				$("ul", this).hide();
			}
		);

	// manipulate thumbnail photos
	$(".thumb:first").css({width: '121px'});
	$(".thumb:last").css({width: '121px', border: 'none'});
	
	//
	$(".product-overview:last").css({border: 'none'});
	
	// manipulating industry list (product detail page)
	$(".text ul.industry-list li:last-child").css({margin: '0', padding: '0', background: 'none'});
	$(".text ul.industry-list li").append('<span>,&nbsp;</span>');
	$(".text ul.industry-list li:last-child span").replaceWith('');
	
	// manipulating related products list (industry detail page)
	$(".text ul.related-products li:last-child").css({margin: '0', padding: '0', background: 'none'});
	
	// news item show/hide
	$(".news-article").hide();
	$(".news-title").click(function(){ 
		$(this).next(".news-article").toggle();
		$(this).toggleClass("open");
		return false;
	});
	
	// manipulate drop down menus
	$("#nav ul li ul li:last-child").css({border: 'none'});
	$("#nav ul li ul li:last-child a").css({border: 'none'});
	
	// contact us callout show/hide
	//$("#directions").hide();
	//$("#contact-info").show();

	$("#get-contact-info").click(function(){
		$("#contact-info").show();
		$("#directions").hide();
		return false;
	});

	$("#get-directions").click(function(){
		$("#contact-info").hide();
		$("#directions").show();
		return false;
	});
	

});

