var same =  Math.floor(Math.random()*1000000); //Webaudit

function flyer_nagyit( fotofile, width, height )
	{
    width += 30;
    height += 30;
        
    fotoWindow = window.open( "", "flyerwindow", "dependent=yes,directories=no,menubar=no,personalbar=no,resizable=yes,scrollbars=yes,titlebar=no,toolbar=no,width="+width+",height="+height);

    fotoWindow.document.writeln( "<html>");
    fotoWindow.document.writeln( "<title>Housemusic.hu</title>");
    fotoWindow.document.writeln( "<body bgcolor=\"#064169\" marginwidth=0 marginheight= 0 leftmargin=0 topmargin=0 framespacing=0>");
    fotoWindow.document.writeln( "<table border=0 width=100% height=100% cellpadding=0 cellspacing=0>");
    fotoWindow.document.writeln( "<tr valign=middle><td align=center>");
    fotoWindow.document.writeln( "<a href=\"#\" onClick=\"javascript:window.close()\"><img src=\""+fotofile+"\" border=1></a>");
    fotoWindow.document.writeln( "</td></tr>");
    fotoWindow.document.writeln( "</table>");
    fotoWindow.document.writeln( "</body>");
    fotoWindow.document.writeln( "</html>");       
	}

function open_partyphoto( party, foto, w, h )
	{
	w = parseInt(screen.availWidth < w ? screen.availWidth : w);
	h = parseInt(screen.availHeight < h ? screen.availHeight : h);
	w+=20;
	h+=20;
	wName = "HM_fotowindow";
	fotoWindow = window.open( "partyphoto.php?party="+party+"&foto="+foto, wName, "directories=0,menubar=0,personalbar=0,resizable=1,scrollbars=0,titlebar=0,toolbar=0,status=0,width="+w+",height="+h);
	fotoWindow.innerWidth = w;
	fotoWindow.innerHeight = h;
	fotoWindow.focus();
	}

function open_foto( party, foto, w, h )
	{
	w = parseInt(screen.availWidth < w ? screen.availWidth : w);
	h = parseInt(screen.availHeight < h ? screen.availHeight : h);
	w+=20;
	h+=20;
	wName = "HM_fotowindow";
	fotoWindow = window.open( "partyview.php?party="+party+"&foto="+foto, wName, "directories=0,menubar=0,personalbar=0,resizable=1,scrollbars=0,titlebar=0,toolbar=0,status=0,width="+w+",height="+h);
	fotoWindow.innerWidth = w;
	fotoWindow.innerHeight = h;
	fotoWindow.focus();
	}
				   
function toggleBannerDiv( DivsId )
	{
	var Obj = document.getElementById( DivsId );
	if( Obj.clientHeight == 0 )
		{ Obj.style.border = '0px'; }
	}

function calibratePartyviewFoto()
	{
	var imgObj = document.getElementById('HM_partyfoto');
	var marginWH = 20;
	var isIE = navigator.appName == 'Microsoft Internet Explorer' ? true : false;

	var wH = isIE ? parseInt(document.body.clientHeight) : parseInt(window.innerHeight);
	var wW = isIE ? parseInt(document.body.clientWidth)  : parseInt(window.innerWidth);
		
	if(isIE)
		{
		if( wH < imgObj.height+marginWH )
			{
			imgObj.height = wH - marginWH;
			}
		var newW = screen.availWidth;
		var newH = screen.availHeight;
		window.moveTo(0,0);
		window.resizeTo(newW, newH);
		}
	else{
		if( wH < imgObj.height+marginWH || wW < imgObj.width+marginWH )
			{
			imgObj.height = wH - marginWH;
			window.innerWidth = parseInt(imgObj.width) + marginWH;
			}
		}
	}

function CookieHandler() {
 
	this.setCookie = function (name, value, seconds) {
 
		if (typeof(seconds) != 'undefined') {
			var date = new Date();
			date.setTime(date.getTime() + (seconds*1000));
			var expires = "; expires=" + date.toGMTString();
		}
		else {
			var expires = "";
		}
 
		document.cookie = name+"="+value+expires+"; path=/";
	}
 
	this.getCookie = function (name) {
 
		name = name + "=";
		var carray = document.cookie.split(';');
 
		for(var i=0;i < carray.length;i++) {
			var c = carray[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
		}
 
		return null;
	}
 
	this.deleteCookie = function (name) {
		this.setCookie(name, "", -1);
	}
 
}

