function bookmarkMe(url, title){
	if (window.sidebar){ 
		// Mozilla Firefox
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ){ 
		// IE
		window.external.AddFavorite( url, title); 
	} else if(window.opera && window.print){
		// Opera
		return true; 
	} 	
}

function EvalResponse(response) {
	vissza = "";
	startpoz = -1;
	endpoz = -1;
	startpoz = response.indexOf("<jseval>", startpoz + 1);
	
	// js részek kinyerése
	while (startpoz > -1) {
		// értelmes válasz kigyűjtése
		vissza +=  response.substr(0, startpoz);
		response = response.substr(startpoz + 8);
		
		startpoz  = -1;
		endpoz = response.indexOf("</jseval>", startpoz + 1);
		
		if (endpoz > -1) {
			futtat =  response.substr(0, endpoz);
			response = response.substr(endpoz + 9);
			eval(futtat);
		}
		startpoz = response.indexOf("<jseval>", startpoz + 1);		
	}
	
	// maradék rész a válasz része
	if (response != "") {
		vissza += response;
	}
	return vissza;	
}

function refreshDIV(link, id)
{ 
	var req = null; 	
	var rnd = Math.round(Math.random()*1000000000);
	
	eval("obj_"+rnd+" = document.getElementById(id);");	
	eval("var div = obj_"+rnd);	
	
	div.innerHTML = "<p align=\"center\" style=\"font-family: Verdana; font-weight:bold; font-size:9pt\"><img src=\"images/loading.gif\" align=\"absmiddle\">&nbsp;betöltés...</p>";
	
	if(window.XMLHttpRequest)
		req = new XMLHttpRequest(); 
	else if (window.ActiveXObject)
		req  = new ActiveXObject("Microsoft.XMLHTTP"); 
		        
	req.onreadystatechange = function()
	{ 
		
		if(req.readyState == 4)
		{
			if(req.status == 200)
			{
			    if (req.responseText != ''){
			    	EvalResponse(req.responseText);			    	
				    div.innerHTML = req.responseText;					
			    }
			}	
			else	
			{
				div.innerHTML="Error: returned status code " + req.status + " " + req.statusText;
			}	
		} 
	}; 
	req.open("GET", link, true); 
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
	req.send(null); 	
} 

function refreshDIV2(link, id)
{ 
	var req = null; 	

	//alert(id);
	
	div = document.getElementById(id);	
	
	if(window.XMLHttpRequest)
		req = new XMLHttpRequest(); 
	else if (window.ActiveXObject)
		req  = new ActiveXObject("Microsoft.XMLHTTP"); 
		        
	req.onreadystatechange = function()
	{ 
		
		if(req.readyState == 4)
		{
			if(req.status == 200)
			{
			    if (req.responseText != ''){
				    div.innerHTML = req.responseText;					
			    }
			}	
			else	
			{
				div.innerHTML="Error: returned status code " + req.status + " " + req.statusText;
			}	
		} 
	}; 
	req.open("GET", link, true); 
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
	req.send(null); 	
} 

function refreshDIV3(link, id)
{ 
	var req = null; 	

	//alert(id);
	
	div = document.getElementById(id);	
	
	if(window.XMLHttpRequest)
		req = new XMLHttpRequest(); 
	else if (window.ActiveXObject)
		req  = new ActiveXObject("Microsoft.XMLHTTP"); 
		        
	req.onreadystatechange = function()
	{ 
		
		if(req.readyState == 4)
		{
			if(req.status == 200)
			{
			    if (req.responseText != ''){
				    div.innerHTML = req.responseText;					
			    }
			}	
			else	
			{
				div.innerHTML="Error: returned status code " + req.status + " " + req.statusText;
			}	
		} 
	}; 
	req.open("GET", link, true); 
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
	req.send(null); 	
}

function makePOSTRequest(url, parameters, id) {	
	//alert("url:"+url+" param:"+parameters+" id:"+id);
	http_request = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			// set type accordingly to anticipated content type
			//http_request.overrideMimeType('text/xml');
			http_request.overrideMimeType('text/html');
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request) {
		alert('Cannot create XMLHTTP instance');
		return false;
	}
	
	http_request.onreadystatechange = function (){
		if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			//alert(http_request.responseText);
			result = http_request.responseText;
			document.getElementById(id).innerHTML = result;            
		} else {
			alert('There was a problem with the request.');
		}
	}
		
	};
	http_request.open('POST', url, true);
	http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http_request.setRequestHeader("Content-length", parameters.length);
	http_request.setRequestHeader("Connection", "close");
	http_request.send(parameters);
}

function postRadioForm(source, target, result) {	
	obj = document.getElementById(source)   	
	
	for (var i = 0; i<= obj.length; i++){   		
		if (obj.elements[i].checked && obj.elements[i].type == "radio"){
			makePOSTRequest(target, obj.elements[i].name+"="+obj.elements[i].value, result);   			
			break;
		}	
	}
}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}

function openGalleryPopup(gID, fn){	
    win = window.open('gallery.popup.php?gID='+gID+'&fn='+fn,'openGalleryPopup','width=640,height=692,top=50,left=300,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0');    
}

function openPicturePopup(fn){	
    win = window.open('gallery.popupSimple.php?fn='+fn,'openPicturePopup','width=640,height=592,top=100,left=300,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0');    
}

function displayPicture(gID, fn, ID){
	refreshDIV('gallery.displayPictureAJAX.inc.php?gID='+gID+'&fn='+fn, ID);	
}

function displayPictureSimple(fn, ID){
	refreshDIV('gallery.displayPictureSimpleAJAX.inc.php?fn='+fn, ID);	
}

function openPrivacyPolicy(){
	ppolicy = window.open('privacyPolicy.html','openPPolicy','width=640,height=480,top=100,left=300,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1');    	
}

function openClubRules(){
	crules = window.open('clubRules.html','openCRules','width=640,height=480,top=100,left=300,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1');    	
}