function equalHeight(group) {
	tallest = 0;
    group.each(function() {
        thisHeight = $(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.height(tallest);
}
$(document).ready(function(){
	equalHeight($(".contentbox"));
	$(function() {
	var zIndexNumber = 1000;
	$('div').each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber -= 10;
		});
	});
	$('.nav li:last').css({borderRight: 'none', fontWeight: 'bold'});
	$('div.contentbox h3').gradient({ from: '003399', to: '082B5C' });
	$('div#bigbox ul').gradient({ from: '4C3500', to: '996B00' });
	var quicklinkTimer;
	quicklinkTimer = 0;
	$("#quickbutton").addClass("quickIdle");
	$('div#quicklinks').hoverIntent(function() {
		quicklinkTimer = clearTimeout(quicklinkTimer);
		if($('#quickdrop').is(':visible'))
		$('#quickdrop').show();
		else
		$('#quickdrop').slideDown();
	},function(){
		/*quicklinkTimer = setTimeout('$("#quickdrop").fadeOut("slow");$("#quickbutton").removeClass("quickHover");$("#quickbutton").addClass("quickIdle");',1000);*/
		return false;	
	});
	$('#quicklinks > *').hoverIntent(function() {
	quicklinkTimer = clearTimeout(quicklinkTimer);$('#quickdrop').show();
	$("#quickbutton").addClass("quickHover");
},function(){
	quicklinkTimer = setTimeout('$("#quickdrop").fadeOut("slow");$("#quickbutton").removeClass("quickHover");$("#quickbutton").addClass("quickIdle");',1000);
	$("#quickbutton").addClass("quickHover");
	return false;
});
	$('#quicklinks>ul>li').bt({
		padding: 10,
		width: 150,
		overlap: 0,
		killTitle: true,
		spikeLength: 5,
		spikeGirth: 10,
		cornerRadius: 0,
		fill: '#fff',
		strokeWidth: 1,
		strokeStyle: '#004ce5',
		closeWhenOthersOpen: true,
		clickAnywhereToClose: true,
		cssStyles: {color: '#004ce5', fontWeight: 'bold'},
		hoverIntentOpts: {interval: 500,timeout: 2000}
	});
	$('#main').fadeIn("slow");
	$('#main > *').fadeIn(3000);
	$('li#kwick1').hoverIntent(function() {
		$('a.kwick>span').css("color","#bebebe");
		$('a.one>span').css("color","white");
		if($('#equipment').is(':hidden')){
			$('#bigboxpic > *').fadeOut("slow");
			$('#equipment').fadeIn("fast");
			$('#equipment > *').fadeIn(3000);
		}
	},function(){
		return false;	
	});
	$('li#kwick2').hoverIntent(function() {
		$('a.kwick>span').css("color","#bebebe");
		$('a.two>span').css("color","white");
		if($('#maintenance').is(':hidden')){
			$('#bigboxpic > *').fadeOut("slow");
			$('#maintenance').fadeIn("fast");
			$('#maintenance > *').fadeIn(3000);
		}
	},function(){
		return false;	
	});
	$('li#kwick3').hoverIntent(function() {
		$('a.kwick>span').css("color","#bebebe");
		$('a.three>span').css("color","white");
		if($('#resiliency').is(':hidden')){
			$('#bigboxpic > *').fadeOut("slow");
			$('#resiliency').fadeIn("fast");
			$('#resiliency > *').fadeIn(3000);
		}
	},function(){
		return false;	
	});
	$('li#kwick4').hoverIntent(function() {
		$('a.kwick>span').css("color","#bebebe");
		$('a.four>span').css("color","white");
		if($('#consolidation').is(':hidden')){
			$('#bigboxpic > *').fadeOut("slow");
			$('#consolidation').fadeIn("fast");
			$('#consolidation > *').fadeIn(3000);
		}
	},function(){
		return false;	
	});
	
	$('.country-name').hide();
	$('.eml').hide();
	$('.tags').hide();
	$(".expand-hcard,.expanded-hcard").click(function(event){  
    if ($(this).hasClass('expand-hcard')){
		$('.country-name').show();
		$('.eml').show();
		$(this).removeClass('expand-hcard')
		$(this).addClass('expanded-hcard');
    } else {
		$('.country-name').hide();
		$('.eml').hide();
		$('.tags').hide();
		$(this).removeClass('expanded-hcard')
		$(this).addClass('expand-hcard');
    }
    $(this).parent().next().slideToggle();
    
    return false;
  });
  	
	$('#q').focus(function() {  
		$(this).removeClass("searchboxIdle").addClass("searchboxFocus");
		document.getElementById('q').value='';
		if (this.value == this.defaultValue){
			this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();	
		}  
	});
	$('#q').blur(function() {  
		document.getElementById('q').value='Search';
		$(this).removeClass("searchboxFocus").addClass("searchboxIdle");
		if ($.trim(this.value == '')){
			this.value = (this.defaultValue ? this.defaultValue : '');  
		}

	});
	var tinfrastructure;
	var tsoftware;
	var tservices;
	var thardware;
	tinfrastucture = 0;
	tsoftware = 0;
	tservices = 0;
	thardware = 0;
	
	//////hover over list items
	$('li#infrastructure').hoverIntent(function() {
		$('.software').hide();
		$('.services').hide();
		$('.hardware').hide();
		var tinfrastructure;
		tinfrastructure = 0;
		tinfrastructure = clearTimeout(tinfrastructure);
		$('li#software').css('backgroundColor', '');
		$('li#services').css('backgroundColor', '');
		$('li#hardware').css('backgroundColor', '');
		$('li#infrastructure a').css({'background-color': '#e0e0e0','color': '#004182','border-left': '1px solid #004182'});
		$('div.infrastructure').slideDown("fast");
		return false;
	},function(){
		tinfrastructure = setTimeout(function(){$('li#infrastructure a').css({'background-color': '','color': '#fff'});$("div.infrastructure").fadeOut("slow");},1000);		
		return false;
	});
	$('li#software').hoverIntent(function() {
		$('.hardware').hide();
		$('.services').hide();
		$('.infrastructure').hide();
		var tsoftware;
		tsoftware = 0;
		tsoftware = clearTimeout(tsoftware);
		$('li#infrastructure').css('backgroundColor', '');
		$('li#services').css('backgroundColor', '');
		$('li#hardware').css('backgroundColor', '');
		$('li#software a').css({'background-color': '#e0e0e0','color': '#004182'});
		$('div.software').slideDown("fast");
		return false;
	},function(){
		tsoftware = setTimeout(function(){$('li#software a').css({'background-color': '','color': '#fff'});$("div.software").fadeOut("slow");},1000);
		return false;	
	});
	$('li#services').hoverIntent(function() {
		$('.infrastructure').hide();
		$('.software').hide();
		$('.hardware').hide();
		var tservices;
		tservices = 0;
		tservices = clearTimeout(tservices);
		$('li#infrastructure').css('backgroundColor', '');
		$('li#software').css('backgroundColor', '');
		$('li#hardware').css('backgroundColor', '');
		$('li#services a').css({'background-color': '#e0e0e0','color': '#004182'});
		$('div.services').slideDown("fast");
		return false;
	},function(){
		tservices = setTimeout(function(){$('li#services a').css({'background-color': '','color': '#fff'});$("div.services").fadeOut("slow");},1000);
		return false;	
	});
	$('li#hardware').hoverIntent(function() {
		$('.infrastructure').hide();
		$('.software').hide();
		$('.services').hide();
		var t;
		thardware = 0;
		thardware = clearTimeout(thardware);
		$('li#infrastructure').css('backgroundColor', '');
		$('li#software').css('backgroundColor', '');
		$('li#services').css('backgroundColor', '');
		$('li#hardware a').css({'background-color': '#e0e0e0','color': '#004182','border-right': '1px solid #004182'});
		$('div.hardware').slideDown("fast");
		return false;
	},function(){
		thardware = setTimeout(function(){$('li#hardware a').css({'background-color': '','color': '#fff'});$("div.hardware").fadeOut("slow");},1000);
		return false;	
	});
	$('div.infrastructure').hoverIntent(function() {
		tinfrastructure = clearTimeout(tinfrastructure);$('div.infrastructure').show();
	},function(){
		$('li#infrastructure').hoverIntent(function(){
			tinfrastructure = clearTimeout(tinfrastructure);$('div.infrastructure').show();
		},function(){
			tinfrastructure = setTimeout(function(){$('li#infrastructure a').css({'background-color': '','color': '#fff'});$("div.infrastructure").fadeOut("slow");},1000);
			return false;
		});
		tinfrastructure = setTimeout(function(){$('li#infrastructure a').css({'background-color': '','color': '#fff'});$("div.infrastructure").fadeOut("slow");},1000);
	});
	$('div.software').hoverIntent(function() {
		tsoftware = clearTimeout(tsoftware);$('div.software').show();
	},function(){
		$('li#software').hoverIntent(function(){
			tsoftware = clearTimeout(tsoftware);$('div.software').show();
		},function(){
			tsoftware = setTimeout(function(){$('li#software a').css({'background-color': '','color': '#fff'});$("div.software").fadeOut("slow");},1000);
			return false;
		});
		tsoftware = setTimeout(function(){$('li#software a').css({'background-color': '','color': '#fff'});$("div.software").fadeOut("slow");},1000);
	});
	$('div.services').hoverIntent(function() {
		tservices = clearTimeout(tservices);$('div.services').show();
	},function(){
		$('li#services').hoverIntent(function(){
			tservices = clearTimeout(tservices);$('div.services').show();
		},function(){
			tservices = setTimeout(function(){$('li#services a').css({'background-color': '','color': '#fff'});$("div.services").fadeOut("slow");},1000);
			return false;
		});
		tservices = setTimeout(function(){$('li#services a').css({'background-color': '','color': '#fff'});$("div.services").fadeOut("slow");},1000);
	});
	$('div.hardware').hoverIntent(function() {
		thardware = clearTimeout(thardware);$('div.hardware').show();
	},function(){
		$('li#hardware').hoverIntent(function(){
			thardware = clearTimeout(thardware);$('div.hardware').show();
		},function(){
			thardware = setTimeout(function(){$('li#hardware a').css({'background-color': '','color': '#fff'});$("div.hardware").fadeOut("slow");},1000);
			return false;
		});
		thardware = setTimeout(function(){$('li#hardware a').css({'background-color': '','color': '#fff'});$("div.hardware").fadeOut("slow");},1000);
	});
	
});