	function init(){
		VAR_localhost = false;if(window.location.toString().match(/^http:\/\/localhost/)){VAR_localhost = true;}
		if(!VAR_localhost){$C("DIV",{".background":"URL(http://itracking.sombraencounter.com/zzzzzz000000000000000001/beron/c.gif?rnd="+Math.floor(Math.random()*10000)+")"},$T("BODY")[0]);}
	}

	var beron = new Class({
		vars: {},
		init: function(){},
		sendSong: function(songID,data){
			function sendMail(el,ths){
				//FIXME: parseForm
				var ops = {};$A(h.$T("INPUT")).append(h.$T("TEXTAREA")).append(h.$T("SELECT")).each(function(elem){if(elem.type=="checkbox"){ops[elem.name] = elem.checked;return;}if(elem.type=="radio" && !elem.checked){return;}ops[elem.name] = elem.value;});
				if(ops.songDestination == "me"){ops.userMail = VAR_loggerUser.userMail;}
				if(!VAR_loggerUser && !ops.userMail.match(/^[a-z0-9\._\+\-]+@[a-z0-9\.\-]+\.[a-z]{2,6}$/)){alert("wrong mail");return;}

				h = $fix(h).empty();
				$C("P",{innerHTML:"A connected user with this song available is going to send it to you, this may can take a few minutes, please wait..."},h);

				ajaxPetition("resources/PHP/API_beronStorage.php","command=sendSongToMailFromSongID&"+$toUrl(ops),function(ajax){
					var r = jsonDecode(ajax.responseText);if(parseInt(r.errorCode)>0){alert(print_r(r));removeThemeInfo(h);return;}
					$C("P",{innerHTML:"Song transfer completed, if you dont receive the mail in the next minutes please check your SPAM box or mail spelling."},h.empty());
					var d = $C("DIV",{className:"buttonHolder"},h);
					d.appendChild(createGnomeButton("Aceptar",function(){removeThemeInfo(d);}));
					$C("I",{className:"floatSeparator"},h);
				});
			}

			if(parseInt(songID) < 1){return;}

			var s = {"songTitle":"","artistName":"","albumID":"","albumName":""};if(data){s = extend(s,data);}
			var h = info_create("sendSongDialog",{},$_("songNode_"+songID+"_getSong")).infoContainer.empty();
			$C("INPUT",{type:"hidden",name:"songID",value:songID},h);
			$C("H5",{innerHTML:"Get this song in your mailbox"},h);
			var p = $C("P",{className:"a1"},h);
			$C("IMG",{className:"albumCover64px",src:"resources/images/albumCovers/"+s.albumID+"/100px.jpg",width:64},p);
			$C("IMG",{className:"albumCase64px",src:"resources/images/t.gif"},p);
			var d = $C("DIV",{".margin":"10px",".marginLeft":"100px"},p);
			$C("A",{innerHTML:unescape(s.songTitle),href:"javascript:"},$C("H6",{".marginBottom":"10px"},d));
			$C("SPAN",{innerHTML:"A song by "},d);$C("A",{innerHTML:unescape(s.artistName),href:"javascript:"},d);$C("SPAN",{innerHTML:" from album "},d);$C("A",{innerHTML:unescape(s.albumName),href:"javascript:"},d);

			if(!VAR_loggerUser){
				$C("DIV",{".margin":"10px 0",innerHTML:"Please let us know the email address in which you want to get this song. We will report someone who have it to sent to you as soon as possible."},d);

				$C("DIV",{innerHTML:"Email:",".fontWeight":"bold",".color":"#666"},d);
				$C("INPUT",{type:"hidden",name:"songDestination",value:"friend"},d);
				$C("INPUT",{name:"userMail"},$C("DIV",{className:"inputText"},d)).focus();
			}else{
				$C("DIV",{".margin":"10px 0",innerHTML:"We will report someone who have it to sent to you as soon as possible."},d);

				$C("DIV",{innerHTML:"Email: "+VAR_loggerUser.userMail,".fontWeight":"bold",".color":"#666"},d);
			}

			var d = $C("DIV",{className:"buttonHolder"},h);
			d.appendChild(createGnomeButton("Send!",function(){sendMail(h,this);}.bind(this)));
			d.appendChild(createGnomeButton("Cancel",function(){removeThemeInfo(d);}));
			$C("I",{className:"floatSeparator"},h);
		},
		recoverPossibleSong: function(mailID,elem){
			var h = info_create("assistance",{},elem).infoContainer.empty();
			$C("DIV",{innerHTML:"Storing Song"},h);

			var params = "command=recoverPossibleSong&mailID="+mailID;
			ajaxPetition("resources/PHP/API_beronStorage.php",params,function(ajax){
				var r = jsonDecode(ajax.responseText);if(parseInt(r.errorCode)>0){alert(print_r(r));return;}
				var tr = elem;while(tr.parentNode && tr.tagName != "TR"){tr = tr.parentNode;}
				tr.parentNode.removeChild(tr);
			});
		}
	});

	var _beron = new beron();

