start=1;
akt_pm = false;
akt_spottype=false;
scity=false;
sname=false;
var aktspotnr = 0;
var marker = new Array();
var removed = false;

function setSpotType(id)
{
	if(akt_spottype)
		$('spottype' + akt_spottype).removeClassName('active');
	
	akt_spottype = id;
	
	$('spottype' + id).addClassName('active');
	
	$('spottype').value = id;
}

function gotostep1()
{
	if(document.getElementById('step1').style.display == 'none')
	{
		if(document.getElementById('step2').style.display == 'none')
		{
			document.getElementById('step3').style.display = 'none';
			document.getElementById('kk').style.display = 'none';
			if(document.getElementById('detail_table').style.display != 'none')
			{
				document.getElementById('detail_table').style.display = 'none';
			}
			document.getElementById('step1').style.display = 'block';
		}
		else
		{
			document.getElementById('step2').style.display = 'none';
			document.getElementById('step1').style.display = 'block';
		}
	}
}

function scityinput()
{
	scity = true;
}

function snameinput()
{
	sname = true;
}

function nextstep(stepid)
{
	
	if(stepid == 1)
	{
		if(!Form.Element.present('country')){
			Form.Element.focus('country');
	
			new Effect.Highlight('country', { startcolor: '#FF0000' } );
	
			return false;
		}
		else
		{
			if($F('country') == 0)
			{
				alert('Choose a country!');
			}
			else
			{
				if(akt_spottype == false)
				{
					alert('Choose a spot type');
				}
				else
				{	
					if(sname == false)
					{
						alert('Please type in a spotname');
					}
					else
					{
						if(scity == false)
						{
							alert('Please type in a city');
						}
						else
						{
							document.getElementById('step'+stepid).style.display = 'none';
							++stepid;
							document.getElementById('step'+stepid).style.display = 'block';
							showformmap();
							iniSetLoc();
							findAddress();
						}
					}
				}
				
			}
		}

	
	}
	else
	{ 
		document.getElementById('step'+stepid).style.display = 'none';
		++stepid;
		document.getElementById('step'+stepid).style.display = 'block';
		document.getElementById('kk').style.display = 'block';
		
	}
}

function prestep(stepid)
{
	document.getElementById('step'+stepid).style.display = 'none';
	--stepid;
	document.getElementById('step'+stepid).style.display = 'block';
	if(stepid == 2)
	{
		document.getElementById('kk').style.display = 'none';
	}
}

function requestFriendship()
{
	var id = $F('request_user_id');
	
	var text = $F('request_text');
	text.stripTags();
	text.escapeHTML();

	new Ajax.Updater(
		"requestFriendship",
		"ajax_com.php?action=requestFriendship",
			{
				method:'post',
				onComplete:function () 
					{
						$('friendship_request_link').toggle();
					},
				onFailure:showError,
				postBody: 'user_id=' + id + '&text=' + text
			}
		);

}

function invite()
{
	if(!Form.Element.present('invitation_emails')){
		Form.Element.focus('invitation_emails');

		new Effect.Highlight('invitation_emails', { startcolor: '#FF0000' } );

		return false;
	}
	
	var emails = $F('invitation_emails');
	var message = $F('invitation_message');
	
	emails.stripTags();
	emails.escapeHTML();

	message.stripTags();
	message.escapeHTML();
	
	
	new Ajax.Updater(
		"invite",
		"ajax_com.php?action=invite",
			{
				method:'post',
				onFailure:showError,
				postBody: 'emails=' + emails + '&message=' + message
			}
		);

}

function showAvatarError(msg)
{
	$('error_avatar').innerHTML =  msg + "<br/><br/>";
	
}
function editAvatar()
{
	$('editAvatar').popup.show();	
	new Ajax.Updater(
		"editAvatar",
	    "ajax_com.php?action=editAvatar",
	    {
	      asynchronous:true,
	      method: 'post', 
	      onFailure:showError
	    }
	)
	
	return false;
}


function editUser()
{
	$('editUser').popup.show();	
	new Ajax.Updater(
		"editUser",
	    "ajax_com.php?action=editUser",
	    {
	      asynchronous:true,
	      method: 'post', 
	      onFailure:showError
	    }
	)
}

function editdesc()
{
	
	if(!Form.Element.present('edit_text')){
		Form.Element.focus('edit_text');
		new Effect.Highlight('edit_text', { startcolor: '#FF0000' } );
		return false;
	}
	
	if(!Form.Element.present('comment')){
		Form.Element.focus('comment');

		new Effect.Highlight('comment', { startcolor: '#FF0000' } );

		return false;
	}
	
	var text = $F('edit_text');
	
	var comment = $F('comment');

	var sid = $F('sid');
	
	var lid = $F('lid');
		
	text.stripTags();
	text.escapeHTML();

	comment.stripTags();
	comment.escapeHTML();

		new Ajax.Updater(
			"edit_desc",
			"ajax_com.php?action=edittype",
				{
					method:'post',
					onFailure:showError,
					postBody: 'text=' + text + '&comment=' + comment + '&type=desc&sid=' + sid + '&lid=' + lid
				}
			);
}

function editsdesc()
{
	
	if(!Form.Element.present('edit_texts')){
		Form.Element.focus('edit_texts');
		new Effect.Highlight('edit_texts', { startcolor: '#FF0000' } );
		return false;
	}
	
	if(!Form.Element.present('scomment')){
		Form.Element.focus('scomment');

		new Effect.Highlight('scomment', { startcolor: '#FF0000' } );

		return false;
	}
	
	var text = $F('edit_texts');
	
	var comment = $F('scomment');

	var sid = $F('sid');
	
	var lid = $F('lid');
		
	text.stripTags();
	text.escapeHTML();

	comment.stripTags();
	comment.escapeHTML();

		new Ajax.Updater(
			"edit_short_desc",
			"ajax_com.php?action=edittype",
				{
					method:'post',
					onFailure:showError,
					postBody: 'text=' + text + '&comment=' + comment + '&type=short_descr&sid=' + sid + '&lid=' + lid
				}
			);
}

function editcontact()
{
	
	if(!Form.Element.present('edit_text3')){
		Form.Element.focus('edit_text3');
		new Effect.Highlight('edit_text3', { startcolor: '#FF0000' } );
		return false;
	}
	
	if(!Form.Element.present('comment3')){
		Form.Element.focus('comment3');

		new Effect.Highlight('comment3', { startcolor: '#FF0000' } );

		return false;
	}
	
	var text = $F('edit_text3');
	
	var comment = $F('comment3');

	var sid = $F('sid');
	
	var lid = $F('lid');
		
	text.stripTags();
	text.escapeHTML();

	comment.stripTags();
	comment.escapeHTML();

		new Ajax.Updater(
			"edit_contact",
			"ajax_com.php?action=edittype",
				{
					method:'post',
					onFailure:showError,
					postBody: 'text=' + text + '&comment=' + comment + '&type=contact&sid=' + sid + '&lid=' + lid
				}
			);
}

