jQuery(document).ready(function() {
																
	jQuery.fn.extend({
 
 	customStyle : function(options) {
	  if(!jQuery.browser.msie || (jQuery.browser.msie&&jQuery.browser.version>6)){
	  return this.each(function() {
	  
			var currentSelected = jQuery(this).find(':selected');
			jQuery(this).after('<span class="customStyleSelectBox"><span class="customStyleSelectBoxInner">'+currentSelected.text()+'</span></span>').css({position:'absolute', opacity:0,fontSize:jQuery(this).next().css('font-size')});
			var selectBoxSpan = jQuery(this).next();
			var selectBoxWidth = parseInt(jQuery(this).width()) - parseInt(selectBoxSpan.css('padding-left')) -parseInt(selectBoxSpan.css('padding-right'));			
			var selectBoxSpanInner = selectBoxSpan.find(':first-child');
			selectBoxSpan.css({display:'inline-block'});
			selectBoxSpanInner.css({width:selectBoxWidth, display:'inline-block'});
			var selectBoxHeight = parseInt(selectBoxSpan.height()) + parseInt(selectBoxSpan.css('padding-top')) + parseInt(selectBoxSpan.css('padding-bottom'));
			jQuery(this).height(selectBoxHeight).change(function(){
				// selectBoxSpanInner.text(jQuery(this).val()).parent().addClass('changed');   This was not ideal
			selectBoxSpanInner.text(jQuery(this).find(':selected').text()).parent().addClass('changed');
				// Thanks to Juarez Filho & PaddyMurphy
			});
			
	  });
	  }
	}
 });
	
	
	if(jQuery("#slides").length != 0){
		jQuery('#slides').slides({
			preload: true,
			preloadImage: 'img/loading.gif',
			play: 5000,
			pause: 2500,
			hoverPause: true,
			animationStart: function(current){
			jQuery('.caption').animate({
				bottom:-35
			},100);
			if (window.console && console.log) {
				// example return of current slide number
				//console.log('animationStart on slide: ', current);
			};
		},
		animationComplete: function(current){
			jQuery('.caption').animate({
				bottom:0
			},200);
			if (window.console && console.log) {
				// example return of current slide number
				//console.log('animationComplete on slide: ', current);
			};
		},
		slidesLoaded: function() {
			jQuery('.caption').animate({
				bottom:0
			},200);
		}
			
		});
	}
	
	
		jQuery('.accordion h4').click(function() {
			jQuery(this).toggleClass('ui-state-active');
			//$(this).next().toggle('slow');
			jQuery(this).next().slideToggle('slow');
			return false;
		}).next().hide();
		
		jQuery('.ui-state-active').next().show();

		jQuery('#open_cl_btn').click(function() {																					
			var obj = jQuery(this).parent();
			var state = jQuery(obj).attr('class');
			jQuery(obj).toggleClass('smF')
			jQuery('#shForm').slideToggle('slow');
			return false;
		})
		
		jQuery('.smF #shForm').hide();
		
		/*
		jQuery('#contactFormContent  .chBox').hide();
		jQuery(".chBox").change(function(){  
        if(jQuery(this).is(":checked")){  
            jQuery(this).next("label").addClass("chBoxSelected");  
        }else{  
            jQuery(this).next("label").removeClass("chBoxSelected");  
        }  
    }); 
		*/
		
		jQuery('body').addClass('has-js');
		jQuery('.chBoxL').click(function() {
			setupLabel();
		});
		setupLabel();	
		
		jQuery('.selectBox').customStyle();
}); 

function setupLabel() {
	if (jQuery('.chBoxL input').length) {
		jQuery('.chBoxL').each(function(){ 
				jQuery(this).removeClass('c_on');
		});
		jQuery('.chBoxL input:checked').each(function(){ 
				jQuery(this).parent('label').addClass('c_on');
		});                
	};	
};


 


