
var bookwin;
var detailswin;
var newswin;
var lambertplayer;


// Book Popup
function openBookWindow(url,name,windowWidth,windowHeight) {
    myleft=(screen.width)?(screen.width-windowWidth)/3:100;
	mytop=(screen.height)?(screen.height-windowHeight)/3:100;
	properties = "width="+windowWidth+",height="+windowHeight+",scrollbars=no, top="+mytop+",left="+myleft;
    bookwin=window.open(url,name,properties);
    bookwin.window.focus();
}



// Collection Popup
function openCollectionWindow(url){
	var windowWidth ="900";
	var windowHeight ="455";
	var name = "popup";
    myleft=(screen.width)?(screen.width-windowWidth)/3:100;
	mytop=(screen.height)?(screen.height-windowHeight)/3:100;
	properties = "width="+windowWidth+",height="+windowHeight+",scrollbars=yes, top="+mytop+",left="+myleft;
    detailswin=window.open(url,name,properties);
    detailswin.window.focus();
}


// News Popup
function openNewsWindow(url){
	var windowWidth ="600";
	var windowHeight ="600";
	var name = "news";
    myleft=(screen.width)?(screen.width-windowWidth)/3:100;
	mytop=(screen.height)?(screen.height-windowHeight)/3:100;
	properties = "width="+windowWidth+",height="+windowHeight+",scrollbars=no, top="+mytop+",left="+myleft;
    newswin=window.open(url,name,properties);
    newswin.window.focus();
}


// Set Music-Off Cookie

function setMusicOffCookie() {
	var cookieName = "lambert_music_off";
	var cookieValue = "off";
	var nDays = 1;
	var today = new Date();
	var expire = new Date();
	if (nDays==null || nDays==0) nDays=1;
	expire.setTime(today.getTime() + 3600000*24*nDays);
	document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString();
}

// Delete Music-Off Cookie

function deleteMusicOffCookie() {
	var cookieName = "lambert_music_off";
	var cookieValue = "on";
	var today = new Date();
	var expire = new Date();
	expire.setTime(today.getTime() - 3600000*24);
	document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString();
}


// Read Music-Off Cookie

function readMusicOffCookie() {
	var cookieName = "lambert_music_off";
	var theCookie=""+document.cookie;
	var ind=theCookie.indexOf(cookieName);
	if (ind==-1 || cookieName=="") return ""; 
	var ind1=theCookie.indexOf(';',ind);
	if (ind1==-1) ind1=theCookie.length; 
	return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}


// Open Music Popup

function openMusicWindow() {
	if (readMusicOffCookie() != "off") {
		var windowWidth ="100";
		var windowHeight ="100";
		var name = "Lambert_Music_Player";
		var url = "int_music.php";
    	myleft=0;
		mytop=0;
		properties = "width="+windowWidth+",height="+windowHeight+",scrollbars=no, top="+mytop+",left="+myleft;
    	lambertplayer=window.open(url,name,properties);
    	lambertplayer.window.blur();
    }
}

// Open Music-Off Pupup

function openMusicOffWindow() {
		var windowWidth ="100";
		var windowHeight ="100";
		var name = "Lambert_Music_Player";
		var url = "int_nomusic.php";
    	myleft=0;
		mytop=0;
		properties = "width="+windowWidth+",height="+windowHeight+",scrollbars=no, top="+mytop+",left="+myleft;
    	lambertplayer=window.open(url,name,properties);
    	lambertplayer.window.blur();
}


function closeMusicWindow()	{
	closePopup("lambertplayer");
}

function closePopup(popupHandle) {
	if (window[popupHandle] && !window[popupHandle].closed) {
		window[popupHandle].close();
	}
}