function popup(url,name,width,height,wplus,hplus,focus,left,top,menubar,status,toolbar,scrollbar,resizable,scrx,scry,directories,loc) {
	if ( !url ) return false;
	if ( !name ) name = 'popupWin';
	if ( !width ) width = '';
	if ( !height ) height = '';
	if ( !directories ) directories = 'no';
	if ( !loc ) loc = 'no';
	if ( !menubar ) menubar = 'no';
	if ( !status ) status = 'no';
	if ( !toolbar ) toolbar = 'no';
	if ( !scrollbar ) scrollbar = 'no';
	if ( !resizable ) resizable = 'no';
	if ( !scrx ) scrx = '100';
	if ( !scry ) scry = '100';
	if ( !left ) left = '0';
	if ( !top ) top = '0';
	if ( wplus ) width  += wplus;
	if ( hplus ) height += hplus;

    var popupWin = window.open(url,name,'width='+width+'px,height='+height+'px,left='+left+',top='+top+',menubar='+menubar+',status='+status+',toolbar='+toolbar+',scrollbars='+scrollbar+',resizable='+resizable+',screenX='+scrx+',screenY='+scry+'directories='+directories+',location='+loc);

	if ( focus ) popupWin.focus();
}

$(document).ready(function() {
    $("a.fancy").fancybox({
        'padding'               : 0           //Space between FancyBox wrapper and content
        //'scrolling'             : 'auto',       //Set the overflow CSS property to create or hide scrollbars. Can be set to 'auto', 'yes', or 'no'
        //'autoScale'             : true,         //If true, FancyBox is scaled to fit in viewport
        //'autoDimensions'        : true,         //For inline and ajax views, resizes the view to the element recieves. Make sure it has dimensions otherwise this will give unexpected results
        //'centerOnScroll'        : false,        //When true, FancyBox is centered while scrolling page
        //'hideOnOverlayClick'    : true,         //Toggle if clicking the overlay should close FancyBox
        //'hideOnContentClick'    : false,        //Toggle if clicking the content should close FancyBox
        //'overlayShow'           : true,         //Toggle overlay
        //'overlayOpacity'        : 0.2,          //Opacity of the overlay (from 0 to 1; default - 0.3)
        //'overlayColor'          : '#000',       //Color of the overlay
        //'titleShow'             : true,         //Toggle title
        //'titlePosition'         : 'inside',     //The position of title. Can be set to 'outside', 'inside' or 'over'
        //'transitionIn'          : 'none',       //The transition type. Can be set to 'elastic', 'fade' or 'none'
        //'transitionOut'         : 'none',       //The transition type. Can be set to 'elastic', 'fade' or 'none'
        //'speedIn'               : 300,          //Speed of the fade and elastic transitions, in milliseconds
        //'speedOut'              : 300,          //Speed of the fade and elastic transitions, in milliseconds
        //'changeSpeed'           : 300,          //Speed of resizing when changing gallery items, in milliseconds
        //'changeFade'            : 'fast',       //Speed of the content fading while changing gallery items
        //'showCloseButton'       : true,         //Toggle close button
        //'showNavArrows'         : true,         //Toggle navigation arrows
        //'enableEscapeButton'    : true          //Toggle if pressing Esc button closes FancyBox
    });
});


/*
 * Form initializtaion
 */

function init(form) {

	var inputs = document.getElementById(form).elements;

	for (i=0;i < inputs.length ; i++) {
		set_input(inputs[i]);
	}

}

function set_input(input) {

	var oldClass = input.className;

	input.onfocus = function() {
		this.className = oldClass+'_in';
	}
	input.onblur = function() {
		this.className = oldClass;
	}
}

function changeImage(img, img_src) {
  img.src = img_src;
}

/*
* Confirm messages
*/

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

var old_table_02 = '';
var is_opened  = 'none';

function toggle( table ) {

    table_obj = document.getElementById(table);
    is_opened = table_obj.style.display;

	if (table != 'a00')
	{
		document.getElementById('a00').style.display = 'none';
	}

    if (old_table_02 != '' && is_opened == 'none') {
        old_table_obj = document.getElementById(old_table_02);
        old_table_obj.style.display = 'none';
    }

    if (old_table_02 != table || is_opened == 'none') {

        table_obj.style.display = 'block';
    }

    old_table_02 = table;
}


/* popup megnyitasa egyszerre az oldal kozepen */

function calcX(img_width) {
	iWidth = img_width;
	var winl = (screen.width - iWidth) / 2;
	return winl;
}

function calcY(img_height) {
	iHeight = img_height;
	var wint = (screen.height -  iHeight) / 2;
	return wint;
}

function downloadConfirmMsg(FirmName) {
	var downloadConfirm = confirm('A letöltött anyagokért (fájlokért) vagy a megjelenített információkért a(z) '+ FirmName +' nem vállal felelőséget!\nAz Adatvédelem menüpontban leírtakat tudomásul veszem!\nA folytatáshoz kattintson az OK gombra, megszakításhoz a Mégse gombra!');
	if (downloadConfirm) return true;
	else return false;
}
