function getcss(cssfile){
    loadcss = document.createElement('link');
    loadcss.setAttribute('rel', 'stylesheet');
    loadcss.setAttribute('type', 'text/css');
    loadcss.setAttribute('media', 'screen');
    loadcss.setAttribute('href', cssfile);
    document.getElementsByTagName('head')[0].appendChild(loadcss);
}

function toggleMenu() {
    $('#dock').toggle();
}

function photoalbum() {
    $('#photogallery a').fancybox({
        overlayOpacity: 0.9,
        overlayColor: '#000000',
        titlePosition: 'over',
        titleFormat: function(title, currentArray, currentIndex, currentOpts) {
            return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
        }
    });
}

function fullscreen() {
	var a = document.getElementsByTagName("a");
	for (var i = 0; i < a.length;i++) {
		if (a[i].className.match("noeffect")) {
		}
		else {
			a[i].onclick = function () {
				window.location = this.getAttribute("href");
				return false;
			};
		}
	}
}

function hideURLbar() {
	window.scrollTo(0, 0.9);
}

if (window.innerHeight < 600) {
    $(function() {
        fullscreen();
        hideURLbar();
    });
    getcss('/media/iphone/css/style.css');
} else if (window.innerHeight > 888) {
    getcss('/media/css/big.css');
} else {
    getcss('/media/css/small.css');
}