function fenster(seite, weite, hoehe,name){ 
var mon, toppos, leftpos; 

toppos = (screen.height - hoehe)/2; 
leftpos = (screen.width - weite)/2; 
features = "scrollbars=1,location=0,toolbar=0,menubar=0,resizable=1,status=0"; 
mon = window.open(seite,"name","width="+weite+",height="+hoehe+",top="+toppos+",left="+leftpos+","+features); 
//mon.document.title=name;
mon.focus();
} 

function fenster1(seite, weite, hoehe, name){ 
var mon, toppos, leftpos; 

toppos = (screen.height - hoehe)/2; 
leftpos = (screen.width - weite)/2; 
features = "scrollbars=1,location=0,toolbar=0,menubar=0,resizable=1,status=0"; 
mon = window.open(seite,"name","width="+weite+",height="+hoehe+",top="+toppos+",left="+leftpos+","+features); 
mon.document.write('<head><title>'+name+'</title></head><body><table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"><tr><td align="center" valign="middle"><img src='+seite+' width="'+eval(weite-40)+'"></td></tr></table></body>');
//mon.document.title=name;
mon.focus();
} 

function MM_displayStatusMsg(msgStr)
{ 
  status=msgStr;
  document.MM_returnValue = true;
}

function linkme(link){
  window.location.href = link;
}
function back(refer){
  if(typeof(document.referrer)!="undefined" && document.referrer.indexOf('http://www.finca-viva-mallorca.de/')>-1 ){
      window.location.href = document.referrer;
  }else{
      window.location.href=refer;
  }
}

var xmlHttp;

function notepad(action,id){
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
  		alert ("Your browser does not support AJAX!");
  		return;
  	}
	var url=document.location.protocol+"//www.finca-viva-mallorca.de/notepad.php";
	url=url+"?action="+action+"&id="+id;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged(){ 
	if (xmlHttp.readyState==4){
		var result=eval(xmlHttp.responseText);
		var notesCounter=result[0];
		var resultText=result[1];
		resultText=unescape(resultText);
		resultText=resultText.replace(/&Auml;/,"Ä");
		resultText=resultText.replace(/&auml;/,"ä");
		resultText=resultText.replace(/&Ouml;/,"Ö");
		resultText=resultText.replace(/&ouml;/,"ö");
		resultText=resultText.replace(/&Uuml;/,"Ü");
		resultText=resultText.replace(/&uuml;/,"ü");
		resultText=resultText.replace(/&szlig;/,"ß");
		resultText=resultText.replace(/&amp;/,"&");
		var link=document.getElementById("navi_merkliste");
		link.innerHTML="Merkliste ("+notesCounter+")";
		if(resultText!="") alert(resultText);
		if(resultText.indexOf('entfernt')>-1) location.reload();
	}
}

function GetXmlHttpObject(){
	var xmlHttp=null;
	try{
  		// Firefox, Opera 8.0+, Safari
  		xmlHttp=new XMLHttpRequest();
  	}
	catch (e){
  		// Internet Explorer
  		try{
    		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    	}
  		catch (e){
    		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    	}
  	}
	return xmlHttp;
}
