Shadowbox.init({
    handleOversize: "drag"
});
Shadowbox.skin.markup = '<div id="sb-container"><div id="sb-overlay"></div><div id="sb-wrapper"><div id="sb-title"><div id="sb-title-inner"></div><a id="sb-nav-close" title="{close}" onclick="Shadowbox.close()"></a></div><div id="sb-wrapper-inner"><div id="sb-body"><div id="sb-body-inner"></div><div id="sb-loading"><div id="sb-loading-inner"><span>{loading}</span></div></div></div></div><div id="sb-info"><div id="sb-info-inner"><div id="sb-counter"></div><div id="sb-nav"><a id="sb-nav-next" title="{next}" onclick="Shadowbox.next()">{next}</a><a id="sb-nav-play" title="{play}" onclick="Shadowbox.play()"></a><a id="sb-nav-pause" title="{pause}" onclick="Shadowbox.pause()"></a><a id="sb-nav-previous" title="{previous}" onclick="Shadowbox.previous()">{previous}</a></div></div></div></div></div>';

var query = new Object();
window.location.search.replace(
new RegExp( "([^?=&]+)(=([^&]*))?", 'g' ),
	function( $0, $1, $2, $3 ){
		query[ $1 ] = $3;
	}
);
easing = query['e'] || 'Expo';

function loadEasing(e) {
	location.href = location.pathname+'?e='+e;
}

$(function(){ 
	// find all the input elements with title attributes
	$('input[title!=""]').hint();
});

function stickyBar() {
	if ($('#footer').viewportOffset().top > $(window).height() ) {
		// elem is below the fold.
		$('#stickybar').attr('style', 'position: fixed; bottom: 0; width: 0;');
	} else {
		// elem is above the fold.
		$('#stickybar').attr('style', 'position: static;');
	}
};

$(document).ready(function(){
	// sticky shopping basket
	stickyBar();
	$(window).bind('resize', function() {
		stickyBar();
	});
	$(window).scroll(function () { 
		stickyBar();
	});

});

/*** alternates tablerows in tables with the class datasheet ***/
$(function() {
  $("table.datasheet tr:nth-child(even)").addClass("striped");
});

$(function(){
$(".outofstock").tipTip({maxWidth: "auto", edgeOffset: 10, delay: 25, defaultPosition: "top"});});

/*** urlify a string ***/
function string_to_url (str, obj) {
	/*
	This method will accept two parameters
	Parameters:
		str -- the string to convert to an url friendly string
		obj -- the object to which we want to update the value
	
	Sideeffects:
		Overvriting the value of the 'obj' object
	*/
		str = encodeURIComponent(str).replace(/%C3%A6/, 'ae').
									  replace(/^%20/g, '').
									  replace(/%20$/g, '').
									  replace(/%C3%B8/g, 'oe').
									  replace(/%C3%A5/g, 'aa').
									  replace(/%C3%86/, 'AE').
									  replace(/%C3%98/g, 'OE').
									  replace(/%C3%85/g, 'AA').
									  replace(/%20/g, '-').
									  replace(/%\S\S%\S\S/g, '').
									  replace(/%\S\S/g, '').
									  replace(/[^a-zA-Z0-9\-]/g, '');
		obj.value = str;
}
 

