Cufon.replace('h2');


$(function() {

	$('div.wrapper').css({'minHeight':$(window).height()});

	/* SMOOTH SCROLL ON INTERNAL LINKS
	-------------------------------------------------- */
    $('a[href*=#]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
        && location.hostname == this.hostname) {
            var $target = $(this.hash);
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
                $('html,body').animate({scrollTop: targetOffset}, 1000);
                return false;
            }
        }
    });
    
    /* LIGHTBOX SCRIPT
    -------------------------------------------------- */
    
    if($('ul.galleryThumbs').length > 0){
    	$('ul.galleryThumbs a').lightBox();
    }
	    
	if($('ul.galleryThumbs li a img').length > 0){
		$('ul.galleryThumbs li a img').hover(
		function(){
			$(this).fadeTo(100, 1);
		},
		function(){
			$(this).fadeTo(100, 0.7);
		});
	}       
	    
    /* FIGHT SPAM FOR EMAIL ADRESS
    -------------------------------------------------- */  
    if($('a#e').length > 0){
		function view_address() {
			var address_to_replace = document.getElementById("e").firstChild;
			real_address = address_to_replace.nodeValue.replace("[at]", "@");
			address_to_replace.nodeValue = real_address; 
			address_to_replace.parentNode.setAttribute("href", "mailto:"+real_address); 
		}
	
		view_address();
	}
		
    /* TWITTER
    -------------------------------------------------- */ 
	if($("#tweet").length > 0){
		getTwitters('tweet', { 
		  id: 'capricebridal', 
		  count: 3, 
		  enableLinks: true, 
		  ignoreReplies: true, 
		  clearContents: true,
		  template: '%text% <a href="http://twitter.com/%user_screen_name%/statuses/%id%/">posted %time%</a>'
		});
	}
	
    /* ACCORDIONS
    -------------------------------------------------- */ 
	if($("#accordion").length > 0){
		jQuery('#accordion').accordion({
			autoheight: true,
			header: 'a',
			active: '.selected',
			selectedClass: 'active',
			animated: "slide"
		});
	}
	
	
});