﻿// Gradient zijkanten JScript File

// deze funtie voegt functies toe aan de onload ipv deze te overschrijven
function addLoadEvent(func) {
  //alert('Addload')
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(function() {

    var leftSd = document.createElement("DIV");
    var rightSd = document.createElement("DIV");
    var sitecontainer = document.getElementById("ctl00_Websitecontainer");
    var sitecontainer2 = document.getElementById("ctl00_Sitecontainer");
    var ShadowLeft = "<img src='images/layout/bg_gradient_shadow_left.jpg' align='right' border='0' style='gradient_shadow' />";
    var ShadowRight = "<img src='images/layout/bg_gradient_shadow_right.jpg' align='left' border='0' style='gradient_shadow' />";
    //alert(sitecontainer.offsetLeft)
    //alert(sitecontainer2.offsetLeft)
    if (sitecontainer.offsetLeft>10) { //verloop niet invoegen als window te smal is
   	    leftSd.style.width = sitecontainer.offsetLeft + "px";
   	    rightSd.style.width = sitecontainer.offsetLeft + "px";
   	    leftSd.style.height = "853px";
   	    rightSd.style.height = "853px";
   	    leftSd.style.left = "0px";
   	    rightSd.style.left = (sitecontainer.offsetLeft + 980) + "px";
   	    leftSd.style.top = "0px";
   	    rightSd.style.top = "0px";
   	    //leftSd.style.backgroundImage = "url(images/layout/bg_gradient.jpg)";
   	    leftSd.className = "gradient"
   	    leftSd.innerHTML = ShadowLeft;
   	    //rightSd.style.backgroundImage = "url(images/layout/bg_gradient.jpg)";
   	    rightSd.className = "gradient"
   	    rightSd.innerHTML = ShadowRight;
   	    leftSd.style.position = "absolute";
   	    rightSd.style.position = "absolute";
   	    document.body.appendChild(leftSd)
   	    document.body.appendChild(rightSd)
   	    document.body.style.backgroundPosition = (sitecontainer.offsetLeft-10) + "px 0px"
   	    document.body.style.backgroundImage = document.body.style.backgroundImage;
   	    }
   	else {
   	    document.body.style.backgroundPosition = "0px 0px"
   	    document.body.style.backgroundImage = document.body.style.backgroundImage;
   	    }
    }
) 


var winWidth = window.document.body.offsetLeft
window.onresize = function(){
    //alert(window.document.body.offsetLeft)
    if (window.document.body.offsetLeft!=winWidth) {
        setTimeout("location.reload();",500)
        winWidth = window.document.body.offsetLeft
        }
    };