function getPage(num){
	var loc = window.location.href.split("/");
	var page = loc[loc.length-1];
	var p = "";
	if(page.indexOf("-en")>0)
		p = page.split("-en.")[0];
	else if(page.indexOf("-sp")>0)	
		p = page.split("-sp.")[0];
	else
		p = page.split(".")[0];
		
	var lang = (num==1)?'sp':'en';
	p = p == "" ? p = "index" : p;
	if (page != "news.php")
		window.location = p=="facts"?"facts.html":(p=="index"?"index"+(lang=="en"?".html":"-sp.html"):p+"-"+lang+".html");
	else
		alert('Esta página no está disponible.\n\nThis page is not available.');
}

function flashFix(width,height,movie){
	var url = window.location.href;
	var lang = (url.indexOf("-sp.")>0?1:0);
	var q;	
	var p = '';
	p='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'">';
	p+='<param name="movie" value="'+movie+'" />';
	p+='<param name="quality" value="high" />';
	p+='<param name="flashvars" value="lang='+lang+'" />';
	p+='<param name="wmode" value="transparent" />';
	p+='<embed src="'+movie+'" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" flashVars="lang='+lang+'" wmode="transparent" width="'+width+'" height="'+height+'">';
	p+='</embed></object>';
	document.write(p);
}

function factoid(){
	var facts = new Array('The average toilet uses 5 to 7 gallons of water per flush.',
						  'A shower can use 25 to 50 gallons (5 gallons per minute)',
						  'Just washing your hands can use up to 3 gallons of water (with tap running at 3 gallons per minute)',
						  'Leaving the water running while you brush your teeth can waste 3 gallons of water (at 3 gallons per minute).',
						  'Outdoor spigots can pump out 5 to 10 gallons per minute.',
						  '80 percent of the earth\'s surface is water','97 percent of the earth\'s water is seawater.',
						  '2 percent of the earth\'s water supply is locked in icecaps and glaciers.')
	f = facts[parseInt(Math.random()*facts.length)];
	document.write(f);
	
}
