$(document).ready(function() {	

// product content module
$('#content > div').hide();
  $('#menu a').click(function() {
    var $this = $(this);
    var hash = $this.attr('href');
    $(hash).siblings(':visible').hide();
    $(hash).slideDown('fast');
    $('#navigation a').removeClass('active');
    $this.addClass('active');
    return false;
  });
  $('#content > div.show').show();
  
  // quick finder tabs module
$(function () {
	var tabContainers = $('div#quick-find > div.body');
	
	$('div#quick-find div.tabs a').click(function () {
		tabContainers.hide();
		tabContainers.filter(this.hash).show();
		$('div#quick-find div.tabs a').removeClass('active');
		$(this).addClass('active');
		return false;
	});
});

});


function gotoCountrySelection(currentselection) {
//takes user to selected country
}

var quicklinks_array = new Array('#', '#', 'http://agproducts.basf.us/information/solution-guides/solutions-guides-landing.html', 'http://agproducts.basf.us/contactUs.html', '#', '#', 'http://www.betterplants.com', 'http://www.pestcontrolfacts.org', 'http://www.betterturf.com', 'http://www.vmanswers.com', '#', 'http://www.agro.basf.com', 'http://www.basf.us', 'http://www.basfpublichealth.com/', 'http://agproducts.basf.us/safety-resources.html', 'http://www.pesweb.info/?mysite=BASF', 'http://www.webfulfillment.com/theAlanCo/Basf/');
function gotoLocation(location) {
	document.location.href = location;
}
function gotoQuickLinks(currselection) {
	if ((currselection.value  == 0) || 
		(currselection.value  == 1) || 
		(currselection.value  == 4) || 
		(currselection.value  == 5) || 
		(currselection.value  == 10)) {
		
		//Do nothing for now
	} else {
		gotoLocation(quicklinks_array[currselection.value]);
	}
}


function redirect(){
	var homepage = "http://agproducts.basf.us/";
	var currenturl = location.href;

	if( currenturl.lastIndexOf(homepage) < 0){
		var newurl = currenturl.substring(7);
		newurl = newurl.replace(newurl.substring(0, newurl.indexOf("/")+1), "");
		
		window.location = homepage + newurl;
	}

}