// oas início
OAS_url ='http://ads.abril.com.br/RealMedia/ads/';
OAS_listpos = ABR_pos ;
OAS_query = '';
OAS_sitepage = ABR_page ;

OAS_version = 10;
OAS_rn = '001234567890'; OAS_rns = '1234567890';
OAS_rn = new String (Math.random()); OAS_rns = OAS_rn.substring (2, 11);

function OAS_NORMAL(pos) { 
 document.write('<a href="' + OAS_url + 'click_nx.ads/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + '!' + pos + OAS_query + '" target="_top">');
 document.write('<img src="' + OAS_url + 'adstream_nx.ads/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + '!' + pos + OAS_query + '" border="0"></a>');
}

OAS_version = 11;
if (navigator.userAgent.indexOf('Mozilla/3') != -1)
OAS_version = 10;
if (OAS_version >= 11)
document.write('<scr'+ 'ipt language=javascript1.1 src="' + OAS_url + 'adstream_mjx.ads/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + OAS_query + '"></sc'+'ript>');

document.write('')
function OAS_AD(pos) {
if (OAS_version >= 11)
	OAS_RICH(pos);
else
	OAS_NORMAL(pos);
}
// oas fim


function wopen(page,nwin,larg,altu,scrol){
	window.open(page,nwin,'width='+larg+',height='+altu+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scrol+',resizable=no,menubar=no,top=10,left=10');
}

moveContent = function(nameDivOas, nameDivOasDisplay) {
	var elemDivOas = document.getElementById(nameDivOas);
	var elemDivOasDisplay = document.getElementById(nameDivOasDisplay);
	if(elemDivOasDisplay != null){
		elemDivOasDisplay.appendChild(elemDivOas);
		elemDivOas.style.display='block';
	}
}

var squareSM = "";

moveSquare = function(nameDivOas, nameDivOasDisplay) {

	var elemDivOas = document.getElementById(nameDivOas);
	var elemDivOasDisplay = document.getElementById(nameDivOasDisplay);
	
	if(squareSM == ""){
		squareSM = elemDivOas;
	}

	if(elemDivOasDisplay != null){
		elemDivOasDisplay.appendChild(squareSM);
		elemDivOas.style.display='block';
	}
}

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
	((expires) ? "; expires=" + expires.toGMTString() : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "");
	document.cookie = curCookie;
}

function getCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else
		begin += 2;
	
	var end = document.cookie.indexOf(";", begin);
	
	if (end == -1)
		end = dc.length;
	
	return unescape(dc.substring(begin + prefix.length, end));
}

function html2entities(str) {
	var keys = 		new Array("&", " ", "¡", "¢", "£", "¤", "¥", "¦", "§", "¨", "©", "ª", "«", "¬", "­", "®", "¯", "°", "±", "²", "³", "´", "µ", "¶", "·", "¸", "¹", "º", "»", "¼", "½", "¾", "¿", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "×", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "Þ", "ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ", "\"", "<", ">");
    var values = 	new Array("&amp;", "&nbsp;", "&iexcl;", "&cent;", "&pound;", "&curren;", "&yen;", "&brvbar;", "&sect;", "&uml;", "&copy;", "&ordf;", "&laquo;", "&not;", "&shy;", "&reg;", "&macr;", "&deg;", "&plusmn;", "&sup2;", "&sup3;", "&acute;", "&micro;", "&para;", "&middot;", "&cedil;", "&sup1;", "&ordm;", "&raquo;", "&frac14;", "&frac12;", "&frac34;", "&iquest;", "&Agrave;", "&Aacute;", "&Acirc;", "&Atilde;", "&Auml;", "&Aring;", "&AElig;", "&Ccedil;", "&Egrave;", "&Eacute;", "&Ecirc;", "&Euml;", "&Igrave;", "&Iacute;", "&Icirc;", "&Iuml;", "&ETH;", "&Ntilde;", "&Ograve;", "&Oacute;", "&Ocirc;", "&Otilde;", "&Ouml;", "&times;", "&Oslash;", "&Ugrave;", "&Uacute;", "&Ucirc;", "&Uuml;", "&Yacute;", "&THORN;", "&szlig;", "&agrave;", "&aacute;", "&acirc;", "&atilde;", "&auml;", "&aring;", "&aelig;", "&ccedil;", "&egrave;", "&eacute;", "&ecirc;", "&euml;", "&igrave;", "&iacute;", "&icirc;", "&iuml;", "&eth;", "&ntilde;", "&ograve;", "&oacute;", "&ocirc;", "&otilde;", "&ouml;", "&divide;", "&oslash;", "&ugrave;", "&uacute;", "&ucirc;", "&uuml;", "&yacute;", "&thorn;", "&yuml;", "&quot;", "&lt;", "&gt;");
   
	for(var i=0; i < keys.length; i++) {
		if(values[i] != "&nbsp;") {
			str = eval('str.replace(/'+keys[i]+'/g, "'+values[i]+'")');
		}
	}
	return str;
}

function ValidaTicket()
{
	username = GetCookie('usuario');
	ticket = GetCookie('ticket');
	codigo = '';
	
	if (username != null) {
		valores = username.split(';');
		codigo = valores[0];
	}
	
	if ((username == null && ticket == null) || (codigo == '2516185'))
	{
		location.replace('http://passaporte.abril.com.br/autenticaUsuario.do?metodo=checarTipoAutenticacao&COD_SITE=902&COD_RECURSO=1487&URL_RETORNO=' + escape(window.location));
		return false;
	}
	return true;
}
