$(document).ready(function() {
//clear the input box for the log in form on focus
    $('.clear-me').focus(function() {
        $(this).val("");
       });


$("a.iframe").fancybox({width: '50%', height: '100%' ,overlayOpacity: .7, overlayColor: '#000'});

$("a[rel=this-gallery]").fancybox({
	'transitionIn'		: 'none',
	'transitionOut'		: 'none',
	'titlePosition' 	: 'over',
	'overlayColor'      : '#000000',
	'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
	    return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title + '</span>';
	}
});

$("a.ytb").click(function() {
$.fancybox({
   'padding'       : 4, //optional
   'autoScale'     : false,
   'overlayColor'      : '#000000',
   'transitionIn': 'none',
   'transitionOut': 'none',
   'title': this.title,
   'width': 640, //or whatever
   'height': 480, //or whatever
   'href': this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
   'type': 'swf',
   'swf': {
       'wmode': 'opaque',
       'allowfullscreen'       : 'true'
}
});
return false;
});

$('#home-gallery-photos').cycle({
    fx:    'fade', 
	prev:   '#prev', 
    next:   '#next'
    //pager:  '#home-gallery-icons',
    // pagerAnchorBuilder: function(idx, slide) {
    //     return '<li id="gallery-icon-fire"><a href="#"><img src="images/gallery-fire-' + if(slide == 1){document.write("-on");}else{document.write("-off");} + '.png" /></a></li>'; 
    // }
});


$('#gallery-icon-fire').click(function() { 
    $('#home-gallery-photos').cycle(1); 
    return false; 
});

$('#gallery-icon-water').click(function() { 
    $('#home-gallery-photos').cycle(2); 
    return false; 
});


$('#gallery-icon-wind').click(function() { 
    $('#home-gallery-photos').cycle(3); 
    return false; 
});

$('#gallery-icon-mold').click(function() { 
    $('#home-gallery-photos').cycle(4); 
    return false; 
});


$(function() {
$(".swapper").hover(
function () {
$(this).attr("src", $(this).attr("src").replace(/-off.png/, "-on.png"));
},
function () {
$(this).attr("src", $(this).attr("src").replace(/-on.png/, "-off.png"));
} 
);
});

//remove background from last item in the subnav
$("ul#sub-list li:last-child").addClass("last");

});//end whole thing
    

