$(document).ready(function(){
	try
	{
		$("a[rel^='prettyPhoto']").prettyPhoto({theme:'dark_square'});
	}
	catch(e) {}
});

function valid(path) {
	var password = prompt("To use the 'Client Logon', please enter your password:", "");
	if (password) location.href = "./clients/" + password + ".htm";
}

function shuffleArray(myArray)
{
	var i = myArray.length;
	
	if (i == 0)
	{
		return false;
	}
	
	while (--i)
	{
		var j = Math.floor(Math.random() * (i + 1));
		
		var tempi = myArray[i];
		var tempj = myArray[j];
		
		myArray[i] = tempj;
		myArray[j] = tempi;
	}
}

$(document).ready(function()
{
	var headerImages = ['/content/office/1.jpg', '/content/office/10.jpg', '/content/office/11.jpg', '/content/office/12.jpg', '/content/office/13.jpg', '/content/office/2.jpg', '/content/office/3.jpg', '/content/office/4.jpg', '/content/office/5.jpg', '/content/office/6.jpg', '/content/office/7.jpg', '/content/office/8.jpg', '/content/office/9.jpg'];
	var arrayTop = headerImages.length - 1;
	
	// $.preload(headerImages);
	
	shuffleArray(headerImages);
	
	var arrayPtr = Math.floor(Math.random() * arrayTop);
	
	$('#officePictures div.bgMain').css('background-image', 'url(' + headerImages[arrayPtr] + ')');
	
	$('#officePictures div.bgMain').fadeIn('fast');
	
	setInterval(function()
	{
		arrayPtr++;
		
		if (arrayPtr > arrayTop)
		{
			arrayPtr = 0;
		}
		
		$('#officePictures').append('<div class="bgNew"></div>');
		$('#officePictures .bgNew').css('background-image', 'url(' + headerImages[arrayPtr] + ')');
		$('#officePictures .bgNew').fadeIn('1500');
		
		$('#officePictures .bgMain').fadeOut('1000');
		
		$('#officePictures .bgNew').fadeIn('500', function()
		{
			$('#officePictures .bgMain').remove();
			$('#officePictures .bgNew').attr('class', 'bgMain');
		});
	}, 12000);
});

$(document).ready(function() {
	$('#bottomFeature').cycle({
		fx:      'scrollLeft',
		speed:   500,
		timeout: 10000,
		pause:   true,
		next:    '#bottom div.next'
	});
});