function edithistory()
{
	
	if(!Form.Element.present('edit_text1')){
		Form.Element.focus('edit_text1');
		new Effect.Highlight('edit_text1', { startcolor: '#FF0000' } );
		return false;
	}
	
	if(!Form.Element.present('comment1')){
		Form.Element.focus('comment1');

		new Effect.Highlight('comment1', { startcolor: '#FF0000' } );

		return false;
	}
	
	var text = $F('edit_text1');
	
	var comment = $F('comment1');

	var sid = $F('sid');
	
	var lid = $F('lid');
		
	text.stripTags();
	text.escapeHTML();

	comment.stripTags();
	comment.escapeHTML();

		new Ajax.Updater(
			"edit_history",
			"ajax_com.php?action=edittype",
				{
					method:'post',
					onFailure:showError,
					postBody: 'text=' + text + '&comment=' + comment + '&type=history&sid=' + sid + '&lid=' + lid
				}
			);
}

function editdetails()
{
	
	if(!Form.Element.present('edit_text2')){
		Form.Element.focus('edit_text2');
		new Effect.Highlight('edit_text2', { startcolor: '#FF0000' } );
		return false;
	}
	
	if(!Form.Element.present('comment2')){
		Form.Element.focus('comment2');

		new Effect.Highlight('comment2', { startcolor: '#FF0000' } );

		return false;
	}
	
	var text = $F('edit_text2');
	
	var comment = $F('comment2');

	var sid = $F('sid');
	
	var lid = $F('lid');
		
	text.stripTags();
	text.escapeHTML();

	comment.stripTags();
	comment.escapeHTML();

		new Ajax.Updater(
			"edit_details",
			"ajax_com.php?action=edittype",
				{
					method:'post',
					onFailure:showError,
					postBody: 'text=' + text + '&comment=' + comment + '&type=details&sid=' + sid + '&lid=' + lid
				}
			);
}


function changePass ()
{
	$('changePass').popup.show();	
	new Ajax.Updater(
		"changePass",
	    "ajax_com.php?action=changePass",
	    {
	      asynchronous:true,
	      method: 'post', 
	      onFailure:showError
	    }
	)
	
}



function setHomebase(spot_id)
{
	new Ajax.Request(
		"ajax_com.php?action=setHomebase",
			{
				method:'post',
				onComplete:window.setTimeout("location.reload()", 500),
				onFailure:showError,
				postBody: 'spot_id=' + spot_id
			}
		);

}

function showHomebaseSelector()
{
	$('HomebaseSelector').popup.show();	

	if(!$('gmapframe'))
	{		
		frame = new Element('iframe',{'id':'gmapframe','src':'ajax_com.php?action=map','width':'400', 'height':'380', 'scrolling':'no' ,'marginheight':'0' ,'marginwidth':'0', 'frameborder':'0'});
		$('HomebaseContent').insert(frame);
	}

	return false;
}


function show_pm(id, viewed)
{	
	if(akt_pm)
		blindBox('pm_text' + akt_pm);
	
	if(akt_pm == id){
		akt_pm = false;
		
		return false;
	}
		
	blindBox('pm_text' + id);
	
	akt_pm = id;

	if(!viewed)
	{
		var myAjax = new Ajax.Request(
		"ajax_com.php?action=pm_setviewed",
			{
				method:'post',
				onComplete:function(){
						$('pm_subject' + id).removeClassName("newpm");
				},
				onFailure:showError,
				postBody: 'id=' + id
			}
		);
	}
	
	return false;
}

function answer(recipient_id, answerto_id)
{
	$('pop_answer').popup.show();	
	$('pm_recipient_id').value =  recipient_id;
	$('pm_answerto_id').value = answerto_id;
	
	return false;
}


function showformmap(spots)
{
	if (GBrowserIsCompatible()) {
		var mapObj = document.getElementById("NewSpotMap");
		if (mapObj != "undefined" && mapObj != null) {
		document.getElementById('NewSpotMap').style.display = 'block';
		}
		//initSetLoc();
	}
}

function getmarkers(sm)
{
	var batch = [];
	
	
	
	//return;
	return batch;
}

function isdefined( variable)
{
    return (typeof(window[variable]) == "undefined")?  false: true;
}


