﻿/*
    Brochure Manager Class 
*/
function BrochureManager(me, popUp)
{
    this.me = me;
    
    this.popUp = document.getElementById(popUp); 
    
    this.htmlDiv = "<div class=\"top\"><img src=\"{src}\" alt=\"{alt}\"></img><div class=\"clearit\"></div><h3>{caption}</h3></div>"
}

BrochureManager.prototype.show = function(id)
{
	this.hide();
	
	var scrollPos = document.body.scrollTop;
	if (scrollPos == 0)
	{
		if (window.pageYOffset)
			scrollPos = window.pageYOffset;
		else
			scrollPos = (document.body.parentElement) ? document.documentElement.scrollTop : 0;
	}
	this.popUp.style.marginTop = scrollPos + 'px';
	
    this.popUp.innerHTML = this.getMarkup(id);
    this.popUp.style.display = "inline";   
}

BrochureManager.prototype.hide = function()
{
	return this.popUp.style.display="none";
}

BrochureManager.prototype.getMarkup = function(id)
{
	var icon = document.getElementById(id);
	var image = (new String(icon.src)).replace("-ico.", ".");
    return this.htmlDiv.replace("{src}", image)
                        .replace("{alt}", icon.alt)
                        .replace("{caption}", icon.alt);
}
