$(document).ready(function() {
// 	 $('.corner').corner('5px');

	 $(".fancybox").fancybox({
  'height' : 700,
  'width': 520,
});
	 
	 $('.video').hover(
		function () {
		  $(this).addClass("video_hover");
		},
		function () {
		  $(this).removeClass("video_hover");
		}
	 );
	 $('.video').click(function() {
		  $(this).find('div').removeClass('nodisplay');
		  $(this).parent().html($(this).find('div').html());
		});
	 
	//clear form fields on focus
	 $('textarea, input:text').bind('focus click', function(){ 
		  if (this.value == this.defaultValue) {
		  this.value = '';
		  }
	 }).bind('blur', function(){
		  if (this.value == '') {
		  this.value = this.defaultValue;
		  }
	 });
	 
	$('#logo').click(function() {
		location.href='/';
	});
	
	 $("#pikame").PikaChoose({carousel:true,carouselOptions:{wrap:'circular'}});
	
	//vertical slider
	
  var positions = [];
  var slideIndex = 0;
  
  var len = $('div.slide', '#slide-wrapper').length;
 
  $('div.slide', '#slide-wrapper').each(function(index) {
    var slide = index;
    var position = $(this).position().top;
	 
    positions[slide] = position;
	 positions[0] = 0;
  
  });
  
  $('#prev', '#slider-controls').hide();
  
  

  
  $('#prev', '#slider-controls').click(function(event) {
  
    if(slideIndex > 0) {
    
      slideIndex--;
      
    } else {
    
      slideIndex++;
    
    
    }
    
    if(slideIndex == len) {
    
      slideIndex = 0;
    
    
    }
    
    
    $('#slide-wrapper').animate({
      top: - (positions[slideIndex])
    }, 'slow');
   


    event.preventDefault();
  });
  
  
  
  $('#next', '#slider-controls').click(function(event) {
  
    
    
    slideIndex++;
// 	 alert(len);
//      alert($(this).position().top);
    if(slideIndex == 1) {
    
      $(this).prev().show();
		 
    }
    
    if(slideIndex == len) {
    
      slideIndex = 0;
    
    }
    
    
//     alert(positions[slideIndex]);
    $('#slide-wrapper').animate({
      top: - positions[slideIndex]
    }, 'slow');



	  
    event.preventDefault();
  });

   var intId = setInterval(clickNext,2000);
	


});

  function clickNext(){
// 		alert(positions[slideIndex]);
		$('#next', '#slider-controls').trigger('click');
     }


