/* wins */
var oneWin = new bt_Window();
function openWindow(on_click){
	var on_click = (on_click) ? on_click : 'closeWindow();' ;
	oneWin.open({
		winclass : 'fps_window',
		drag : 'fps_windrag',
		html : '<div id="x_wintitle" class="fps_windrag"></div><div id="x_winclose" onclick="'+ on_click +'" title="Close" class="fps_winclose"></div><div id="loader" class="fps_winloading"></div><div id="x_wincontent" class="fps_wincontent"></div>'
	});
}
function openWindow2(on_click){
	var on_click = (on_click) ? on_click : 'closeWindow();' ;
	oneWin.open({
		winclass : 'fps_window',
		drag : 'fps_windrag',
		html : '<div id="x_wintitle2" class="fps_windrag"></div><div id="x_winclose2" onclick="'+ on_click +'" title="Close" class="fps_winclose"></div><div id="loader2" class="fps_winloading"></div><div id="x_wincontent2" class="fps_wincontent"></div>'
	});
}
function returnWindow(title, str, type, on_click){
	var on_click = (on_click) ? on_click : 'closeWindow();' ;
	var content = '';
	if(type==0){
		content += '<div class="error">';
	}else if(type==1){
		content += '<div class="success">';
	}else{
		content += '<div class="notice">';
	}
	content += str + '</div>';
	content += '<div style="text-align:center;"><input onclick="'+ on_click +'" class="button" type="button" value="OK" /></div></div>';

	oneWin.open({
		winclass : 'fps_window',
		drag : 'fps_windrag',
		html : '<div id="x_returntitle" class="fps_windrag">' + title + '</div><div id="x_returnclose" onclick="'+ on_click +'" title="Close" class="fps_winclose"></div>'+
		'<div id="returnloader" class="fps_winloading"></div><div id="x_returncontent" class="fps_wincontent">' + content + '</div>'
	});
}
function centermessagebox(){
	
	document.getElementById('messagebox').style.display = "none";
	leftpos = 0 ;
	toppos = 0 ;
	
	/**/
	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;
	}
	if (self.innerHeight) {
		inheight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		inheight = document.documentElement.clientHeight;
	} else if (document.body) {
		inheight = document.body.clientHeight;
	}
	toppos = (yScroll + (inheight/2)) - 60;
	/**/
	
	if (screen){
		leftpos = (document.body.clientWidth/2) - 165 ;
	}
	
	document.getElementById('messagebox').style.left = leftpos+'px';
	document.getElementById('messagebox').style.top = toppos+'px';
	
	document.onclick = hidemessagebox ;
} 
function hidemessagebox()
	{
	document.getElementById("messagebox").style.display = "none" ;
	window.focus() ;
	document.onclick = empty ;
	}
function fps_alert(str, type){
	var content = '';
	var myhref;

	if(!type) type='fps_caution';

	content = "<div class=\""+type+"\">"+str+"</div><div style=\"text-align: center\"><input type=\"button\" class=\"fps_button\" value=\""+fps_confirm_ok+"\" onclick=\"oneWin.close();\" /></div>";
	oneWin.open({
		winclass : 'fps_window',
		drag : 'fps_windrag',
		html : '<div id="x_winalert" class="fps_windrag"><img src="'+fps_globalurl+'image/redcaution_small.png" />'+fps_confirm_warning+'</div><div id="x_winalertclose" onclick="closeWindow();" title="'+fps_confirm_close+'" class="fps_winclose"></div><div id="x_winconfirmcontent" class="fps_wincontent">'+content+'</div>'
	});
	return false;
}

function fps_confirm(obj, str, yesscript, noscript){
	var content = '';
	var myhref;
	if(obj.href) {
		myhref = obj.href;
	}
	else myhref="";

	if(!yesscript) yesscript='';
	if(!noscript) noscript='';

	content = "<div class=\"fps_caution\">"+str+"</div><div style=\"text-align: center\"><input type=\"button\" class=\"fps_button2\" value=\""+fps_confirm_yes+"\" onclick=\"oneWin.close();"+yesscript+"window.location.href='"+myhref+"';\" /> <input type=\"button\" class=\"fps_button\" value=\""+fps_confirm_no+"\" onclick=\"oneWin.close();"+noscript+"\" /></div>";
	oneWin.open({
		winclass : 'fps_window',
		drag : 'fps_windrag',
		html : '<div id="x_winconfirm" class="fps_windrag"><img src="'+fps_globalurl+'image/redcaution_small.png" />'+fps_confirm_warning+'</div><div id="x_winconfirmclose" onclick="closeWindow();'+noscript+'" title="'+fps_confirm_close+'" class="fps_winclose"></div><div id="x_winconfirmcontent" class="fps_wincontent">'+content+'</div>'
	});
	return false;
}

function fps_confirm3(obj, str, yesscript, noscript, cancelscript){
	var content = '';
	var myhref;
	if(obj.href) {
		myhref = obj.href;
	}
	else myhref="";

	if(!yesscript) yesscript='';
	if(!noscript) noscript='';
	if(!cancelscript) cancelscript='';

	content = "<div class=\"fps_caution\">"+str+"</div>"+"<div style=\"text-align: center\">"+"<input type=\"button\" class=\"fps_button2\" value=\""+fps_confirm_yes+"\" onclick=\"oneWin.close();"+yesscript+" window.location.href='"+myhref+"';\" /> <input type=\"button\" class=\"fps_button\" value=\""+fps_confirm_no+"\" onclick=\"oneWin.close();"+noscript+"\" /> <input type=\"button\" class=\"fps_button3\" value=\""+fps_confirm_cancel+"\" onclick=\"oneWin.close();"+cancelscript+"\" /></div>";
	oneWin.open({
		winclass : 'fps_window',
		drag : 'fps_windrag',
		html : '<div id="x_winconfirm3" class="fps_windrag"><img src="'+fps_globalurl+'image/redcaution_small.png" />'+fps_confirm_warning+'</div><div id="x_winconfirm3close" onclick="closeWindow();'+cancelscript+'" title="'+fps_confirm_close+'" class="fps_winclose"></div><div id="x_winconfirmcontent" class="fps_wincontent">'+content+'</div>'
	});
	return false;
}


