var addthis_pub = "";
window.addEvent("domready", function(){
	
	new SmoothScroll({"links": $$(".scroll")});
	new AlphaPng();

	$$(".volatile").each(function(el){
		$(el).addEvent("focus", function(){
			if(this.getValue() == this.getProperty("title")) {
				this.value = "";
			}
		});
	});

	$$("a[rel*='external']").each(function(a){ 
		$(a).setProperty("target", "_blank");
	});
	
	$$("#nav li").each(function(el){
		if (el.hasClass("selected")){
			new ListItemSelector($(el),{ "fxMin": 0.5, "fxMax": 0.5 });
		} else {
			new ListItemSelector($(el),{ "fxMin": 1, "fxMax": 0.5 });
		}
	});
		
	if($("sitelinks")){
	
		var togglers = $$("#sitelinks .tabs a");
		var elements = $$("#sitelinks .sitelinkaccordian .section");
	
		togglers.addEvent("click", function(e){ 
			new Event(e).stop();
		});
		
		var productTabs = new Accordion(togglers, elements,{
			"onActive": function(tab){
				tab.getParent().addClass("selected");
			},
			"onBackground": function(tab){
				tab.getParent().removeClass("selected");
			},
			"alwaysHide": false,
			"transition": null,
			"duration": 0,
			"fixedHeight": 300
		});
		
		var currenturi = window.location.toString();
		var startposition = 0;
		
		if (currenturi.indexOf('meeting-rooms') > 0){
			startposition = 1
		}
		else if (currenturi.indexOf('virtual-offices') > 0) {
			startposition = 2
		}
		
		productTabs.display(startposition);
	
		$$('.section').setStyle('overflow', 'auto');
			
	}
	
	
		$$(".iCal").each(function(el){
		el.setStyle("display", "block");
        var fieldID = el.id.substr( 5 );
        var myCal = new MooCal(fieldID);
    	el.addEvent("click", function(e){
    		var event = new Event(e).stop();
    		var x = event.page.x -235;
    		var y = event.page.y -220;
    		myCal.show(x,y);
    	});
    });
	

	if($("dropdownLink")) {
		var customLink = new Fx.Slide("dropdownContent",{ "duration":1200, "transition": Fx.Transitions.Expo.easeOut });
		customLink.hide();
		$("dropdownLink").addEvent("click", function(e){
			new Event(e).stop();
			customLink.toggle();
		});
	}


	
	$$(".homesections ul").each(function(el){ new Ticker(el, {"interval": 6000}) });
	
	$$(".socialize").addEvent("click", function(e){
		new Event(e).stop();
		addthis_url = location.href;
		addthis_title = document.title;
		addthis_click(this);
	});
	
	
	new Tips($$(".ukmap li a"), {
		initialize: function(){
			this.fx = new Fx.Style(this.toolTip, "opacity", {wait: false});
		},
		onHide: function(){
			this.fx.start(0);
		},
		onShow: function(){
			this.fx.start(1);
		},
		offsets:{
			x:-50,
			y:-30
		}
		
	});
	


	multibox = new MultiBox('mb', {
		showControls:true,
		useOverlay:true,
		overlayColor: "#ffffff"
	});	

	multibox = new MultiBox('virtualtour', {
		showControls:false,
		useOverlay:true,
		overlayColor: "#ffffff"
	});
	
	multibox = new MultiBox('contactus', {
		showControls:false,
		useOverlay:true,
		overlayColor: "#ffffff"
	});
	
	multibox = new MultiBox('referterms', {
		showControls:false,
		useOverlay:true,
		overlayColor: "#ffffff"
	});




});
