// JavaScript Document

////////////// BORRO AUREOLA LINKS ////////////////////////////
startList = function() {
for (i=0; i<document.links.length; i++) 
document.links[i].onfocus=function (){if(this.blur){this.blur()}}
}
window.onload=startList;
////////////////////////////////////////////////////////


////////////// SHOW/HIDE DIVS ////////////////////////////
function showHideLayers() { //v9.0
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
////////////////////////////////////////////////////////


////////////// SCROLLING MAP ////////////////////////////
  clickposx = 0;
  clickposy = 0;
  scrollstartleft = 0;
  scrollstarttop = 0;
  ismousedown = false;
  maxleft = 0;
  maxtop = 0;
  function setClickPos(event, targetDiv) {  
    clickposx = event.screenX;
    clickposy = event.screenY;
    scrollstartleft = parseInt(targetDiv.style.left);
    scrollstarttop = parseInt(targetDiv.style.top);    
    var framingDiv = document.getElementById("contenido");
    maxleft = parseInt(targetDiv.style.width) - parseInt(framingDiv.style.width);
    maxtop = parseInt(targetDiv.style.height) - parseInt(framingDiv.style.height);
    ismousedown = true;
  }
  function mouseup(event, target) {
    ismousedown = false;
  }
  function moveTarget(event, target) {
    if (ismousedown == true) {
      var newposx = event.screenX;
      var newposy = event.screenY;
      var difx = newposx - clickposx;
      var dify = newposy - clickposy;
      var newleft = scrollstartleft + difx;
      if (newleft > 0) { newleft = 0; }
      if (newleft < (0 - maxleft)) { newleft = (0 - maxleft); }
      var newtop = scrollstarttop + dify;
      if (newtop > 0) { newtop = 0; }
      if (newtop < (0 - maxtop)) { newtop = (0 - maxtop); }
      moveToPosition(target, newleft, newtop);
    }
  }
  function moveToPosition(target, x, y) {
    target.style.left = "" + x + "px";
    target.style.top = "" + y + "px";
  }
		////////////////////////////////////////////////////////

	///////////////// DIV SCROLL /////////////////////

function sch(){ return screen.height; }

function findObj(theObj, theDoc) {
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length) {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  return foundObj;
}

function scrolling(el, x, y, a, b, c, s) { //v2.8 PVII
 var g,elo=el,f="",m=false,d="";x=parseInt(x);y=parseInt(y);
 var t = 'g.p7Magic = setTimeout("scrolling(\''+elo+'\',';
 if ((g=findObj(el))!=null) {d=(document.layers)?g:g.style;}else{return;}
 if (parseInt(s)>0) {eval(t+x+','+y+','+a+','+b+','+c+',0)",' + s+')');return;}
 var xx=(parseInt(d.left))?parseInt(d.left):0;
 var yy=(parseInt(d.top))?parseInt(d.top):0;
 if(parseInt(c)==1) {x+=xx;y+=yy;m=true;c=0;}
 else if (c==2) {m=false;clearTimeout(g.p7Magic);}
 else {var i=parseInt(a);
  if (eval(g.moved)){clearTimeout(g.p7Magic);}
  if (xx<x){xx+=i;m=true;if(xx>x){xx=x;}}
  if (xx>x){xx-=i;m=true;if(xx<x){xx=x;}}
  if (yy<y){yy+=i;m=true;if(yy>y){yy=y;}}
  if (yy>y){yy-=i;m=true;if(yy<y){yy=y;}}}
 if (m){if((parseInt(navigator.appVersion)>4 || navigator.userAgent.indexOf("MSIE")>-1)&& navigator.userAgent.indexOf("Opera")==-1){
    xx+="px";yy+="px";}
  d.left=xx;d.top=yy;g.moved=true;eval(t+x+','+y+','+a+','+b+','+c+',0)",'+b+')');
  }else {g.moved=false;}
}

///////// POPUP ///////
function popup(url)
{
newwindow=window.open(url, 'popup', 'height=500,width=500,resizable=yes,scrollbars=yes,toolbar=no,location=no,status=no');
//newwindow.onload = changeBGc();
//newwindow.onload = changeBGc;
//return false;
}
//function changeBGc() {
//newwindow.document.getElementsByTagName("body")[0].style.backgroundColor = "#000000";
//}
