$(document).ready(function() {
		
	// Overlay
	$('div.overlay').appendTo('body');
	$("a.launchoverlay[rel]").overlay({
		expose: 'black'
	});
	 $('a.prev, a.next').click(function() {
	 	return false;
	 });

	
	//Scrollable
	
	$('#flowpanes').scrollable({size: 1, clickable: false}).navigator({
		navi: '#flowtabs',
		naviItem: 'a',
		activeClass: 'current'
	});
	
	$('#flowpanes2').scrollable({size: 1, clickable: false}).navigator({
		navi: '#flowtabs2',
		naviItem: 'a',
		activeClass: 'current'
	});
	
	// Round Corners
	$('.inner, .innerWrap, .showcase').corner({
		tl: {radius: 6},
		tr: {radius: 6},
		bl: {radius: 6},
		br: {radius: 6},
		AntiAlias: true
	});
	
	//Initialize forms accordion
	$('div#forms_accordion').accordion({ active: false });
	//Check URI for #success hash
	var theHash = location.hash;
	if ( theHash == '#success' )
	{
		//Show success message
		$('#msg_thanks').fadeIn('slow');
	}
	//Close on click
	$('a.closeme').click(function() {
		$(this).parent().fadeOut('normal');
	});
	
	
	
	// open pdf files in new window
	$("a[href$=pdf]").each(function() {
		$(this).attr('target', '_blank');
	});
	
	jQuery.fn.fadeIn = function(speed, callback) { 
	    return this.animate({opacity: 'show'}, speed, function() { 
	        if (jQuery.browser.msie)  
	            this.style.removeAttribute('filter');  
	        if (jQuery.isFunction(callback)) 
	            callback();  
	    }); 
	}; 
	 
	jQuery.fn.fadeOut = function(speed, callback) { 
	    return this.animate({opacity: 'hide'}, speed, function() { 
	        if (jQuery.browser.msie)  
	            this.style.removeAttribute('filter');  
	        if (jQuery.isFunction(callback)) 
	            callback();  
	    }); 
	}; 
	 
	jQuery.fn.fadeTo = function(speed,to,callback) { 
	    return this.animate({opacity: to}, speed, function() { 
	        if (to == 1 && jQuery.browser.msie)  
	            this.style.removeAttribute('filter');  
	        if (jQuery.isFunction(callback)) 
	            callback();  
	    }); 
	};
	
});