var enableGA = false;

function AjaxHTMLUpdate(url,e, period)
{
	if(e==undefined)
		e = $('content');
	if( period != undefined && typeof period == 'number' )
		new Ajax.PeriodicalUpdater(e, url, {frequency:period});
	else
		new Ajax.Updater(e, url, {method:'get', evalScripts:true});
	if( enableGA == true && period == undefined )
		pageTracker._trackPageview(url);
}

function displayPopupMsg(url,type)
{
	if( $('popupcontent') != undefined )
	{
		if( type != undefined)
				$('popup').className = type;
		new Ajax.Updater( $('popupcontent'), url, { method:'get', evalScripts:true, onComplete:displayPopup });
		
		$('popup').style.top = (navigator.appVersion.indexOf("MSIE") != -1) ? (document.documentElement.scrollTop+275) + "px" : (window.pageYOffset + 275)+"px";
		if( enableGA == true )
			pageTracker._trackPageview(url);
	}
}

function displayPopup()
{
	//$('popup').style.top = (navigator.appVersion.indexOf("MSIE") != -1) ? (document.documentElement.scrollTop+275) + "px" : (window.pageYOffset + 275)+"px";
	//alert(new Browser.version())
	if(navigator.userAgent.toLowerCase().indexOf('msie 6') != -1)
		new Effect.Appear("popup", {from:0,to:1},{duration:1.0})
	else
		new Effect.Parallel( [new Effect.Appear("popuplayer", {from:0,to:0.7}), new Effect.Appear("popup", {from:0,to:1},{duration:1.0})]);
}
function closePopup()
{
	//if((ereg("MSIE 6", $_SERVER["HTTP_USER_AGENT"])))		
		new Effect.Parallel( [new Effect.Fade("popuplayer"), new Effect.Fade("popup")] );
//	else
//		new Effect.Fade("popup");
}


function ajaxPopup(url, popuptype)
{
	if( $('popupcontent') != undefined )
	{
		new Ajax.Updater($('popupcontent'), url, {method:'get', evalScripts:true, onComplete: displayPopup});
		if( popuptype != undefined )
			$('popup').className = popuptype;
	}
}



function displayMapTooltip(e, name)
{
	$('tooltip').innerHTML = name;
	Effect.Appear($('tooltip'),{duration:0.3});
	reg = new RegExp('([0-9]*)?', "g");
	$('tooltip').style.top = Math.round(reg.exec(e.style.top)[0]) - 3 + "px";
	reg = new RegExp('([0-9]*)?', "g");
	$('tooltip').style.left = Math.round(reg.exec(e.style.left)[0]) + 15 + "px";
}
function hideMapTooltip()
{
	$('tooltip').style.display="none";
}