function getHTTPObject() 
{
	var xmlhttp;
	/*@cc_on
	@if (@_jscript_version >= 5)
	try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	  try {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
		xmlhttp = false;
	  }
	}
	@else
	xmlhttp = false;
	@end @*/

	if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
	{
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp = false;
		}//try - catch
	}
	return xmlhttp;
}//getHTTPObject

var http = getHTTPObject();
div = "";

function obterPagFunc(_url,_div)
{  		
	div = document.getElementById(_div);
	try{
		http.open("GET", _url, true);
		http.onreadystatechange = handleHttpResponse;
		http.send(null);
	}
	catch(e){
		div.innerHTML = '';
	}
}//obter_pagina

function handleHttpResponse()
{
	div.innerHTML = "";
	if (http.readyState == 4) {
		div.innerHTML = http.responseText;
	}

}//handleHttpResponse
var isOpera = navigator.userAgent.indexOf("Opera")>=0;
function mostraFerramenta(perfil,content) {
	this.content = content[4].substring(10,17);
	if(perfil=="hsbc-premier") {
		obterPagFunc('/common/ferramentas/func_outros_premier.shtml','ferramentaUtil');
	} else if(this.content == "premier") {
		obterPagFunc('/common/ferramentas/func_outros_premier.shtml','ferramentaUtil');
		esconderTodosLink();
	} else {
		obterPagFunc('/common/ferramentas/func_outros_int.shtml','ferramentaUtil');
	}
}

function pesquisar(obj,form){
    var palavra = obj.value;
    var div = document.createElement('div');
    var iframe = '<iframe src="http://www.pormundomaisfeliz.com.br/ranking/busca.php?palavra='+palavra+'" id="frameBusca" name="frameBusca" width="100" height="100" frameborder="1" marginheight="0" marginheight="0" onload="document.'+form+'.submit();"></iframe>';
    div.id = 'iframe'
    div.style.display = 'none';
    obj.parentNode.appendChild(div);
    div.innerHTML = iframe;
}

function valida_pesquisa(form) {
    var form = (form==undefined) ? "pesquisa" : form;
    var inputs = document.getElementsByTagName("input");
    for(i=0;i<inputs.length;i++){
        if(inputs[i].name == "words"){
            if(inputs[i].value != ""){
                pesquisar(inputs[i],form);
                break;
            }
        }
	}
}
