// JavaScript Document

	var aImages = new Array();
	var oImages = new Array();
	var aURL = new Array();
	var aArtists = new Array();
	/*var iPrev = -1;*/ 
	var iRnd = 0;
	var nImages = 4;
	
	aImages[0] = "images/page_content/1.JPG";
	aImages[1] = "images/page_content/2.JPG";
	aImages[2] = "images/page_content/3.JPG";
	aImages[3] = "images/page_content/4.JPG";
	
	oImages[0] = "images/art_home.png";
	oImages[1] = "images/new_badge_smn.png";
	oImages[2] = "";
	oImages[3] = "images/new_badge_sucvia.png";

	aURL[0] = "http://www.udfrance.com/folio.html";
	aURL[1] = "http://www.udfrance.com/smn.html";
	aURL[2] = "http://www.udfrance.com/whynot.html";
	aURL[3] = "http://www.udfrance.com/sucvia.html";
	
	aArtists[0] = "";
	aArtists[1] = "SMN PORT GRIMAUD";
	aArtists[2] = "WHYNOT CONSTRUCTION";
	aArtists[3] = "SUCVIA";	

/*sizing function*/
$.fn.fullscreenrResizer = function(options) {
	
		// Set bg size
		var ratio = options.height / options.width;	
		// Get browser window size
		var browserwidth = $(window).width();
		var browserheight = $(window).height();
		// Scale the image
		if ((browserheight/browserwidth) > ratio){
		    $(this).height(browserheight);
		    $(this).width(browserheight / ratio);
		} else {
		    $(this).width(browserwidth);
		    $(this).height(browserwidth * ratio);
		}
		// Center the image
		$(this).css('left', (browserwidth - $(this).width())/2);
		$(this).css('top', (browserheight - $(this).height())/2);
		return this; 		
	};

function LoadImage(iNr)
{
	
	
	/*img counter, for sequence display*/
	iRnd++

	/* Assign the new image to the background */
	$("img#bg").attr("src", aImages[iNr]);

	/* Assign the artist name to the description */
	$("#image_artist").html(aArtists[iNr]);
	
	/* Assign the new overlay image */
	$("img#overlayImg").attr("src", oImages[iNr]);

	/* Assign the image url to the description */
	$("a#image_url").attr("href", aURL[iNr]);
	
	
	
	/*for loading different overlay images*/
	if(iRnd ==2){
					
		$("img#overlayImg").css("margin-top", "280px");
				
	}else if(iRnd ==4){
		$("img#overlayImg").hide();
		$("img#overlayImg").css("margin-top", "240px","margin-left", "380px");
					
					
	}else{
					
		$("img#overlayImg").css("margin-top", "0px");
	}
	
	
	if(iRnd==1){
		
	$("a#image_url").html("visit portfolio");
	
	}else{
		
	$("a#image_url").html("visit project");
	
	}
	

};

function LoadImages()
{

	/* for random images */
	/*while(iPrev == iRnd)
	{
		iRnd = Math.floor(Math.random()*aImages.length);
	}*/
	
	
	/*reset if its reeached max number of images to display*/
	if(iRnd == nImages){
		
		iRnd = 0;
	};
	
	
	
	/* Show the selected image */
	LoadImage(iRnd);

 	/*iPrev = iRnd;*/
	
	

};

