function newMap(mapX,mapY,mapZ,mapText)
{
	var dialogContainer = document.createElement('div');
   	dialogContainer.setAttribute('id', 'dialogContainer');
   	dialogContainer.setAttribute('title', 'Karta till enjoy wellnesscenter');

   	document.body.appendChild(dialogContainer);

	$.ui.dialog.defaults.bgiframe = true;
	$(function() {
		$("#dialogContainer").dialog({
  			width: 600,
  			height: 400,
  			modal: true,
			overlay:{color:'#000000'},
  			//buttons:{ "Close": function() { $(this).dialog("close"); } },
        	close: function(ev, ui) { $(this).remove(); }
		});
	});
	if (GBrowserIsCompatible())
	{
        var map = new GMap2(document.getElementById('dialogContainer'));
        map.setCenter(new GLatLng(mapX, mapY), mapZ);
        map.getPane(G_MAP_FLOAT_SHADOW_PANE).style.display = "none";
		var marker = new GMarker(new GLatLng(mapX, mapY));
		map.addOverlay(marker);
		marker.openInfoWindow(mapText);
		map.setUIToDefault();
 	}
}

function popit(url,title,w,h)
{
	
	var dialogContainer = document.createElement('div');
   	dialogContainer.setAttribute('id', 'popit');
   	dialogContainer.setAttribute('title', title);

   	document.body.appendChild(dialogContainer);

	$.ui.dialog.defaults.bgiframe = true;
	$("#popit").load(url, function(){
		
		$("#popit").dialog({
			width: w,
			height: h,
			modal: true,
			overlay:{color:'#000000'},
    		close: function(ev, ui) { $(this).remove(); }
		});
	});
}

function envokeTab(tab)
{
	$('.leftTabs').each(function(index) {
    	$(this).css( { color: '#333333'} );
    	$(this).removeAttr("style");
  	});

	$('#tab_'+tab).css( { color: '#CC3333'} );

	$.ajax({
		url: 'tabs/'+tab+'.php',
			success: function(data) {
				$("#tabBody").fadeOut("fast", function() {
		  				$('#tabBody').html(data);
            			$("#tabBody").fadeIn("slow");
    			});
			}
	});
}

function envokeRightTab(tab)
{
	$.ajax({
	  	url: 'tabs/'+tab+'.php',
	  	success: function(data) {
	    $('#centerTableRight').html(data);}
	});
}

function envokePage(page)
{
	if(page.indexOf("#")==-1)
		page = '#'+page;

	$.ajax({
		url: 'bodyBody/'+page.substring(1)+'.php',
			success: function(data) {
				$("#pageCenter").fadeOut("fast", function() {
		  				$('#pageCenter').html(data);
            			$("#pageCenter").fadeIn("slow");
    			});
			}
	});

	$('.menuTabs').each(function(index) {
    	$(this).css( { color: '#333333'} );
    	$(this).removeAttr("style");
  	});


	$('#menu_'+page.substring(1)).css( { color: '#CC3333'} );
	$('#menu_xtravaganza').css( { color: '#E68527'} );
}

hashListener.onHashChanged = function ()
{
	if (document.location.hash.toString().length > 2)
	{
		envokePage(document.location.hash.toString());
	}
	else
	{
		envokePage('start');
	}
};

function setHash(Hash_value)
{
	if(document.location.hash.substring(1)==Hash_value)
	{
		envokePage(document.location.hash);
	}
	else
	{
		hashListener.setHash(Hash_value);
	}
}