﻿/* Importing some useful scripts */
require("lib.jquery.jquery");
require("modules.prototypeUtils");
require("lib.zparse.zparse");
require("modules.jquery.getParsed");

/* Global variables */
var section = window.section || '';
var sectionName = window.sectionName || '';
var subSection = window.subSection || '';
var subSectionName = window.subSectionName || '';
var pageSession = window.pageSession || '';
var pageType = window.pageType || '';
var guid = window.guid || '';

var oBanner = new Banner( false );
var oNews = new News();
var oTags = new Tags();
var oAudios = new Audios();

function addDelicious(){
	 window.open('http://del.icio.us/post?v=4&noui&jump=close&url='+encodeURIComponent('http://www.territorioeldorado.limao.com.br'+pageUrl)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=700,height=400');
};
function addYahoo(){
	 window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?t=Eldorado&d=&u='+encodeURIComponent('http://www.territorioeldorado.limao.com.br'+pageUrl)+'&ei=UTF-8','popup', 'toolbar=no,width=700,height=400,scrollbar=yes',0);
};
function addTechnorati(){
	 window.open('http://www.technorati.com/faves?add='+encodeURIComponent('http://www.territorioeldorado.limao.com.br'+pageUrl), 'technorati','toolbar=no,width=700,height=400,scrollbar=yes');
};
function addDigg(){
	 window.open('http://digg.com/submit?phase=2&url='+encodeURIComponent('http://www.territorioeldorado.limao.com.br'+pageUrl)+'&title='+encodeURIComponent(document.title)+ '&bodytext=&topic=', 'digg','toolbar=no,width=700,height=400,scrollbar=yes');
};

function xmlOBJ() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
}

onload = function() {
	if(document.getElementById('relatedNewsBox') != null) {
		materiasRelacionadas = new xmlOBJ();
		materiasRelacionadas.open('GET', 'http://www.territorioeldorado.limao.com.br/interatividade/eldorado/searchDirect55.jsp?s=' + guid + ';' + tags, true);
		materiasRelacionadas.onreadystatechange = function() {
			if(materiasRelacionadas.readyState == 4) {
				if(materiasRelacionadas.status  == '200') {			
					document.getElementById('relatedNewsBox').innerHTML = materiasRelacionadas.responseText;
				}
			}
		};
		materiasRelacionadas.send(null);
	}
};
