var stringtrim = new String(location.protocol + "//" + location.hostname + "/");
var completeurl = new String(location.href);
var cutfrom = stringtrim.length+3;
var relativeurl=completeurl.slice(cutfrom,completeurl.length);

// certifica
var certificaurl="/" + certificaLocalization(completeurl.slice(cutfrom,completeurl.length));
if (certificaurl.charAt(certificaurl.length-1) != "/") {certificaurl += "/"}
certificaurl +=  "index";
//alert(certificaurl);

// returnurl
var actualurl = ""+document.location;
if (actualurl.charAt(actualurl.length-1) != "/") {actualurl += "/"}

function openFull(id, siteid) {
	var w = screen.width;
	var h = screen.height;
	var leftPosition = 0;
	var topPosition = 0;
	var targetURL = "/"+siteid+"/videos/fullscreen/" + id;
	var windowprops = 'width=' + w + ',height=' + h + ',top='+ topPosition +',left='+ leftPosition +',toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no,resizable=yes';
	var fs = window.open(targetURL,'wtc',windowprops);
	fs.resizeTo(w,h);
	fs.focus();
}

function openPopup(w,h,targetURL) {
	var leftPosition = (screen.width-w)/2;
	var topPosition = (screen.height-h)/2;
	//var targetURL = "/"+siteid+"/videos/fullscreen/" + id;
	var windowprops = 'width=' + w + ',height=' + h + ',top='+ topPosition +',left='+ leftPosition +',toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no,resizable=yes';
	var fs = window.open(targetURL,'wtc',windowprops);
	fs.resizeTo(w,h);
	fs.focus();
}

function certificaLocalization(sPath) {
	sPath=sPath.replace(/fotos/gi,'galleries');
	sPath=sPath.replace(/peliculas|filmes/gi,'movies');
	sPath=sPath.replace(/sinopsis|sinopse/gi,'synopsis');
	sPath=sPath.replace(/descargas/gi,'downloads');
	sPath=sPath.replace(/personajes|personajens/gi,'characters');
	sPath=sPath.replace(/episodios/gi,'episodes');
	sPath=sPath.replace(/programacion|programacao/gi,'schedule');
	sPath=sPath.replace(/concursos|concurso|contests/gi,'contest');
	sPath=sPath.replace(/especiales|especiais/gi,'specials');
	sPath=sPath.replace(/bloques|blocos/gi,'blocks');
	return sPath;
}