/**
	Blog scripts by Jennette Fulda at http://www.makemyblogpretty.com/
**/

function clearSearch() {
	if (document.searchform.s.value == "Search") {
		document.searchform.s.value="";
	}
}
function writeEmail(to, domain, subject) {
	var subjectquery = "";
	if (subject != undefined) {
		subjectquery = "?subject=" + subject;
	}
	document.write('<a href="mailto:' + to + '@' + domain + subjectquery + '">' +to + '@' + domain + '</a>');
}

/*** 
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not 
    responsible for anything, etc.  Please link out to me if you like it :)
    http://jonraasch.com/blog/a-simple-jquery-slideshow
***/

function slideSwitch() {
    var $active = $('#slideshow li.active');

    if ( $active.length == 0 ) $active = $('#slideshow li:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow li:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(document).ready(function() {
						   
	//set links to open in new window
$('.entry a').attr('target', '_blank');
$('.more-link').attr('target', '_self');
						   
						   
						   
	var intervalID = setInterval("slideSwitch()", 4000 );
	$("#slogan").click(function() {
		clearInterval(intervalID);	// Clears old interval cycle
		slideSwitch();				// Go to next slide
		intervalID = setInterval("slideSwitch()", 4000 );	// Start the interval cycle again
	});
});

/* Floating menu code, courtesy Jeff Dion: 
http://net.tutsplus.com/html-css-techniques/creating-a-floating-html-menu-using-jquery-and-css/
*/
var name = "#floatMenu";
var menuYloc = null;
$(document).ready(function(){
	menuYloc = parseInt($(name).css("top").substring(0,$(name).css("top").indexOf("px")))
	/*$(window).scroll(function () { 
		offset = menuYloc+$(document).scrollTop()+"px";
		$(name).animate({top:offset},{duration:500,queue:false});
	});*/
	
}); 