function setSpots()
{
	
	if (GBrowserIsCompatible())
	{
		var mapObj = document.getElementById("pic");
		if (mapObj != "undefined" && mapObj != null) {
		
			//spmap := spotcontent map || smap := spotboxmap
			if(sts != 'undefined' && sts != null)
			{
			map = new GMap2(document.getElementById("pic"), {size: new GSize(555,420)});
			map.addControl(new GLargeMapControl());
			map.setCenter(new GLatLng(sts[0]['latitude'], sts[0]['longitude']),15, G_HYBRID_MAP);
			var clusterer = new Clusterer(map);
			
			var icons = new Array();
			
			inactive = new GIcon(G_DEFAULT_ICON);
			inactive.image = 'templates/default/images/marker.png';
			inactive.iconSize = new GSize(13,13);
			inactive.shadow = '';
			inactive.shadowsize = new GSize(0,0);
			inactive. iconAnchor = new GPoint(6,6);
			icons['inactive'] = inactive;
			
			active = new GIcon(G_DEFAULT_ICON);
			active.image = 'templates/default/images/marker_active.png';
			active.iconSize = new GSize(13,13);
			active.shadow = '';
			active.shadowsize = new GSize(0,0);
			active. iconAnchor = new GPoint(6,6);
			icons['active'] = active;
			
			dirt = new GIcon(G_DEFAULT_ICON);			
			dirt.iconSize = new GSize(35,46);
			dirt.shadow = '';
			dirt.shadowsize = new GSize(0,0);
			dirt.iconAnchor = new GPoint(17,46);
			dirt.image = 'templates/default/images/google_pins/dirt.png';
			icons['dirt'] = dirt;
			icons['undefined'] = dirt;
			
			pevent = new GIcon(G_DEFAULT_ICON);
			pevent.iconSize = new GSize(35,46);
			pevent.shadow = '';
			pevent.shadowsize = new GSize(0,0);
			pevent.iconAnchor = new GPoint(17,46);
			pevent.image = 'templates/default/images/google_pins/event.png';
			icons['pevent'] = pevent;
			
			dead = new GIcon(G_DEFAULT_ICON);			
			dead.iconSize = new GSize(35,46);
			dead.shadow = '';
			dead.shadowsize = new GSize(0,0);
			dead.iconAnchor = new GPoint(17,46);
			dead.image = 'templates/default/images/google_pins/dead.png';
			icons['dead'] = dead;
			
			flatland = new GIcon(G_DEFAULT_ICON);			
			flatland.iconSize = new GSize(35,46);
			flatland.shadow = '';
			flatland.shadowsize = new GSize(0,0);
			flatland.iconAnchor = new GPoint(17,46);
			flatland.image = 'templates/default/images/google_pins/flatland.png';
			icons['flatland'] = flatland;
			
			indoor = new GIcon(G_DEFAULT_ICON);			
			indoor.iconSize = new GSize(35,46);
			indoor.shadow = '';
			indoor.shadowsize = new GSize(0,0);
			indoor.iconAnchor = new GPoint(17,46);
			indoor.image = 'templates/default/images/google_pins/indoor.png';
			icons['indoor'] = indoor;
			
			outdoor = new GIcon(G_DEFAULT_ICON);			
			outdoor.iconSize = new GSize(35,46);
			outdoor.shadow = '';
			outdoor.shadowsize = new GSize(0,0);
			outdoor.iconAnchor = new GPoint(17,46);
			outdoor.image = 'templates/default/images/google_pins/outdoor.png';
			icons['outdoor'] = outdoor;
			
			private = new GIcon(G_DEFAULT_ICON);			
			private.iconSize = new GSize(35,46);
			private.shadow = '';
			private.shadowsize = new GSize(0,0);
			private.iconAnchor = new GPoint(17,46);
			private.image = 'templates/default/images/google_pins/private.png';
			icons['private'] = private;
			
			ramp = new GIcon(G_DEFAULT_ICON);			
			ramp.iconSize = new GSize(35,46);
			ramp.shadow = '';
			ramp.shadowsize = new GSize(0,0);
			ramp.iconAnchor = new GPoint(17,46);
			ramp.image = 'templates/default/images/google_pins/ramp.png';
			icons['ramp'] = ramp;
			
			street = new GIcon(G_DEFAULT_ICON);			
			street.iconSize = new GSize(35,46);
			street.shadow = '';
			street.shadowsize = new GSize(0,0);
			street.iconAnchor = new GPoint(17,46);
			street.image = 'templates/default/images/google_pins/street.png';
			icons['street'] = street;
			
			var t = new Array();
			
			for(var i = 0; i < sts.length; ++i)
			{
				aktspotnr++;
				
				
				
				
				
				if(sts[i]['image'] == 'active')
				{
					marker = new GMarker(new GLatLng(sts[i]['latitude'], sts[i]['longitude']), {title: sts[i]['name'], icon: active});
					//clusterer.AddMarker(marker);
				}
				else
				{
					if(sts[i]['image'] == 'inactive')
					{
						marker = new GMarker(new GLatLng(sts[i]['latitude'], sts[i]['longitude']), {title: sts[i]['name'], icon: inactive});
						//clusterer.AddMarker(marker);
					}
					else
					{
						if(sts[i]['image'] == 'templates/default/images/google_pins/dirt.png')
						{
							
							marker = new GMarker(new GLatLng(sts[i]['latitude'], sts[i]['longitude']), {title: sts[i]['name'], icon: dirt});
							//clusterer.AddMarker(marker);
						}
						else
						{
							if(sts[i]['image'] == 'templates/default/images/google_pins/dead.png')
							{
								
								marker = new GMarker(new GLatLng(sts[i]['latitude'], sts[i]['longitude']), {title: sts[i]['name'], icon: dead});
								//clusterer.AddMarker(marker);
							}
							else
							{
								if(sts[i]['image'] == 'templates/default/images/google_pins/event.png')
								{
									marker = new GMarker(new GLatLng(sts[i]['latitude'], sts[i]['longitude']), {title: sts[i]['name'], icon: pevent});
									//clusterer.AddMarker(marker);
								}
								else
								{
									if(sts[i]['image'] == 'templates/default/images/google_pins/flatland.png')
									{
										marker = new GMarker(new GLatLng(sts[i]['latitude'], sts[i]['longitude']), {title: sts[i]['name'], icon: flatland});
										//clusterer.AddMarker(marker);
									}
									else
									{
										if(sts[i]['image'] == 'templates/default/images/google_pins/indoor.png')
										{
											marker = new GMarker(new GLatLng(sts[i]['latitude'], sts[i]['longitude']), {title: sts[i]['name'], icon: indoor});
											//clusterer.AddMarker(marker);
										}
										else
										{
											if(sts[i]['image'] == 'templates/default/images/google_pins/outdoor.png')
											{
												marker = new GMarker(new GLatLng(sts[i]['latitude'], sts[i]['longitude']), {title: sts[i]['name'], icon: outdoor});
												//clusterer.AddMarker(marker);
											}
											else
											{
												if(sts[i]['image'] == 'templates/default/images/google_pins/private.png')
												{
													marker = new GMarker(new GLatLng(sts[i]['latitude'], sts[i]['longitude']), {title: sts[i]['name'], icon: private});
													//clusterer.AddMarker(marker);
												}
												else
												{
													if(sts[i]['image'] == 'templates/default/images/google_pins/ramp.png')
													{
														marker = new GMarker(new GLatLng(sts[i]['latitude'], sts[i]['longitude']), {title: sts[i]['name'], icon: ramp});
														//clusterer.AddMarker(marker);
													}
													else
													{
														if(sts[i]['image'] == 'templates/default/images/google_pins/street.png')
														{
															marker = new GMarker(new GLatLng(sts[i]['latitude'], sts[i]['longitude']), {title: sts[i]['name'], icon: street});
															//clusterer.AddMarker(marker);
														}
														
													}
												}
											}
										}
									}
								}
							}
						}
					}
				
				}
				
//				alert(sts[i]['spot_type'] + ' <---> ' + icons[sts[i]['spot_type']]);
//				marker = new GMarker(
//							new GLatLng(sts[i]['latitude'], sts[i]['longitude']), 
//							{title: sts[i]['name'], icon: icons[sts[i]['spot_type']]});
				title = sts[i]['name'];
				
//				alert(t + ' ' + title);
				
				t = sts[i]['link'];
				html = '<a href="' + t + '">'+title+'</a>';
//				if(t != 'undefined' && t != '')
//				{
//					//GEvent.addListener(marker, "click", function() {document.location.href(t)});
//					GEvent.addListener(marker, "click", function() {
//			            marker.openInfoWindowHtml(title + "<br>" + html);
//			          });
//
//				}
				GEvent.addListener(marker,'mouseover',function() {marker.openToolTip(title)});
				GEvent.addListener(marker,'mouseout',function() {marker.closeToolTip()});
				clusterer.AddMarker(marker);
				
				}
			}
		}
	
	}
	
	return;
}

