﻿$(document).ready(function() {
  $('.systemhouseBox #systemhouselink').click(function() {showSystemHouse()});
  $('#banner #systemhouselink').click(function() {showSystemHouse()});
  $('.linkbox #systemhouselink').click(function() {showSystemHouse()});
  $('#systemicons #systemhouselink').click(function() {showSystemHouse()});
});  

var showingSystemHouse = false;

function showSystemHouse() {
  if(!showingSystemHouse){
    showingSystemHouse = true;
    window.scrollTo(0,0);
    $.ajax({
      url: 'http://www.knaufdanogips.dk/Default.aspx?ID=266&rnd='+Math.random(),
      success: function(data) {
        var html = data;
        var systemhousediv = document.createElement('div');
        var wrapperstartindex = html.indexOf('<div id="systemhousewrapper">');
        var wrapperendindex = html.indexOf('</body>');
        var documentheight = document.body.offsetHeight;
        html = html.substring(wrapperstartindex,wrapperendindex);
        
        systemhousediv.style.cssText = 'clear: both; float: left; z-index: 10000; margin-left: -991px; width: 991px; background: #ffffff; height:740px;';
        systemhousediv.setAttribute('style','clear: both; float: left; z-index: 10000; margin-left: -991px; width: 991px; background: #ffffff; height:740px;');
        
        systemhousediv.setAttribute('id','systemhousediv');
        systemhousediv.innerHTML = html;
        document.body.appendChild(systemhousediv);
        
        $('.icondescription').fadeOut();
        $('.description').fadeOut();
        
        $('#systemhousewrapper').css({'height' : '740', 'position' : 'relative', 'zIndex' : '10000'});
        $(systemhousediv).animate({marginLeft: '+=991'},500);
        
        $('#gobacklink').click(function() {
            $('#systemhousediv').animate({marginLeft: '-=991'},
               500,
               function() {
                 $('#systemhousediv').remove();
                 showingSystemHouse = false;
                 return false;
               }
            );
        });
        
        //convertPNG4IE();
        var showIcons = setTimeout('showIcons()',1000);
        
        $('.icondescription').hover(function(){
          $(this).css('z-index','9999');
          $(this).children().last().clearQueue().fadeIn(250);
        },function(){
          $(this).css('z-index','10');
          $(this).children().last().fadeOut(0);
        });        
      }
    });
  }
  return false;
}  

function showIcons()
{  
  $('.icondescription').fadeIn(250);
}






























































