$(document).ready(function(){
	$('#slides').cycle({  
		fx: 'scrollLeft',
		speed: 1500,
		timeout: 6800
  	});
  	
  	if ($.browser.msie) {
		$('ul#nav li').hover(function() {
			$(this).addClass('hover')
		}, function() {
			$(this).removeClass('hover');
		});
	}
  	
	//$('.homenewsletteremail').example('Enter your email address');
	thisPage = location.href.substring((location.href.lastIndexOf("/"))+1);
	if (thisPage.indexOf("#")>0){
		thisPage = thisPage.substring(0,thisPage.indexOf("#"));
	}
	if (thisPage.indexOf("?")>0){
		thisPage = thisPage.substring(0,thisPage.indexOf("?"));
	}
        
	$("#nav li a[href='"+thisPage+"']'").each(function() {
		$(this).parent().addClass('current');
	});
	$("#nav li ul li a[href='"+thisPage+"']'").each(function() {
		$(this).parent().parent().parent().addClass('current');
	});

        
        $(".subnav li a[href='"+thisPage+"']'").each(function() {
              $(this).parent().addClass('current');
        });

	//Simple Gallery switcher
	
	$('.profilephotos ul li a').click(function () {
		$(this).parent().parent().children('li').removeClass('current');
		$(this).parent().addClass('current');
		thisImage = $(this).children('img').attr('src');
		thisCaption = $(this).children('img').attr('alt');
		thisImage = thisImage.replace('imagethumb','imagebig');
		$('.profilemainphoto a img').attr('src',thisImage);
		$('p.photocaption').text(thisCaption);
		return false;
	});


        


});
