// check for layer/resolution and setWidth/SetLayout
// JPU: Be gentle when changing the indenting, this is too complex for me :-/
function setLayout() {
    if (document.getElementById('menuCoulisseAria') == null) {
        // collection
        if (document.getElementById('leftCoulisse') != null) {
            if (screen.width > 800) {
                document.getElementById('switchlayout').style.width = '650px';
                document.getElementById('switchlayout').style.left = '300px';
            } else {
                document.getElementById('switchlayout').style.left = '140px';
                document.getElementById('collectionMenu').style.width = '30px';
                document.getElementById('framework').style.width = '1000px';
                document.getElementById('switchlayout').style.width = '610px';
           document.getElementById('leftCoulisse').style.left = '60px';
                if (document.getElementById('rightCoulisse') != null) 
                    document.getElementById('rightCoulisse').style.left = '750px';
            }
            if (document.getElementById('rightCoulisse') != null)
                document.getElementById('contentDivPad').style.padding = '20px 110px 20px 20px';
        } else {
            // collection no visuals
            if (screen.width > 800) {
                document.getElementById('switchlayout').style.width = '730px';
                document.getElementById('switchlayout').style.left = '220px';
            } else {
                document.getElementById('switchlayout').style.left = '60px';
                document.getElementById('collectionMenu').style.width = '30px';
                document.getElementById('framework').style.width = '750px';
                document.getElementById('switchlayout').style.width = '690px';
                if (document.getElementById('rightCoulisse') != null)
                    document.getElementById('rightCoulisse').style.left = '750px';
            }
            
            if (document.getElementById('rightCoulisse') != null)
                document.getElementById('contentDivPad').style.padding = '20px 110px 20px 20px';
        }
    } else {
        // aria
    if (screen.width > 800) {
            document.getElementById('switchlayout').style.width = '810px';
        if (document.getElementById('contentDivside') != null)
                document.getElementById('contentDivmain').style.width = '590px';
        } else {
      document.getElementById('framework').style.width = '750px';
      document.getElementById('switchlayout').style.width = '610px';
      if (document.getElementById('rightCoulisse') != null)
                document.getElementById('rightCoulisse').style.left = '750px';
      if (document.getElementById('contentDivside') != null)
      document.getElementById('contentDivmain').style.width = '570px';
      if (document.getElementById('contentDivside') != null)
                document.getElementById('contentDivside').style.display = 'none';
                /*document.getElementById('contentDivmain').style.width = '570px';
      if (document.getElementById('contentDivside') != null)
                document.getElementById('contentDivside').style.left = '414px';*/
    }
    document.getElementById('switchlayout').style.left = '140px';
        if (document.getElementById('leftCoulisse')) {
        document.getElementById('leftCoulisse').style.left = '60px';
        }
    if (document.getElementById('rightCoulisse') != null)
            document.getElementById('contentDivPad').style.padding = '20px 110px 20px 20px';
  }
}

//set min-height safari
var Browser = function(){
  this.ie = navigator.appName.toLowerCase().indexOf('microsoft') != -1 ? 1 : 0;
  this.mac =  navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 1 : 0;
  this.win = !this.mac ? 1 : 0;
  this.safari =  navigator.userAgent.toLowerCase().indexOf('safari') != -1 ? 1 : 0;
  this.mozilla = navigator.appName.toLowerCase().indexOf('netscape') != -1 && !this.safari ? 1 : 0;
  this.winIE = this.ie && !this.mac ? 1: 0;
  this.macIE = this.ie && this.mac ? 1: 0;
  this.safariVersion = function (){
    if (!this.safari) return false;
    var ua = navigator.userAgent.toLowerCase();
    var indexNum = ua.indexOf('safari/') + 7;
    var vNum = ua.substring(indexNum,indexNum+3);
    return parseInt(vNum,10);
  }
}
var browser = new Browser();
function SetHeight(){
  if (browser.safari){
    document.getElementById('contentDivPad').style.display = "table-cell";
    document.getElementById('contentDivPad').style.height = "556px";
  }
}
//window.onload = function() {SetHeight();}




 //swap images
function createMouseOvers(){
  var p = 0, d = document.images;
  prelImgs = new Array();
  for (var i = 0; i < d.length; i++){
    var o = d[i];
  }
}


if (window.HTMLElement) {
  HTMLElement.prototype.contains = function(el)
  {
    var tempEl = el;
    while (tempEl!=null) {
      if (tempEl == this) return true;
      tempEl = tempEl.parentNode;
    }
    return false;
  };
}

function isInside(parentEl, evt) {
  if (window.HTMLElement) {
    // mozilla and alike
    return parentEl.contains(evt.relatedTarget);
  } else {
    return parentEl.contains(evt.toElement);
  }
}


