$(document).ready(function() {

	
	if ($("#amp_menu_container").width() > 610) {
		//care for the chrome
		var width = $("#amp_menu_container").width();
		$("div.amp_submenu_item").width((width - 2));
	}

//	var base_url = 'http://www.amplifytrading.com/';
	var base_url = 'http://192.168.1.68/amplifytrading/';

	var is_ie6 = (
		window.external &&
		typeof window.XMLHttpRequest == "undefined"
	);
	if (is_ie6 == true) {
		//we have to set the width and height as IE6 can not do it with css
		$('#amp_blanket').css({
			'width' : ($(document).width() - 16) + 'px',
			'height' : $(document).height() + 'px'
		});
	}
	
	$('#amp_blanket').fadeTo("fast", 0);
	/*
	$('#amp_menu_container').hover(
		function() {
			$("#amp_blanket").show();
			$("#amp_blanket").fadeTo("fast", 0.2);
		},
		
		function() {
			$('#amp_blanket').fadeTo("fast", 0);
			$("#amp_blanket").hide();
		}
	);*/
	
	/**
	  * simulates the hypertext click for the whole menu rectangle
	  * there is alsi a <a href tag to make it google friendly and this cares for the rest
	  */
	$(".amp_menu_item").click(function() {
		var uri = $(this).attr('id').substr(4);
		//rewrite _ to /
		uri = uri.replace(/_/g, "/")
		window.location = base_url + uri;
	});
	
	$(".amp_menu_item").hover(
		function(objekt) {			
			var uri = $(this).attr('id').substr(4);
			$("#sml_" + uri).show();
		},
		function(objekt) {
			var uri = $(this).attr('id').substr(4);
			if (objekt.clientY < 52) {
				$("#sml_" + uri).hide();
			}
		}			
	);
	
	$(".amp_submenu_item").mouseout (function (objekt) {
		var target = objekt.relatedTarget.className;
		if (target == null) {
			target = objekt.toElement.className;
		}
		if ((target != 'amp_submenu_item_j') && (target != 'amp_submenu_item')) {
			$(this).hide();
		}
		
	});
});
