if (navigator.userAgent.indexOf('iPhone') != -1) {
        addEventListener("load", function() {
						    setTimeout(updateLayout, 2000);
        }, false);
}

var currentWidth = 0;

function updateLayout() {
    if (window.innerWidth != currentWidth) {
        currentWidth = window.innerWidth;

        var orient = currentWidth == 320 ? "profile" : "landscape";
        document.body.setAttribute("orient", orient);
        setTimeout(function() {
            window.scrollTo(0, 1);
        }, 100);
    }
}
setInterval(updateLayout, 400);

$(document).ready(function(){
   $("#loginfld").blur(function(event){
     //alert("Home Tab");
     //event.preventDefault();
   });
   $("#home-tab").click(function(event){
     //alert("Home Tab");
     //event.preventDefault();
   });
   $("#regels-tab").click(function(event){
     //alert("About Tab");
     //event.preventDefault();
   });
   $("#rooms-tab").click(function(event){
     //alert("Help Tab");
     //event.preventDefault();
   });
   $("#info-tab").click(function(event){
     //alert("Settings Tab");
     //event.preventDefault();
   });


 });

var simpleEncoding = 
  'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';

function simpleEncode(valueArray,maxValue) {

var chartData = ['s:'];
  for (var i = 0; i < valueArray.length; i++) {
    var currentValue = valueArray[i];
    if (!isNaN(currentValue) && currentValue >= 0) {
    chartData.push(simpleEncoding.charAt(Math.round((simpleEncoding.length-1) * 
      currentValue / maxValue)));
    }
      else {
      chartData.push('_');
      }
  }
return chartData.join('');
}