function loc(link)
{
//	alert(link);
	window.open(link);
}

function new_spot()
{
	$('pop_newspot').popup.show();	
	
	return false;
}

function sendMessage()
{
 
	if(!Form.Element.present('pm_text')){
		Form.Element.focus('pm_text');

		new Effect.Highlight('pm_text', { startcolor: '#FF0000' } );

		return false;
	}
	
	if(!Form.Element.present('pm_subject')){
		Form.Element.focus('pm_subject');

		new Effect.Highlight('pm_subject', { startcolor: '#FF0000' } );

		return false;
	}

	var subject = $F('pm_subject');
	subject.stripTags();
	subject.escapeHTML();

	var message = $F('pm_text');
	message.stripTags();
	message.escapeHTML();

 	new Ajax.Request(
		"ajax_com.php?action=pm_send",
			{
				method:'post',
				onComplete:function(r){
							$('pm_info').innerHTML = "Nachricht gesendet";				
							$('pm_subject').value = "";
							$('pm_text').value = "";
						},
				onFailure:showError,
				postBody: 'recipient_id=' + $F('pm_recipient_id') + '&message=' + message  + '&subject=' + subject +
							'&answerto_id=' + $F('pm_answerto_id')
			}
		);

	$('pop_answer').popup.hide();	
	
	return false;
}


function show_recent(direction,  div, side, media_type , append) 
{
	new Ajax.Updater(
	 	div,
	    "ajax_com.php?action=videos&" + append,
	    {
	      asynchronous:true,
	      method: 'post', 
	      postBody: 'dir=' + direction + '&filter=' + div + '&side=' + side + '&media_type=' + media_type,
	      onFailure:showError
	    }
	)
  
	return false;
}

function show_recent_users(direction,  div, side, media_type , append) 
{
	new Ajax.Updater(
	 	div,
	    "ajax_com.php?action=users&" + append,
	    {
	      asynchronous:true,
	      method: 'post', 
	      postBody: 'dir=' + direction + '&filter=' + div + '&page=' + side + '&media_type=' + media_type,
	      onFailure:showError
	    }
	)
  
	return false;
}

function show_pms(page) 
{
 new Ajax.Updater(
 	"pms",
    "ajax_com.php?action=pms",
    {
      asynchronous:true,
      method: 'post', 
      postBody: 'page=' + page,
      onFailure:showError
    }
  )
}




function fullscreenPlayer(mid, mlink) {
	//alert('mediaid: ' + mid + ' ,medialink: ' + mlink);

	var sbreite, shoehe;

	var ns6 = (!document.all && document.getElementById);
	var ie4 = (document.all);
	var ns4 = (document.layers);

	if(ns6||ns4) {
		sbreite = outerWidth;
		shoehe = outerHeight;
	}
	else if(ie4) {
		sbreite = document.body.clientWidth;
		shoehe = document.body.clientHeight;
	}
	
	sbreite = 640;
	shoehe = 480;

	var url = "fs.php?mid=" + mid;
	var wnd = window.open(url,"flashfullscreen","height="+shoehe+", width="+sbreite+", status = 0, toolbar = 0, menubar = 0, location = 0, resizable = 0, titlebar = 0, scrollbars = 0, fullscreen = 1, top =0,left =0");
};


akt_spotbox = false;

function change_spotbox(id) 
{
	if (akt_spotbox) 
	{
		document.getElementById("header_" + id).style.color = "#FFFFFF";
		document.getElementById("box_" + id).style.display = "block";

		document.getElementById("header_" + akt_spotbox).style.color = "#1DBBE9";
		document.getElementById("box_" + akt_spotbox).style.display = "none";
		akt_spotbox = id;
	}
	else
	{
		akt_spotbox = id;
	}
		
	return;
};



function blindBox(id)
{
	var box = document.getElementById(id);
	
	if(box.style.display == 'none')
		new Effect.BlindDown(id);
		
	else
		new Effect.BlindUp(id);
}

function setRate(rating)
{
	for(i=2; i<=10; i=i+2){
		document.getElementById("rate" + i).src = "templates/default/images/star_blank.png";
	}
	for(i=2; i <= rating; i=i+2)
		document.getElementById("rate" + i).src = "templates/default/images/star_full2.png";
}

/** This function is only for the big flashplayer - mouseover **/
function setRateBig(rating)
{
	for(i=2; i<=10; i=i+2){
		document.getElementById("rate" + i).src = "templates/default/images/player/stars/star_blank.png";
	}
	for(i=2; i <= rating; i=i+2){
		document.getElementById("rate" + i).src = "templates/default/images/player/stars/star_full.png";
	}
}

function setRatingBig(rating, media_key, isspot){
//	alert(rating+" "+media_key+" "+isspot);
	//media: isspot := 0
	//spot: isspot := 1
	var myAjax = new Ajax.Request(
		"ajax_com.php?action=mediarating",
			{
				method:'post',
				onComplete:showRatingResultBigPlayer,
				onFailure:showError,
				postBody: 'rating=' + rating + '&mediakey=' + media_key + '&isspot=' + isspot  + '&player=big'
			}
	)

}
function setRating(rating, media_key, isspot){
	//media: isspot := 0
	//spot: isspot := 1
	var myAjax = new Ajax.Request(
		"ajax_com.php?action=mediarating",
			{
				method:'post',
				onComplete:showRatingResult,
				onFailure:showError,
				postBody: 'rating=' + rating + '&mediakey=' + media_key + '&isspot=' + isspot
			}
	)

}

function addFav(isSpot, id, uid, language){
//	alert("+ Favoriten");
//alert(language);
	var myAjax = new Ajax.Request(
		"ajax_com.php?action=addFavourite",
			{
				method:'post',
				onComplete:showFavouriteResult,
				onFailure:showError,
				postBody: 'isSpot=' + isSpot + '&id=' + id + '&uid=' + uid
			}
	)

}

function delFav(isSpot, id, uid, language){
//	alert("- Favoriten");
//alert(language);
	var myAjax = new Ajax.Request(
		"ajax_com.php?action=delFavourite",
			{
				method:'post',
				onComplete:showDeleteFavouriteResult,
				onFailure:showError,
				postBody: 'isSpot=' + isSpot + '&id=' + id + '&uid=' + uid
			}
	)
}


