$(document).ready(init);

var preloaded = new Array();
function preload_images() {
    for (var i = 0; i < arguments.length; i++){
        preloaded[i] = document.createElement('img');
        preloaded[i].setAttribute('src',arguments[i]);
    };
};

function init() {
	preload_images(
	"images/homeh.png",
     "images/infoh.png",
     "images/kalenderh.png",
     "images/fotosh.png",
	 "images/contacth.png"
	);
  var section = new Array('p');
  section = section.join(',');

  // Reset Font Size
  var originalH2 = $("h2").css('font-size');
  var originalP = $("p").css('font-size');
  
  $("#normal").click(function(){
    $("h2").css('font-size', originalH2);
    $("p").css('font-size', originalP);
  });
  $("#larger").click(function(){
    var currentFontSizeNum = parseFloat(originalH2, 10);
    var newFontSize = currentFontSizeNum*1.2;
    $("h2").css('font-size', newFontSize);
		
    var currentFontSizeNum = parseFloat(originalP, 10);
    var newFontSize = currentFontSizeNum*1.2;
    $("p").css('font-size', newFontSize);
    return false;
  });
    $("#xtralarge").click(function(){
     var currentFontSizeNum = parseFloat(originalH2, 10);
    var newFontSize = currentFontSizeNum*1.4;
    $("h2").css('font-size', newFontSize);
		
    var currentFontSizeNum = parseFloat(originalP, 10);
    var newFontSize = currentFontSizeNum*1.4;
    $("p").css('font-size', newFontSize);
    return false;
  });

	$("#highq").click(function() { 
		var current=$("link[rel=stylesheet]").attr("href");
		var newstyle="";
		var high="";
		if(current.indexOf("high") ==-1){
			newstyle=current.replace('screen','high');
			high="true";
		}
		else {	
			newstyle=current.replace('high','screen');
			high="false";
		}
		$("link[rel=stylesheet]").attr("href",newstyle);
		$.cookie("css",high, {expires: 365, path: '/'});
		return false;
	});
  if($.cookie("css")) {
	var current=$("link[rel=stylesheet]").attr("href");
	var newstyle="";
	var high="";
	if($.cookie("css") =="true"){
		newstyle=current.replace('screen','high');
		high="true";
	}
	else {	
		newstyle=current.replace('high','screen');
		high="false";
	}
	$("link[rel=stylesheet]").attr("href",newstyle);
}
}


