function openpopup( popupName ) {
	
	var popup = null;
	var width=510;
	var height=540;		
	var theURL='';
	var winName='';
	var topY=(screen.height-height)/2;
	var leftX=(screen.width-width)/2;		
	var features='innerWidth=' + width+',innerHeight='+height+',width=' + width+',height='+height+',top='+topY+',left='+leftX+',resizable=0,scrollbars=0,toolbar=no,status=no,location=no';
						
	if(popupName=='polityka_prywatnosci') {
		theURL='popups/polityka_prywatnosci.html';
		winName='polityka_prywatnosci';
	} else if(popupName =='nota_prawna' ) {
		theURL='popups/nota_prawna.html';
		winName='nota_prawna';
	} else if( popupName =='regulamin_konkursu' ) {
		theURL='popups/regulamin_konkursu.html';
		winName='regulamin_konkursu';
	} 

	if( !winName || !theURL ) {
		alert( 'Not defined: ' + popupName );
		return;
	}	
	
	popup = window.open(theURL,winName,features);	

	if ( popup && !popup.closed ) {
		popup.focus();
	}
}

var book_owner = "";

function getHashParam(param) {
	var hash = (window.location.hash).substr(1) + ";";
	var pairs = hash.split(";");
	var strReturn = "";
	for (var i=0; i < pairs.length; i++) {
		if (pairs[i].indexOf(param.toLowerCase() + ":") > -1 ){
			var aParam = pairs[i].split(":");
			strReturn = aParam[1];
			break;
		}
	}
	return unescape(strReturn);
}

function getBookOwner() {
	book_owner = getHashParam('owner');
	return book_owner;
}

function setBookOwner(val) {
	book_owner = val;
	window.location.hash = "owner:"+val;
}

function setPageNumber(val) {
	window.location.hash = "owner:"+book_owner+";page:"+val;
}

function gotoPageOnStart() {
	return getHashParam("page");
}