
	function load() {
		if (location.search) {
			//untogglecuriosidades();
			//$('#dialog').dialog("close");
			var cat = queryString( "cat" );
			if (cat) {
				dome(cat);
				window.location.href += "#"+cat;
			}
			var tag = queryString( "tag" );
			if (tag) {
				window.location.href = "http://enoughrecords.scene.org/imageflow/?tag="+tag;
			}
		}
	}
	
	function openDialog() {
		$('#dialog').dialog('open');
		infoen();
		return false;
	}

	function queryString(key) {
    	var re = new RegExp( "[?&]" + key + "=([^&$]*)", "i" );
    	var offset = location.search.search( re );
    	if ( offset == -1 ) return null;
   		return RegExp.$1;
	}

	function ltrim(stringToTrim) {
		return stringToTrim.replace(/^\s+/,"");
	}

	function dome(id) {
		var hidden = document.getElementById('nfo_'+trim12(id));
		if (hidden) submitForm(id);
	}


	function MM_swapImgRestore() {
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}

	function MM_findObj(n, d) {
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}

	function MM_swapImage() {
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}

	function trim12(str) {
		var	str = str.replace(/^\s\s*/, ''),
			ws = /\s/,
			i = str.length;
		while (ws.test(str.charAt(--i)));
		return str.slice(0, i + 1);
	}


	function submitForm(id)	{ 
		var req = null; 
 
		if (window.XMLHttpRequest)
		{
 			req = new XMLHttpRequest();
			if (req.overrideMimeType) 
			{
				req.overrideMimeType('text/xml; charset=iso-8859-1');
			}
		} 
		else if (window.ActiveXObject) 
		{
			try {
				req = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e)
			{
				try {
					req = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
	     }


		req.onreadystatechange = function()
		{ 
			//document.getElementById(id).innerHTML = "Wait server...";
			if(req.readyState == 4)
			{
				if(req.status == 200)
				{
					//var thistext = '<img src=\"covers/'+id+'.jpg\" /><br /><br />'+req.responseText;
					document.getElementById('nfo_'+trim12(id)).innerHTML = req.responseText;
				}	
				else	
				{
					document.getElementById('nfo_'+trim12(id)).innerHTML="Error: returned status code " + req.status + " " + req.statusText;
				}	
			} 
		}; 
		req.open("GET", "nfo/"+trim12(id)+".txt", true); 
		req.send(null); 
	} 


	function untogglecuriosidades() {
		document.getElementById("containercuriosidades").style.display = "none";
		document.getElementById("containercuriosidades2").style.display = "none";
		document.getElementById("container").style.top = "0px";
	}

	function info(tag) {
		var text = "Enough Records, Portuguese netlabel since 2001";
		switch(tag){
			case 'about': text = "About Enough Records Netlabel";
		 	break;
		 	case 'blog': text = "Enough Records wordpress blog (with reviews and articles)";
		 	break;
		 	case 'catalogue': text = "Browse our catalogue with ImageFlow";
		 	break;
		 	case 'network': text = "Enough Records on the internet";
		 	break;
		 	case 'sublabels': text = "Browse the sub-labels associated with Enough Records";
		 	break;
			case 'news': text = "Enough News, latest information updated from our twitter account";
			break;
			case 'releases': text = "Enough Releases, our catalogue or audio releases, available for stream preview or free download";
			break;			
			case 'gigs': text = "Enough Gigs, information on the events organized by Enough";
			break;
			case 'manifesto': text = "Enough Manifesto, why we promote free music online";
			break;
			case 'faq': text = "Enough Frequently Asked Questions we already answered";
			break;
			case 'newsletter': text = "Enough Newsletter, subscribe to get our news delivered to your email";
			break;
		 	case 'wordpress': text = "Wordpress, our blog, with more indepth articles about our artists and activity";
		 	break;
			case 'archiveorg': text = "Archive.org, online repository of our entire catalogue";
		 	break;
			case 'discogs': text = "Discogs.com, online discography, ratings and reviews of our entire catalogue";
		 	break;
		 	case 'rym': text = "RateYourMusic.com, online discography, ratings and reviews of our entire catalogue";
		 	break;
			case 'delicious': text = "Delicious, online links aggregator of Enough artists and related labels";
		 	break;
		 	case 'facebook': text = "Facebook, online social media presence";
		 	break;
		 	case 'flickr': text = "Flickr, online social media presence, repository of flyers from related event and our record cover designers";
		 	break;			
		 	case 'ff': text = "Friend Feed, online social media presence";
		 	break;
			case 'lastfm': text = "Last.fm, online repository, discography and social media presence";
		 	break;
			case 'lastfm2': text = "Last.fm group";
		 	break;
			case 'legaltorrents': text = "Clearbits, online repository of our entire catalogue as torrents";
		 	break;
		 	case 'myspace': text = "Myspace, online social media presence";
		 	break;
			case 'sceneorg': text = "Scene.org, online repository of our entire catalogue";
		 	break;
			case 'sonicsquirrel': text = "Sonicsquirrel, online repository of our entire catalogue";
		 	break;
		 	case 'soundshiva': text = "Soundshiva, netaudio index";
		 	break;
		 	case 'musicbrainz': text = "Musicbrainz, online discography, ratings and reviews of our catalogue";
		 	break;
		 	case 'dogmazic': text = "Dogmazic, online repository of our catalogue";
		 	break;
		 	case 'soundcloud': text = "Soundcloud, online social media presence";
		 	break;
		 	case 'twitter': text = "Twitter, online social media presence";
		 	break;
		 	case 'vimeo': text = "Vimeo, online social media presence";
		 	break;
		 	case 'youtube': text = "Youtube, online social media presence";
		 	break;
		 	case '[Esc.]': text = "Browse the catalogue released at Enough of the [Esc.] Laboratory collective";
		 	break;
		 	case 'c!': text = "Browse the merged 8bit netlabel Catita! catalogue";
		 	break;
		  	case 'anon': text = "Browse the catalogue of our Anonymous Archives, dedicated to anonymous social political activism";
		  	break;
		  	case 'thisk': text = "Browse our shared artists and co-releases with Thisco Records";
		 	break;
		 	default: text = tag;
		 	break;
		 }
		document.getElementById("info").innerHTML = text;
	}


		function infoen() {
			document.getElementById('info2').innerHTML = "Enough Records is a <a href=\"http://en.wikipedia.org/wiki/Netlabel\">netlabel</a>. Our mission is to promote and distribute music online for free.<br />We run Enough Records as a hobby since 2001.<br />There is no specific genre direction. There is no commercial intent.<br /><br />All of our catalogue is available under <a href=\"http://creativecommons.org/licenses/by-nc-sa/3.0/\">Creative Commons BY-NC-SA 3.0</a> licenses unless otherwise specified. Feel free to share, use and remix accordingly.<br /><br />If you like Enough Records please share our releases with your family, friends and colleagues.<br /><br />Click <a href=\"#\" onclick=\"infoartist(); return false;\">here</a> for artists info.";
			document.getElementById('info2').style.textAlign = 'justify';
		}
		
		function infopt() {
			document.getElementById('info2').innerHTML = "Enough Records é uma <a href=\"http://en.wikipedia.org/wiki/Netlabel\">netlabel</a>. Um hobby mantido por um par de Portugueses com demasiado tempo livre desde 2001.<br /><br />O nosso objectivo é distribuir e promover música livre, com o acordo e devida autorização dos seus criadores. Sem fins lucrativos.<br /><br />Não temos orientação estílistica. Não temos intenções comerciais. Simplesmentes gostamos de promover boa música livre.<br /><br />Todo o nosso catálogo encontra-se disponivel para download gratuito e legal, através de licenças <a href=\"http://creativecommons.org/licenses/by-nc-sa/3.0/\">Creative Commons BY-NC-SA 3.0</a>.<br /><br />Se gostar das nossas edições por favor partilhe-as.";
			document.getElementById('info2').style.textAlign = 'justify';
		}
		
		function infoartist() {
			document.getElementById('info2').innerHTML = "If you are interested in collaborating with us, this is what you should know:<br /><br /><strike>You can send us links to your demo <a href='mai&#108;to&#58;ps&#64;e&#37;6Eou&#103;hre%63o&#37;&#55;&#50;&#37;6&#52;%73&#37;2Eorg'>by email</a>, please don't send attached binaries, upload them to yousendit or sendspace instead and only mail us the link.</strike><br><br>We are closed to demos until May 2012.<br /><br />We do not manage bands. We do not organize concerts.<br /><br />We only promote releases and events online from our featured artists.<br /><br />Our terms of release are as follows:<br />By agreeing to release through Enough Records you are granting us non exclusive right to distribute and promote your submitted work under creative commons by-nc-sa license (or a similar license you prefer). This is valid for both online and promotional physical media we might print on occasion, always in non profit regime. Any profit we make (flattr donations, last.fm radio plays, label merchandise, etc.) is rechanneled to more promotional material for the label and/or the artist. You, the artist, are free to re-release the tracks wherever and howhever you see fit as long as no one comes asking us to take these releases offline.";

			document.getElementById('info2').style.textAlign = 'center';
		}

		function showNetwork() {
			document.getElementById('network').style.display = 'block';
			document.getElementById('sublabels').style.display = 'none';
		}

		function showSubLabels() {
			document.getElementById('network').style.display = 'none';
			document.getElementById('sublabels').style.display = 'block';
		}

