function openwindow(pageurl,width,height,scroll,winname) 
	{
	scroll=(scroll!='no' && scroll!=0) ? 'yes' : 'no';
	winname=winname ? winname : '_blank';
	if (width || height)
		{
		posleft=(screen.width-width)/2;
		postop=(screen.height-height)/2;
	   if (0>postop) postop=0; 
	   if (0>posleft) posleft=0;
		pos=',toolbar=no,location=no,directories=no,menubar=no,status=no,left='+posleft+',top='+postop+',width='+width+',height='+height;
	   }
	  else
	  	{
	  	pos='';
	  	}

	window.open(pageurl,winname,'scrollbars='+scroll+pos);
	}


function maskDate(objInput,e)
	{
	e = e || window.event;
	ch = e.which || e.keyCode;

	if ((objInput.value.length==4 || objInput.value.length==7) && (ch>=48 && ch<=57)) objInput.value=objInput.value+'-';
	}


function shareContent(share) 
	{
	share_url='';
	url_href=escape(document.location.href);

	if (share=='print')
		{
		openwindow('/misc/printpage.php?pageurl='+escape(document.location.pathname)+'&'+document.location.search.substring(1), '720','450', 'yes','yes','yes');
		}
	else if (share=='email')
		{
		openwindow('/misc/sendbyemail.php?pageurl='+escape(document.location.pathname)+'&fullurl='+escape(document.location.pathname+document.location.search)+'&'+document.location.search.substring(1), '480','323','no','no','no');
		}
	else if (share=='facebook')
		{
		share_url='http://www.facebook.com/share.php?u='+url_href;
		}
	else if (share=='iwiw')
		{
		share_url='http://iwiw.hu/pages/share/share.jsp?u='+url_href;
		}

	if (share_url) openwindow(share_url);
	} 


content_loaded=Array();
newscript=Array();

function loadContent(contentid,contentparam,forcereload,outputid,lang)
	{
	if (content_loaded[contentid]!=1 || forcereload==1)
		{
		loading_text='Betöltés...';
		document.getElementById('content_'+contentid).innerHTML='<br/><br/><center>'+loading_text+'</center>';

		content_loaded[contentid]=1;
		newscript[contentid]=document.createElement("script");
		outputparam=outputid ? '&outputid='+outputid : '';
		langparam=lang ? '&lang='+lang : '';
		newscript[contentid].src='/inc/functions/load_content.php?' + (contentparam.indexOf('contentid')==-1 ? 'contentid='+contentid+outputparam+langparam : '') + contentparam;
		document.getElementsByTagName("body")[0].appendChild(newscript[contentid]);
		}

	return true;
	}

