// JavaScript Document

$(document).ready(function ()
{
	var listImages = ["home-g01.gif", "home-g02.gif", "home-g03.gif"];
	var currentImage = Math.ceil(listImages.length * Math.random()) - 1;
		
	// load image
	$("#flashcontent").append("<img src='" + serverLocation + "library/img/pages/home/gallery/" + listImages[currentImage] + "' />");
	$("#flashcontent img").css("display", "none");
	$("#flashcontent img").load(function ()
	{
		$(this).fadeIn(500);
	});
	
	/*if(navigator.userAgent.match(/iPad/i) != null) 
	{
		var myVideo = document.getElementById('video_home_bg');
		
		myVideo.addEventListener('ended', function () {
			this.currentTime = 0;
			this.play(); }, false);
				
		myVideo.play();
	}
	else 
	{
		var params = { 
			wmode: "transparent", 
			menu: "false", 
			allowFullScreen: "true",
			allowScriptAccess: "always"
		}; 
		var flashvars = {wmode: "transparent"};
		var attributes = {
			id: "flashcontent",
			wmode: "transparent"
		};
		swfobject.embedSWF("library/swf/intro.swf", "flashcontent", "1024px", "592px", "10.0.0", false, flashvars, params, attributes);
	}	*/
	
});


/*var _totalImages = 2;
var _currentImage;

$(document).ready(function() 
{
	_currentImage = (Math.floor(Math.random()*_totalImages)) + 1;
	loadImage();
});

function removeNoise()
{
    $("#noise").fadeOut(2000, function() { removeBars(); });
}

function removeBars()
{
    var total = $("#bars > div").size();
	$("#bars > div").animate({height:'1px'}, 750, function() { $(this).css('visibility', 'hidden') });
	
	_currentImage = _currentImage < _totalImages ? _currentImage + 1 : 1;
	setTimeout(loadImage, 5000);
}

function loadImage()
{
	$("#noise").fadeIn(2000, function () 
	{
		var image = new Image(1024, 592);
		image.onLoad = setTimeout(removeNoise, 3000);
   		image.src = "library/img/pages/home/gallery/" + _currentImage + ".jpg";
    	$('#images').html(image);
	});
}*/
