var timer;
var ready = true;
var reset = false;
var running = true;
var locked = false;
var lockedby;

var currentImage = 0;
var totalImages;



function nextImage() {
	
	$("#slideshow a.next").click();
		
	timer = setTimeout("nextImage()", 6000);

}

function nextClient() {

	if($("#clientscoller").find("ul").css("marginTop")=="-30px") {
	
		$("#clientscoller ul li:first").appendTo("#clientscoller ul");
		$("#clientscoller ul li:first").appendTo("#clientscoller ul");
		$("#clientscoller").find("ul").css({marginTop : 0}, "fast");
	}

	$("#clientscoller").find("ul").animate({
		marginTop : -30
	}, 800);
	
	setTimeout("nextClient()", 1400);

}

function nextOfficeImage() {
	totalImages = $("#officeinfo img.office").length-1;
	
	if (currentImage!=totalImages) {
		$("#officeinfo img.office").eq(currentImage+1).fadeIn("slow");
		$("#officeinfo img.office").eq(currentImage).fadeOut("slow");
		currentImage += 1;
	}
	else {
		$("#officeinfo img.office").eq(0).fadeIn("fast");
		$("#officeinfo img.office").eq(totalImages).fadeOut("slow");
		currentImage = 0;
	}
	
	setTimeout("nextOfficeImage()", 4000);
}
setTimeout("nextOfficeImage()", 4000);

$(document).ready(function() {


	
		/* Contact Us map  */
	
		$("#buildingmap").addClass("active");
		
		if($.browser.msie) { 
			$("#buildingmap div.popup").hover(function(){
				$(this).find("div").show();
			},function(){
				$(this).find("div").hide();
			});
		}
		else {
			$("#buildingmap div.popup").hover(function(){
				$(this).find("div").fadeIn("fast");
			},function(){
				$(this).find("div").fadeOut("fast");
			});
		}
		
		/* Office Google Maps */
		
		$("#mapthumb a").click(function(){
			if($.browser.msie)
				$("#mappopup").show();
			else
				$("#mappopup").fadeIn("fast");
				
			load();
			return false;
		});
		
		$("#mappopup p.close").click(function() {
			$("#mappopup").hide();		

			GUnload();
		});

	
});