window.addEvent('domready' , function(){
	var style = new Element('link', {
	    'rel' : 'stylesheet',
	    'href' : 'modules/kalkulator/css/calculator.css',
	    'type' : 'text/css',
	    'media' : 'screen'
	}).inject(document.body);
	var style2 = new Element('link', {
	    'rel' : 'stylesheet',
	    'href' : 'modules/kalkulator/js/formcheck/theme/red/formcheck.css',
	    'type' : 'text/css',
	    'media' : 'screen'
	}).inject(document.body);
	var script1 = new Element('script', {
	    'src' : 'modules/kalkulator/js/formcheck/lang/hu.js',
	    'type' : 'text/javascript'
	}).inject(document.body);
	var script1 = new Element('script', {
	    'src' : 'modules/kalkulator/js/formcheck/formcheck.js',
	    'type' : 'text/javascript'
	}).inject(document.body);
});

var Calculator = {
		Open: function(){
			var windowSize = window.getSize();
			var blackOut = new Element('div', {
			    'id': 'blackOut',
			    'style': 'background:#000;position:fixed;top:0;left:0;width:'+windowSize.x+'px;height:'+windowSize.y+'px;z-index:400'
			});
			blackOut.setOpacity(0.3);
			blackOut.inject(document.body);
			var shadow = new Element( 'img', {
				'id' : 'shadow',
				'style' : 'position:fixed;z-index:500;width:860px;height:610px;top:'+((windowSize.y / 2) - 305)+'px;left:'+((windowSize.x / 2) - 430)+'px;behavior: url(css/png2.htc);',
				'src' : 'modules/kalkulator/images/shadow.png',
				'alt' : ''
				} ).inject(document.body);
			var mainHolder = new Element( 'div', {
				'id' : 'calcHolder',
				'class' : 'calcHolder',
				'style' : 'position:fixed;z-index:600;top:'+((windowSize.y / 2) - 225)+'px;left:'+((windowSize.x / 2) - 350)+'px;'
				} ).inject(document.body);
			var mainHead = new Element( 'div', {
				'id' : 'calcHead',
				'class' : 'calcHead',
				'html' : 'h&#337;szigetel&#337; rendszer kalkul&#225;tor'
				} ).inject($('calcHolder') , 'top');
			var closeBtn = new Element( 'a', {
				'id' : 'closeBtn',
				'html' : 'Bez&#225;r&#225;s',
				'href' : 'javascript:closeCalc();',
				'style' : 'font-size:10px;float:right;text-decoration:underline;color:#fff'
				} ).inject($('calcHead'));
			var mainContent = new Element( 'div', {
				'id' : 'calcContent',
				'class' : 'calcContent'
				} ).inject($('calcHolder'));
			$('calcContent').innerHTML = "<iframe src='modules/kalkulator/index.html' style='width:700px;height:396px;margin:0;padding:0' frameborder='0'></iframe>";
		}
};

function closeCalc(){
	try{
		$('blackOut').fade(0);
		$('shadow').fade(0);
		$('calcHolder').fade(0);
		setTimeout(destroyAll , 1000);
	}catch(z){};
};

function destroyAll(){
	try{
		$('blackOut').destroy();
		$('shadow').destroy();
		$('calcHolder').destroy();
		$('calcHead').destroy();
		$('calcContent').destroy();
		Calculator = null;
	}catch(z){};
};

window.addEvent('resize' , function(){
	try{
		var windowSize = window.getSize();
		$('blackOut').setStyle('width' , windowSize.x+'px');
		$('blackOut').setStyle('height' , windowSize.y+'px');
		$('shadow').setStyle('top' , ((windowSize.y / 2) - 305)+'px');
		$('shadow').setStyle('left' , ((windowSize.x / 2) - 430)+'px');
		$('calcHolder').setStyle('top' , ((windowSize.y / 2) - 225)+'px');
		$('calcHolder').setStyle('left' , ((windowSize.x / 2) - 350)+'px');
	}catch(z){};
});