function playerAlert(text, id){
	var crossClose = '<a href="javascript:fadeOut(\''+id+'\')"><img id="crossClose" src="templates/default/images/crossClose.gif" border="0" title="Hinweis schliessen"></a>';
	if(alert != ''){
		var  alertText = text;
	}else{		
		var alertText = "Es ist ein Fehler aufgetreten. Bitte versuche es noch einmal!";
	}	
		document.getElementById(id).style.display = 'block';
		document.getElementById(id).innerHTML = alertText+crossClose;
}

function fadeOut(id){	
		//Effect.Appear(id, { duration: 3.0, from: 0, to: 1 });	//FadeIn
		window.setTimeout("Effect.Fade('"+id+"', { duration: 1.0 })", 0);//FadeOut
}

function privacy(uid){

	if($F('name4')!=null){
		
		var name = $F('name4');
	}
	else
	{
		if($F('name3')!=null)
		{
			var name = $F('name3')
		}
		else
		{
			if($F('name2')!=null)
			{
				var name = $F('name2')
			}
			else
			{
				if($F('name1')!=null)
				{
					var name = $F('name1')
				}
				else
				{
					if($F('name0')!=null)
					{
						var name = $F('name0')
					}
					else
					{
						var name = 4;
					}
				}
			}
		}
		
	}
	
	if($F('zip4')!=null){
		
		var zip = $F('zip4');
	}
	else
	{
		if($F('zip3')!=null)
		{
			var zip = $F('zip3')
		}
		else
		{
			if($F('zip2')!=null)
			{
				var zip = $F('zip2')
			}
			else
			{
				if($F('zip1')!=null)
				{
					var zip = $F('zip1')
				}
				else
				{
					if($F('zip0')!=null)
					{
						var zip = $F('zip0')
					}
					else
					{
						var zip = 4;
					}
				}
			}
		}
		
	}
	
	if($F('country4')!=null){
		
		var country = $F('country4');
	}
	else
	{
		if($F('country3')!=null)
		{
			var country = $F('country3')
		}
		else
		{
			if($F('country2')!=null)
			{
				var country = $F('country2')
			}
			else
			{
				if($F('country1')!=null)
				{
					var country = $F('country1')
				}
				else
				{
					if($F('country0')!=null)
					{
						var country = $F('country0')
					}
					else
					{
						var country = 4;
					}
				}
			}
		}
		
	}
	
	if($F('birthday4')!=null){
		
		var birthday = $F('birthday4');
	}
	else
	{
		if($F('birthday3')!=null)
		{
			var birthday = $F('birthday3')
		}
		else
		{
			if($F('birthday2')!=null)
			{
				var birthday = $F('birthday2')
			}
			else
			{
				if($F('birthday1')!=null)
				{
					var birthday = $F('birthday1')
				}
				else
				{
					if($F('birthday0')!=null)
					{
						var birthday = $F('birthday0')
					}
					else
					{
						var birthday = 4;
					}
				}
			}
		}
		
	}
	
	if($F('interest_bmx4')!=null){
		
		var interest_bmx = $F('interest_bmx4');
	}
	else
	{
		if($F('interest_bmx3')!=null)
		{
			var interest_bmx = $F('interest_bmx3')
		}
		else
		{
			if($F('interest_bmx2')!=null)
			{
				var interest_bmx = $F('interest_bmx2')
			}
			else
			{
				if($F('interest_bmx1')!=null)
				{
					var interest_bmx = $F('interest_bmx1')
				}
				else
				{
					if($F('interest_bmx0')!=null)
					{
						var interest_bmx = $F('interest_bmx0')
					}
					else
					{
						var interest_bmx = 4;
					}
				}
			}
		}
		
	}
	
	if($F('interest_gen4')!=null){
		
		var interest_gen = $F('interest_gen4');
	}
	else
	{
		if($F('interest_gen3')!=null)
		{
			var interest_gen = $F('interest_gen3')
		}
		else
		{
			if($F('interest_gen2')!=null)
			{
				var interest_gen = $F('interest_gen2')
			}
			else
			{
				if($F('interest_gen1')!=null)
				{
					var interest_gen = $F('interest_gen1')
				}
				else
				{
					if($F('interest_gen0')!=null)
					{
						var interest_gen = $F('interest_gen0')
					}
					else
					{
						var interest_gen = 4;
					}
				}
			}
		}
		
	}
	
	if($F('about_me4')!=null){
		
		var about_me = $F('about_me4');
	}
	else
	{
		if($F('about_me3')!=null)
		{
			var about_me = $F('about_me3')
		}
		else
		{
			if($F('about_me2')!=null)
			{
				var about_me = $F('about_me2')
			}
			else
			{
				if($F('about_me1')!=null)
				{
					var about_me = $F('about_me1')
				}
				else
				{
					if($F('about_me0')!=null)
					{
						var about_me = $F('about_me0')
					}
					else
					{
						var about_me = 4;
					}
				}
			}
		}
		
	}
	
	if($F('sponsors4')!=null){
		
		var sponsors = $F('sponsors4');
	}
	else
	{
		if($F('sponsors3')!=null)
		{
			var sponsors = $F('sponsors3')
		}
		else
		{
			if($F('sponsors2')!=null)
			{
				var sponsors = $F('sponsors2')
			}
			else
			{
				if($F('sponsors1')!=null)
				{
					var sponsors = $F('sponsors1')
				}
				else
				{
					if($F('sponsors0')!=null)
					{
						var sponsors = $F('sponsors0')
					}
					else
					{
						var sponsors = 4;
					}
				}
			}
		}
		
	}
	
	if($F('filmer_act4')!=null){
		
		var filmer_act = $F('filmer_act4');
	}
	else
	{
		if($F('filmer_act3')!=null)
		{
			var filmer_act = $F('filmer_act3')
		}
		else
		{
			if($F('filmer_act2')!=null)
			{
				var filmer_act = $F('filmer_act2')
			}
			else
			{
				if($F('filmer_act1')!=null)
				{
					var filmer_act = $F('filmer_act1')
				}
				else
				{
					if($F('filmer_act0')!=null)
					{
						var filmer_act = $F('filmer_act0')
					}
					else
					{
						var filmer_act = 4;
					}
				}
			}
		}
		
	}
	
	if($F('riding_since4')!=null){
		
		var riding_since = $F('riding_since4');
	}
	else
	{
		if($F('riding_since3')!=null)
		{
			var riding_since = $F('riding_since3')
		}
		else
		{
			if($F('riding_since2')!=null)
			{
				var riding_since = $F('riding_since2')
			}
			else
			{
				if($F('riding_since1')!=null)
				{
					var riding_since = $F('riding_since1')
				}
				else
				{
					if($F('riding_since0')!=null)
					{
						var riding_since = $F('riding_since0')
					}
					else
					{
						var riding_since = 4;
					}
				}
			}
		}
		
	}
	
	if($F('music_pref4')!=null){
		
		var music_pref = $F('music_pref4');
	}
	else
	{
		if($F('music_pref3')!=null)
		{
			var music_pref = $F('music_pref3')
		}
		else
		{
			if($F('music_pref2')!=null)
			{
				var music_pref = $F('music_pref2')
			}
			else
			{
				if($F('music_pref1')!=null)
				{
					var music_pref = $F('music_pref1')
				}
				else
				{
					if($F('music_pref0')!=null)
					{
						var music_pref = $F('music_pref0')
					}
					else
					{
						var music_pref = 4;
					}
				}
			}
		}
		
	}
	
	if($F('favourites4')!=null){
		
		var favourites = $F('favourites4');
	}
	else
	{
		if($F('favourites3')!=null)
		{
			var favourites = $F('favourites3')
		}
		else
		{
			if($F('favourites2')!=null)
			{
				var favourites = $F('favourites2')
			}
			else
			{
				if($F('favourites1')!=null)
				{
					var favourites = $F('favourites1')
				}
				else
				{
					if($F('favourites0')!=null)
					{
						var favourites = $F('favourites0')
					}
					else
					{
						var favourites = 4;
					}
				}
			}
		}
		
	}
	
	
	var uid = uid;
	
	var myAjax = new Ajax.Request(
		"ajax_com.php?action=private",
			{
				method:'post',
				onFailure:showError,
				postBody: '&name=' + name + '&zip=' + zip + '&country=' + country + '&birthday=' + birthday + '&interest_bmx=' + interest_bmx + '&interest_gen=' + interest_gen + '&about_me=' + about_me + '&sponsors=' + sponsors + '&filmer_act=' + filmer_act + '&riding_since=' + riding_since + '&music_pref=' + music_pref + '&favourites=' + favourites + '&uid=' + uid
			}
	)

}

