// Top search bar
$(document).ready(function() {
	$('#ZoekInput').focus(function() {
		if ( $('#ZoekInput').val() == "Zoeken..." ) {
			$('#ZoekInput').val("");
			$('#ZoekInput').css("color","#000");			
		}
	});
	
	$('#ZoekInput').blur(function() {
		if ( $('#ZoekInput').val() == "" ) {
			$('#ZoekInput').val("Zoeken...");
			$('#ZoekInput').css("color","#b8b8b8");			
		}
	});
});


// Artikel info image switch
$(document).ready(function() {
	$(".afbeeldingen .afbeelding_thumb .thumb").hover(function() {	
		$(".afbeeldingen .afbeelding_big").html( $(this).html().replace(/width="50"/g, 'width="200"').replace(/height="50"/g, 'height="200"') );
		// Reload Lightbox, om de afbeelding goed te houden :)
		$('a[rel=lightbox]').lightBox();
	});
});

// Lightbox init
$(document).ready(function() {
	$('a[rel=lightbox]').lightBox();
});

// Flash popup
function popFlash(flash){
	newwindow2=window.open('','name','height=620,width=600, scrollbars=no');
	var nu = new Date();
	var tijd = nu.getHours() +":" +nu.getMinutes() +":" +nu.getSeconds()
	var strHTML = "<html><head><title>Flashview</title></head>";
	strHTML += "<body leftmargin=0 rightmargin=0 topmargin=0 onblur=\"window.top.close();\">";

	strHTML += "<object width=\"620\" height=\"600\" >";
	strHTML += "<param name=\"movie\" value=\"" + flash + "\">";
	strHTML += "<embed src=\"" + flash + "\" width=\"620\" height=\"600\">";
	strHTML += "</embed>";
	strHTML += "</object>";

	strHTML += "</body>";
	strHTML += "</html>";
	newwindow2.document.write(strHTML);
	// newwindow2.document.close();
	// if (window.focus) {newwindow2.focus()}
	return false;
}

// Winkelwagen functies
function bagDelete(){
	if (confirm('Weet u zeker dat u uw winkelwagen wilt leegmaken?')){
		location.href = '/cat/front/bag_item_delete.asp?id=all';
	}
	return;
}

function bagRecalc(){
	document.bagFrm.action = '/cat/front/bag_recalc.asp';
	document.bagFrm.submit();
	return;
}

function bagCheckout(){
	location.href = '/inloggen.html';
	return;
}

jQuery(document).ready(function() {
	setTimeout("SwitchItem()", 5000);
	setTimeout("fadeOut()", 4500);
});

function SwitchItem () {		
	// Ajax request
	jQuery.ajax({
		url: '/ajax/GetItem.asp',  
			cache: false,
				success: function(data) { // Success functie
			jQuery('.productenHome').html(data);		
			$('.productenHome').fadeIn('slow', function() {
      // Animation complete.
    });				

		setTimeout("SwitchItem()", 5000);
		} // Success functie		
	}); // Ajax request
}


function fadeOut () {
	$('.productenHome').fadeOut('slow', function() {
     // Animation complete
  });
}
