var str
var ss
var tipo

//Gets the browser specific XmlHttpRequest Object
function getXmlHttpRequestObject() {
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

//Our XmlHttpRequest object to get the auto suggest
var searchReq = getXmlHttpRequestObject();

//Called from keyup on the search textbox.
//Starts the AJAX request.
function searchSuggest() {
	
	if (searchReq.readyState == 4 || searchReq.readyState == 0) {
		str = escape(document.getElementById('q').value);
		ss = document.getElementById('search_suggest')
		ss.innerHTML='';
		searchReq.open("GET", 'bancodeinnovaciones_test.php?tipe=sg&q=' + str, true);
		searchReq.onreadystatechange = handleSearchSuggest; 
		searchReq.send(null);
	}		
}

//Called when the AJAX response is returned.
function handleSearchSuggest() {
	if (searchReq.readyState == 4) {
		ss = document.getElementById('search_suggest')				
		str = searchReq.responseText.split("\n");
		for(i=0; i < str.length - 1; i++) {
			//Build our element string.  This is cleaner using the DOM, but
			//IE doesn't support dynamically added attributes.
			var suggest = '<div onmouseover="javascript:suggestOver(this);" ';
			suggest += 'onmouseout="javascript:suggestOut(this);" ';
			suggest += 'onclick="javascript:setSearch(this.innerHTML); javascript:BuscarBancoInnovaciones(\'frmSocios1\');" ';
			suggest += 'class="suggest_link">' + str[i] + '</div>';
			ss.innerHTML += suggest;
		}
	}
}




var newproy;
function AbreVentana(ven){
newproy=window.open(ven,"NuevaVentana","width=640,height=500,left=190,top=50,toolbar=no,directories=no,menubar=no,status=no,scrollbars=yes");  
  if (window.focus) {newproy.focus()}
  return false;
}

function AbreFicha(url,ven){
newproy=window.open(url,ven,"width=640,height=500,left=190,top=50,toolbar=no,directories=no,menubar=no,status=no,scrollbars=yes");  
  if (window.focus) {newproy.focus()}
  return false;
}

function BuscarBancoInnovaciones(frm){
document.forms[frm].action='bancodeinnovaciones.php';
document.forms[frm].submit();
}

function Registrar(frm){
var valid_pub = new Validation(frm, {useTitles:true, immediate : true});
var result=valid_pub.validate();
if(result){
	document.forms[frm].action='registrar.php';
	document.forms[frm].submit();
}
}

function Enviar(frm){
var valid_pub = new Validation(frm, {useTitles:true, immediate : true});
var result=valid_pub.validate();
if(result){
	document.forms[frm].action='send_pag.php';
	document.forms[frm].submit();
}
}

function EnviarContac(frm){
var valid_pub = new Validation(frm, {useTitles:true, immediate : true});
var result=valid_pub.validate();
if(result){
	document.forms[frm].action='send_contac.php';
	document.forms[frm].submit();
}
}

function EnviarFrConcurso(frm){
var valid_pub = new Validation(frm, {useTitles:true, immediate : true});
var result=valid_pub.validate();
if(result){
	document.forms[frm].action='save_concurso.php';
	document.forms[frm].submit();
}
}

function BuscarBancoSocios(){
document.forms['frmSocios2'].action='bancodesocios.php';
document.forms['frmSocios2'].submit();
}

function BuscarBancoSocios2(){
document.forms['frmSocios2'].action='bancodesocios2.php';
document.forms['frmSocios2'].submit();
}

function OpenCloseBuscadorInnovaciones(act,des){	
document.getElementById(des).style.display = 'none';			
document.getElementById(act).style.display = 'block';
}

function BuscarNot(){
document.forms['frmNot'].action='?';
document.forms['frmNot'].submit();
}

function Activa(id1,id2,id3){	
document.getElementById(id1).style.display = 'block';			
document.getElementById(id2).style.display = 'block';
document.getElementById(id3).style.display = 'block';
}

function Desactiva(id1,id2,id3){	
document.getElementById(id1).style.display = 'none';			
document.getElementById(id2).style.display = 'none';
document.getElementById(id3).style.display = 'none';
}