/* jQuery Global */
jQuery.noConflict();
jQuery(document).ready(function() {


// Featured Teaser Slider		
	
	 
  if(jQuery("#teaserCycle").length) {  
	jQuery('#teaserCycle')
	.cycle({ 
		fx:  'uncover',
		speed:  '2000',
		timeout: 6000,
		pause: 1,
		cleartype:  true,
		cleartypeNoBg:  true,
		sync:true
     });
 }
 
   if(jQuery("#keyvisualCycle").length) {  
	jQuery('#keyvisualCycle')
	.before('<div id="slideshowNav">') 
	.cycle({ 
		fx:  'uncover',
		speed:  '2000',
		timeout: 7000,
		pause: 1,
		cleartype:  true,
		cleartypeNoBg:  true,
		sync:true,
		pager:'#slideshowNav'
     });
 }

 /*jQuery UI Tabs*/
	if(jQuery( "#tabs" ).length){
 	   /*support tab clicked by buttons*/	
	   if(document.location.href.match(/id/)){	
	   	var id=getUrlVars()["id"];
	   	var param = parseInt(id);   
	   	  jQuery( "#tabs" ).tabs({
	   	   	  collapsible: true,
	   	   	  selected: param
	   	   });
	  	} else {
	  	 jQuery( "#tabs" ).tabs({
		  collapsible: true
		  });
	  	
	    }
	  	
	 }	
	
	/*fancybox*/
     jQuery('.galleryItem').each( function(index){
        var i=index+1;									 
	 jQuery(this).find('.galleryPics a').attr('rel','gallery'+i);
	});
     
     jQuery(".galleryLink").click(function(){
	
		jQuery(this).next(".galleryPics").find('a:first').trigger('click');
		jQuery(this).next(".galleryPics").find('a:first').fancybox();
	});
         
      
	   
   

});

function getUrlVars(){
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}

     
     

