function decode(l,shift)
{
	g = "";c = "";
	for ( i=0;i < l.length;i++)
	{c = l.charAt(i);g += String.fromCharCode( c.charCodeAt(0) - shift );}
	window.location.href = g;
}

var rootdomain="http://"+window.location.hostname;	 
	 
function openajaxpage(containerid, idStoria)
{
	url = 'gallery_ajax.asp?id=' + idStoria;
	url += '&key=' + Math.floor(Math.random()*1000000);
	
	var page_request = false;
	if (window.XMLHttpRequest) //Mozilla, Safari
	{
		page_request = new XMLHttpRequest();
	}
	else if (window.ActiveXObject) //IE
	{
		try
		{
			page_request = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				page_request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
			}
		}
	}
	else
		return false;
	
	page_request.onreadystatechange = function()
									  {
										loadpage(page_request, containerid);
									  }
				
	page_request.open('GET', url, true);
	page_request.send(null);
	openajaxpage_gallery('contains', idStoria);
}
 
function loadpage(page_request, containerid)
{
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
	{
		document.getElementById(containerid).innerHTML = page_request.responseText;
	}
}

function openPic(pic)
{
	id = 'thepic';
	
	if (document.getElementById)
	{
		x = document.getElementById(id);
		x.src = pic;
	}
	else if (document.all)
	{
		x = document.all[id];
		x.src = pic;
	}
	else if (document.layers)
	{
		x = document.layers[id];
		x.src = pic;
	}
}
