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.');
	}
}

$(document).ready(function(){

	$('#layerlink').click(function(){
	    createPopup('/'+_arg+'/gallery/');
		return false;
    });

    if (anch == 'belepeshiba') {
        showLogin();
        showLoginError();
    }

    if (anch == 'regisztraciohiba') {
        showLogin();
        showRegError();
    }

});


function loadImage(shopId, imageId){
	$("#imageContainer").hide();
    $("#imageContainer_loader").show();
	$.ajax({
		url: '/'+_arg+'/gallery/showimage/'+shopId+'/'+imageId,
		success: function(msg){
			$("#imageContainer").html(msg);
            $("#imageContainer_loader").hide();
			$("#imageContainer").fadeIn(200);
		}
	});
}

function showBasket() {
    hideLogin();
    $('#out-top-header-basket').show();
    $('#openbasket').hide();
    $('#closebasket').show();
/*
    $('#openbasket').removeClass('w60');
    $('#openbasket').addClass('w60 active');
*/
}

function hideBasket() {
    $('#out-top-header-basket').hide();
    $('#openbasket').show();
    $('#closebasket').hide();
/*
    $('#openbasket').removeClass('w60 active');
    $('#openbasket').addClass('w60');
*/
}

function showLogin() {
    hideBasket();
    $('#out-top-header-login').show();
    $('#openlogin').hide();
    $('#closelogin').show();
/*
    $('#openlogin').removeClass('w140');
    $('#openlogin').addClass('w140 active');
*/
}

function hideLogin() {
    $('#out-top-header-login').hide();
    $('#openlogin').show();
    $('#closelogin').hide();
/*
    $('#openlogin').removeClass('w140 active');
    $('#openlogin').addClass('w140');
*/
}

function showLoginError() {
    $('#loginbox').hide();
    $('#loginbox-error').show();
}

function showRegError() {
    $('#regbox').hide();
    $('#regbox-error').show();
}

function showLoginBox() {
    $('#loginbox-error').hide();
    $('#loginbox').show();
}

function showRegBox() {
    $('#regbox-error').hide();
    $('#regbox').show();
}

function addBasket() {
    $('#prodForm')[0].submit();
}

function toggleProducts( parent ) {
    if ( $('ul:visible', parent).length > 0 ) {
        $('ul', parent).wsVhide();
    } else {
        $('ul.togglable:visible', parent.parentNode).wsVhide();
        $('ul', parent).wsVshow();
    }
}

var anch = getAnchor();

function getAnchor() {
	var myFile = document.location.toString();
	if (myFile.match('#'))
	  return myAnchor = myFile.split('#')[1];

	return '';
}

function prodChangeImage(nr) {
    var container = $('.products .picbox div.pic');
    var imgs = $('img:visible', container);
    var newBgPic = imgs[0].src;

    container[0].style.background = 'transparent url('+(newBgPic)+') no-repeat 0 0';

    imgs.hide();


    $('img:eq('+(nr-1)+')', container).fadeIn();
}

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