function init() 
{	
	$("#globalNav ul li a:last").css("border","none");   
	$("#localNav ul li.active ul li:last").css("borderBottom","none");   
	$(".colRight #localNav ul li.active ul li:last").css("borderBottom","none");
	
	var sInputL = 'Uw e-mailadres...';
	
	$('#emailAddress').focus(function(){		
		if ($('#emailAddress').val()==sInputL){
			$('#emailAddress').val('');
		}
	}).blur(function(){
		if ($('#emailAddress').val()==''){
			$('#emailAddress').val(sInputL);
		}
	});	

	$('.tooltip').tooltip({
		track: false, 
		delay: 0, 
		fade: 100 
	});	

	$('.focusElement').focus(function(){
		if ($(this).val() == $(this).attr('title'))
			$(this).val('');		
	}).blur(function(){		
		if ($(this).val() == '')
			$(this).val($(this).attr('title'));
	});	

	$("input[type=text].spinner").each(function() {$(this).spinner({max: 100, min: 1}).parent().find("button").html("");});		
	
	$("input").focus(function() {$(this).addClass("focus");});
	$("input").blur(function() {$(this).removeClass("focus");});
	$("textarea").focus(function() {$(this).addClass("focus");});
	$("textarea").blur(function() {$(this).removeClass("focus");});	
	
	$(document).pngFix(); 	
}

$(document).ready(function() 
{
	init();	
	
	$('#carouselList').jcarousel({
		scroll: 1,
		auto: 5,
		wrap: 'last',
		initCallback: mycarousel_initCallback
	});
	
	function mycarousel_initCallback(carousel) {	
		//$('#thumbList a').bind('click', function() {			
		//	var sVal = $(this).attr("value")
		//	carousel.scroll($.jcarousel.intval(sVal));			
		//	return false;
		//});	
	}	
	
	$(".categoryContent").expandableText({width: 700, height: 60}).show();
				
	$('#productItem a[rel=lightbox]').lightbox({});
	
	$("a.zoom").click(function()
	{
		$("#productItem a[rel=lightbox]").trigger("click");
	});
});


function goFormSpecialPrice(sUrl, id, h){
	

	location.href=sUrl +'?id='+id+'&h='+h;
	
}

(function($) {
	// jQuery plugin definition
	$.fn.expandableText = function(params) {
		// merge default and user parameters
		params = $.extend( {
			width: 300, 
			height: 45,
			more: 'Lees meer...',
			less: 'Inklappen...'
		}, params);
		// traverse all nodes
		this.each(function() {
			// express a single node as a jQuery object
			el = $(this);
			var self = this;
			self.params = params;
			self.longText = escape(el.html());
			self.shortText = '';
			var splitText = self.longText.split('%20');

			el.width(params.width).html('').height('');
			var i = 0;
			var text = '';
			$.each(splitText, function(index, value){
				text += value + ' ';
				el.html(text + params.more);
				++i;
				if (el.height() > params.height) {
					return false;
				} else {
					self.shortText = text;
				}
			});
			if (i < splitText.length)
				lessClick(self, el);
			else
				el.html(unescape(self.longText));
		});
		// allow jQuery chaining
		return this;
	};
	
	function moreClick($this, elem) {
		var less = $('<a></a>').html($this.params.less).attr('href','javascript:;').click(function(){
			lessClick($this, elem);
		});
		elem.empty().html(unescape($this.longText)).append(less);
	}
	
	function lessClick($this, elem) {
		var more = $('<a></a>').html($this.params.more).attr('href','javascript:;').click(function(){
			moreClick($this, elem);
		});			
		elem.empty().html(unescape($this.shortText)).append(more);
	}
	
})(jQuery);

