function showkep(pic, title) {
  option = "width=470, height=630, scrollbars=1, resizable=1";
  bigpic = window.open("", "bigpic", option) ;
  bigpic.document.writeln('<title>'+title+'</title>'); 
  bigpic.document.writeln('<img alt="Ablak bezárása" src="'+pic+'" onclick="window.close()">'); 
  bigpic.focus();
}

function showwind(url) {
  option = "width=800, height=580, scrollbars=1, resizable=1, status=0";
  newwind = window.open(url, "newwind", option) ;
  newwind.focus();
}

function maxwindow() {
	window.moveTo(0,0);
	window.resizeTo(screen.availWidth,screen.availHeight);
}

function validateForm()
{
 with (document.katlap)
 {
  if (u_sender.value.length < 4)
  {
   alert ("Kérjük töltse ki az adatlap szerkesztőjének nevét (túl rövid)!");
   u_sender.focus();
   u_sender.select();
   return false;
  }
  else {
		return true;
	}
 }
}

function checkUncheckAll(theElement) {
	var theForm = theElement.form, z = 0;
	for(z=0; z<theForm.length;z++){
    if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
			theForm[z].checked = theElement.checked;}
	}
}

function ClickAdminForm(order, n_button) {
	document.admin.order.value=order;
	document.admin.admode[n_button].click();
}

function copyoldtarif(theElement) {
	//o_ar másolása t_ar-ba
	var theForm = theElement.form, z = 0;
	var counter = 0, string = '' ;
	Price = new Array(0) ; 
	for(z=0; z<theForm.length;z++){
    if(theForm[z].type == 'text' && theForm[z].name.substring(0,4) == 'o_ar'){
			counter++ ;
			Price.length = counter ; 
			Price[counter-1] = theForm[z].value ;
		}
	}
	counter = 0 ;
	for(z=0; z<theForm.length;z++){
    if(theForm[z].type == 'text' && theForm[z].name.substring(0,4) == 't_ar'){
			counter++ ;
			theForm[z].value = Price[counter-1] ;
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
	var status = 'block' ;
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id).style.display == 'block') {
			status = 'none' ;}
		document.getElementById(id).style.display = status ;
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function clearform(thisform, definput, defselect) {
  var definput = (definput == null) ? '' : definput ;
  var defselect = (defselect == null) ? 0 : defselect ;
  if (document.getElementsByTagName){
		elements = thisform.getElementsByTagName('input');
		for( i=0; i<elements.length; i++){
			if (elements[i].getAttribute('type') == "text"){
				elements[i].value = definput;
			}
		}
		elements = thisform.getElementsByTagName('select');
		for( i=0; i<elements.length; i++){
			elements[i].options.selectedIndex=defselect;
		}
	}
}

// Image preload
function loadImages(yourImages) { 
	var preImages = new Array() ;
	for (i = 0; i < yourImages.length; i++) { 
		preImages[i] = new Image()
		preImages[i].src = yourImages[i]
	}
}

// Font sizer
var initSize = get_cookie("fontsize") ;
if (!initSize) {initSize = 1 ;}
	else {initSize = Number(initSize) ;}
function fontSizer(inc,unit) {
  var tags = new Array( 'p', 'td');
  var pixelArray =  new Array('11','12','14','16');
  var emArray =  new Array('0.8','0.9','1.0','1.1');
  var maxSize = 3;
	if (!document.getElementById) 
		return;
	var size = initSize;
		size += inc;
	if (size < 0 ) {
		size = 0;
	}
	if (size > maxSize ) {
		size = maxSize ;
	}
	initSize = size;
	set_cookie("fontsize", size, 1000*3600*24*365) ; 
	getBody = document.getElementsByTagName('body')[0];
	for (i = 0 ; i < tags.length ; i++ ) {
		getallTags = getBody.getElementsByTagName(tags[i]);
		for (k = 0 ; k < getallTags.length ; k++) {
			if (getallTags[k].id == "" && getallTags[k].className == "") 
				getallTags[k].style.fontSize = (unit=='px') 
					? pixelArray[size]+unit: emArray[size]+unit ;
		}
	}
}

//  ********************* General Cookie handling      *********************
function get_cookie ( cookie_name ){
  var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );
  if (results) return ( unescape ( results[1] ) );
  else return null;
}

function set_cookie ( name, value, expire, path, domain, secure ){
  var cookie_string = name + "=" + escape ( value );
  if ( expire ){
		var cookie_date = new Date() ;
		cookie_date.setTime ( cookie_date.getTime() +cookie_date.getTimezoneOffset()+ expire );
    cookie_string += "; expires=" + cookie_date.toGMTString();}
  if (path) cookie_string += "; path=" + escape ( path );
  if (domain) cookie_string += "; domain=" + escape ( domain );
  if (secure) cookie_string += "; secure";
  document.cookie = cookie_string;
}







		

