function open_close(img_id,div_id) {
	var img = document.getElementById(img_id); 
	var obj = document.getElementById(div_id);
	var st = img.src;
	
	if (st.match("close.png")) {
		img.src = st.replace("close.png","open.png");
	} else if (st.match("open.png")) {
		img.src = st.replace("open.png","close.png");
	}
	
/*	
	if (obj.style.display == 'none') {
		obj.style.display = 'block';
	} else {
		obj.style.display = 'none';
	}
	*/
}

function order_lister(order,cmd) {
	wLoader.show();
	var form = document.getElementById("lista_report_form");
	form.orderby.value      = order;
	form.actual_page.value  = 1;
	eval(cmd);
	//    xajax_lista_report(xajax.getFormValues('lista_report_form'));
}
function pager_lister(page,cmd) {
	wLoader.show();
	var form = document.getElementById("lista_report_form");
	form.actual_page.value      = page;
	eval(cmd);
	//    xajax_lista_report(xajax.getFormValues('lista_report_form'));
}
function onepage_count_lister(record,cmd) {
	wLoader.show();
	var form = document.getElementById("lista_report_form");
	form.actual_page.value      = 1;
	form.on_onepage_count.value = record;
	eval(cmd);
	//xajax_lista_report(xajax.getFormValues('lista_report_form'));
}
function reload_lister(sel_value,cmd) {
	wLoader.show();
	var form = document.getElementById("lista_report_form");
	form.actual_page.value  = 1;
	form.sel_value.value    = sel_value;
	eval(cmd);
	//    xajax_lista_report(xajax.getFormValues('lista_report_form'));
}
function search_lister(cmd) {
	wLoader.show();
	eval(cmd);
	//    xajax_lista_report(xajax.getFormValues('lista_report_form'));
}

/**
*  Letiltható az elem kijelölése
**/
function disableSelection(target){
	if (typeof target.onselectstart!="undefined") //IE route
	target.onselectstart=function(){return false}
	else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
	target.style.MozUserSelect="none"
	else //All other route (ie: Opera)
	target.onmousedown=function(){return false}
	target.style.cursor = "default"
}

//Sample usages
//disableSelection(document.getElementById("mydiv")) //Disable text selection on element with id="mydiv"



function show_gallery() {
   document.getElementById('loading_index').style.display = "none";
   document.getElementById('gallery').style.display = "block";
   //fadeIn(document.getElementById('gallery'),100,2); 
   
}


function welcome() {
   
   setTimeout("fadeOut(document.getElementById('welcome_text'),5)",2000); 
   setTimeout("document.getElementById('welcome_text').style.display = 'none'",3000); 
   setTimeout("document.getElementById('welcome_imgs').style.display = 'block'",3000); 

   setTimeout("fadeIn(document.getElementById('welcome_1'),100,5)",3500); 
   setTimeout("document.getElementById('welcome_1').style.display = 'block'",3500); 

   setTimeout("fadeIn(document.getElementById('welcome_2'),100,5)",3500); 
   setTimeout("document.getElementById('welcome_2').style.display = 'block'",3500); 

   setTimeout("fadeIn(document.getElementById('welcome_3'),100,5)",3500); 
   setTimeout("document.getElementById('welcome_3').style.display = 'block'",3500); 

   setTimeout("fadeIn(document.getElementById('welcome_4'),100,5)",3500); 
   setTimeout("document.getElementById('welcome_4').style.display = 'block'",3500); 
}

function welcome_text() {
	document.getElementById('welcome_text').style.display = 'none';
}

