
function sendEmail() {
	var email = dojo.byId('notif_email').value;
	var content = dojo.byId('notif_content').value;

	dojo.xhrGet({
		url: 'footer/notify',
		content: { email: email, content: content },
		handleAs: 'text',
		load: function (response, ioArgs) {
			alert(response);
		}
		
	});

	popUp(null, 'toolTipEmail');
}

function open_blank(url) {
	window.open(url, '_blank');
}

function popImage(base, url) {
	window.open(base + '/imagewin.php?url=' + encodeURIComponent(url), '_blank', "menubar=no,location=no,statusbar=no,resizable=yes,toolbar=no,width=100,height=100,left=50,top=50");
}

function showLogin(event) {
	popUp(event, 'loginBox', 0, -10);
	dojo.byId('login-username').focus();
}

function openUserInfo(url) {
	var w = window.open(url, 'userinfo', "menubar=no,location=no,statusbar=no,resizable=yes,toolbar=no,width=350,innerWidth=350,height=500,left=50,top=50");
	w.focus();
}

function topicRequireLogin() {
	var u = dojo.byId('post-comment-username').value;
	var p = dojo.byId('post-comment-password').value;
	if (u.match(/^\s*$/) || p.match(/^\s*$/)) {
		alert('Jelenleg nem vagy belépve. Kérjük add meg a felhasználóneved és jelszavad!');
		return false;
	}
	return true;
}

// Extended Tooltip Javascript
// copyright 9th August 2002, 3rd July 2005
// by Stephen Chapman, Felgall Pty Ltd


// permission is granted to use this javascript provided that the below code is not altered
var DH = 0;var an = 0;var al = 0;var ai = 0;if (document.getElementById) {ai = 1; DH = 1;}else {if (document.all) {al = 1; DH = 1;} else { browserVersion = parseInt(navigator.appVersion); if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {an = 1; DH = 1;}}} function fd(oi, wS) {if (ai) return wS ? document.getElementById(oi).style:document.getElementById(oi); if (al) return wS ? document.all[oi].style: document.all[oi]; if (an) return document.layers[oi];}
function pw() {return window.innerWidth != null? window.innerWidth: document.body.clientWidth != null? document.body.clientWidth:null;}
function mouseX(evt) {if (evt.pageX) return evt.pageX; else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); else return null;}
function mouseY(evt) {if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return null;}
function popUp(evt,oi,xp,yp) {if (DH) {var wp = pw(); ds = fd(oi,1); dm = fd(oi,0); st = ds.visibility; if (dm.offsetWidth) ew = dm.offsetWidth; else if (dm.clip.width) ew = dm.clip.width; if (st == "visible" || st == "show") { ds.visibility = "hidden"; } else {tv = mouseY(evt)-yp; lv = mouseX(evt) - (ew/4)-xp; if (lv < 2) lv = 2; else if (lv + ew > wp) lv -= ew/2; if (!an) {lv += 'px';tv += 'px';} ds.left = lv; ds.top = tv; ds.visibility = "visible";}}}


function F_Vote() {
}

F_Vote.setup = function() {
	for (var i = 1; i <= 5; i++) {
		var v = new F_Vote();
		var img = dojo.byId('f-vote-' + i);
		dojo.connect(img, 'onclick', v, 'handleClick');
	}
}

F_Vote.prototype.handleClick = function (event) {
	var id = event.target.getAttribute('id');
	var m = id.match(/^f-vote-(\d+)/);
	if (!m) return;

	var idx = m[1];
	var input = dojo.byId('f-vote');
	input.value = idx;

	for ( var i = 1; i <= parseInt(idx); i++ ) {
		var img = dojo.byId('f-vote-' + i);
		img.src = 'img/csillag-sarga-trans.png';
		// img.className = 'sarga';
	}

	for ( var i = parseInt(idx) + 1 ; i <= 5; i++ ) {
		var img = dojo.byId('f-vote-' + i);
		img.src = 'img/csillag-szurke-trans.png';
		// img.className = 'szurke';
	}
}


