imgsrc=new Array();imgsrc[1]="iconos/cotiza_ov.gif";imgsrc[2]="iconos/cotiza_nor.gif";img=new Array();for(i=0;i<imgsrc.length;i++){img[i]=new Image();img[i].src=imgsrc[i]}function change(number,picture){{document[picture].src=img[number].src}}function chframe(){if(self==window.top)window.open("/","_top");}function mouseOver(){var test=document.getElementById("inicio");test.style.color="red"}function mouseOut(){var test=document.getElementById("inicio");test.style.color="black"}function ir_a(dire){window.location=dire}function handleKey(e){e=(!e)?window.event:e;code=(e.charCode)?e.charCode:((e.keyCode)?e.keyCode:((e.which)?e.which:0));if(e.type=="keydown"){if(code==13){login()}}}var xmlHttp=createXmlHttpRequestObject();var xsltFileUrl="grid.xsl";var feedGridUrl="grid.php";var gridDivId="gridDiv";var statusDivId="statusDiv";var tipoayuda="dos";var NA="na";var stylesheetDoc;function init(page,id,tipo,id2,order,dire){if(window.XMLHttpRequest&&window.XSLTProcessor&&window.DOMParser){loadStylesheet();loadGridPage(page,id,tipo,id2,order,dire);return}if(window.ActiveXObject&&createMsxml2DOMDocumentObject()){loadStylesheet();loadGridPage(page,id,tipo,id2,order,dire);return}alert("Su explorador no soporta la funcionalidad necesaria.")}function createMsxml2DOMDocumentObject(){var msxml2DOM;var msxml2DOMDocumentVersions=new Array("Msxml2.DOMDocument.6.0","Msxml2.DOMDocument.5.0","Msxml2.DOMDocument.4.0");for(var i=0;i<msxml2DOMDocumentVersions.length&&!msxml2DOM;i++){try{msxml2DOM=new ActiveXObject(msxml2DOMDocumentVersions[i])}catch(e){}}if(!msxml2DOM)alert("Porfavor actualize su version de MSXML en \n"+"http://msdn.microsoft.com/XML/XMLDownloads/default.aspx");else return msxml2DOM}function createXmlHttpRequestObject(){var xmlHttp;try{xmlHttp=new XMLHttpRequest()}catch(e){var XmlHttpVersions=new Array("MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP");for(var i=0;i<XmlHttpVersions.length&&!xmlHttp;i++){try{xmlHttp=new ActiveXObject(XmlHttpVersions[i])}catch(e){}}}if(!xmlHttp)alert("Error creando el objeto XMLHttpRequest.");else return xmlHttp}function loadStylesheet(){xmlHttp.open("GET",xsltFileUrl,false);xmlHttp.send(null);if(this.DOMParser){var dp=new DOMParser();stylesheetDoc=dp.parseFromString(xmlHttp.responseText,"text/xml")}else if(window.ActiveXObject){stylesheetDoc=createMsxml2DOMDocumentObject();stylesheetDoc.async=false;stylesheetDoc.load(xmlHttp.responseXML)}}function loadGridPage(pageNo,id,tipo,id2,order,dire){var query=feedGridUrl+"?page="+pageNo+"&id="+id+"&tipo="+tipo+"&id2="+id2+"&ordenar="+order+"&dire="+dire;if(xmlHttp&&(xmlHttp.readyState==4||xmlHttp.readyState==0)){xmlHttp.open("GET",query,true);xmlHttp.onreadystatechange=handleGridPageLoad;xmlHttp.send(null)}}function handleGridPageLoad(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){response=xmlHttp.responseText;if(response.indexOf("ERRNO")>=0||response.indexOf("error")>=0||response.length==0){alert(response.length==0?"Error del Servidor.":response);return}xmlResponse=xmlHttp.responseXML;if(window.XMLHttpRequest&&window.XSLTProcessor&&window.DOMParser){var xsltProcessor=new XSLTProcessor();xsltProcessor.importStylesheet(stylesheetDoc);page=xsltProcessor.transformToFragment(xmlResponse,document);var gridDiv=document.getElementById(gridDivId);gridDiv.innerHTML="";gridDiv.appendChild(page)}else if(window.ActiveXObject){var theDocument=createMsxml2DOMDocumentObject();theDocument.async=false;theDocument.load(xmlResponse);var gridDiv=document.getElementById(gridDivId);gridDiv.innerHTML=theDocument.transformNode(stylesheetDoc)}}else{alert("Error leyendo respuesta del servidor.")}}}function createXmlHttpRequestObject(){var xmlHttp;try{xmlHttp=new XMLHttpRequest()}catch(e){var XmlHttpVersions=new Array("MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP");for(var i=0;i<XmlHttpVersions.length&&!xmlHttp;i++){try{xmlHttp=new ActiveXObject(XmlHttpVersions[i])}catch(e){}}}if(!xmlHttp)alert("Error creando el objeto XMLHttpRequest.");else return xmlHttp}function process(){if(xmlHttp){try{document.getElementById("btnEnvia").disabled=true;var txtCotiza=document.getElementById("txtCotiza").value;txtCotiza=encodeURIComponent(txtCotiza);var fecha=document.getElementById("ufec").value;fecha=encodeURIComponent(fecha);var lugar=document.getElementById("lugar").value;lugar=encodeURIComponent(lugar);var params="txtCotiza="+txtCotiza+"&fecha="+fecha+"&lugar="+lugar;xmlHttp.open("POST","cotiza.php",true);xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.onreadystatechange=handleRequestStateChange;xmlHttp.send(params)}catch(e){alert("Imposible conectarse con el servidor:\n"+e.toString())}}}function login(){if(xmlHttp){try{var user=document.getElementById("loguser").value;user=encodeURIComponent(user);var contra=document.getElementById("logcontra").value;contra=encodeURIComponent(contra);var params="loguser="+user+"&logcontra="+contra;xmlHttp.open("POST","p_login.php",true);xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.onreadystatechange=handleRequestStateChange;xmlHttp.send(params)}catch(e){alert("Imposible conectarse con el servidor:\n"+e.toString())}}}function cambiacd(id){if(xmlHttp){try{var url="camcds.php";url=url+"?cd="+id;xmlHttp.open("GET",url,true);xmlHttp.onreadystatechange=handleCD;xmlHttp.send(null)}catch(e){alert("Imposible conectarse con el servidor:\n"+e.toString())}}}function handleCD(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){window.location.reload()}else{alert("Error leyendo respuesta del servidor.")}}}function handleRequestStateChange(){myDiv=document.getElementById("mensaje");if(xmlHttp.readyState==1){myDiv.innerHTML="Por favor espere..."}else if(xmlHttp.readyState==2){myDiv.innerHTML="Por favor espere..."}else if(xmlHttp.readyState==3){myDiv.innerHTML="Por favor espere..."}else if(xmlHttp.readyState==4){if(xmlHttp.status==200){try{handleServerResponse()}catch(e){alert("Error en lectura de respuesta: "+e.toString())}}else{alert("Hubo un problema procesando la informacion:\n"+xmlHttp.statusText)}}}function handleServerResponse(){var xmlResponse=xmlHttp.responseXML;if(!xmlResponse||!xmlResponse.documentElement)throw("Estructura XML Invalida:\n"+xmlHttp.responseText);var rootNodeName=xmlResponse.documentElement.nodeName;if(rootNodeName=="parsererror")throw("Estructura XML Invalida:\n"+xmlHttp.responseText);xmlRoot=xmlResponse.documentElement;if(rootNodeName!="response"||!xmlRoot.firstChild)throw("Estructura XML Invalida:\n"+xmlHttp.responseText);responseText=xmlRoot.firstChild.data;myDiv=document.getElementById("mensaje");myDiv.innerHTML=responseText;if(responseText=='Ingreso Exitoso!!')window.location.reload()}