$(function() {
	$(window).bind('resize', resizeText);
	resizeText();

	$('div.logoRight').css('cursor','pointer');
	var originalFontSize = parseFloat($('html').css('font-size'), 10);

	if (typeof $.cookie("size") == "string" ) {
		var size = parseFloat($.cookie("size"));
		$('html').css('font-size', size);
	}

	$(".resetFont").click(function(){
		$('html').css('font-size', originalFontSize);
		$.cookie("size", originalFontSize);	
	});
	
	$(".increaseFont").click(function(){
		var tmp = parseFloat(parseFloat($('html').css('font-size'), 10) * 1.1);
		$('html').css('font-size', tmp);
		$.cookie("size", tmp);
		return false;
	});
  
	$(".decreaseFont").click(function(){
		var tmp = parseFloat(parseFloat($('html').css('font-size'), 10) * 0.9);
		$('html').css('font-size', tmp);
		$.cookie("size", tmp);
		return false;
	});
});

function resizeText()
{
	$('div.text').height($('div.text').parent().height() - 289);
	$('div.textOnly').height($('div.textOnly').parent().height() - 209);
}


function enter(site, width, height) {
	window.open("jpgs/"+site, "servicefoto", "width="+width+",height="+height+",left=" + ((screen.width - 790) / 2) + ",top=" + ((screen.height - 570) / 2 - 20) + ",resizable=0,scrollbars=0,status=0").focus();
}


jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

