// JavaScript Document

function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};


$(function() {
		   $('a[href*=portfolio]').fancybox({
											'overlayOpacity': 0.75,
											'padding': 0,
											'frameHeight': 355,
											'frameWidth': 600,
											'showCloseButton': false,
											'hideOnOverlayClick': true,
											'hideOnContentClick': false,
											'enableEscapeButton': true
											});
		   $('#requestEstimate a').fancybox({
									'overlayOpacity': 0.75,
									'padding': 0,
									'frameHeight': 445,
									'frameWidth': 600,
									'showCloseButton': false,
									'hideOnOverlayClick': true,
									'hideOnContentClick': false,
									'enableEscapeButton': true
									});
		   $('input[name=nombre]').focus(function() {
												  if( $(this).val() == 'Nombre' )
												  { $(this).val(''); }
												  });
		   $('input[name=nombre]').blur(function() {
												  if( $(this).val() == '' )
												  { $(this).val('Nombre'); }
												  });
		   $('input[name=correo]').focus(function() {
												  if( $(this).val() == 'E-mail' )
												  { $(this).val(''); }
												  });
		   $('input[name=correo]').blur(function() {
												  if( $(this).val() == '' )
												  { $(this).val('E-mail'); }
												  });
		   $('textarea[name=mensaje]').focus(function() {
												  if( $(this).val() == 'Mensaje' )
												  { $(this).val(''); }
												  });
		   $('textarea[name=mensaje]').blur(function() {
												  if( $(this).val() == '' )
												  { $(this).val('Mensaje'); }
												  });
		   $('#ourWorks ul').removeClass('thumbs');
		   $('#ourWorks ul').jcarousel({
										auto: 4,
										wrap: 'both',
										scroll: 1,
										animation: 'slow',
										easing: 'swing',
										initCallback: mycarousel_initCallback
										});
		   });

jQuery.preloadImages = function()
{
  for(var i = 0; i < arguments.length ; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}