function calendar_loader() {
	var div     = document.getElementById('calendar_main');
	var loader  = document.getElementById('calendar_loader');
	
	var height = div.offsetHeight;
	//alert(div.offsetHeight); 
	
	div.style.display = "none";
	loader.style.height = height + 'px';
	loader.style.display = "block";
	
}

	function maps_load() {
			if (GBrowserIsCompatible())
				{
				var bounds = new GLatLngBounds();
				var icon = new GIcon(G_DEFAULT_ICON); 
				icon.image = "frames/google_marker.png";
				icon.transparent = "frames/google_marker.png"; 
				
				function gmarker_object(infohtml,point,icon)
					{
					this.infohtml = infohtml ;
					this.point = point ;
					this.icon = icon ;
					}
				var gmarkers = new Array() ;
				gmarkers[0] = new gmarker_object(
					'',
					new GLatLng(48.131268, 20.918484, true),
					icon
					) ;

				var map = new GMap2(document.getElementById("map"));
				map.addControl(new GLargeMapControl());
				map.setCenter(gmarkers[0].point, 13);
				
				var opts = {maxWidth : 200};
				
				var marker1 = new GMarker(gmarkers[0].point,gmarkers[0].icon);
				//map.addOverlay(marker1);
				bounds.extend(marker1.getPoint()) ;
				}
	}            
	function maps_load2() {
			if (GBrowserIsCompatible())
				{
				var bounds = new GLatLngBounds();
				var icon = new GIcon(G_DEFAULT_ICON); 
				icon.image = "frames/google_marker.png";
				icon.transparent = "frames/google_marker.png"; 
				
				function gmarker_object(infohtml,point,icon)
					{
					this.infohtml = infohtml ;
					this.point = point ;
					this.icon = icon ;
					}
				var gmarkers = new Array() ;
				gmarkers[0] = new gmarker_object(
					'',
					new GLatLng(48.131268, 20.918484, true),
					icon
					) ;

				var map = new GMap2(document.getElementById("map"));
				map.addControl(new GLargeMapControl());
				map.setCenter(gmarkers[0].point, 10);
				
				var opts = {maxWidth : 200};
				
				var marker1 = new GMarker(gmarkers[0].point,gmarkers[0].icon);
				map.addOverlay(marker1);
				bounds.extend(marker1.getPoint()) ;
				}
	}    
/*    
	function gallery_upload(A_kekep,max,ac,gallery_id,topic_id,size,dir,orig,del) {
		for (i=1; i<=(max+1); i++) {
			//alert(i);
			xajax_imgs_upload(A_kekep,max,i,gallery_id,topic_id,size,dir,orig,del);
		}
		xajax_gallery_upload_complet(topic_id);
	}
*/    

function isset() {
	var a = arguments;
	if (a.length > 0) {
		var i = 0;
		while (i !== a.length) {
			if (typeof(a[i]) === 'object') {
				if (typeof(a[i]) === 'undefined' || a[i] === null) {
					return false;
				} else {
					i++;
				}
			} else if (typeof(a[i]) === 'string') {
				if (typeof(window[a[i]]) === 'undefined' || window[a[i]] === null) {
					return false;
				} else {
					i++;
				}
			}
		}
		return true;
	}
	return false;
}

function getHeight() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
	myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	myWidth = document.body.clientWidth;
	myHeight = document.body.clientHeight;
  }
	return myHeight;
}
function getWidth() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
	myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	myWidth = document.body.clientWidth;
	myHeight = document.body.clientHeight;
  }
	return myWidth;
}

	function getTop(imgH) {
		//var winH = getHeight();
		var winH = screen.height;
		return ((imgH-winH)/2) *-1;
	}
	function getLeft(imgW) {
		//var winW = getWidth();
		var winW = screen.width;
		return ((imgW-winW)/2) *-1;
	}
	function start_and_ginit() {
		start();
		initPage();
	
	}
function in_array(needle, haystack, argStrict) {
	// http://kevin.vanzonneveld.net
	// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
	// *     example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']);
	// *     returns 1: true
 
	var found = false, key, strict = !!argStrict;
 
	for (key in haystack) {
		if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
			found = true;
			break;
		}
	}
 
	return found;
}    


function printSelection(content){

  //var content=node.innerHTML
  var pwin=window.open('','print_content','');

  pwin.document.open();
  pwin.document.write('<html><body onload="window.print()">'+content+'</body></html>');
  pwin.document.close();
 
  setTimeout(function(){pwin.close();},1000);

}

  function PrintThisPage()  {
	 if (window.frames['print_frame'] == null){
		alert('document not found');
	 } else {
	   window.frames['print_frame'].focus();
	   print();
	 }
  }

