function addWoonderland( ) {
	var woo = $( "#woonderland" );
	if ( !woo ) return;
	var text = woo.find( "p" );
	// Only add CSS if JS is enabled
	woo.addClass( "woonderland" );
	woo.hover(function() {
		text.slideDown( 150 );
		this.$events.onmouseover = null;
	}, function() {
		text.slideUp( 300 );
		this.$events.onmouseout = null;
	}
	);
	woo.click(function() {
		window.open( "http://www.woonderland.com" );
	});
	text.addClass( "woonderland_text" );
};
$(addWoonderland);

function addHomeButton( ) {
	$( "#logo" ).click(function() {
		window.location.href = "http://www.woo.se";
	});
}
$(addHomeButton);

/* ______________________________________________________________
   SUBMENU 
*/

function addClearFloat( ) {
	$( "#body" ).append( "<div class='clearfloat'></div>" );
}
//$(addClearFloat);

function addExpanders( color ) {
	$(".expanding_description").each(function(i) {
		var selectedId = "description_" + i;
		var icon = $("<img src='/graphics/buttons/info_" + color + ".gif' alt='Information' class='info' id='info_" + selectedId+ "' /><div class=\"clearfloat\" />");
		$(this).css('display', 'none');
		$(icon).click(function() {
			expand(this);
		});
		$(this).before(icon);
		$(this).after("<div class=\"clearfloat\" />");
	});
}
function expand(target) {
	var grabId = $(target).attr('id');
	var theTarget = $('#'+grabId).parent().find('.expanding_description');
	if ($(theTarget).css('display') == 'none') {
		$(theTarget).slideDown(350);
	} else {
		$(theTarget).slideUp(400);
	}
}

function contact_seller(email,title) {
	open("../pages/contact_seller.php?email=" + email + "&title=" + title,"Contact seller","width=450,height=460");
}


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.setAttribute("target","_blank");
	}
}
$(externalLinks);