//jquery homepage
$(document).ready(function(){
    $("#big-ben").fadeIn(4000);
    setTimeout('$("#homepage-wrapper").animate({bottom:"-500px"},3000);',4000);
});

//tickertape
var headline_count;
    var headline_interval;
    var current_headline = 0;
    var old_headline = 0;
    $(document).ready(function(evt){
        
        var ifacts = $("#factoids li").size();
        $("#factoids li:eq(" + current_headline + ")").css("top","5px");
        
        headline_interval = setInterval(headline_rotate,4000);
        
        $("#factoids").hover(function() {
            clearInterval(headline_interval);
        }, function () {
            headline_interval = setInterval(headline_rotate,4000);
        });
        
        function headline_rotate() {
            current_headline = (old_headline + 1) % ifacts;
            $("#factoids li:eq(" + old_headline + ")")
                .animate({top: "-25px"},1200,
                function () { $(this).css("top", "25px");
            });
            $("#factoids li:eq(" + current_headline + ")")
                .animate({top: "5px"},1200);
            old_headline = current_headline;
        };
    });
    
//jquery for map
$(document).ready(function(){	
    $(".dot").easyTooltip();
        $("#world-map a").click(function(){
        	var retailer = $(this).parent().attr("class").split('-');
		$(".map-overlay." + retailer[1]).fadeIn(200);
		$(".close-me").click(function(){
        		$(".map-overlay").fadeOut(400);	
		});
	});
});

//jquery watches
$(document).ready(function(){
	$("#parliament-link").click(function(){
		$("#holder").animate({left:"0px"},"slow");
		$(".watcharrow").animate({left:"45px"},"slow");
		return false;
	});
	$("#ministry-link").click(function(){
		$("#holder").animate({left:"-940px"},"slow");
		$(".watcharrow").animate({left:"153px"},"slow");
		return false;
	});
	$('a').click(function() {
		this.blur();
	});
});

//jquery clocks
$(document).ready(function(){
	$("#three-train-link").click(function(){
		$("#holder").animate({left:"0px"},"slow");
		$(".arrow").animate({left:"61px"},"slow");
		return false;
	});
	$("#rhodium-link").click(function(){
		$("#holder").animate({left:"-940px"},"slow");
		$(".arrow").animate({left:"243px"},"slow");
		return false;
	});
	$("#rosemary-link").click(function(){
		$("#holder").animate({left:"-1880px"},"slow");
		$(".arrow").animate({left:"425px"},"slow");
		return false;
	});
	$('a').click(function() {
		this.blur();
	});
});

//jquery architectural clocks
$(document).ready(function(){
	$("#intro-link").click(function(){
		$("#holder").animate({left:"0px"},"slow");
		$(".archarrow").animate({left:"51px"},"slow");
		return false;
	});
	$("#st-pancras-link").click(function(){
		$("#holder").animate({left:"-940px"},"slow");
		$(".archarrow").animate({left:"196px"},"slow");
		return false;
	});
	$("#victoria-link").click(function(){
		$("#holder").animate({left:"-1880px"},"slow");
		$(".archarrow").animate({left:"371px"},"slow");
		return false;
	});
	$("#sketch-concept-link").click(function(){
		$("#holder").animate({left:"-2820px"},"slow");
		$(".archarrow").animate({left:"536px"},"slow");
		return false;
	});
	$('a').click(function() {
		this.blur();
	});
});

//watches
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}