Place = function(id ,lat, lng, name, country, street, city, region, phoneNumbers,type){
	this.id = id; // stelle im array
	this.lat = lat;
	this.lng = lng;
	this.name = name;
	this.country = country;
	this.street = street;
	this.city = city;
	this.region = region;
	this.phoneNumbers = phoneNumbers;
	this.type = type;
}

/**
 * Erzeugt einen Place-Eintrag fuer die Liste der gefundenen Places
 */
Place.prototype.asResultListEntry = function (markerId){
//type ist googlePlace oder dbPLace

	//info("Erzeuge Listen-Eintrag für Place mit ID " + markerId);
	
	// OnClick-Methode + Beschreibung, wenn der Benutzer auf das Bookmark-Icon klickt
//	global.action = "showAddWizard('" + lat + "', '" + lng + "', '" + encodeForRequest(description) + "', '" 

	/*var action = "showAddWizard('" + this.lat + "', '" + this.lng + "', '" + encodeForRequest(this.description) + "', '" 
			+ encodeForRequest(this.street) + "', '" + encodeForRequest(this.city) + "', '" + encodeForRequest(this.country) + "');";*/
	var action = "showAddEarthFaveOverlay('" + this.id + "', '" + this.lat + "', '" + this.lng +"',false,'" + this.type + "'); jumpAnchor() ";
	if (user != "Guest" && user != "guest") 
	{
//		var addEFOnClick = global.action;
		var addEFOnClick = action;
		var addEFTitle = 'Fave it first!';
		global.action = "";// Diese globale Aktion wird mit dem Onclick oben ausgefuehrt, brauchen wir also nicht nach dem Login auszufuehren
	}
	else if (user == "Guest" || user == "guest")
	{
		var addEFOnClick = 'showLogin(\'login\');';
		var addEFTitle = 'Log in to fave it';
	}

  // Die Beschreibung Land-Ort-Straße setzen
	var countryCityStreet = "";
	if (this.country != "") {
		countryCityStreet += this.country;
	}
	if (this.city != "") {
		if (countryCityStreet.length > 0) {
			countryCityStreet += ' > ';
		}
		countryCityStreet += this.city;
	}
	if (this.street != "") {
		if (countryCityStreet.length > 0) {
			countryCityStreet += ' > ';
		}
		countryCityStreet += this.street;
	}
//	if (fcode != "") {
//		countryCityStreet += " (" + fcode + ")";
//	}

	var	r =	'<tr class="result-list-entry" id="trPRLE_' + this.id + '">'
		+	'	<td class="image-place">'
		+	' 		<img alt="image" src="' + global.IMG_URL_TEXTLANGUAGE  + 'icons/add-as-ef-gross.gif" title="'+  addEFTitle + '" onclick="' + addEFOnClick + '" />'
		+	'	</td>'
	 	+	'	<td class="category-icon">'
		//+ ' 		<img src="img/icons/restaurants-gray-large.gif"/>'
		+ 	' 	</td>'
		+ 	'	<td class="description">'
		+	'		<h1>' + this.name + '</h1>'
		+	'		<p class="path">' + countryCityStreet  + '</p>'
		+	'	</td>'
		+ 	'	<td class="actions">'
		+ 	'		<ul>'
		+	'			<li onmouseover="myTip(\'' + addEFTitle + '\');" onmouseout="UnTip();" class="action-label-add-ef" title="'+  addEFTitle + '" onclick="' + addEFOnClick + '"></li>'
		+ 	'			<li onmouseover="myTip(\'Center this place on the map\');" onmouseout="UnTip();" class="action-label-place_show-map" title="Center this place on the map" onclick="Map.show(); Map.centerMarker(' + this.lat+',' + this.lng + '); markDiv(' + markerId + '); closeFilter();"></li>';
		+	'		</ul>'
		+	'	</td>'
		+	'</tr>' 
		+	'<tr>'
		+	'	<td colspan="5">'
		+	'		<div class="result-status" id="divPRS_' + this.id + '">&nbsp</div>'
		+ 	'	</td>'
		+   '</tr>';
		
  return r;
}

// Maria 20.05.2010

