var  browseRendszer,opRendszer;

function regWindow() {
	var popWin = window.open("registration.aspx","REG","width=600,height=400");				  
	popWin.focus();
}

function diaryWindow() {
	var popwin = window.open("popup_naplo_index.aspx","NAPLO","width=600,height=400");
	popwin.focus();
}
function quizWindow() {
	var popwin = window.open("popup_kviz_index.aspx","NAPLO","width=600,height=400");
	popwin.focus();
}
function gameWindow() {
	var popwin = window.open("popup_race.aspx","GAME","width=600,height=400");
	popwin.focus();
}
function labirintusWindow() {
	var popwin = window.open("popup_labirintus.aspx","LABIRINTUS","width=620,height=430");
	popwin.focus();
}
function gyorstesztWindow() {
	var popwin = window.open("popup_gyorsteszt.aspx","GYORSTESZT","width=620,height=430");
	popwin.focus();
}



function layerPosition( obj , pMode ) {
	allDetect();
	if (browseRendszer == "NS6") {
		var centerPos = document.width / 2;
	} else {
		var centerPos = document.body.clientWidth / 2;
	}
	if ( pMode == 1) {
		document.getElementById(obj).style.display = "";
	}
	document.getElementById(obj).style.left = centerPos + 55;
	
}

function hideAlert( obj ) {
	document.getElementById(obj).style.display = "none";
}
function showLayer( obj ) {
	document.getElementById(obj).style.display = "";
}

function allDetect() {
	var opString = navigator.appVersion;
	if (document.layers) {
		browseRendszer = "NS4";
	} else if (document.all) {
		if (document.getElementById) {
			browseRendszer = "DOM";
		} else {
			browseRendszer = "IE4";
		}
	} else {
		browseRendszer = "NS6";
	}
	if ( opString.indexOf('Win') != -1 ) {
		opRendszer = "win";
	} else if ( opString.indexOf('Mac') != -1 ) {
		opRendszer = "mac";
	} else if ( opString.indexOf('X11') != -1 ) {
		opRendszer = "linux";
	}
	return browseRendszer,opRendszer;
}

var addEvent = function(obj, type, fn){
    if (obj.addEventListener)obj.addEventListener(type, fn, false);
    else if (obj.attachEvent)obj.attachEvent('on' + type, function(){return fn.apply(obj, new Array(window.event))});
}

var popup = function(url,w,h){
    var l = (screen.width  - w)/2;
    var t = (screen.height - h)/2;
    window.open(url, 'popup', 'status=0,toolbar=0,scrollbars=0,resizable=0,menubar=0,width='+w+',height='+h+',left='+l+',top='+t+'');
}

addEvent(window,'load',function(){
    
});


function showModalLayer(){
    $('div.overlayCont').fadeIn('slow');
	$('div.overlay').height($('body').height());
    $('div.overlay').fadeTo('slow', 0.6);
}

function hideModalLayer(){
    $('div.overlayCont').fadeOut('slow');
    $('div.overlay').fadeOut('slow');
}

function addUnderConstructionLayer(){
     $('body').append('<div class="overlay"></div>');
     $('body').append('<div class="overlayCont"></div>');
}

function gotoPage(){
    alert('hello :)');
}

$(function(){
    
    // addUnderConstructionLayer();
    
	showModalLayer();
	
    $('.showLayer').click(function(e){
		e.preventDefault();
        showModalLayer();
    });
    
	$('.hideLayer').live('click', function() {
		hideModalLayer();
	});
	
});
