/************************************************************************************************
 *
 *                            RB-Media Internet Solutions
 *                                    JS Loader
 *                                 www.rb-media.nl
 *
 ************************************************************************************************/

$(document).ready(function() {
  $('#hdrSlider').nivoSlider({ effect:'fade', prevText: '<span class="previous"></span>', nextText: '<span class="next"></span>', animSpeed: 1500, pauseTime: 8000, controlNav: false, keyboardNav: false });  
  $("a[rel^='pret_gal']").prettyPhoto({animation_speed:'normal',theme:'facebook',slideshow:3000,autoplay_slideshow:false});

  $('#left .moodboard > div > div > img').click(function() {  
    var iNr = 0;
    var imgelem = $(this);
    var imgelem_input = imgelem.parent().children('input');
    
    if (imgelem_input.is(':checked') == false) {
      imgelem.parent().parent().children('div').children('input').each(function() {
        var checked = $(this).is(':checked');
        if (checked == true) { iNr = iNr + 1; }
      }); 

      if (iNr < 3) { imgelem_input.attr('checked', true); }
    }
    else { imgelem_input.attr('checked', false); }
  });

  $('#left .moodboard > div > div > input').click(function() {
    var iNr = 0;
    $(this).parent().parent().children('div').children('input').each(function() {
      var checked = $(this).is(':checked');
      if (checked == true) iNr = iNr + 1;
    });
         
    if (iNr > 3) {$(this).attr('checked', false); }
  });
  
  $('#step2f').submit(function() {
    $('#loader').css('display','block');
  });




  $('#left .moodboard > div > div').hover(function() {
    $(this).css({'z-index' : '10'});
    $(this).find('img')
    		.animate({
    			marginTop: '-85px', /* The next 4 lines will vertically align this image */ 
    			marginLeft: '-100px',
    			marginBottom: '0',
    			marginRight: '0',
    			top: '50%',
    			left: '50%',
    			width: '200px', /* Set new width */
    			height: '170px' /* Set new height */
    		}, 200); /* this value of "200" is the speed of how fast/slow this hover animates */
    
    	} , function() {
    	$(this).css({'z-index' : '0'}); /* Set z-index back to 0 */
    	$(this).find('img')  /* Remove the "hover" class , then stop animation queue buildup*/
    		.animate({
    			marginTop: '0', /* Set alignment back to default */
    			marginLeft: '0',
    			marginBottom: '1px',
    			marginRight: '1px',
    			top: '0',
    			left: '0',
    			width: '128px', /* Set width back to default */
    			height: '115px' /* Set height back to default */
    		}, 400);
    });
});
