
Cufon.replace(['.main_banner p', '.winter_sale h1', '.winter_sale h2'], {fontFamily: 'ITC Avant Garde Gothic Std Medium', hover: true});
Cufon.replace(['#menu ul li','#left_menu h3','#main_banner p','#Bread_container h1'], {fontFamily: 'ITC Avant Garde Gothic Std Book', hover: true});
Cufon.replace(['.main_banner h1','#body_text h2','.watermark'], {fontFamily: 'ITC Avant Garde Gothic Std Extra Light', hover: true});
Cufon.replace(['#product_container .product span'], {fontFamily: 'Arial', hover: true});
Cufon.replace(['#body_text h1'], {fontFamily: 'ITC Avant Garde Gothic Std Book'});
Cufon.replace(['#body_text h2'], {fontFamily: 'Arial'});
Cufon.replace(['#body_text h3'], {fontFamily: 'ITC Avant Garde Gothic Std Book'});

// General extension to get URL variables
$.extend({
  getUrlVars: function(){
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
      hash = hashes[i].split('=');
      vars.push(hash[0]);
      vars[hash[0]] = hash[1];
    }
    return vars;
  },
  getUrlVar: function(name){
    return $.getUrlVars()[name];
  }
});

$(window).load(function(){
	
	//SIZE DROPDOWN
	$('div.filtersize_dropdown').click(function() {
		$(this).addClass("filtersize_dropdown_hover");
	});
	$('div.filtersize_dropdown').hover(function(){
		//$(this).addClass("filtersize_dropdown_hover");
	},function(){
		$(this).removeClass("filtersize_dropdown_hover");
	});	
	
	$('#form_filter').submit(function(){
		var szSearchUrl = $(this).attr('action');
		if ($('#searchvalue').val() != 'Zoekterm')
			szSearchUrl += (szSearchUrl.indexOf('?') >= 0 ? '&' : '?') + 'search=' + escape($('#searchvalue').val());
		document.location = szSearchUrl;
		return false;
	});
});

jQuery.fn.Loading = function() {
	$(this).prepend('<div class="loading"><img src="/Kinderschoenen/kinderschoenen.com/gfx/images/loading.gif" width="32" height="32" /></div>');
}

function InitializeProductPagers() {
	$('div.product_container .paging a').click(function(){
		var szAjaxUrl = $(this).attr('href');
		szAjaxUrl += (szAjaxUrl.indexOf('?') >= 0 ? '&' : '?') + 'view=ajax&dt=' + new Date();
		$('div.product_container').Loading();
		$.get(szAjaxUrl, function(szData) {
			$('div.product_container').html(szData);
			$('div.product_container .dialog_link').click(function(event){
				event.preventDefault();	
				$("#dialog")
					.html("LOADING...")
					.load($(this).attr("href") + "&view=ajax&dt=" + new Date().getTime(), function(){ InitializeDynamicBindings(); })
					.dialog('open');	
			});
			InitializeProductPagers();
		});
		return false;
	});
}

$(document).ready(function(){
	InitializeProductPagers();
});

