/**
*  Selection of AHK welcome page
*/
$(function() { 
	var ahk_select	= "select[name='portal']";
	$("#portal_button").click(function(){
		var ahk_selection = $(ahk_select + " option:selected").attr("value");
		if (ahk_selection != 0) {
			window.location = 'http://'+ahk_selection+'.renewablesb2b.com';
		}
	});
});

$(document).ready(function() {
	$(function() {
		$("a.welcometooltip").tooltip({ 
			bodyHandler: function() { 
			return $(this).attr("value"); 
		}, 
		showURL: false 
		});
	});
	
	$(function() {
		$("img.welcometooltip").tooltip({ 
			bodyHandler: function() { 
			return $(this).attr("value"); 
		}, 
		showURL: false 
		});
	});
	
	/**
	* Initial selection for welcome page if locale is detected
	*/
	$(function() {
		var ahk_select	= "select[name='portal']";
		var locale_detection = $("#detected_country").attr("value");
		$(ahk_select+" option[value="+locale_detection+"]").attr('selected', 'selected');
	});
	
	$(".section_portal").hoverIntent({
		sensitivity: 3,  
		over: function(){
			$(".section_portal").children("h2").slideUp(350);
			$(".section_portal").children("div").slideDown(350);
		},
		out: function(){
			$(".section_portal").children("h2").slideDown(350);
			$(".section_portal").children("div").slideUp(350);
		}
	});
	
	$(".section_marketplace").hoverIntent({
		sensitivity: 3,  
		over: function(){
			$(".section_marketplace").children("h2").slideUp(350);
			$(".section_marketplace").children("div").slideDown(350);
		},
		out: function(){
			$(".section_marketplace").children("h2").slideDown(350);
			$(".section_marketplace").children("div").slideUp(350);
		}
	});
});