
function changePartnerBox()
{
	var obj = document.getElementById("container_partnerbox");
	var disp = 	obj.getAttribute("style");

	if (disp == "" || disp == null) obj.setAttribute("style", "display: none");
	else obj.setAttribute("style", "");

	obj = document.getElementById("container_receptkereso");
	disp = 	obj.getAttribute("style");

	if (disp == "" || disp == null) obj.setAttribute("style", "display: none");
	else obj.setAttribute("style", "");
}

function lapajanlo()
{
	var link = document.getElementsByTagName('base')[0].href
		+ "index.php?page=ajanlo&action=form&href=" + document.location;
	window.open(link, "_blank",
		'width=504,height=404,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=1');
	return false;
}

function switchPage(nr)
{
	var i = 1;
	var obj;
	while (obj = document.getElementById("cpage_"+i)) {
		if (i == nr) obj.style.display = 'block';
		else  obj.style.display = 'none';
		i++;
	}

	var lnk = document.location.href;

	if (lnk.indexOf("#cikktop") > 0) lnk = document.location.href;
	else lnk = document.location.href + "#cikktop";

	document.getElementById("cpagea_"+nr).href = lnk;
	return true;
}

function check_regisztracio()
{
	var obj = document.forms["regisztracio"].elements;

	if (obj["reg[nev]"].value == "") {
		alert("Kérem adja meg a nevét!");
		return false;
	}
	if (obj["reg[username]"].value == "") {
		alert("Kérem adja meg a felhasználói nevet!");
		return false;
	}
	if (obj["reg[email]"].value == "") {
		alert("Kérem adja meg az email címét!");
		return false;
	}
	if (obj["reg[password]"].value == "") {
		alert("Kérem adja meg a jelszavát!");
		return false;
	}
	if (obj["reg[password]"].value != obj["password2"].value) {
		alert("Nem egyezik meg a két jelszó!");
		return false;
	}
	return true;
}

function picPopup(picpath)
{
	var link = document.getElementsByTagName('base')[0].href;
	window.open(
		link+
		"/jsext/tiny_mce/plugins/imanager/scripts/popup.php?url="+picpath+
		"&clTxt=Click on image to close window","Image",
		"width=500, height=300, scrollbars=no, toolbar=no, location=no, status=no, "+
		"resizable=yes, screenX=100, screenY=100");
	return false;
}
function array_indexOf(array, item)
{
	var res = -1;
	for (var i = 0; i < array.length; i++) {
		if (array[i] == item) {
			res = i;
			break;
		}
	}
	return res;
}

function changecss(theClass,element,media,setter)
{
	//documentation for this script at http://www.shawnolson.net/a/503/
	var cssRules, mediatext;
	if (document.all) cssRules = 'rules';
	else if (document.getElementById) cssRules = 'cssRules';

	for (var S = 0; S < document.styleSheets.length; S++) {
		if (document.styleSheets[S].media.mediaText) mediatext = document.styleSheets[S].media.mediaText;
		else mediatext = document.styleSheets[S].media;
		if( array_indexOf(media, mediatext) >= 0 ) {
			for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
				if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
	//				alert(theClass + ', ' + typeof document.styleSheets[S][cssRules][R].style[element]);
					document.styleSheets[S][cssRules][R].style[element] = setter(document.styleSheets[S][cssRules][R].style[element]);
				}
			}
		}
	}
}


function cikkFontMeret(size, ctrl, classes)
{
	for (var i = 0; i < classes.length; i++) {
		changecss('.'+classes[i], 'fontSize', ['screen'], function(val){
				if (val == '') val = '12px';
				if (!this[classes[i]]) {
					this[classes[i]] = val;
					return parseInt(parseInt(val)*size)+'px';
				}
				else {
					val = this[classes[i]];
					this[classes[i]] = null;
					return val;
				}

		});
	}
	return false;
}


/*
function cikkFontMeret(size, ctrl, classes)
{
	var all = document.all || document.getElementsByTagName('*');
	for (var ai = 0; ai < all.length; ai++ ) {
		for (var i = 0; i < classes.length; i++) {
			if (all[ai].className == classes[i] ) {
				if (!all[ai]._switchedFontsize ) {
					all[ai]._switchedFontsize = true;
					all[ai].style.fontSize = size + '%';
				}
				else {
					all[ai].style.fontSize = null;
					all[ai]._switchedFontsize = false;
				}
			}
		}
	}

	return false;
}
*/

function hirlevel_regcheck()
{
	var oTxt = document.forms['hirleveluser'].elements['hlreg[email]'];
	if (oTxt.value == '') {
		alert('Kérem, adja meg az e-mail címét.');
		oTxt.focus();
		return false;
	}
	return true;
}
