
var window_h = window.screen.height;
var window_w = window.screen.width;
var client_h = 1000;
var client_w = 1000;
var mac1024_ch = 817;

function iran(i) { return Math.floor(1+Math.random(1)*i); }

function par(n) {

  var i = 0;

  p = new String(document.location.href); 
  p = p.substring(p.indexOf("?")+1,999);

  if  ( p.indexOf("#") < 0 ) {
    if ( n > 0 )
      return "";
  }

  while ( i < n ) {
    p = p.substring(p.indexOf("#")+1,999);
    i++;
  }

  k = p.indexOf("#");
  if ( k > 0 ) p = p.substring(0,p.indexOf("#")); 
  return p;

}


function action(d) {

  src = "<a href='#' id='action_focus' onfocus=\"blur(); go_action('"+d+"');\"><img src='standard/layout/leer.gif' width=1 height=1></a>";

  parent.parent.document.getElementById("action").innerHTML = src;

  parent.parent.document.getElementById("action_focus").focus();

}

function getSize() {  
    var myWidth = 0, myHeight = 0;  
  
    if( typeof( window.innerWidth ) == 'number' ) {  
        //Non-IE  
        myWidth = window.innerWidth;  
        myHeight = window.innerHeight;  
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {  
        //IE 6+ in 'standards compliant mode'  
        myWidth = document.documentElement.clientWidth;  
        myHeight = document.documentElement.clientHeight;  
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {  
        //IE 4 compatible  
        myWidth = document.body.clientWidth;  
        myHeight = document.body.clientHeight;  
    }  
    return [ myWidth, myHeight ];  
}  

function getClientSize(w) {
  if ( w.document.body != null ) {
    client_h = w.document.body.clientHeight;
    client_w = w.document.body.clientWidth;
    //if ( client_h > mac1024_ch ) client_h = mac1024_ch;
  }
}

function z(x) { getClientSize(this); return Math.floor(x*client_h/mac1024_ch); }
function z0(x,fix) { if ( fix ) return x; else return z(x); }
function getClientHeight(w) { getClientSize(w); return client_h; }
function getClientWidth(w) { getClientSize(w); return client_w; }

function getStringTo(s, p) { return s.substring(0, s.indexOf(p)); }
function getStringFrom(s, p) { return s.substring(s.indexOf(p)+p.length,999); }

function sound(url) { getObject("sound").innerHTML="<embed src='"+url+"' hidden=true autostart=true loop=false>"; }

function getObject(id) { return document.getElementById(id); }
function show(id) { getObject(id).style.visibility = "visible"; }
function hide(id) { getObject(id).style.visibility = "hidden"; }
function set_src(id, src) { getObject(id).src = src; }
function set_left(id, i) { getObject(id).style.left = i; }
function set_top(id, i) { getObject(id).style.top = i; }
function set_width(id, i) { getObject(id).style.width = i; }
function set_height(id, i) { getObject(id).style.height = i; }

function parentGetObject(id) { return parent.document.getElementById(id); }
function parentShow(id) { parentGetObject(id).style.visibility = "visible"; }
function parentHide(id) { parentGetObject(id).style.visibility = "hidden"; }
function parentSet_src(id, src) { parentGetObject(id).src = src; }

function set_html(id, src) { getObject(id).innerHTML = src; }

var images = 0;
var image = new Array(1000);
function loadImage(img) {
  images++;
  image[images] = new Image();
  image[images].src = img;
}

var over = "onmouseover='mouseover_img(this)' onmouseout='mouseout_img(this)'";

function overf(div,art) {

  switch ( art ) {
 
    case "go": {
       return "onmouseover=\"mouseover_go('"+div+"',z(-10),z(5))\" onmouseout=\"mouseover_go('"+div+"',z(10),z(-5))\"";
      break;
    }

    default: {
      return "";
    }

  }

}

function mouseover_go(div,x,y) {
  obj = getObject(div);
  obj.style.left = parseInt(obj.style.left) + x;
  obj.style.top = parseInt(obj.style.top) + y;
}

function mouseover_img(img) { 
  src = img.src; 
  img.src = getStringTo(src,".gif")+"0.gif"+getStringFrom(src,".gif");
}
function mouseout_img(img) { 
  src = img.src; 
  if ( src.indexOf("0.") > -1 )
    img.src = getStringTo(src,"0.gif")+".gif"+getStringFrom(src,"0.gif");
}

function getScroll(xy) {  
    var scrOfX = 0, scrOfY = 0;  

    if( typeof( window.pageYOffset ) == 'number' ) {  
        //Netscape compliant  
        scrOfY = window.pageYOffset;  
        scrOfX = window.pageXOffset;  
    } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {  
        //DOM compliant  
        scrOfY = document.body.scrollTop;  
        scrOfX = document.body.scrollLeft;  
    } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {  
        //IE6 standards compliant mode  
        scrOfY = document.documentElement.scrollTop;  
        scrOfX = document.documentElement.scrollLeft;  
    }  
    if ( xy == "x" ) return scrOfX; else return scrOfY;  
}  

function view_layout(w,h,d,layout,ol,o,or,r,ur,u,ul,l,m) {

  layout = layout+"/";
  w = w-2*d;
  h = h-2*d;

  src = "";

  src += "<table border=0 cellspacing=0 cellpadding=0 style='padding:0px; spacing:0px; border-style:solid; border-width:0px; border-spacing:0px;'>";

  src += "<tr><td><img src='"+layout+ol+"' height="+d+" width="+d+"></td><td><img src='"+layout+o+"' height="+d+" width="+w+"></td><td><img src='"+layout+or+"' height="+d+" width="+d+"></td></tr>";

  src += "<tr><td><img src='"+layout+l+"'  height="+h+" width="+d+"></td><td><img src='"+layout+m+"' height="+h+" width="+w+"></td><td><img src='"+layout+r+"'  height="+h+" width="+d+"></td></tr>";

  src += "<tr><td><img src='"+layout+ul+"' height="+d+" width="+d+"></td><td><img src='"+layout+u+"' height="+d+" width="+w+"></td><td><img src='"+layout+ur+"' height="+d+" width="+d+"></td></tr>";

  src += "</table>";

  return src;
}

