function levag(hossz) {
  var tex=document.elso.t_text.value;
  document.elso.t_text.value = tex.substring(0,hossz);
  document.elso.szamlalo.value=0;
  return true;
}

function szamol() {
    document.elso.szamlalo.value = 500 - document.elso.t_text.value.length;
        if (document.elso.szamlalo.value<0) {levag(500);};
    return true;
}
function szamol2() {
    document.elso.szamlalo.value = 250 - document.elso.t_text.value.length;
        if (document.elso.szamlalo.value<0) {levag(250);};
    return true;
}

function del_conf(tex) {
   if (confirm(tex))
     {
       return true;
     } else {return false;}

}
function proba() {
    document.arufeltolt.akod.value ='500';

    return true;
}
 function open_help_window(oldal,x1,y1)
	{
	  var hauteur_popup=x1;
	  var H = (screen.height - hauteur_popup) / 2;
	  var largeur_popup=y1;
	  var L = (screen.width - largeur_popup) / 2;
	  window.open(oldal,"Popup","status=no,scrollbars=yes,resizable=yes,height="+hauteur_popup+",width="+largeur_popup+",top="+H+",left="+L);

	};

function get_str(str,formid)
{
  megn=prompt(str,'');
  if (!megn) 
	{
	  return false;
	} else 
	{
		formid.str_get.value=megn;
		return true;
	}
};


function AddImg(inp){
	document.body.all.szinek.aktiv_elem.value=inp;
	y = event.y+document.body.scrollTop;
	x = event.x+document.body.scrollLeft-20;
	y+=-100;
	y+='px';
	x+='px';
	document.all.addimg.style.left = x;
	document.all.addimg.style.top = y;
	document.all.addimg.style.visibility = 'visible';
};


function open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

function na_call(str)
{
  eval(str);
}

function noop()
{
  return false;
}

function chang_cellszin(inp){
   inp.style.backgroundColor=inp.value;
};

function change_template(inp,elem){
//   alert(inp);
   if (inp=='tartalomhatter') {document.all.tartalom.style.background=elem.value;};
};


function AddImg(inp)
{
	document.body.all.szinek.aktiv_elem.value=inp;
	y = event.y+document.body.scrollTop;
	x = event.x+document.body.scrollLeft-20;
	y+=-100;
	y+='px';
	x+='px';
	document.all.addimg.style.left = x;
	document.all.addimg.style.top = y;
	document.all.addimg.style.visibility = 'visible';
	document.all.addfile.style.visibility = 'hidden';
};

function AddDefault(szinkod,aktivelem)
{
  document.all.szinek[aktivelem].value=szinkod;
  document.all.szinek[aktivelem].style.backgroundColor=szinkod;
};


function AddFile(inp)
{
	document.body.all.szinek.aktiv_elem.value=inp;

	document.ifframe_f.uploadimage.kodfname.value=document.all.szinek[inp].id;
//	alert(top.document.all.szinek[inp].id);
	y = event.y+document.body.scrollTop;
	x = event.x+document.body.scrollLeft-20;
	y+=-100;
	y+='px';
	x+='px';
	document.all.addfile.style.left = x;
	document.all.addfile.style.top = y;
	document.all.addfile.style.visibility = 'visible';
	document.all.addimg.style.visibility = 'hidden';
};

function add_file_name_to(filename)
{
	var aktivelem = parent.document.all.szinek.aktiv_elem.value;
	parent.document.all.szinek[aktivelem].value=filename;
	parent.document.all.szinek[aktivelem].style.backgroundColor="white";
    parent.document.all.addfile.style.visibility = 'hidden';
}


