
function showpic(kep, width, height, text, alt)
{
    if(!text)text='Bezáráshoz kattintson a képre';
    if(!alt)alt='';
    var marginBottom=0;
    if(/MSIE (6|5|4)/.test(navigator.userAgent))marginBottom=10;
  $('seged').innerHTML ='<div style="position: relative"><img src="'+kep+'" alt="' + alt + '" onclick="$(\'seged\').hide();" style="cursor: pointer" onmouseover="new Effect.Opacity(\'close\', {from: 0.0, to: 0.7, duration: 0.2 }); return false;" onmouseout="new Effect.Opacity(\'close\', {from: 0.7, to: 0.0, duration: 0.2 }); return false;" /><div id="close" align="right" style="display: block; width: 100%; margin: 0px; margin-bottom:' + marginBottom + 'px;padding: 3px 0px 3px 0px; position: absolute; bottom: 0px; left: 0px; background: #000; opacity:  0.0; filter:Alpha(style=0,opacity=0);color:#fff;">' + text + '!&nbsp;</div></div>';
  position_layer2('seged', width, height);
  //Effect.Grow('seged', {direction: 'center'}); return false;
  $('seged').show();
  
  
 
}



function position_layer2(div, width, height){
  var dim = document.viewport.getDimensions();
  var myLayer = $(div);
  AktTop = document.viewport.getScrollOffsets().top;
  mywidth = width;
  myheight = height;
  // myheight += (myheight<50 ? plusheight : 0);
  
  //mywidth = document.viewport.getWidth();
  //myheight = document.viewport.getHeight();
  newLeft = (dim.width-mywidth)/2;
  if(myheight > dim.height)newtop = AktTop + 10;
  else newtop = AktTop + (dim.height-myheight)/2;
  if(newLeft < 10)newLeft = 10;
  if(newtop < 10)newtop = 10;

  //alert(myLayer.style.left + ' - ' + myLayer.style.top);
  myLayer.style.left = newLeft + "px";
  myLayer.style.top = newtop + "px";
}
 


/**
* Toggles the check state of a group of boxes
*
* Checkboxes must have an id attribute in the form cb0, cb1...
* @param The number of box to 'check'
* @param An alternative field name
*/

function checkAll( n, fldName ) {
  if (!fldName) {
     fldName = 'cb';
  }
	
	var f = document.adminForm;
	var n2 = 0;
	toggle='toggle_'+fldName;
	tgl=eval('f.' + toggle);
	if (fldName=='cb') c = f.toggle.checked; else c = tgl.checked;
	for (i=0; i < n; i++) {
		cb = eval( 'f.' + fldName + '' + i );
		if (cb) {
			cb.checked = c;
			n2++;
		}
	}
	if (c) {
		document.adminForm.boxchecked.value = n2;
	} else {
		document.adminForm.boxchecked.value = 0;
	}
}



function isChecked(isitchecked){
	if (isitchecked == true){
		document.adminForm.boxchecked.value++;
	}
	else {
		document.adminForm.boxchecked.value--;
	}
}

/**
* Default function.  Usually would be overriden by the component
*/
function submitbutton(pressbutton) {
	submitform(pressbutton);
}

/**
* Submit the admin form
*/
function submitform(pressbutton){
	document.adminForm.task.value=pressbutton;
	try {
		document.adminForm.onsubmit();
		}
	catch(e){}
	document.adminForm.submit();
}

function submitbutton_user(pressbutton) {
	submitform_user(pressbutton);
}

/**
* Submit the admin form
*/
function submitform_user(pressbutton){
	document.urlap.task.value=pressbutton;
	try {
		document.urlap.onsubmit();
		}
	catch(e){}
	document.urlap.submit();
}

function checked_alert(submiting)
{
	if (document.adminForm.boxchecked.value == 0) 
	{
		alert('Jelöljön ki egy elemet!'); 
	}
	else 
	{
		submitbutton(submiting);
	}
}

function checked_alert_confirm(submiting)
{
	if (document.adminForm.boxchecked.value == 0) 
	{
		alert('Jelöljön ki egy elemet!'); 
	}
	else 
	{
		if (confirm('Biztos, hogy törli?')) submitbutton(submiting);
		else return false;
	}
}

function listItemTask( id, task ) {
    var f = document.adminForm;
    cb = eval( 'f.' + id );
    if (cb) {
        for (i = 0; true; i++) {
            cbx = eval('f.cb'+i);
            if (!cbx) break;
            cbx.checked = false;
        } // for
        cb.checked = true;
        f.boxchecked.value = 1;
        submitbutton(task);
    }
    return false;
}

function checkclick(id) {
var elem = document.getElementById(id);
if (elem.checked == '') elem.checked='checked'; else elem.checked='';
}

function txt_num_suffix() {
	if (document.getElementById('type_sel').value == 'text_num')
	document.getElementById('suffix').style.display ='';
	else 
	document.getElementById('suffix').style.display ='none';

}


function open_window_img(what,pwidth,pheight) {

	myleft=(screen.width)?(screen.width-pwidth)/2:100;
	mytop=(screen.height)?(screen.height-pheight)/2:100;
	
	f_popup = open("","cartridge_popup","width="+pwidth+",height="+pheight+",left="+myleft+", top="+mytop+",status=no,toolbar=no,menubar=no,resizable=no");
	f_popup.document.open();
	f_popup.document.write("<HTML><HEAD><TITLE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TITLE></HEAD>");
	f_popup.document.write("<BODY style='margin: 0px 0px 0px 0px; padding: 0px;' bgcolor='#000000'>");
	f_popup.document.write("<a href='javascript:;' onClick='javascript:window.close();'><img src='"+what+"' title='Bezáráshoz kattintson a képre!' border='0'></a>");
	f_popup.document.write("</BODY></HTML>");
	f_popup.document.close();
}



function anim_span(span_name, color, dir)
{
	
	var colors = new String('0123456789ABCDEF');
	var step_wait = 20;
	
	color = (dir?color-1:color+1);
	if(dir && color<0)
		{
			dir = false;
			color = 0;
		}
	if(!dir && color>15)
		{
			dir = true;
			color = 15;
		}

	// piros-fekete
	szin='#'+colors.charAt(color)+'0'+'0000';
	document.getElementById(span_name).style.color = szin;
	setTimeout('anim_span("'+span_name+'", '+color+', '+(dir?'true':'false')+')', step_wait);
}

