$(document).ready(function(){
	//$("ul.subnav").parent().addClass("topnav_parent");
	var over = false;
	$("ul.topnav li").mouseenter(function() {
		var top = $(this).offset().top + 20;
		var left = $(this).offset().left;
		//$(this).find("ul.subnav").css({
		//	top: top,
		//	left: left
		//}).show();
		//alert($("#sub_"+$(this).attr('id')).html());
		$('.subnav').hide();
		over = true;
		$("#sub_"+$(this).attr('id')).css({
			top: top,
			left: left
		}).show();
	});
	
	$("#pagecontainer").mouseenter(function() {
		$('.subnav').hide();
	});
	$("#header_top").mouseenter(function() {
		$('.subnav').hide();
	});
	$("ul.topnav li").mouseleave(function() {
		var id = $(this).attr('id');
		if(!over){
			$("#sub_"+id).hide();
		}
	});
	$(".subnav").mouseover(function(e){
		over = true;
	});

	$(".subnav").mouseleave(function(e){
		over = false;
		$(this).hide();
	});


	$("#home_solutions_webedi").hover(
		function() {
			overlayInfoPanel('home_solutions_webedi');
		},
		function(){	//On Hover Out
			overlayInfoPanel('');
		}
	);
	$("#home_solutions_edisoftware").hover(
		function() {
			overlayInfoPanel('home_solutions_edisoftware');
		},
		function(){	//On Hover Out
			overlayInfoPanel('');
		}
	);
	$("#home_solutions_hostededi").hover(
		function() {
			overlayInfoPanel('home_solutions_hostededi');
		},
		function(){	//On Hover Out
			overlayInfoPanel('');
		}
	);
	$("#home_solutions_solutionfinder").hover(
		function() {
			overlayInfoPanel('home_solutions_solutionfinder');
		},
		function(){	//On Hover Out
			overlayInfoPanel('');
		}
	);
	
	$(".linktoimg").click(function(event){
		event.preventDefault();
		$("#modal").html("<img onload='$(\"#modal\").modal()' src='"+$(this).attr('href')+"'/>").load(function(){$("#modal").modal()});
		return false;
	});
});
function overlayInfoPanel(panelname){
	if(panelname){
		$('#home_infopanel_'+panelname).show();
		$('#home_infopanel').show();
		$('#home_slideshow').hide();
	}else{
		$('#home_slideshow').show();
		$('#home_infopanel').hide();
		$('.home_infopanel_panels').hide();
	}
}
function hideTip(){
	$("#tip").hide().html("");
}
function showTip(id){
	var top = $("#tiplink_"+id).offset().top;
	var left = $("#tiplink_"+id).offset().left;
	$("#tip").load("actions/tips.php?id="+id).css({
		top: top,
		left: left
	}).show();
}
