﻿
function DefaultPageInit() {
	// Replace the sub title by our own title
	doImageCaching();
}

var tabs;
function doImageCaching() {
	tabs = [ 
		imageCache("./images/KalenderOver.png"),
		imageCache("./images/AccomodatieOver.png"), 
		imageCache("./images/ContactOver.png"),		
		imageCache("./images/ReglementOver.png"),		
		imageCache("./images/SintAubertusOver.png")		
		];
}

function imageCache(url) {
   var result = new Image();
   result.src = url;
   return result;
}
/*
//Global XMLHTTP Request object
var XmlHttp;
//Creating and setting the instance of appropriate XMLHTTP Request object to 
//a "XmlHttp" variable  
function CreateXmlHttp() {
 	//Creating object of XMLHTTP in IE
 	if (window.XMLHttpRequest) {
	   XmlHttp= new XMLHttpRequest();
	} else {
		try {
	  		XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	 	} catch(e) {
	  		try {
	   			XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	  		} catch(oc) {
			   	XmlHttp = null;
	  		}
	 	}
 	}
}
*/
function ShowLarge() {
	var source = window.event.srcElement;
	var foto = document.getElementById("Foto");
	var src = source.src.replace("/t-","/l-");

	foto.src = src;
}

/* ========================================= */
/* Integration with picasa */

var picasa = {
    url: "http://picasaweb.google.com/data/feed/api/user/gert.vantslot/albumid/5427833213865344193?kind=photo&thumbsize=320",
    host: null,
    start: function (slHost) {
        this.host = slHost;
        this.status = "preparing";
        $.get(this.url, {},
                function (data) {
                    this.status = "loading";
                    slHost.LoadRss(data);
                    this.status = "finished";
                },
                "jsonp");
        this.status = "calling";
    },
    status: "initialised"
};

function picasa_start(host) {
    picasa.start(host);
    // hook up events
    $("#imgView")
        .load(function () {
            $("#imgView").fadeIn();
        }).click(function () {
            $("#imgViewParent").fadeOut("slow");
    	});
   $("#imgViewParent").click(function () {
            $("#imgViewParent").fadeOut("slow");
    	});
   $("#imgViewClose").click(function () {
            $("#imgViewParent").fadeOut("slow");
            return false;
    	});

}

function picasa_showImg(path, img) {
	var allowedWidth = [94, 110, 128, 200, 220, 288, 320, 400, 512, 576, 640, 720, 800, 912, 1024, 1152, 1280, 1440, 1600];
	var maxWidth = $("#content").width();
	var maxHeight = $(window).height() - $("#head").height() - 48;
	var useWidth = 94;
	for(var i = 0; i < allowedWidth.length; i++) {
		if (allowedWidth[i] < maxWidth) {
			useWidth = allowedWidth[i];
		}
	}
    $("#imgView")
    	.attr("src", path + "/s" + useWidth + "/" + img)
    	.attr("height", maxHeight);
    $("#imgViewParent").fadeIn();
}

