// return a reference to a DOM element by ID
function e(id) {
	return document.getElementById(id);
}

//show or hide an object
function toggle(elementID) {
	e(elementID).style.display = e(elementID).style.display == 'none' ? '' : 'none';
}

$(document).ready(function() {

	$("#read-news").click(function() {
		location.href = "?latest-news";
	});
	
	$('.current').corners();

	$(function() {
		$(".box1").show(400, function() {
			$(".box2").show(400, function() {
				$(".box3").show(400);
			});	 
		});
	});
	
	$(".boxes .box1").click(function() {
		location.href = "?services";
	});
	$(".boxes .box2").click(function() {
		location.href = "?holidays-and-travel";
	});
	$(".boxes .box3").click(function() {
		location.href = "?about-us";
	});
	//tabs
	$(function() {
		var tab = e('tabs');
		if(tab != null)
		{
			var selectedTabIndex = e('selectedTab');
			$("#tabs").tabs({fx: {opacity: 'toggle'}, selected: selectedTabIndex.value}).addClass('ui-tabs-vertical ui-helper-clearfix');
			$("#tabs li").removeClass('ui-corner-top').addClass('ui-corner-all');
			$("#tabs li a").click(function(){
				var imageGet = this.toString().split("#");
				$("#contentImage").fadeOut("slow");
				
				setTimeout(function(){
					$("#contentImage").fadeIn("slow").html('<img src="images/'+imageGet[1]+'.jpg" alt="Assisting - Developing - Creating" border="0" />');
				}, 500);
			});
		}
	});
	
	$(":button").hover(function(){ 
		$(this).addClass("ui-state-hover"); 
		}, function(){ 
			$(this).removeClass("ui-state-hover"); 
		}).mousedown(function(){
			$(this).addClass("ui-state-active"); 
		}).mouseup(function(){
			$(this).removeClass("ui-state-active");
	});
});