function closeWindow(){
	oneWin.close();
}

/* galéria */
function open_gallery (gid,pic) {
	window.open('/_gallery.php?id='+gid+'&pic='+pic,'Galeria','status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,height=650,width=690');
}


/* forum */
function forumpost (forumid,topicid,postid,mode) {
	if(mode==1 && forumid){// new topic
		param = '?forumid='+forumid+'&mode=newtopic';
	}else{
		if(topicid && postid){
			param = '?topicid='+topicid+'&postid='+postid;
		}else if(topicid && !postid){
			param = '?topicid='+topicid;
		}
	}
	if(param){
		window.open('http://test.kocsonyafesztival.hu/_forum.php'+param,'Forumpost','status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=1,height=550,width=559');
	}
}
function emoticon(icon){
	insAtCursor(eval(document.winform.posttext),' '+icon+' ');
}
function insAtCursor(myField,myValue){
	if(document.selection){ // IE support
		myField.focus() ;
		sel = document.selection.createRange() ;
		sel.text = myValue ;
	}else if (myField.selectionStart || myField.selectionStart == "0"){ // MOZILLA/NETSCAPE support
		var startPos = myField.selectionStart ;
		var endPos = myField.selectionEnd ;
		myField.value = myField.value.substring(0, startPos)
		+ myValue
		+ myField.value.substring(endPos, myField.value.length) ;
	}else{
		myField.value += myValue;
	}
}
// FLASH MEGJELENÍTÉS
function showflash(file,width,height,bgcolor,wmode) {
	if (wmode)
		wmode = 'transparent' ;
	else
		wmode = 'opaque' ;
	document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"'+width+'\" height=\"'+height+'\">');
	document.write('<param name=\"allowScriptAccess\" value=\"always\" />');
	document.write('<param name=\"movie\" value=\"'+file+'\" />');
	document.write('<param name=\"quality\" value=\"high\" />');
	document.write('<param name=\"wmode\" value=\"'+wmode+'\" />');
	document.write('<param name=\"bgcolor\" value=\"'+bgcolor+'\" />');
	document.write('<param name=\"swliveconnect\" value=\"true\" />');
	document.write('<param name=\"menu\" value=\"false\" />');
	document.write('<embed src=\"'+file+'\" quality=\"high\" bgcolor=\"'+bgcolor+'\" width=\"'+width+'\" height=\"'+height+'\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" wmode=\"'+wmode+'\"  swliveconnect=\"true\" menu=\"false\"/>');
	document.write('</object>');
}
function elrejt(element){
	document.getElementById(element).style.visibility = "hidden" ;
	window.focus() ;
}
function felfed(element){
	document.getElementById(element).style.visibility = "visible" ;
	window.focus() ;
}
/*------------------*/
var xmouse;
var ymouse;
function mouseMove(e){
	if(!e) var e = window.event;

	if(e.pageX){
		xmouse = e.pageX;
		ymouse = e.pageY;
	}else if(e.clientX){
		xmouse = e.clientX;
		ymouse = e.clientY
	}else return;

}
document.onmousemove = mouseMove;

function centerbox(t){
	
	var box = 'messagebox';

	document.getElementById(box).style.display = "none";
	leftpos = 0 ;
	toppos = 0 ;
	
	/**/
	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;
	}
	if (self.innerHeight) {
		inheight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		inheight = document.documentElement.clientHeight;
	} else if (document.body) {
		inheight = document.body.clientHeight;
	}
	toppos = (yScroll + (inheight/2)) - 60;
	/**/

	if (screen){
		leftpos = (document.body.clientWidth/2) - 160 ;
	}
	if(t){
		toppos = t;
	}
	
	document.getElementById(box).style.left = leftpos+'px';
	document.getElementById(box).style.top = toppos+'px';


	document.onclick = function() {
		document.getElementById(box).style.display = "none" ;
		window.focus() ;
		document.onclick = empty ;
	}

}

function empty()
	{
	}

function getradiovalue(radioObj)
	{
	if (!radioObj)
		return "" ;
	var radioLength = radioObj.length ;
	if (radioLength == undefined)
		if (radioObj.checked)
			return radioObj.value ;
		else
			return "" ;
	for (var i = 0; i < radioLength; i++)
			{
		if (radioObj[i].checked)
			{
			return radioObj[i].value ;
			}
		}
	return "" ;
	}
function mouseposition(boxname){
	leftpos = 0 ;
	toppos = 0 ;

	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;  
	}  

	if(navigator.appName == "Microsoft Internet Explorer"){
		toppos = ymouse + yScroll;
	}else{
		toppos = ymouse; 
	}
	leftpos = xmouse;

	document.getElementById(boxname).style.display = "block";
	document.getElementById(boxname).style.left = leftpos - 220 + 'px';
	document.getElementById(boxname).style.top = toppos - 260 + 'px';
} 