// JavaScript Document
// The JS below was pieced together, customized, and developed by Evan Fell.
// EvanFell.com
  function grayOut(vis, options) {
        var options = options || {}; 
        var zindex = options.zindex || 50;
        var opacity = options.opacity || 50;//70
        var opaque = (opacity / 100);
        var bgcolor = options.bgcolor || '#000000';
        var dark=document.getElementById('darkenScreenObject');
        if (!dark) {
          var tbody = document.getElementsByTagName("body")[0];
          var tnode = document.createElement('div');
              tnode.style.position='absolute';
              tnode.style.top='0px';
              tnode.style.left='0px';
              tnode.style.overflow='hidden';          
              tnode.style.display='none';
              tnode.id='darkenScreenObject';
          tbody.appendChild(tnode);
          var dark=document.getElementById('darkenScreenObject');
          var wall=document.getElementById('wall');
        }
        if (vis) {
          // Calculate the page width and height 
          if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
              var pageWidth = document.body.scrollWidth+'px';
              var pageHeight = document.body.scrollHeight+'px';
          } else if( document.body.offsetWidth ) {
            var pageWidth = document.body.offsetWidth+'px';
            var pageHeight = document.body.offsetHeight+'px';
          } else {
             var pageWidth='100%';
             var pageHeight='100%';
          }   
          //set the shader to cover the entire page and make it visible.
          dark.style.opacity=opaque;                      
          dark.style.MozOpacity=opaque;                   
          dark.style.filter='alpha(opacity='+opacity+')'; 
          dark.style.zIndex=zindex;        
          dark.style.backgroundColor=bgcolor; 
          dark.style.width= pageWidth;
          dark.style.height= pageHeight;
          dark.style.display='block';				 
          wall.style.display='block';
        } else {
           document.getElementById('darkenScreenObject').style.display='none';
           document.getElementById('wall').style.display='none';
        }
    }


  function grayOn(vis, options) {
        var options = options || {}; 
        var zindex = options.zindex || 50;
        var opacity = options.opacity || 50;//70
        var opaque = (opacity / 100);
        var bgcolor = options.bgcolor || '#000000';
        var dark=document.getElementById('darkenScreenObject2');
        var wall=document.getElementById('wall2');
        if (!dark) {
          var tbody = document.getElementsByTagName("body")[0];
          var tnode = document.createElement('div');
              tnode.style.position='absolute';
              tnode.style.top='0px';
              tnode.style.left='0px';
              tnode.style.overflow='hidden';          
              tnode.style.display='none';
              tnode.id='darkenScreenObject2';
          tbody.appendChild(tnode);
          var dark=document.getElementById('darkenScreenObject2');
        }
        if (vis) {
          // Calculate the page width and height 
          if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
              var pageWidth = document.body.scrollWidth+'px';
              var pageHeight = document.body.scrollHeight+'px';
          } else if( document.body.offsetWidth ) {
            var pageWidth = document.body.offsetWidth+'px';
            var pageHeight = document.body.offsetHeight+'px';
          } else {
             var pageWidth='100%';
             var pageHeight='100%';
          }   
          //set the shader to cover the entire page and make it visible.
          dark.style.opacity=opaque;                      
          dark.style.MozOpacity=opaque;                   
          dark.style.filter='alpha(opacity='+opacity+')'; 
          dark.style.zIndex=zindex;        
          dark.style.backgroundColor=bgcolor; 
          dark.style.width= pageWidth;
          dark.style.height= pageHeight;
          dark.style.display='block';				 
          wall.style.display='block';
        } else {
           document.getElementById('darkenScreenObject2').style.display='none';
           document.getElementById('wall2').style.display='none';
        }
    }
      
  function getURLVar(urlVarName) {
      var urlHalves = String(document.location).split('?');
      var urlVarValue = '';
      if(urlHalves[1]){
          var urlVars = urlHalves[1].split('&');
          for(i=0; i<=(urlVars.length); i++){
              if(urlVars[i]){
              var urlVarPair = urlVars[i].split('=');
                  if (urlVarPair[0] && urlVarPair[0] == urlVarName) {
                  urlVarValue = urlVarPair[1];
                  }
              }
          }
      }
      return urlVarValue;   
  }

  function checkLanding(){
     if( document.location.href == 'http://www.ramp.com/' || document.location.href == 'http://ramp.com/'){
       grayOut(true); 
      //create the cookie noting that the user has seen the lightshow
      createCookie('lightshow','yes',364);
     }
  }
     
  function checkDownload(){
       grayOn(true); 
  }