var Scenario = 
{
  Active: null,
  ActiveTrigger: null,
  FirstRun: true,
  Image: null,
  Caption: null,
  OrgImage: '',
  OrgCaption: '',
  Show: function(o, pic, captId)
  {
    if (this.FirstRun)
    {
      this.Image = document.getElementById('scenarioImage');
      this.OrgImage = this.Image.style.backgroundImage;
      this.Caption = document.getElementById('scenarioCaption');
      this.OrgCaption = this.Caption.innerHTML;
      this.FirstRun = false;
    }
    var uls = o.parentNode.getElementsByTagName('ul');
    if (uls.length > 0)
    {
      if (this.Active) this.Active.style.display = 'none';
      if (this.ActiveTrigger) this.ActiveTrigger.className = '';
      if (uls[0] == this.Active)
      {
        // the currently open group is clicked again - just close it and return
        this.Active = null;
        this.ActiveTrigger = null;
        this.Image.style.backgroundImage = this.OrgImage;
        this.Caption.innerHTML = this.OrgCaption;
        return false;
      }
      this.Active = uls[0];
      this.Active.style.display = 'block';
      this.ActiveTrigger = o.parentNode;
      this.ActiveTrigger.className = 'active';
      if (pic) 
      {
        this.Image.style.backgroundImage = 'url(' + pic + ')';
      }
      if (captId) 
      {
        this.Caption.innerHTML = document.getElementById(captId).innerHTML;
      }
    }
    return false;
  }
}


//ColorBox
$(document).ready(function(){
  $("a[rel='example1']").colorbox();

  $(".contourSubmit").keydown(function() {
    $.ajax({
      url: '/xmlCountMarathon',
      success: function(data) {
        $("div.id input").val(data);
      }
    });
  });
  
  $(".contourSubmit").mousedown(function() {
    $.ajax({
      url: '/xmlCountMarathon',
      success: function(data) {
        $("div.id input").val(data);
      }
    });
    
    

  });
});


//Modals
var modals= 
{
  newsletterSubmition: function(){
    $.modal('<iframe src="http://sparfar.us2.list-manage.com/subscribe?u=fda1f06c06597e9d349af13f3&id=f327c57167" height="400" width="670" frameborder="0" scrolling="no" style="border:0">', {
      opacity:60,
      overlayCss: {
        backgroundColor:"#000"
      },
      containerCss:{
        backgroundColor:"#fff",
        borderColor:"#fff",
        height:420,
        padding:0,
        width:670
      },
      overlayClose:true,
      closeClass: "modalClose",
      closeHTML: "<a href='#'><img src='/occ/images/x.png'/></a>"

    });

  }
}


        function checkBrowser() {
            var nVer = navigator.appVersion;
            var nAgt = navigator.userAgent;
            var browserName = navigator.appName;
            var fullVersion = '' + parseFloat(navigator.appVersion);
            var majorVersion = parseInt(navigator.appVersion, 10);
            var nameOffset, verOffset, ix;

            // In MSIE, the true version is after "MSIE" in userAgent
            if ((verOffset = nAgt.indexOf("MSIE")) != -1) {
                browserName = "Microsoft Internet Explorer";
                fullVersion = nAgt.substring(verOffset + 5);
            }


            if ((ix = fullVersion.indexOf(";")) != -1) fullVersion = fullVersion.substring(0, ix);
            if ((ix = fullVersion.indexOf(" ")) != -1) fullVersion = fullVersion.substring(0, ix);

            if (browserName == "Microsoft Internet Explorer" && fullVersion == "6.0") {
                var r = confirm("Sparekassen Farsø anbefaler at du opdaterer din internetbrowser. Browseren du anvender er forældet og af sikkerhedsmæssige årsager anbefaler vi dig at opdatere den. \r\n \r\nTryk OK for at opdatere din browser.")
                if (r == true) {
                    window.open("http://windows.microsoft.com/da-DK/windows-vista/Update-Internet-Explorer");
                }
                else {}
            }

        }