Place.prototype.asResultListEntry2 = function (markerId) 
{
//	console.group();
	var action = "showAddEarthFaveOverlay('" + this.id + "', '" + this.lat + "', '" + this.lng +"',false,'" + this.type + "'); jumpAnchor() ";
	if (user != "Guest" && user != "guest") 
	{

		var addEFOnClick = action;
		var addEFTitle = 'Fave it first!';
		global.action = "";
	}
	else if (user == "Guest" || user == "guest")
	{
		var addEFOnClick = 'showLogin(\'login\');';
		var addEFTitle = 'Log in to fave it';
	}

  // Die Beschreibung Land-Ort-Straße setzen
	var countryCityStreet = "";
	if (this.country != "") {
		countryCityStreet += this.country;
	}
	if (this.city != "") {
		if (countryCityStreet.length > 0) {
			countryCityStreet += ' > ';
		}
		countryCityStreet += this.city;
	}
	if (this.street != "") {
		if (countryCityStreet.length > 0) {
			countryCityStreet += ' > ';
		}
		countryCityStreet += this.street;
	}

	var row = "";
	 
	row +=	'<div class="mainDivRListe" id="trPRLE_' + this.id + '">';
	row +=  '  	<div style="float:left; width:100px; min-height:140px; background-color:#fff; margin: 0 8px 0 0;">';
	row +=	' 		<img style="cursor:pointer;" alt="'+this.name+'" src="' + global.IMG_URL_TEXTLANGUAGE  + 'img_default/place_platzhalter_100.png" title="'+  addEFTitle + '" onclick="' + addEFOnClick + '" />';

	row +=	'  		<div class="ef_icons" style="padding-left:25px;">';
	row +=  '			<img onmouseover="myTip(\'show this place centered on the map\');" onmouseout="UnTip();" title="Show this place centered on the map"';
	row +=  '			onclick="Map.show(); Map.centerMarker(' + this.lat+',' + this.lng + '); markDiv(' + markerId + '); closeFilter();"';
	row +=  '			src="' + global.IMG_URL_NONTEXT + 'icons/zoom_place_on_map_16_23.png" />';

	row +=  '			<img onmouseover="myTip(\'' + addEFTitle + '\');" onmouseout="UnTip();" title="'+  addEFTitle + '"';
	row +=  '			onclick="' + addEFOnClick + '"';
	row +=  '			src="' + global.IMG_URL_NONTEXT + 'icons/add_new_place_17_23.png" />'; // !!! falsches BIld, richtiger Bildname!!! Anna
	row +=	'  		</div>';
	row +=	'	</div>';

	row +=	'	<div style="float:left; width:300px; min-height:120px; background-color:#fff; padding-bottom:4px;">';
	row +=	'		<h1 class="place_description">' + this.name + '</h1>';
	row	+=	'		<span>' + countryCityStreet  + '</span>';
	row	+=	'	</div>';
	row +=	'</div>';
// +	'<div>'
		// +	'	<div colspan="5">'
		// +	'		<div class="result-status" id="divPRS_' + this.id + '">&nbsp</div>'
		// + 	'	</div>'
		// +   '</div>';
console.groupEnd();
  return row;
}


/**
 * Erzeugt einen Place-Eintrag fuer die Liste der gefundenen Places im AddWizard
 */
Place.prototype.asAddWizardResultListEntry = function (index) 
{
	
	var trHg = "#f2f2f2"; // Hintegrund farbe fur die <tr..>
	if(index/2 == Math.round(index/2)) {trHg = "#ffffff"};
	//alert("hallo");
	if(this.name == global.YOUR_MARKER){ // marker hat keine adresse, hier werden die trennpfeile zwischen country, city und street entfernt
		var result = '<tr style="height:50px; background-color:'+ trHg +';">';
		//result += '<td style="width:100px;" align="center"> <img src="' + global.IMG_URL_NONTEXT + 'icons/placeToDisEf.jpg" alt="Place" /></td>';
		result += '<td style="width:50px; text-align:left;"> &nbsp; </td>';
		result += '<td colspan="2" style="text-align:left;"> <h3 style="color:#6DC067; margin:3px 0;">' + this.name + '</h3>';
		result += '<td style="width:112px; text-align: center;"> <img src="' + global.IMG_URL_TEXTLANGUAGE + '/buttons/fave_it_first_92_30.png" alt="Be the Discoverer"';
		result += ' onmouseover="this.style.cursor=\'pointer\'; myTip(\'Be the discoverer\');" onmouseout="this.style.cursor=\'auto\'; UnTip();"';
		result += ' onClick="changePageinOverlay(1, 3,\'Index\', ' + index + ', \'no\',\'no\');" /> </td>';
		result += '</tr><tr style="display:block; height:2px;"> </tr>';	
		return result;
	}
	else{
		var result = '<tr style="height:50px; background-color:'+ trHg +';">';
		result += '<td style="width:50px; text-align:left;"> <img style="width:50px;" src="' + global.IMG_URL_NONTEXT + 'icons/placeToDiscEf_54_30.png" alt="Place" /></td>';
//		result += '<td style="width:50px;" align="center"> &nbsp; </td>';
		result += '<td colspan="2" style="text-align:left;"> <h3 style="color:#6DC067; margin:3px 0;">' + this.name + '</h1>';
		result += '<span style="font-size:10px; color:#B0A9A7"> ' + this.country + ' > ';
		result += this.city + ' > ' + this.street + ' &nbsp;</span> </td>';
		result += '<td  style="width:112px; text-align: center;"> <img src="' + global.IMG_URL_TEXTLANGUAGE + '/buttons/fave_it_first_92_30.png" alt="Be the Discoverer"';
		result += ' onmouseover="this.style.cursor=\'pointer\'; myTip(\'Be the discoverer\');" onmouseout="this.style.cursor=\'auto\'; UnTip();"';
		result += ' onClick="changePageinOverlay(1, 3,\'Index\', ' + index + ', \'no\',\'no\');" /> </td>';
		result += '</tr><tr style="display:block; height:2px;"> </tr>';	
		return result;
	}
}