function delImage(iid){

	var myAjax = new Ajax.Request(
		"ajax_com.php?action=delimage",
			{
				method:'post',
				onFailure:showError,
				postBody: '&iid=' + iid
			}
	)

}

function setPic(iid, type, sid){

	spot_id = sid;

	var myAjax = new Ajax.Request(
		"ajax_com.php?action=setpic",
			{
				method:'post',
				onComplete:gotospot,
				onFailure:showError,
				postBody: '&iid=' + iid + '&type=' + type + '&sid=' + sid
			}
	)

}

function gotospot()
{
	window.location.href=("spots.php?spot_id="+spot_id);
}

function showDeleteImageResult(r){
	if(CheckIfError(r)) return;
}

function setFavorite(media_key){

	var myAjax = new Ajax.Request(
		"ajax_com.php?action=favourite",
		{
				method:'post',
				onComplete:showFavouriteResult,
				onFailure:showError,
				postBody: '&mediakey=' + media_key
			}
	)
}

function showDeleteFavouriteResult(r){
	if(CheckIfError(r)) return;
	var result = r.responseXML.documentElement;
	var label = result.getElementsByTagName('label')[0].firstChild.data;
	var m2 = result.getElementsByTagName('m2')[0].firstChild.data;
	var id = result.getElementsByTagName('id')[0].firstChild.data;
	var uid = result.getElementsByTagName('uid')[0].firstChild.data;
	var isspot = result.getElementsByTagName('isspot')[0].firstChild.data;
	var image = result.getElementsByTagName('image')[0].firstChild.data;
	if(isspot == "true"){
		document.getElementById("addfav").innerHTML = '<a href="javascript:void(0)" onclick="addFav(true, ' + id + ', ' + uid + ')"><img src="' + image + '" border="0"></a>';
		document.getElementById("playerAlertBox").style.display = 'block';
		document.getElementById("playerAlertBox").innerHTML = m2;
		//Effect.Appear('m2', { duration: 3.0, from: 0, to: 1 });	
		window.setTimeout("Effect.Fade('playerAlertBox', { duration: 2.0 })", 1000);
	}
	else{
		document.getElementById("addfav").innerHTML = '<a href="javascript:void(0)" onclick="addFav(false, ' + id + ', ' + uid + ')"><img src="' + image + '" border="0"></a>';
		document.getElementById("playerAlertBox").style.display = 'block';
		document.getElementById("playerAlertBox").innerHTML = m2;
		//Effect.Appear('m2', { duration: 3.0, from: 0, to: 1 });	
		window.setTimeout("Effect.Fade('playerAlertBox', { duration: 2.0 })", 1000);
	}	
}
function showFavouriteResult(r){
	if(CheckIfError(r)) return;
	var result = r.responseXML.documentElement;
	var label = result.getElementsByTagName('label')[0].firstChild.data;
	var m2 = result.getElementsByTagName('m2')[0].firstChild.data;
	var id = result.getElementsByTagName('id')[0].firstChild.data;
	var uid = result.getElementsByTagName('uid')[0].firstChild.data;
	var isspot = result.getElementsByTagName('isspot')[0].firstChild.data;
	var image = result.getElementsByTagName('image')[0].firstChild.data;
	if(isspot == "true"){
		document.getElementById("addfav").innerHTML = '<a href="javascript:void(0)" onclick="delFav(true, ' + id + ', ' + uid + ')"><img src="' + image + '" border="0"></a>';
		document.getElementById("playerAlertBox").style.display = 'block';
		document.getElementById("playerAlertBox").innerHTML = m2;
		//Effect.Appear('m2', { duration: 3.0, from: 0, to: 1 });	//FadeIn
		window.setTimeout("Effect.Fade('playerAlertBox', { duration: 2.0 })", 1000);//FadeOut
	}
	else{
		document.getElementById("addfav").innerHTML = '<a href="javascript:void(0)" onclick="delFav(false, ' + id + ', ' + uid + ')"><img src="' + image + '" border="0"></a>';
		document.getElementById("playerAlertBox").style.display = 'block';
		document.getElementById("playerAlertBox").innerHTML = m2;
		//Effect.Appear('m2', { duration: 3.0, from: 0, to: 1 });	//FadeIn
		window.setTimeout("Effect.Fade('playerAlertBox', { duration: 2.0 })", 1000);//FadeOut
	}
}

