jQuery.noConflict();
jQuery(document).ready(function(){
    //jQuery("#products li").eq(2).addClass("last");
	var len=jQuery("#products li").length;
	for(i=0;i<len;i++){if(i%3==2){jQuery("#products li").eq(i).addClass("last")}}
		jQuery("#products li img").hover(function(){
		
		jQuery(this).fadeTo("slow", 0.4); // This sets the opacity to 100% on hover
	},function(){
		jQuery(this).fadeTo("slow", 1); // This sets the opacity back to 60% on mouseout
	});
		
		
});


jQuery(function() {
  jQuery("#slider")
    //calling scrollable plugin
    .scrollable({
      size: 1,
      speed: 500, // The time (in milliseconds) of the scrolling animation.
      easing: "swing" // The type of "easing" applied to the scrolling animation. 'swing' means that there is an acceleration, followed by a constant speed, followed by a deceleration. 'linear' means that the whole animation happens at a constant speed.
    })
    //calling autoscroll plugin
    .autoscroll({
      steps: 1, // The number of items being scrolled within a single autoscroll.
      interval: 4000, // The time (in milliseconds) between autoscrolls.
      autoplay: true, // When enabled the scrolling starts automatically upon page load.
      autopause:true // If this property is set to true then, when any navigational buttons are mouseovered, the autoscrolling will pause.
    })
    //calling circular, and navigator
    .circular()
    .navigator(); // comment out this line if you don't want to support keyboard navigation in slider, just remember to add semicolon(;) to the previous line.
    //.mousewheel(500); // uncomment this line if you want to support mousewheel navigation in slider, just remember to remove the semicolon(;) from the previous line.

  //calling tooltip plugin
  jQuery(".items img").tooltip({
    tip: ".items .info",
    position: "bottom center",
    offset: [-100,0],
    effect: "slide",
    relative: true
  })

  //calling reflection plugin
  jQuery("#slider img").reflect({
    height: 0.15,
    opacity: 0.2
  });

  //calling superfish plugin
  jQuery('ul#main-menu').superfish({
    autoArrows: false
  });

  //calling prettyPhoto plugin
  jQuery(".project-gallery-lightbox .item a[rel^='prettyPhoto']")
    .prettyPhoto({
      theme:'dark_rounded' // available theme: dark_rounded, dark_square, facebook, light_rounded, light_square.
  });

  //calling autofill plugin
 jQuery('#search-input').autofill({
    value: "Search...",
    defaultTextColor:"#2D363B"
  });

  // Custom Script
  // calculate and set absolute left position for navi
  // to make it horizontally centered
  var navWidth = jQuery(".navi").width();
  var galWidth = jQuery("#slider").width();
  jQuery(".navi").css({'left' : ((galWidth - navWidth) / 2) + "px"});

  // Ajax PHP Contact Form
  // Based on tutorial by Jeffrey Way, http://blog.themeforest.net/tutorials/how-to-create-a-contact-form-using-php-and-ajax/

  var paraTag = jQuery('input#submit').parent('p');
 jQuery(paraTag).children('input').remove();
 jQuery(paraTag).append('<input class="button" type="button" name="submit" id="submit" tabindex = "5" value="Send" />');

  jQuery('#contact-main input#submit').click(function() {
      jQuery('#contact-main p.button').append('<img src="images/ajax-loader.gif" class="loaderIcon" alt="Loading..." />');

      var name = jQuery('input#name').val();
      var email = jQuery('input#email').val();
      var subject = jQuery('input#subject').val();
      var message = jQuery('textarea#message').val();

     jQuery.ajax({
          type: 'post',
          url: 'sendEmail.php',
          data: 'name=' + name + '&email=' + email + '&subject=' + subject + '&message=' + message,

          success: function(results) {
              jQuery('#contact-main img.loaderIcon').fadeOut(1000);
              jQuery('div#response').html(results);
              var responseStatus = jQuery('div#response p').attr('class');
              jQuery('div#response').removeClass().addClass(responseStatus);
              if (responseStatus == 'success')
               jQuery( "form" )[ 0 ].reset();
          }
      }); // end ajax
  });
});


