
/////////////////////////////////////////////böngészo méret, helyzet
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
	//alert(pageWidth+":"+pageHeight+":"+windowWidth+":"+windowHeight); 
	return arrayPageSize;
}

function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	}

	arrayPageScroll = new Array(xScroll,yScroll) 
	return arrayPageScroll;
}
///////////////////////////////////////////////modal
function show_Modal(divID)
{
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	document.getElementById("modalBg").style.width = arrayPageSize[0]+"px";
	document.getElementById("modalBg").style.height = arrayPageSize[1]+"px";
	new Effect.Appear('modalBg', { duration: 0.2, from: 0.0, to: 0.6 });
    document.getElementById(divID).style.display = "block";
	var modal_boxWidth=document.getElementById("modal_box").style.width;
	var modal_boxHeight=document.getElementById("modal_box").style.height;
	//meg pageWidth+":"+pageHeight+":"+windowWidth+":"+windowHeight
	
    var yyyy = arrayPageScroll[1] + (arrayPageSize[3] -300)/2;
	var xxxx = arrayPageScroll[0] + (arrayPageSize[2] -600)/2;
	document.getElementById("modal_box").style.top=yyyy+"px";
	document.getElementById("modal_box").style.left=xxxx+"px";
}

function hide_Modal(divID)
{
	new Effect.Appear('modalBg', { duration: 0.2, from: 0.6, to: 0.0 });
    document.getElementById(divID).style.display = "none";
}

////////////////////////////////////////////uzenet
function uzenet(mit){
	
	//<? include("$include_dir/cikk_kuldes.php");?>
	var param="cikk_id="+mit;
	new Ajax.Updater('link_kuldes_hely', '/_includes/cikk_kuldes.php', {method: 'post', parameters: param, evalScripts: true});
	show_Modal("modal_div");
}
function link_kuldese(formname){
	//alert(document.getElementById("cimzett_neve").value);
	if(document.getElementById("cimzett_neve").value==""){
		alert(_KOTELEZOMEZO);
	} else if(document.getElementById("cimzett_email")==""){
		alert(_KOTELEZOMEZO);
	} else if(document.getElementById("felado_neve").value==""){
		alert(_KOTELEZOMEZO);
	} else if(document.getElementById("felado_email")==""){
		alert(_KOTELEZOMEZO);
    } else {
		var params = Form.serialize(formname);
		new Ajax.Updater('ajax_munkaterulet', '/_includes/functions/email.kuld.php', {method: 'post', parameters: params, evalScripts: true});
		hide_Modal('modal_div');
	}
}
////////////////////////////////////////////uzenet
function nyomtat(mit){
	win_w=680;
	win_h=600;
	w = screen.width;
	h = screen.height;
	win_left=(w-win_w)/2;
	win_top=(h-win_h)/2;
	window.open("/nyomtatobarat.php?cikk="+mit,"galeria","top="+win_top+",left="+win_left+",menubar=0,resizable=1,scrollbars=1,toolbar=0,width="+win_w+",height="+win_h+"");
}
//////////////////////////////////////////////kereses/////////////////////
function kereses(txt){
	//ellenöriz
	return true;
}
//////////////////////////////////////////////regisztracio////////////////////////
function regisztracio(formname){
	
	if(document.getElementById("username_reg").value.length<4){

		alert(_MEGFELEOUSERNAME);
		document.getElementById("username_reg").style.border="2px red solid";
		return false;
	} else {
		document.getElementById("username_reg").style.border="1px #006600 solid";
	}
	apos=document.getElementById("email").value.indexOf("@")
	dotpos=document.getElementById("email").value.lastIndexOf(".")
	if(apos<1||dotpos-apos<2){

		alert(_LETEZOEMAILCIM);
		document.getElementById("email").style.border="2px red solid";
		return false;
	} else {
		document.getElementById("email").style.border="1px #006600 solid";
	}
	if(document.getElementById("password_confirm").value.length<6 || document.getElementById("password_confirm").value!=document.getElementById("password_reg").value){

		alert(_MIN6KARAKTER);
		document.getElementById("password_reg").style.border="2px red solid";
		document.getElementById("password_confirm").style.border="2px red solid";
		return false;
	} else {
		document.getElementById("password_reg").style.border="1px #006600 solid";
		document.getElementById("password_confirm").style.border="1px #006600 solid";
	}
	var params = Form.serialize(formname);
	//alert(params);
	new Ajax.Updater('box_sz_595', '/_includes/reg_tart.php', {method: 'post', parameters: params, evalScripts: true});
}
//////////////////////////////////////////////regisztracio módosítása////////////////////////
function adatmodositas(formname){
	
	var params = Form.serialize(formname);
	new Ajax.Updater('box_sz_595', '/_includes/reg_tart.php', {method: 'post', parameters: params, evalScripts: true});	
}
//////////////////////////////////hozzászólások////////////////////////////////////////////
function hozzaszolaskiiras(cikk_id,forum_id){
	var params = "cikkid="+cikk_id+"&forumid="+forum_id;
	new Ajax.Updater('hozzaszolasok', '/_includes/ajax/hozzaszolas.php', {method: 'post', parameters: params, evalScripts: true});
}
function uj_hozzaszolas(formname){
	var params = Form.serialize(formname);
	new Ajax.Updater('hozzaszolasok', '/_includes/ajax/hozzaszolas.php', {method: 'post', parameters: params, evalScripts: true});
}

function kontakt_uzenet_kuldese(formname){
	if(document.getElementById("keresztnev").value==""){
		alert(_KOTELEZOMEZO);
	} else if(document.getElementById("vezeteknev")==""){
		alert(_KOTELEZOMEZO);
	} else if(document.getElementById("utca").value==""){
		alert(_KOTELEZOMEZO);
	} else if(document.getElementById("iranyitoszam")==""){
		alert(_KOTELEZOMEZO);
	} else if(document.getElementById("varos")==""){
		alert(_KOTELEZOMEZO);
	} else if(document.getElementById("email")==""){
		alert(_KOTELEZOMEZO);
    } else {
		var params = Form.serialize(formname);
		new Ajax.Updater('kontakt_uzenet_div', '/_includes/form_content.php', {method: 'post', parameters: params, evalScripts: true});
	}
}
