// No Conflict
var $j = jQuery.noConflict();
var herbez =false;
jQuery.validator.addMethod("defaultInvalid", function(value, element) 
    {
     switch (element.value) 
     {
      case "Voer uw naam":
       if (element.name == "element_name") return false;
       break;

       default: return true; 
       break;

     }
    });





$j(document).ready(function() {
			

						
	$j("#nieuwsbrief-aanmelden").validate({
		rules: {
		
			FullName: "required",
			email:  {
				required: true,
				EmailAddress: true
			}

		},
		messages: {
			FullName:"Dit veld is verplicht.",
			EmailAddress: {
				required: "Wilt u alstublieft uw e-mailadres invullen?",
				email:"Wilt u alstublieft een geldig e-mailadres invullen?"
			}
		}

	});

	//$j(".homeaanbiedingen .productfeaturelist li:first").addClass("first");

	/*Stukje code voor rechterborder van li */
	//$j('#headnav ul li a').hover(
     // function(){
      // $j(this).parent().prev('li').find('a').css('border-right','none'); 
      //},function () {
      //$j(this).parent().prev('li').not('.selected').find('a').css('border-right','3px dotted #e4e4e3'); 
  	//});
	//$j('#headnav ul li ul li a').hover(
     // function(){
      // $j(this).parent().parent().parent().prev('li').find('a').css('border-right','none'); 
     // },function () {
      //$j(this).parent().parent().parent().prev('li').not('.selected').find('a').css('border-right','3px dotted #e4e4e3'); 
 // 	});


	/* Ook de voorganger van het geselecteerde item mag geen rechterborder hebben */ 
	//$j('.selected').parent().prev('li').find('a').css('border-right','none');
	
	

	$j(".paauwetweet").tweet({
		avatar_size: 32,
		count: 1,
		username: "uwstijl",
		loading_text: "Tweet zoeken..."
	});
	// Replace all 'text' words with 'TEXT'
	$j(".cartSummaryItem").html($j(".cartSummaryItem").html().replace(/Shopping cart is empty./, '<span class="emptycart">(Uw winkelwagen is leeg)</span>'));
	$j(".cartSummaryItem").html($j(".cartSummaryItem").html().replace(/Total/, 'Totaal'));
	$j(".cartSummaryItem").html($j(".cartSummaryItem").html().replace(/View Cart/, 'Afrekenen'));
	
	

	

	/*$j(".shippingDiv").html($j(".shippingDiv").html().replace(/Choose Shipping Option/, 'Kies een verzendmethode'));
	$j("a.cartLink").html($j("a.cartLink").html().replace(/Shopping cart is empty. Continue Shopping./, 'Uw winkelwagen is leeg. Ga verder met winkelen.'));*/
	$j("#showcase").awShowcase(
	{
		content_width:			1115,
		content_height:			470,
		fit_to_parent:			false,
		auto:					true,
		interval:				5000,
		continuous:				true,
		loading:				true,
		tooltip_width:			200,
		tooltip_icon_width:		32,
		tooltip_icon_height:	32,
		tooltip_offsetx:		18,
		tooltip_offsety:		0,
		arrows:					false,
		buttons:				false,
		btn_numbers:			false,
		keybord_keys:			true,
		mousetrace:				false, /* Trace x and y coordinates for the mouse */
		pauseonover:			false,
		stoponclick:			false,
		transition:				'fade', /* hslide/vslide/fade */
		transition_delay:		300,
		transition_speed:		500,
		show_caption:			'show', /* onload/onhover/show */
		thumbnails:				true,
		thumbnails_position:	'inside-last', /* outside-last/outside-first/inside-last/inside-first */
		thumbnails_direction:	'horizontal', /* vertical/horizontal */
		thumbnails_slidex:		0, /* 0 = auto / 1 = slide one thumbnail / 2 = slide two thumbnails / etc. */
		dynamic_height:			false, /* For dynamic height to work in webkit you need to set the width and height of images in the source. Usually works to only set the dimension of the first slide in the showcase. */
		speed_change:			false, /* Set to true to prevent users from swithing more then one slide at once. */
		viewline:				false /* If set to true content_width, thumbnails, transition and dynamic_height will be disabled. As for dynamic height you need to set the width and height of images in the source. */
	});

	$j(".loguit").html($j(".loguit").html().replace(/Log out/, 'Log uit'));

	
	
});


function messagebox(){
$j("#messageBox").removeClass().addClass("confirmbox").html("Product toegevoegd aan uw verlanglijst").fadeIn(2000).fadeOut(2000);
}
function removebox(){
$j("#messageBox").removeClass().addClass("remove").html("Product verwijderd uit uw verlanglijst").fadeIn(2000).fadeOut(2000);
}

$j('.favoritelink').live('click', function(e){	
e.preventDefault();
	if ($j('body.isLoggedIn1').length > 0){
		$j.ajax({
			url: $j(this).attr('href'),
			cache: false
		});
		var addImage = "/images/template/starribbon.png";
		var removeImage = "/images/template/removefromimage.png";
		var addImagetitle = "Voeg artikel toe aan uw verlanglijst";
		var removeImagetitle = "Verwijder artikel uit uw verlanglijst";

		if ($j(this).find('img').hasClass('fav-add')){
			
			$j(this).find('img').attr('title', removeImagetitle);
			$j(this).find('img').attr('src', removeImage).removeClass('fav-add').addClass('fav-remove');
			messagebox();
			
		} else {
			$j(this).find('img').attr('title', addImagetitle);
			$j(this).find('img').attr('src', addImage).removeClass('fav-remove').addClass('fav-add');
			removebox();
		}

} else {
		alert('U moet ingelogd zijn om een artikel toe te voegen aan uw verlanglijstje.');
	}
});
