//console.log(tisztelet_menu);

function HideAndShow(div_id) {
	if($(div_id).style['display'] == "none")
	{
		$(div_id).style['display'] = "inline";
		$("fomenu01").className ="fomenu_nyitott";
		setCookie("menu", 1, 7);
	}
	else
	{
		$(div_id).style['display'] = "none";
		$("fomenu01").className ="fomenu_zart";
		setCookie("menu", 0, 7);
	}
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}
function addCurtain(color, opacity) {
	var curtain = document.createElement('DIV');
	var color 	= (color) ? color : 'white';
	var opacity = (opacity) ? opacity : 0.8;

	curtain.id  = 'curtain';
	$(document.body).appendChild(curtain);

	$('curtain').setStyle({
		position: 	'absolute',
		left: 		'0px',
		top: 		'0px',
		height: 	$(document.body).getDimensions().height+'px',
		width: 		$(document.body).getDimensions().width+'px',
		opacity: 	opacity,
		background: color,
		zIndex: 	5
	});	
}
	
function removeCurtain(){
	$(document.body).removeChild($('curtain'));
}

Position.GetWindowSize = function(w) {
	var width, height;
        w = w ? w : window;
        this.width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth);
        this.height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);
        
        return this;
}

function openMailLayer() {
	addCurtain('black', 0.6);
	var dim = Position.GetWindowSize();
	var margin_left = parseInt((dim.width - 300)/2);
	var o = $('mail_box');
	o.style['display'] = "block";
	o.style['zIndex']  = 10;
	o.style['left']    = margin_left + 'px';
	o.style['top']     = '225px';
	$('szegely_1').setStyle({
		background: "#e8b427",
		opacity: 0.5
	});
	$('szegely_2').setStyle({
		background: "#e8b427",
		opacity: 0.5
	});
	$('szegely_3').setStyle({
		background: "#e8b427",
		opacity: 0.5
	});
	$('szegely_4').setStyle({
		background: "#e8b427",
		opacity: 0.5
	});
	//$('btn_igen').writeAttribute("href", "javascript: VoteThis('"+m+"');");
}
function closeMailLayer() {
	$('mail_box').hide();
	removeCurtain();
}
function MailArticle(l) {
	//console.log($("url").value + '/php/mail_article.php');
	var params = {to_name: $("to_name").value, to_mail: $("to_mail").value, from_name: $("from_name").value, art_url: l};
	var url = $("url").value + '/php/mail_article.php';
	var myAjax = new Ajax.Request(url, {
		asynchronous:  	false,
		method: 'post',
		parameters: params,
		onCreate: function() {
			//$('loading_box').show();
		},
		onSuccess: function (result) {
			var data = result.responseText;
			if(data == "1") {
				closeMailLayer();
			}
		}
	});	
}

function actionPrint(url)
{
  window.open(url);
}
function fPrint() {
	$('head_pic').hide();
	$('bal_oldal').hide();
	$('hozzaszolas_lista').hide();
	$('uj_hozzaszolas').hide();
	$('menu_alja').hide();
	$('lablec_eltartas').hide();
	$("share_box").hide();
	$("back_button").hide();
	$("utvonal").hide();
	$('menu_tartalom').style['background'] = "none";
	$('cikk_oldal').style['background'] = "none";
	$('cikk_lead').style['color'] = "black";
	$('cikk_cim').style['color'] = "black";
	$('cikk_tartalom').style['color'] = "black";
	window.print();
	
}