function showRatingResult(r){
//	alert("showRatingResult(r)"+r);
		if(CheckIfError(r)) return ;
		var result = r.responseXML.documentElement;
		var stars = result.getElementsByTagName('stars')[0].firstChild.data;
		var message = result.getElementsByTagName('message')[0].firstChild.data;
		document.getElementById("new_rate").innerHTML = stars + '<br /><br />' + message + '<br /><br />';
}
function showRatingResultBigPlayer(r){
//	alert("showRatingResultBigPlayer(r)"+r);
		if(CheckIfError(r)) return ;
		var result = r.responseXML.documentElement;
		var stars = result.getElementsByTagName('stars')[0].firstChild.data;
		var message = result.getElementsByTagName('message')[0].firstChild.data;
//		alert(stars);
		document.getElementById("newBigRate").innerHTML = stars;
		document.getElementById("playerAlertBox").style.display = 'block';
		document.getElementById("playerAlertBox").innerHTML = message;
		window.setTimeout("Effect.Fade('playerAlertBox', { duration: 2.0 })", 1000);
}

function checkMediaForm(){


	if(!Form.Element.present('comment_text_id')){
		Form.Element.focus('comment_text_id');

		new Effect.Highlight('comment_text_id', { startcolor: '#FF0000' } );

		return false;
	}


	showComments(1)

	blindBox('new_comment');

	return false;
}

function showError(r){
	alert("Error: " + r.status + "/n" + r.statusText);
}

function CheckIfError(r){
	var result = r.responseXML.documentElement;
	var error = result.getElementsByTagName('error')[0].firstChild.data;
	var error_string = result.getElementsByTagName('error_string')[0].firstChild.data;
	if(error == 1){
		if(error_string != ""){
			alert("Error: " + error_string);
		}
	return true;
	}
return false;
}

function clearValue(id, defaultValue){
	if(defaultValue == document.getElementById(id).value){
		document.getElementById(id).value = '';
	}
	document.getElementById(id).style.color='#000';
}
function setDefaultValue(id, defaultValue){
	if(defaultValue == document.getElementById(id).value || document.getElementById(id).value == ''){
		document.getElementById(id).value = defaultValue;
		document.getElementById(id).style.color='#a1a1a1';
	}
}

function showComments(page)
{
	var myAjax = new Ajax.Updater(
	'comments',
		"ajax_com.php?action=comments",
			{
				method:'post',
				onFailure:showError,
				onComplete: function(){$('comment_text_id').value=""},
				postBody: 'page=' + page + '&mediakey=' + $F('comment_mediakey_id') + '&comment_text=' +  $F('comment_text_id').escapeHTML()
			}
	);
}

function lookupRider(inputString) {
    if(inputString.length < 3) {
        // Hide the suggestion box.
        $('#rider_suggestions').hide();
    } else {
        $.post("rpc.php", {queryString: ""+inputString+"", table: "ost_rider_info", prefix: "rider"}, function(data){
            if(data.length >0) {
                $('#rider_suggestions').show();
                $('#rider_autoSuggestionsList').html(data);
            }
            else
            {
            $('#rider_suggestions').hide();
            }
        });
    }
}

function fillrider(thisValue, id) {
	var Eintrag = document.createElement("option");
	Eintrag.text = thisValue;
	Eintrag.value = id;
	var FO = null;
	var formObj = document.getElementById("rlist");
	for(var i=0; i<formObj.options.length; i++) {
	  if(formObj.options[i].value == id) {
	   removeFromRiderList(i);
	  }
	}
	document.forms[1].rlist.add(Eintrag, FO);
	document.forms[1].rider.value = '';
	$('#rider_suggestions').hide();
}

function lookupFilmer(inputString) {
    if(inputString.length < 3) {
        // Hide the suggestion box.
        $('#filmer_suggestions').hide();
    } else {
        $.post("rpc.php", {queryString: ""+inputString+"", table: "ost_filmer_info", prefix: "filmer"}, function(data){
            if(data.length >0) {
                $('#filmer_suggestions').show();
                $('#filmer_autoSuggestionsList').html(data);
            }
            else
            {
            $('#filmer_suggestions').hide();
            }
        });
    }
}

function fillfilmer(thisValue, id) {
    var Eintrag = document.createElement("option");
	Eintrag.text = thisValue;
	Eintrag.value = id;
	var FO = null;
	var formObj = document.getElementById("flist");
	for(var i=0; i<formObj.options.length; i++) {
	  if(formObj.options[i].value == id) {
	   removeFromFilmerList(i);
	  }
	}
	document.forms[1].flist.add(Eintrag, FO);
	document.forms[1].filmer.value = '';
   $('#filmer_suggestions').hide();
}

function copyToSpotList(name, id)
{
	var Eintrag = document.createElement("option");
	Eintrag.text = name;
	Eintrag.value = id;
	var formObj = document.getElementById("spots");
	for(var i=0; i<formObj.options.length; i++) {
	  if(formObj.options[i].value == id) {
	   removeFromSpotsList(i);
	  }
	}
	var FO = null;
	document.forms[1].spots.add(Eintrag, FO);
	
}

function lookupEditor(inputString) {
    if(inputString.length < 3) {
        // Hide the suggestion box.
        $('#editor_suggestions').hide();
    } else {
        $.post("rpc.php", {queryString: ""+inputString+"", table: "ost_editor_info", prefix: "editor"}, function(data){
            
            if(data.length >0) {
                $('#editor_suggestions').show();
                $('#editor_autoSuggestionsList').html(data);
            }
            else
            {
            $('#editor_suggestions').hide();
            }
        });
    }
}

function filleditor(thisValue, id) {
    var Eintrag = document.createElement("option");
	Eintrag.text = thisValue;
	Eintrag.value = id;
	var FO = null;
	var formObj = document.getElementById("elist");
	for(var i=0; i<formObj.options.length; i++) {
	  if(formObj.options[i].value == id) {
	   removeFromEditorList(i);
	  }
	}
	document.forms[1].elist.add(Eintrag, FO);
	document.forms[1].editor.value = '';
   $('#editor_suggestions').hide();
}

function removeFromSpotList(id)
{
	var formObj = document.getElementById("spots");
	for(var i=formObj.options.length-1; i>=0; i--) {
	  if(formObj.options[i].selected) {
	   document.forms[1].spots.remove(i);
	  }
	}
	
}

function removeFromRiderList(id)
{
	var formObj = document.getElementById("rlist");
	for(var i=formObj.options.length-1; i>=0; i--) {
	  if(formObj.options[i].selected) {
	   document.forms[1].rlist.remove(id);
	  }
	}
	
}

function removeFromEditorList(id)
{
	var formObj = document.getElementById("elist");
	for(var i=formObj.options.length-1; i>=0; i--) {
	  if(formObj.options[i].selected) {
	   document.forms[1].elist.remove(id);
	  }
	}
	
}

