$(document).ready(function() {
    $("a.fancy").fancybox({
        'padding'               : 40,
        'centerOnScroll'        : true,
        'overlayOpacity'        : 0.4,
        'overlayColor'          : '#000000',
        'titlePosition'         : 'inside',
        'transitionIn'          : 'elastic',
        'transitionOut'         : 'elastic'
    });

    $("a.lvideo").fancybox({
        'padding'               : 40,
        'centerOnScroll'        : true,
        'overlayOpacity'        : 0.4,
        'overlayColor'          : '#000000',
        'titlePosition'         : 'inside',
        'transitionIn'          : 'elastic',
        'transitionOut'         : 'elastic',
        'autoScale'             : false,
	    'autoDimensions'        : false,
        'width'                 : 425,
        'height'                : 400
    });

    $("a#gmap").fancybox({
        'padding'               : 40,
        'centerOnScroll'        : true,
        'overlayOpacity'        : 0.4,
        'overlayColor'          : '#000000',
        'titlePosition'         : 'inside',
        'autoScale'             : false,
	    'autoDimensions'        : false,
        'width'                 : 600,
        'height'                : 600
    });

    $("#showlogin").click(function () {
        $("#login-form").show();
        $("#showlogin").hide();
        $("#closelogin").show();
    });

    $("#showlogin1").click(function () {
        $("#login-form").show();
        $("#showlogin").hide();
        $("#closelogin").show();
        window.location = '#top';
    });

    $("#showlogin2").click(function () {
        $("#login-form").show();
        $("#showlogin").hide();
        $("#closelogin").show();
        window.location = '#top';
    });

    $("#showlogin3").click(function () {
        $("#login-form").show();
        $("#showlogin").hide();
        $("#closelogin").show();
        window.location = '#top';
    });

    $("#closelogin").click(function () {
        $("#login-form").hide();
        $("#closelogin").hide();
        $("#showlogin").show();
    });

});

function confirmMsg(msg) {
	var con = confirm(msg);
	if (con) return true;
	else return false;
}

function langalert(lang) {
	if ( lang == 'en') {
		alert('This website is under construction!\nPlease visit later!');
	}
	if ( lang == 'de') {
		alert('An dieser Website wird gerade gebaut.\nBitte schauen Sie später noch einmal vorbei.');
	}
}

function getCalendar(time) {
    $.ajax({
        url: '/'+_lang+'/ajax/calendar/'+time,
        success: function(msg) {
			$('#calendar_container').html(msg);
		}
    });
}

function eventVote(lid, type) {
    $.ajax({
        url: '/'+_lang+'/ajax/voteevent/'+lid+'/'+type,
        success: function(msg) {
			value = parseInt($('#counter').html());
			$('#vote').slideUp();
			if (type == 1)
				$('#counter').html(value+1);
		}
    });
}

function eventSubscribe(lid, time) {
    $.ajax({
        url: '/'+_lang+'/ajax/subscribeevent/'+lid+'/'+time,
        success: function(msg) {
			if (msg == 'OK') {
				$('#subscribe').hide();
				$('#subslink').hide();
				$('#subscribe_ok').show();
				return;
			}
			if ( msg == 'ERR_LOGIN' ){
				$('#subscribe_error').show();
			}
		}
    });
}

var H1 = {
    src: '/gfx/microgramma.swf'
        ,ratios: [6, 1.41, 9, 1.35, 15, 1.29, 21, 1.25, 22, 1.22, 27, 1.24, 29, 1.21, 34, 1.22, 41, 1.21, 45, 1.2, 46, 1.21, 59, 1.2, 68, 1.19, 69, 1.2, 96, 1.19, 97, 1.18, 102, 1.19, 103, 1.18, 107, 1.19, 108, 1.18, 112, 1.19, 114, 1.18, 116, 1.19, 120, 1.18, 121, 1.19, 1.18]
};
sIFR.activate(H1);
sIFR.replace(H1, {
    selector: 'h1'
    ,wmode: 'transparent'
    ,css: {
        '.sIFR-root': { 'color': '#90ba3c', 'text-transform': 'lowercase', 'background-color': 'transparent' }
    }
});

var H2 = {
    src: '/gfx/microgramma.swf'
        ,ratios: [6, 1.41, 9, 1.35, 15, 1.29, 21, 1.25, 22, 1.22, 27, 1.24, 29, 1.21, 34, 1.22, 41, 1.21, 45, 1.2, 46, 1.21, 59, 1.2, 68, 1.19, 69, 1.2, 96, 1.19, 97, 1.18, 102, 1.19, 103, 1.18, 107, 1.19, 108, 1.18, 112, 1.19, 114, 1.18, 116, 1.19, 120, 1.18, 121, 1.19, 1.18]
};
sIFR.activate(H2);
sIFR.replace(H2, {
    selector: 'h2'
    ,wmode: 'transparent'
    ,css: {
        '.sIFR-root': { 'color': '#e8e0f4', 'text-transform': 'lowercase', 'background-color': 'transparent' },
        'a': { 'color': '#90ba3c', 'text-decoration': 'none', 'text-transform': 'lowercase' },
        'a:hover': { 'color': '#90ba3c', 'text-decoration': 'none' }
    }
});
