//Your JQuery Code Here
$(document).ready(function(){   
  
  //All Pages
  
    //Header Rotation
    $('.rotate').cycle({
      timeout: '6000'
    });
  
    //Slider
    $('.slider ul').cycle({
      fx: 'scrollHorz',
      next: '#next',
      prev: '#prev',
      timeout: 0
    });
    
    //Quick Contact Labels
    $('#first-name, #last-name, #email, #comments').inline_label();
    
    
    $('.quick-contact').submit(function(){
      
      var firstname = $(this).find('input[name=firstname]').val();
      var lastname = $(this).find('input[name=lastname]').val();
      var email = $(this).find('input[name=email]').val();
      var email2 = $(this).find('input[name=email2]').val();
      var comments = $(this).find('textarea[name=comments]').val();
      
      if(email2 == ''){
      
        if(firstname == 'First Name' || lastname == 'Last Name' || email == 'Email' || comments == 'Comments'){
          alert('All fields are required.');          
        }else{
         
          $.post('/submit/submitquickcontact', $('.quick-contact').serialize(),function(){
 			  		$('.quick-contact').hide();
 				    $('#qcmessage').html('Thanks! We have received your information.');
 			  	});         				
         
        }
              
      }
      
      return false;
      
    });
    
    
    
    //jquery for category page vertical toggle/slider
    
       
    //Hide (Collapse) the toggle containers on load
	 //$(".toggle_container").hide(); 
  
	//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
	/*
$("h2.trigger").click(function(){
		$(this).toggleClass("active").next().slideToggle("slow");
		return false; //Prevent the browser jump to the link anchor
	});
	
	$('#viewninefavs').click(function(){
	 $('#ninefavs').slideToggle();
	});
*/
	
	
	//detail page shadow box pop-ups
	Shadowbox.init();
	
	
	$('.datepicker').datepicker({
      showOn: 'button',
      buttonImage: '/admin/images/datepicker/cal.png',
      buttonImageOnly: true      
   });
   
   $('#submitevent').validate();
   
   jQuery('#mycarousel').jcarousel({scroll: 3});
   
   
   
   //category page swapper
   
   $('#mycarousel li a').click(function(){
      
      var id = $(this).attr('rel');
      
      $.ajax({
        
        url: "getadvertiser?id="+id,
        success: function(data){
          $('#placeholder').html(data);
        } 
      
      });      
      
    });
   
   
  	
});
