﻿
function Logos() 
{
}

Logos.prototype.show = function(image, format) {
    if (this.popup == null)
        this.popup = document.getElementById("popup");

    this.popup.innerHTML = '';

    if (format == "SACD")
        this.popup.innerHTML += "<b>SACD (Super Audio Compact Disc)</b><br /> This CD can be played on all CD players. It can also be enjoyed (and sounds even better) as an HDCD or SACD if your player allows for these formats. For further information click on the 'formats' tab.<br/>";
    if (format == "SACD-HD")
        this.popup.innerHTML += "<b>SACD (Super Audio Compact Disc)</b><br /> This CD can be played on all CD players. It can also be enjoyed (and sounds even better) as an SACD if your player allows for this format. For further information click on the 'formats' tab.<br/>";
    if ((format == "HDCD") || (format == "SACD"))
        this.popup.innerHTML += "<b>HDCD (High Definition Compact Disc)</b><br /> This CD can be played on all CD players. It can also be enjoyed (and sounds even better) as an HDCD if your player allows for this format. For further information click on the 'formats' tab.<br/>";
    if ((format == "CD") || (format == "HDCD") || (format == "SACD"))
        this.popup.innerHTML += "<b>CD (Compact Disc)</b><br /> This CD can be played on all CD players.<br/>";

    if (format == "Vinyl")
        this.popup.innerHTML = "<b>Vinyl</b><br/ > Linn's top quality pressings are available on 180 gram LPs.";

    if (format == "Downloadable")
        this.popup.innerHTML = "This album is available for download to play on your computer or burn to CD.";

    if (format == "MP3")
        this.popup.innerHTML = "<b>MP3 - 320k</b><br />- These files can be played on any portable device and can be imported to any media player. <br />- If your internet connection is a little slow, this format is best for you.";

    if (format == "DMC")
        this.popup.innerHTML = "<b>Digital Music Collection</b><br /> Linn Records music downloads delivered to you on a digital music storage device.";

    if (format == "CD Quality WMA")
        this.popup.innerHTML = "<b>CD Quality - Windows Media Audio Lossless</b><br />- For PC users. Works best in Windows Media Player but may be converted to other formats for iTunes.<br />- The sound is equivalent to that of the original CD master.<br />- No DRM is attached to these files.";
    if (format == "CD Quality FLAC")
        this.popup.innerHTML = "<b>CD Quality - Free Lossless Audio Codec</b><br />- For all users. FLAC is an open format and may be converted for your personal choice of player.<br />- The sound is equivalent to that of the original CD master.<br />- No DRM is attached to these files.";

    if (format == "Studio Master WMA")
        this.popup.innerHTML = "<b>Studio Master - Windows Media Audio Lossless</b><br />- For PC users who desire the best sound.<br />- The sound is equivalent to the album's production master.<br />- No DRM is attached to these files.";
    if (format == "Studio Master FLAC")
        this.popup.innerHTML = "<b>Studio Master - Free Lossless Audio Codec</b><br />- For all users who desire the best sound (please download the test files before making a purchase).<br />- The sound is equivalent to the album's production master.<br /> - No DRM is attached to these files.";

    if (format == "Studio Master 5.1 WMA")
        this.popup.innerHTML = "<b>Studio Master, Surround Sound 5.1<br />Windows Media Audio Lossless</b><br />For PC users who desire the best surround sound (please download the surround test files before making a purchase).<br />- The sound is equivalent to the album's production master.<br />- No DRM is attached to these files.";
    if (format == "Studio Master 5.1 FLAC")
        this.popup.innerHTML = "<b>Studio Master, Surround Sound 5.1<br />Free Lossless Audio Codec</b><br />- For all users who desire the best surround sound (please download the surround test files before making a purchase).<br />- The sound is equivalent to the album's production master.<br />- No DRM is attached to these files.";

    if (format == "Studio Master (192) FLAC")
        this.popup.innerHTML = "<b>Studio Master (192) - Free Lossless Audio Codec</b><br />- For all users who desire the best sound (please download the 192k test files before making a purchase).<br />- The sound is equivalent to the album's production master.<br />- No DRM is attached to these files.";

    this.popup.style.position = "absolute";
    this.popup.style.border = "1px solid black";
    this.popup.style.padding = "2px";
    this.popup.style.color = "black";
    this.popup.style.background = "white";
    this.popup.style.textAlign = "left";
    this.popup.style.width = "280px";
    this.popup.style.height = "auto";
    this.popup.style.display = "block";
    this.popup.style.top = this.getRealTop(image) - this.popup.offsetHeight - 1 + "px";
    this.popup.style.left = this.getRealLeft(image) - 130 + "px";    
}

Logos.prototype.hide = function()
{
    this.popup.style.display = "none";
}

Logos.prototype.getRealLeft = function(el)
{
	xPos = el.offsetLeft;
	tempEl = el.offsetParent;
	while (tempEl != null)
	{
		xPos += tempEl.offsetLeft;
		tempEl = tempEl.offsetParent;
	}
	return xPos;
}

Logos.prototype.getRealTop = function(el)
{
	yPos = el.offsetTop;
	tempEl = el.offsetParent;
	while (tempEl != null)
	{
		yPos += tempEl.offsetTop;
		tempEl = tempEl.offsetParent;
	}
	return yPos;
}

// Global instance
var logos = new Logos();