function removeFromFilmerList(id)
{
	var formObj = document.getElementById("flist");
	for(var i=formObj.options.length-1; i>=0; i--) {
	  if(formObj.options[i].selected) {
	   document.forms[1].flist.remove(id);
	  }
	}
	
}

function addNewRider(namestring)
{
	
	new Ajax.Request(
			"ajax_com.php?action=new_rider",
				{
					method:'post',
					onComplete:newRiderToList,
					onFailure:doNothing,
					postBody: 'name=' + namestring
				}
			);
}

function newRiderToList(r)
{
    var result = r.responseXML.documentElement;
	var id = result.getElementsByTagName('id')[0].firstChild.data;
	var name = result.getElementsByTagName('name')[0].firstChild.data;
	var Eintrag = document.createElement("option");
	Eintrag.text = name;
	Eintrag.value = id;
	var FO = null;
	document.forms[1].rlist.add(Eintrag, FO);
	document.forms[1].rider.value = "";
	
}

function addNewEditor(namestring)
{
	
	new Ajax.Request(
			"ajax_com.php?action=new_editor",
				{
					method:'post',
					onComplete:newEditorToList,
					onFailure:doNothing,
					postBody: 'name=' + namestring
				}
			);
}

function newEditorToList(r)
{
    var result = r.responseXML.documentElement;
	var id = result.getElementsByTagName('id')[0].firstChild.data;
	var name = result.getElementsByTagName('name')[0].firstChild.data;
	var Eintrag = document.createElement("option");
	Eintrag.text = name;
	Eintrag.value = id;
	var FO = null;
	document.forms[1].elist.add(Eintrag, FO);
	document.forms[1].editor.value = "";
	
}

function addNewFilmer(namestring)
{
	
	new Ajax.Request(
			"ajax_com.php?action=new_filmer",
				{
					method:'post',
					onComplete:newFilmerToList,
					onFailure:doNothing,
					postBody: 'name=' + namestring
				}
			);
}

function newFilmerToList(r)
{
    var result = r.responseXML.documentElement;
	var id = result.getElementsByTagName('id')[0].firstChild.data;
	var name = result.getElementsByTagName('name')[0].firstChild.data;
	var Eintrag = document.createElement("option");
	Eintrag.text = name;
	Eintrag.value = id;
	var FO = null;
	document.forms[1].flist.add(Eintrag, FO);
	document.forms[1].filmer.value = "";
	
}

function doNothing(){
alert('FAILURE');
}

function saveSpot()
{
	var name = new Array(document.forms[0].name1.value, document.forms[0].name2.value, document.forms[0].name3.value);
	
	var url = document.forms[0].url.value;
	
	var country = document.forms[0].country.value;
	
	var zip = document.forms[0].zip.value;
	
	var city = new Array(document.forms[0].city1.value, document.forms[0].city2.value, document.forms[0].city3.value);
	
	var street = document.forms[0].street.value;
	
	var street_nr = document.forms[0].street_nr.value;
	
	var type = document.forms[0].spottype.value;
	
	var longitude = document.forms[0].longitude.value;
	
	var latitude = document.forms[0].latitude.value;
	
	var descr = new Array(document.forms[0].descr1.value, document.forms[0].descr2.value, document.forms[0].descr3.value);
	
	var details = new Array(document.forms[0].details1.value, document.forms[0].details2.value, document.forms[0].details3.value);

	var contact = new Array(document.forms[0].contact1.value, document.forms[0].contact2.value, document.forms[0].contact3.value);
	
	var history = new Array(document.forms[0].history1.value, document.forms[0].history2.value, document.forms[0].history3.value);
	
	var short_descr = new Array(document.forms[0].short_descr1.value, document.forms[0].short_descr2.value, document.forms[0].short_descr3.value);
	
	new Ajax.Request(
		"ajax_com.php?action=save_spot",
		{
			method:'post',
			onComplete:blindnew_spot,
			postBody: "en_name=" + name[0] + "&de_name=" + name[1] + "&es_name=" + name[2] + "&url=" + url + "&country=" + country + "&zip=" + zip + "&en_city=" + city[0] + "&de_city=" + city[1] + "&es_city=" + city[2] + "&street=" + street + "&street_nr=" + street_nr + "&type=" + type + "&longitude=" + longitude + "&latitude=" + latitude + "&en_descr=" + descr[0] + "&de_descr=" + descr[1] + "&es_descr=" + descr[2] + "&en_details=" + details[0] + "&de_details=" + details[1] + "&es_details=" + details[2] + "&en_contact=" + contact[0] + "&de_contact=" + contact[1] + "&es_contact=" + contact[2] + "&en_history=" + history[0] + "&de_history=" + history[1] + "&es_history=" + history[2] + "&en_short_descr=" + short_descr[0] + "&de_short_descr=" + short_descr[1] + "&es_short_descr=" + short_descr[2]
		}
	);
}

function blindnew_spot(r)
{
	$('pop_newspot').popup.hide();
	var result = r.responseXML.documentElement;
	var id = result.getElementsByTagName('spot_id')[0].firstChild.data;
	//alert(id);
	var name = result.getElementsByTagName('name')[0].firstChild.data;
	//alert(name);
	var Eintrag = document.createElement("option");
	Eintrag.text = name;
	Eintrag.value = id;
	var FO = null;
	document.forms[1].spots.add(Eintrag, FO);
}

function recommend()
{
	if(!Form.Element.present('recommendation_emails')){
		Form.Element.focus('recommendation_emails');

		new Effect.Highlight('recommendation_emails', { startcolor: '#FF0000' } );

		return false;
	}

	var emails = $F('recommendation_emails');
	
	var message = $F('recommendation_message');

	var isspot = $F('isspot');


	if(isspot == 'true')
	{
		var sid = $F('sid');
		sid.stripTags();
		sid.escapeHTML();
		
	}
	else
	{
		var mid = $F('mid');
		mid.stripTags();
		mid.escapeHTML();
	}
		
	emails.stripTags();
	emails.escapeHTML();

	message.stripTags();
	message.escapeHTML();

	if(isspot == 'true')
	{
		new Ajax.Updater(
			"recommend",
			"ajax_com.php?action=recommend",
				{
					method:'post',
					onFailure:showError,
					postBody: 'emails=' + emails + '&message=' + message + '&sid=' + sid + '&spot=true'
				}
			);
	}
	else
	{

		new Ajax.Updater(
			"recommend",
			"ajax_com.php?action=recommend",
				{
					method:'post',
					onFailure:showError,
					postBody: 'emails=' + emails + '&message=' + message + '&mid=' + mid + '&spot=false'
				}
			);
	}
}


