(function($) {
$(document).ready(function(){ 


	if(typeof sIFR == "function"){
	
		
		sIFR.replaceElement(named({sSelector:"body .newsletter-cta-full-module h2.sifr", sFlashSrc:"/wp-content/themes/lamborghini-club-2011/j/interstate-boldcondensed.swf", sColor:"#FFFFFF", sLinkColor:"#ffd300", sWmode:"transparent", sHoverColor:"#ffd300", nPaddingTop:0, nPaddingBottom:0, sCase:"upper", sFlashVars:"textalign=center"}));
		
		sIFR.replaceElement(named({sSelector:"body.page-template-join-php h3.loud", sFlashSrc:"/wp-content/themes/lamborghini-club-2011/j/interstate-boldcondensed.swf", sColor:"#FFFFFF", sLinkColor:"#ffd300", sWmode:"transparent", sHoverColor:"#ffd300", nPaddingTop:0, nPaddingBottom:0, sCase:"upper", sFlashVars:"textalign=left"}));
		sIFR.replaceElement(named({sSelector:"div.s2member-pro-paypal-form-section-title", sFlashSrc:"/wp-content/themes/lamborghini-club-2011/j/interstate-boldcondensed.swf", sColor:"#FFFFFF", sLinkColor:"#ffd300", sWmode:"transparent", sHoverColor:"#ffd300", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left"}));
		
		sIFR.replaceElement(named({sSelector:"body .member-type", sFlashSrc:"/wp-content/themes/lamborghini-club-2011/j/interstate-boldcondensed.swf", sColor:"#FFFFFF", sLinkColor:"#ffd300", sWmode:"transparent", sHoverColor:"#ffd300", nPaddingTop:0, nPaddingBottom:0, sCase:"upper", sFlashVars:"textalign=center"}));
		sIFR.replaceElement(named({sSelector:"body .member-cost", sFlashSrc:"/wp-content/themes/lamborghini-club-2011/j/interstate-boldcondensed.swf", sColor:"#FFFFFF", sLinkColor:"#ffd300", sWmode:"transparent", sHoverColor:"#ffd300", nPaddingTop:0, nPaddingBottom:0, sCase:"upper", sFlashVars:"textalign=center"}));
		
		sIFR.replaceElement(named({sSelector:"body h2.sifr", sFlashSrc:"/wp-content/themes/lamborghini-club-2011/j/interstate-boldcondensed.swf", sColor:"#FFFFFF", sLinkColor:"#ffd300", sWmode:"transparent", sHoverColor:"#ffd300", nPaddingTop:0, nPaddingBottom:0, sCase:"upper", sFlashVars:"textalign=left"}));
		sIFR.replaceElement(named({sSelector:"body h3.sub-sub-title", sFlashSrc:"/wp-content/themes/lamborghini-club-2011/j/interstate-boldcondensed.swf", sColor:"#FFFFFF", sLinkColor:"#ffd300", sWmode:"transparent", sHoverColor:"#ffd300", nPaddingTop:0, nPaddingBottom:0, sCase:"upper", sFlashVars:"textalign=left"}));
		
		
		sIFR.replaceElement(named({sSelector:"body h3.ad-h3", sFlashSrc:"/wp-content/themes/lamborghini-club-2011/j/interstate-boldcondensed.swf", sColor:"#FFFFFF", sLinkColor:"#ffd300", sWmode:"transparent", sHoverColor:"#ffd300", nPaddingTop:0, nPaddingBottom:0, sCase:"upper", sFlashVars:"textalign=left"}));
		sIFR.replaceElement(named({sSelector:"body h3.ad-orange", sFlashSrc:"/wp-content/themes/lamborghini-club-2011/j/interstate-boldcondensed.swf", sColor:"#eda613", sLinkColor:"#ffd300", sWmode:"transparent", sHoverColor:"#ffd300", nPaddingTop:0, nPaddingBottom:0, sCase:"upper", sFlashVars:"textalign=left"}));
		
		sIFR.replaceElement(named({sSelector:".regions-table h3", sFlashSrc:"/wp-content/themes/lamborghini-club-2011/j/interstate-boldcondensed.swf", sColor:"#FFFFFF", sLinkColor:"#ffd300", sWmode:"transparent", sHoverColor:"#ffd300", nPaddingTop:0, nPaddingBottom:0, sCase:"upper", sFlashVars:"textalign=left"}));
	};
		

	$(document).pngFix();
	
	
		jQuery('img:not(.parent-pageid-46 img)').lazyload({
			effect:"fadeIn"
		}); 
	
	
	if($('.lambo-gallery-module').length>0){
		$('.gallery-list').jcarousel({
			animation: 1000,
			scroll: 1
		});
				
		var temp = null;
		var allLi = $('.lambo-gallery-module .gallery-list li');
		$('.lambo-gallery-module .gallery-list li img').each(function(i){
			var li = $(this).parent('li');
			
			$(this).click(function(){
				if(($(this).attr('src')).search(/-150x150/i)>0) {
					var bigImage = ($(this).attr('src')).replace('-150x150','');
				} else if(($(this).attr('src')).search(/-92x55/i)>0) {
					var bigImage = ($(this).attr('src')).replace('-92x55','');
				} else {
					var bigImage = $(this).attr('src');
				}
				$('.gallery-image').html('<img src="'+bigImage+'" class="hide-regular" />');
				$('.gallery-image img').fadeTo('slow',1);
				$('img',allLi).each(function(){ $(this).attr('style','')});
				allLi.removeClass('selected');
				$(this).fadeTo('slow', 0.5);
				li.toggleClass('selected');
				
				$('.gallery-image img').fancybox({
					titleShow: false,
					overlayOpacity: 0.7,
					overlayColor: '#000'
				});
				
				$('.gallery-image').append('<div class="zoombutton"></div>').click(function(){
					$('.gallery-image img').click();
				});

			});
			
			if(i==0){
				$(this).click();
			}
		});
	}
	
	
	if($('.home').length>0){
		$('ul.vert-scroll').jcarousel({
			animation: 'fast',
			scroll: 2,
			vertical: true
			
		});
	}
	
	
	

	
	if($('.page-id-200').length>0){
		$('.show-hide-block .show-hide-trigger').click(function(){
			if($(this).hasClass('open')){
				$(this).next().hide('fast');
				$(this).removeClass('open');
				$(this).parents('li').removeClass('showOpen');
			} else {
				$(this).addClass('open');	
				$(this).next().show('fast');
				$(this).parents('li').addClass('showOpen');
			}
		});
		
	}
	
	
	var allSubs = $('ul.sub-menu');
	allSubs.each(function(){
		$('li:last',$(this)).addClass('last');
	});
	
	if($('#cp_country').length && $('#cp_state').length){
		$('#cp_country').change(function(){
			if($(this).val()!='United States'){
				$('#cp_state').val('none');	
			} else {
				$('#cp_state').val('');	
			}	
		});
	}
	
	if($('li.parter-addmember-nav-link a').length>0){
		$('li.parter-addmember-nav-link a').click(function(e){
			e.preventDefault();
			logoutPartnerAlert();
			
		});
	}
	
});
}) ( jQuery );



function mycarousel_buttonNextCallback(carousel, button, enabled) {
	carousel.next();
};
function mycarousel_buttonPrevCallback(carousel, button, enabled) {
	carousel.prev();
};

function logoutPartnerAlert(){
	var answer = confirm("In order to add new members, you will need to be logged off first? Confirm logout?");
	if(answer){
		if($('#logoutLinkHolder').length>0) {
			window.location = $('#logoutLinkHolder').attr('href');
		} else {
			alert('Something went wrong. Please log out manually by clicking logout.');	
		}
	}

}












