function openWnd() {
	
	var url = openWnd.arguments.length > 0 ? openWnd.arguments[0] :  'about:blank';
	var w = openWnd.arguments.length > 1 ? openWnd.arguments[1] : 300;
	var h = openWnd.arguments.length > 2 ? openWnd.arguments[2] : 250;
	var toolbar = openWnd.arguments.length > 3 ? openWnd.arguments[3] : 0;
	var resizable = openWnd.arguments.length > 4 ? openWnd.arguments[4] : 1;
	var x = openWnd.arguments.length > 5 ? openWnd.arguments[5] : screen.width/2 - w/2;
	var y = openWnd.arguments.length > 6 ? openWnd.arguments[6] : screen.height/2 - h/2;
	
	window.open(url, '', 'left=' + x + ',top=' + y + ',width=' + w + ',height=' + h + ',toolbar=' + toolbar + ',resizable=' + resizable);
}

function openWnd2(url, params) {
	
	var keys = new Array("width","height","toolbar","resizable","left","top","scrollbars");
	
	if(params["url"])
		url = params["url"];
	
	if(!params["left"] && params["width"])
		params["left"] = screen.width/2 - params["width"]/2;
	
	if(!params["top"] && params["height"])
		params["top"] = screen.height/2 - params["height"]/2;
	
	var s = '';
	
	for(var i = 0; i < keys.length; i++) {
		
		s += keys[i] + '=' + params[keys[i]] + ',';
	}
	
	s = s.substring(0,s.length-1);
	
	window.open(url, '', s);
}

function saveAs(s) {
	
	try {
		document.execCommand('SaveAs',1,s);
	} catch(e) {
		alert("A mentéshez használd a CTRL+S billentyukombinációt!");
	}
}

function currDate() {
	
	var now = new Date()
	
	return now.getFullYear() + "." + (now.getMonth()+1) + "." + now.getDate();
}

function charCheck(numcheck,e)
{
	var keynum;
	var keychar;
	
	if(window.event) // IE
	{
		keynum = e.keyCode;
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which;
	}
	
	if(keynum == 8)	return true;
	
	keychar = String.fromCharCode(keynum);
	
	return !numcheck.test(keychar);
}

function getPageScroll()
{
	var yScroll;

	if (self.pageYOffset) yScroll=self.pageYOffset;
	else if (document.documentElement && document.documentElement.scrollTop) yScroll=document.documentElement.scrollTop;
	else if (document.body) yScroll=document.body.scrollTop;

	arrayPageScroll=new Array('',yScroll)
	return arrayPageScroll;
}

function getPageSize(){

	var xScroll, yScroll;

	if (document.body.scrollHeight > document.body.offsetHeight)
	{
		xScroll=document.body.scrollWidth;
		yScroll=document.body.scrollHeight;
	}
	else
	{
		xScroll=document.body.offsetWidth;
		yScroll=document.body.offsetHeight;
	}

	var windowWidth, windowHeight;

	if (self.innerHeight)
	{
		windowWidth=self.innerWidth;
		windowHeight=self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
	{
		windowWidth=document.documentElement.clientWidth;
		windowHeight=document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		windowWidth=document.body.clientWidth;
		windowHeight=document.body.clientHeight;
	}

	if (yScroll < windowHeight) pageHeight=windowHeight;
	else pageHeight=yScroll;

	if (xScroll < windowWidth) pageWidth=windowWidth;
	else pageWidth=xScroll;

	arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight)

	return arrayPageSize;
}

function lifestyle_open()
{

	var arrayPageSize=getPageSize();
	var arrayPageScroll=getPageScroll();

	document.getElementById("lifestyle_box").style.top=(arrayPageScroll[1]+((arrayPageSize[3]-35-410)/2)+"px");

	document.getElementById("lifestyle_box").style.left=(((arrayPageSize[0]-40-410)/2)+"px");
	document.getElementById("lifestyle_box").style.zIndex=101;
	document.getElementById("lifestyle_box").style.border="1px solid #000000";
	document.getElementById("lifestyle_box").style.display="";

	sendRequest("?area=lifestyle&lifestyle_kotelezo=1", lifestyle_response);
//encodeURIComponent(nyelv_id)
	document.getElementById("lifestyle_overlay").style.height=(arrayPageSize[1]+"px");
	document.getElementById("lifestyle_overlay").style.zIndex=100;
	document.getElementById("lifestyle_overlay").style.display="";

}

function lifestyle_close()
{
	document.getElementById("lifestyle_overlay").style.display="none";
}

function lifestyle_response(respTxt)
{
	document.getElementById("lifestyle_box").innerHTML = respTxt;
}