/**
 * Gibt den Typ zurück, wird z.B. für Namenskonvention bei den Icon auf der Karte verwendet
 */
Place.prototype.getType = function (){return "place";}
/**
 * Vergleiche zwei Entities (Places oder earthfaves)
 */
Place.prototype.equal = function(entity){
	if (this.name == entity.name) {	return true;}
	return false;
}

//Arno Place Overlay
Place.prototype.asPlaceEntry = function (markerId){
	var def = "";	var undef = "";	var z; // Fuer die Rueckgabe des HTML-Codes
	var classname = "";	var hasBookedDisc = 0;	var li_bookmark = "";	var bookmarkOnClick = "";	var bookmarkTitle = "";	var prozent =  0;
	var geobookmarker = "";	var stati;	var target = "_self";	var catLink = "";	var placeLocation = "";	var media = "";	var categoryImage = "";

	for( prop in this ){
		if( prop == "asMarker" ){ break; } 
		if( this[prop] == undefined ){ undef += prop + ' value :' + this[prop]+ ' '; }
		else{ def += prop + ' value :' + this[prop]+ ' ';}
	}

	if (get.page_id == "access_extern"){} 
	else {
		placeLocation = this.country ;
		if ( this.city != "" ) { placeLocation += ' > ' + this.city; }
		if ( this.street != "" ) { placeLocation += ' > ' + this.street; }
	}

	switch (this.relationship)	{
		case 0: //user is not loged in
			if (get.page_id != "access_extern"){
				bookmarkOnClick = 'showLogin(\'login\');';
				bookmarkTitle = 'Log in to add this earthfave to your list';
				li_bookmark = '<li id="li-labAdd2" style=""onmouseover="myTip(\'' + bookmarkTitle + '\');" onmouseout="UnTip();" title="' + bookmarkTitle + '" onclick= "setPlaceOverlayVisible(false); setPlaceOverlayInvisibleTimer(); ' + bookmarkOnClick + '"></li>';
			}
			break;
		case 1: //user is loged in
			if (get.page_id != "access_extern"){
				bookmarkOnClick = 'showAddEarthFaveOverlay(' + this.id + ', \'no\', \'no\')';
				bookmarkTitle = 'Add this earthfave to your list';
				li_bookmark = '<li id="li-labAdd2" style=""onmouseover="myTip(\'' + bookmarkTitle + '\');" onmouseout="UnTip();"  title="' + bookmarkTitle + '" onclick= "setPlaceOverlayVisible(false); setPlaceOverlayInvisibleTimer(); ' + bookmarkOnClick + '"></li>';
				global.action = "";
			}
			break;
		
	}

	if (user != "Guest" && user != "guest") {	var addEFTitle = 'Fave it first!';}
	else if (user == "Guest" || user == "guest"){	var addEFTitle = 'Log in to fave it';}
	
	var liDiscover = '<li id="li-addPlace"; style="" onmouseover="myTip(\'' + addEFTitle + '\');" onmouseout="UnTip();" title="'+  addEFTitle + '"';
	//Arno: keine ahnung, wie es in der if-schleife heissen muss
	if (get.page_id == "access_extern") {
		liDiscover += ' onclick="setPlaceOverlayVisible(false); setPlaceOverlayInvisibleTimer(); showAddEarthFaveOverlay(\'' + this.id + '\',\'' + this.lat + '\',\'' + this.lng +'\'); jumpAnchor()">';
	}
	else {
		if(global.user_id == "1") {
			liDiscover += 'onclick="showLogin(\'login\'); setPlaceOverlayVisible(false); setPlaceOverlayInvisibleTimer()"/>';
		}
		else {
			liDiscover += ' onclick="setPlaceOverlayVisible(false); setPlaceOverlayInvisibleTimer(); showAddEarthFaveOverlay(\'' + this.id + '\',\'' + this.lat + '\',\'' + this.lng +'\'); jumpAnchor()"/>';
		}
	}
	
	
	var liCenterMap = '<li id="li-centerPlace"style="" onmouseover="myTip(\'Show this place centered on the map\');"'+markerId+' '+this.id+');" onmouseout="UnTip();"  title="Show this place centered on the map"';
		  liCenterMap +=' onclick="setPlaceOverlayVisible(false); setPlaceOverlayInvisibleTimer(); Map.show(); Map.centerMarker(' + this.lat + ', ' + this.lng+'); markDiv(' + markerId + '); closeFilter(); " />';
		  
	var trStart =	'<tr id="trRLE_' + this.id + '">';
	
	
	var efName = this.name;
	if(efName.length > 42){
		efName = efName.substring(0,42) + "...";
	}
	
	var myTip = this.name;
	var tdImage = '<td style="height:80px; overflow:hidden; width:80px; padding:0px; magin:0px;">'
		+		'<a onmouseover="myTip(\'' + myTip + '\');" onmouseout="UnTip();" href="' + global.URL + this.city + '/' +  this.id + '/' + this.name +'\'" target="' + target + '">'
		+		'<img style="height:80px; width:80px; padding-top:0px; margin:0px;" name="efBild_' + this.id + '" alt="'+ this.name + '" src="' + this.media + '"/>'
		+		'</a>'
		+		'</td>';
	//var tdDescText= '<td class="description-text"></td>';
	var tdCatIcon = '<td rowspan="2" style="height:100px; width:20px; magin:0px;">&nbsp;' + categoryImage	+ '</td>';	
  
  	
	var tdAction = '<td style="width: 0px; height:140px;">'
  	+ '<ul>'
// 	+	liShowEf 			
		+	liCenterMap
//		+ liDeleteOrDiscover
		+	li_bookmark
 		+ '</ul>'
		+	'</td>';


			if( this.relationship != 0 ){
			
				var allLove = parseInt(this.numberBookmarkingFriends) + parseInt(this.numberBookmarkingFF) + parseInt(this.numberBookmarkingOthers);
				if(allLove > 0 || this.relationship == 3 || this.relationship == 2){
				}
		}


	var divFooter = '<div style="height: 30px; margin-top:5px;"  id="divRS_' + this.id + '">';
		divFooter += '	<div  style="float:right;"> <input  class="submitbuttons_login2 login_close_button"  type="submit" value="Cancel" onclick="hideForm(\'placeInformation\');">';
		divFooter += '	</div>';	
		divFooter += '</div>';		
	
	r =	"<tr>"
	+		'<td rowspan=4 style="height:130px; width:80px; vertical-align:top;" >'
	+		'<a onmouseover="myTip(\'' + myTip + '\');" onmouseout="UnTip();" >'
	if(global.user_id=="1") {
	r +=		'<img onclick="showLogin(\'login\'); setPlaceOverlayVisible(false); setPlaceOverlayInvisibleTimer();" style="height:80px; width:80px;" name="efBild_' + this.id + '" alt="'+ this.name + '" src="' + global.URL + 'img_sort/img-text/en/icons/add-as-ef-gross.gif"/>'
	}
	else {
	r +=		'<img onclick="setPlaceOverlayVisible(false); setPlaceOverlayInvisibleTimer(); showAddEarthFaveOverlay(\'' + this.id + '\',\'' + this.lat + '\',\'' + this.lng +'\'); jumpAnchor()" style="height:80px; width:80px;" name="efBild_' + this.id + '" alt="'+ this.name + '" src="' + global.URL + 'img_sort/img-text/en/icons/add-as-ef-gross.gif"/>'
	}
	r+=		'</a>'
	+ categoryImage
	+	'</td>'
	+	"</tr>"
	+	"<tr>"
	+		'<td colspan=3 style="height:30px; width:250px; vertical-align:top;"'
	+		'<h1 style="margin:0px; position:top; overflow:hidden; height:18px; padding-top:2px; color: #3DBB4E;text-decoration: none; text-underline: none; font-size: 14px; width:205px;">'
    + this.name
	+ 		'</h1>'
	+ '<p class="path" style="font-size:10px;">' + placeLocation  + '</p>'
	+	"</td>"
	+		'<td rowspan=3 style="height:130px; width:20px; vertical-align:top;">'
	  	+ '<ul>'
//  	+	liShowEf 			
		+	liCenterMap
//		+ liDeleteOrDiscover
		+	li_bookmark
 		+ '</ul>'
	+'</td>'
	+	"</tr>"
	+	"<tr>"
	+		'<td style="height:70px; overflow:hidden;">'
	+'</td>'
	+	"</tr>";

// mit div-tags - anna
		r =	'<div style="height:100px; width:110px;float:left;" >'
		+		'<a onmouseover="myTip(\'' + myTip + '\');" onmouseout="UnTip();">'
		if(global.user_id=="1") {
		r +=		'<img onclick="showLogin(\'login\'); setPlaceOverlayVisible(false); setPlaceOverlayInvisibleTimer();" style="height:100px; width:100px;" name="placeBild_' + this.id + '" alt="'+ this.name + '" src="' + global.URL + 'img_sort/img-text/en/img_default/place_platzhalter_100.png"/>'
		}
		else {
		r +=		'<img onclick="setPlaceOverlayVisible(false); setPlaceOverlayInvisibleTimer(); showAddEarthFaveOverlay(\'' + this.id + '\',\'' + this.lat + '\',\'' + this.lng +'\'); jumpAnchor()" style="height:100px; width:100px;" name="placeBild_' + this.id + '" alt="'+ this.name + '" src="' + global.URL + 'img_sort/img-text/en/img_default/place_platzhalter_100.png"/>'
		}
		r+=		'</a>'

		+	"</div>"
		+	'<div style="height:100px; min-width:300px;" >'
		+		'<h1 class="place_description" style="overflow:hidden; max-height:65px;">'		
//		+		'<h1 style="margin:0px; position:top; overflow:hidden; height:18px;">'
		+			'<span style="padding-top:2px; font-size: 14px; height:14px; width:205px;" onmouseover="myTip(\'' + myTip + '\');" onmouseout="UnTip();"  >' + this.name + '</span>'
		+ 		'</h1>'
		+ 		'<p class="path" style="font-size:10px; max-height:25px; overflow:hidden;">' + placeLocation  + '</p>'		
//		+ categoryImage
		+	"</div>"
		+	'<div class="ef2_icons" style="height: 25px; width:245px; padding-left:25px;">' // class-name nur furs orientieren
//		+		liShowEf 			
		+		liCenterMap
		+ 		liDiscover
		+	"</div>"
//		+	'<div style="height:auto; overflow:hidden;">'
//		+ 		'<div style="height:12px; width:200px; padding-bottom:5px; color:#676767;font-weight: bold;"> first faved by: </div>'
//		+ 		'<a href="' + global.URL + 'user/' + this.discovererName + '.html"><img style="height:40px; width:40px;float:left;" name="userBild_' + this.id + '" alt="'+ this.name + '" src="' + this.discovererMedium + '"/>'+'</a>'
//		+		'<div class="short-text" style="height:40px; background-color:#EDEEF0;padding-left:45px;">' //<span class="userLink" style="font-weight: bold;">' +this.discovererName+'</span> : '
//		+			'<a class="userLink" onmouseOver="myTip(\'' + discName + ' Rank: ' + this.discovererRank + '\');"'
//		+ 			'onmouseout="UnTip();" href="' + global.URL + 'user/' + this.discovererName + '.html" target="_self">' +  this.discovererName + ': </a>'			
//		+ 			ov
//		+ 		'</div>'
//		+ 		'<div style="height:12px; width:200px; padding-bottom:5px;padding-top:5px; color:#676767;font-weight: bold;"><span class="userLink" style="font-weight: bold;">' +this.numberOfBooker+'</span> people loves this place: </div>'
//		+ 		'<a href="' + global.URL + 'user/' + bookerName + '.html"><img style="height:40px; width:40px;float:left;" name="userBild_' + bookerName + '" alt="'+ bookerName + '" src="' + bookerImg + '"/>' +'</a>'
//		+		'<div class="short-text" style="height:40px; background-color:#EDEEF0;padding-left:45px;"><span class="userLink" style="font-weight: bold;">' +bookerName+'</span> : '
//		+ 			bw
//		+ 		'</div>'
//		+	'</div>'
		+ divFooter;
// anna-ende

	return r;
}
