function goTo(url) {
    var a = document.createElement('a');
    if(!a.click) { //only IE has this (at the moment);
        window.location = url;
        return;
    }
    a.setAttribute("href", url);
    a.style.display = "none";
    document.body.appendChild(a); //prototype shortcut
    a.click();
}

function toggleMenu(open, close) {
	$('#'+close+'box').hide();
	$('#'+open+'box').show();
    $('#'+close+'link').removeClass('active');
    $('#'+open+'link').addClass('active');
	cookieControl.set('cat_open', open,'1','','','');
	cookieControl.set('cat_close', close,'1','','','');
}

function toggleCatMenu(cls, id) {
    $('.'+cls).hide();
	$('#sub_cat_'+id).show();
    $('.main_cat').removeClass('active');
    $('#menu_cat_'+id).addClass('active');
}

function toggleSubCatMenu(cls, id) {
    $('.'+cls).hide();
	$('#subsub_cat_'+id).show();
    $('.main_cat').removeClass('active');
    $('#menu_cat_'+id).addClass('active');
}

function toggleBrandMenu(cls, id) {
    $('.'+cls).hide();
	$('#sub_brand_'+id).show();
    $('.main_brand').removeClass('active');
    $('#menu_brand_'+id).addClass('active');
}

function toggleNews(cls, id) {
    $('.'+cls).hide();
	$('#news'+id).show();
    $('.menu').removeClass('active');
    $('#newsmenu'+id).addClass('active');
}

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 confirmMsg(msg) {
	var con = confirm(msg);
	if (con) return true;
	else return false;
}

function bannerView() {
    var containerWidth =  $("#container").width();

	var windowWidth =  $(window).width();
	var bannerWidth =  $('#banner').width();
	var marginWidth = windowWidth-980-bannerWidth;
	$('#banner').css('margin-right', marginWidth);
	var bannerHeight =  $('#banner').height();
	$('#data-out').css('min-height', bannerHeight);

	if ( containerWidth <= 1113 ) {
        $('#banner').hide();
    } else {
        $('#banner').show();
    }
}

$(document).ready(function() {
    $("a.lpopup").fancybox({
        'zoomSpeedIn': 0,
        'zoomSpeedOut': 0,
        'overlayShow': true,
        'hideOnContentClick': false,
        'overlayOpacity': 0.50
    });

    $("a#gmap").fancybox({
        'zoomSpeedIn': 0,
        'zoomSpeedOut': 0,
        'overlayShow': true,
        'hideOnContentClick': false,
        'overlayOpacity': 0.50,
        'padding': '10',
        'frameWidth': 610,
        'frameHeight': 610
    });

    $("a.lvideo").fancybox({
        'zoomSpeedIn': 0,
        'zoomSpeedOut': 0,
        'overlayShow': true,
        'hideOnContentClick': false,
        'overlayOpacity': 0.50,
        'padding': '0',
        'frameWidth': 340,
        'frameHeight': 300
    });


	setTimeout(function() {
		var windowWidth =  $(window).width();
		var bannerWidth =  $('#banner').width();
		var marginWidth = windowWidth-980-bannerWidth;
		$('#banner').css('margin-right', marginWidth);
		var bannerHeight =  $('#banner').height();
		$('#data-out').css('min-height', bannerHeight);

	}, 100);

	bannerView();
})

window.onresize = bannerView;


