function loadlarge(imgnumber) {
	imgsrc = document.getElementById('img_lrg'+imgnumber).src;
$("#img_lrg").fadeTo(0, 0, function() {
	document.getElementById('img_lrg').src = imgsrc;
}).fadeTo("mid", 0).fadeTo("mid", 1);
}

function loadlarge2(imgnumber) {
	imgsrc = document.getElementById('img_lrg'+imgnumber).src;
	document.getElementById('img_lrg').src = imgsrc;
}

// Adds/removes the labels from the newsletter form on the home page on focus/blur
$(document).ready(function() {
	// Name - Focus
	$('#newsletter-name').focus(function() {
		var myname = $(this).val();
		if(myname == "Name") {
			$(this).attr("value", "");
			$(this).css("color","#333333");
		}
	});
	
	// Name - Blur
	$('#newsletter-name').blur(function() {
		var myname = $(this).val();
		if(myname == "") {
			$(this).attr("value", "Name");
			$(this).css("color","#707070");
		}
	});
	
	// Email - Focus
	$('#newsletter-email').focus(function() {
		var myemail = $(this).val();
		if(myemail == "Email") {
			$(this).attr("value", "");
			$(this).css("color","#333333");
		}
	});
	
	// Email - Blur
	$('#newsletter-email').blur(function() {
		var myemail = $(this).val();
		if(myemail == "") {
			$(this).attr("value", "Email");
			$(this).css("color","#707070");
		}
	});
	



// Home Image functionality -------------------------------------------------	

	//delay function
	jQuery.fn.delay = function(time,func){
		this.each(function(){
			setTimeout(func,time);
		});

		return this;
	};
	
	jQuery.extend({
		random: function(X) {
		    return Math.floor(X * (Math.random() % 1));
		},
		randomBetween: function(MinV, MaxV) {
		  return MinV + jQuery.random(MaxV - MinV + 1);
		}
	});	
	
	//var homeimg = ($j.randomBetween(1, 3)); //if want it to be random
	var homeimg = ('1');
	
	if(homeimg==1){
		$('#home-img-2').css({'display' : 'none'});
		$('#home-img-3').css({'display' : 'none'});
		$('#home-img-4').css({'display' : 'none'});
		$('#home-img-5').css({'display' : 'none'});
	} 
	
	var homeimgtimer = 4500;
	
	function homeimgscroll() {
		if(homeimg==1){
			homeimg++;
			$(this).delay(homeimgtimer,function(){
				$('#home-img-2').fadeIn(1000);
				$(this).delay(1000,function(){
					$('#home-img-1').css({'display' : 'none'});
					homeimgscroll();
				});
			});
		} else if(homeimg==2) {
			homeimg++;
			$(this).delay(homeimgtimer,function(){
				$('#home-img-3').fadeIn(1000);
				$(this).delay(1000,function(){
					$('#home-img-2').css({'display' : 'none'});
					homeimgscroll();
				});
			});
		} else if(homeimg==3) {
			homeimg++;
			$(this).delay(homeimgtimer,function(){
				$('#home-img-4').fadeIn(1000);
				$(this).delay(1000,function(){
					$('#home-img-3').css({'display' : 'none'});
					homeimgscroll();
				});
			});
		} else if(homeimg==4) {
			homeimg++;
			$(this).delay(homeimgtimer,function(){
				$('#home-img-5').fadeIn(1000);
				$(this).delay(1000,function(){
					$('#home-img-4').css({'display' : 'none'});
					homeimgscroll();
				});
			});
		} else if(homeimg==5) {
			homeimg=1;
			$(this).delay(homeimgtimer,function(){
				$('#home-img-1').css({'display' : 'block'});
				$('#home-img-5').fadeOut(1000);
				$(this).delay(1000,function(){
					homeimgscroll();
				});
			});
		} else {
			homeimg=1;
			homeimgscroll();
		}
	}
	
	homeimgscroll();
	
});
