var map;
var userMarker;
var tweets = [];
//var tag = 'wien';
//var lang = 'lang_de';
var tag="";
var lang="";
var temp;

function addCodeToFunction(func,code){
    if(func == undefined)
        return code;
    else{
        return function(){
            func();
            code();
        }
    }
}

function GetWindowWidthHeight () {
	var myWidth = 0, myHeight = 0;
	if(typeof(window.innerWidth) == 'number')
	{
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	}
	else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
	{
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	}
	else if(document.body && (document.body.clientWidth || document.body.clientHeight))
	{
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	
	return {'width' : myWidth, 'height' : myHeight};
}

function sizeMap () {

  var w = GetWindowWidthHeight().width;
	var h = GetWindowWidthHeight().height;

 center_w = w/2;
  m = document.getElementById("map");
  c = document.getElementById("mapCaption");
  f = document.getElementById("StatusText");
  fa = document.getElementById("faq");
  su = document.getElementById("suche");
  ue = document.getElementById("ueber");
  lo = document.getElementById("loading");
  if (m) { m.style.top = 0; m.style.left = 0;  m.style.width=w; m.style.height=h; }
  if (c) { c.style.top = h-46; }
  if (f) { f.style.left = center_w-200; }
  if (fa) { fa.style.left = center_w-450; }
  if (ue) { ue.style.left = center_w-200; }
  if (su) { su.style.left = center_w-360; }
  if (lo) { lo.style.left = center_w-100; }

if (map) {
} else {
  map = new GMap2(document.getElementById("map"));
	var agent=navigator.userAgent.toLowerCase();
	var is_iphone = (agent.indexOf('iphone')!=-1);
	
	if (is_iphone) {
  	map.setCenter(new GLatLng(39,76), 3);
  	map.addControl(new GSmallMapControl());
  } else {
  	map.setCenter(new GLatLng(39,76), w>700 ? 3 : 2);
  	map.addControl(new GLargeMapControl());	
	}
}
}

function wheelZoom(a) { (a.detail || -a.wheelDelta) < 0 ? map.zoomIn() : map.zoomOut(); }


window.onresize = function() { sizeMap() };

window.onload = addCodeToFunction(window.onload,function() {

  if (GBrowserIsCompatible()) {    
    sizeMap();
  } else {
    alert("Sorry, your browser isn't compatible with Blogsvision!")
  }

//  GEvent.addDomListener(document.getElementById('map'), "DOMMouseScroll", wheelZoom);
//  GEvent.addDomListener(document.getElementById('map'), "mousewheel", wheelZoom);
//  document.getElementById('systemstatus').onclick = function () { new Effect.Fade('systemstatus'); }
document.getElementById('faq').onclick = function () { new Effect.Fade('faq') }
document.getElementById('ueber').onclick = function () { new Effect.Fade('ueber') }


load(id);
}
//load(id);
);

function showfaq () { 
new Ajax.Updater('faq', '/faq.html?', {asynchronous:true, method:'get', evalScripts:false, onSuccess:function(request){new Effect.Appear('faq', {to : 0.9})}}); 
}
function showueber () { 
new Ajax.Updater('ueber', '/ueber.html?', {asynchronous:true, method:'get', evalScripts:false, onSuccess:function(request){new Effect.Appear('ueber', {to : 0.9})}}); 
}
function showsuche () { 
//new Ajax.Updater('suche', '/suche.cgi', {asynchronous:true, method:'get', evalScripts:false, onSuccess:function(request){ new Effect.Appear('suche', {to : 0.9})}}); 
new Effect.Appear('suche', {to : 0.9});
}
function showsuche1 () { 
new Ajax.Updater('suche', '/suche.cgi', {asynchronous:true, method:'get', evalScripts:true, onSuccess:function(request){ new Effect.Appear('suche', {to : 0.9})}}); 
}

function showsearch(id) {
load(id);
new Effect.DropOut('suche');
}

function showresult(page,suche) {
new Effect.Appear('loading',{ duration: 0 });

new Ajax.Updater('suche', '/suche.cgi?page='+page+'&suche='+String(suche), {asynchronous:true, method:'get', evalScripts:true, onSuccess:function(request){new Effect.Appear('suche', {to : 0.9})}}); 

}



