function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function popup(url,ancho,alto,id,extras){
	if(navigator.userAgent.indexOf("Mac")>0){ancho=parseInt(ancho)+15;alto=parseInt(alto)+15;}
	var left = (screen.availWidth-ancho)/2;
	var top = (screen.availHeight-alto)/2;
	if(extras!=""){extras=","+extras;};
	var ventana = window.open(url,id,'width='+ancho+',height='+alto+',left='+left+',top='+top+',screenX='+left+',screenY='+top+extras);
	var bloqueado = "AVISO:\n\nPara ver este contenido es necesario que desactive\nel Bloqueo de Ventanas para este Sitio."
	//var bloqueado = "WARNING:\n\nIn order to use this functionality, you need\nto deactivate Popup Blocking."
	if(ventana==null || typeof(ventana.document)=="undefined"){ alert(bloqueado) }else{ return ventana; };
}

function OpenCCs(http,callcenters,hhlang,referer,pwd,rows,cc,un,dni) {
     browserVer = parseInt(navigator.appVersion);
     if(browserVer>2 )
	if (callcenters) {	
		hWnd=window.open(http+'logincc2.htm?ReadForm&dni='+dni+'&referer='+referer+'&pwd='+pwd+'&rows='+rows+'&hhlang='+hhlang+'&UN='+un+'&CC=&EN','','menu=yes,screenX=0,screenY=0,left=0,top=0,width=260,height=380');
     } else {
		window.open(http+'login.htm?ReadForm&dni='+dni+'&referer='+referer+'&pwd='+pwd+'&rows='+rows+'&hhlang='+hhlang+'&UN='+un+'&CC='+cc+'&EN','','hotkeys=no,screenX=0,screenY=0,left=0,top=0,width=260,height=380');
     }
}

function escribir(obj,html){
	if(document.layers){
		with (obj.document){
			open('text/html');
			write(html);
			close();
		}
   }else{
		obj.innerHTML = html;
	}
}

function ocultar(obj){
	style = (document.layers)? 'hide' : 'hidden';
	obj.style.visibility = style;
}

function mostrar(obj){
	style = (document.layers)? 'show' : 'visible';
	obj.style.visibility = style;
}

function agregar(){
   if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {
      var url="/ar/hsbcgrupo/"; 
      var titulo="Grupo HSBC";
      window.external.AddFavorite(url,titulo);
   } else { 
      if(navigator.appName == "Netscape")
         alert("Presione Crtl+D para agregar este sitio en sus Bookmarks"); 
   }
} 

function locateObject(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=locateObject(n,d.layers[i].document); return x;
}

function Lvl_openWin(u,n,w,h,l,t,c,f) { //v2.2 4LevelWebs
  var x=((screen.width-w)/2);if(c==1){l=x;t=(screen.height-h)/2;}if(c==2){l=x}
	f+=',top='+t+',left='+l;LvlWin=window.open(u,n,f);LvlWin.focus();
}

function windowOpener(nOpt){
	switch (nOpt){		
		case 1:
			window.open('http://www.homeandaway.hsbc.com','HomeAway','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=600,height=700,top=5,left=10');
		break;
		case 2:
			window.open('http://www.hsbcpremier.com/1/2/hsbcpremier/premier-center-locator','CentreLocator','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=600,height=700,top=5,left=10');
		break;
	}
	return;
}

function Lvl_openWin(u,n,w,h,l,t,c,f) { //v2.2 4LevelWebs
  var x=((screen.width-w)/2);if(c==1){l=x;t=(screen.height-h)/2;}if(c==2){l=x}
	f+=',top='+t+',left='+l;LvlWin=window.open(u,n,f);LvlWin.focus();
}


var DWin 
function DemirWin(url,name){	
	DWin = window.open(url,name,"toolbar=0,top=0,left=0,width=777,height=570,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,copyhistory=1"); 
}
