/*******************************************************************************
 * LayoutTool - die LayoutTool-Klasse versammelt Funktionen f?r das akutelle   *
 *              (Version 7.0) Layout der www.swr3.de.                          *
 ******************************************************************************/
function LayoutTool()
{
    if (LayoutTool._instance == null || LayoutTool._instance == undefined) {
        LayoutTool._instance = this;
    }
    this._domTool = DOMTool.getInstance();
    this._registry = new Array();
    this._onloadHandlers = new Array();
}
LayoutTool.JS_QUERYPARAM_PREFIX = 'JS::';

LayoutTool.SAM_POPUP = {
	getName:		function() { return 'SWR3AM'},
	getLiveUrl:		function() { return 'http://www.swr3.de/audioplayer/index.php?type=live'}
}


// 'private' static var containing singleton instance
LayoutTool._instance = null;


// Singleton
LayoutTool.getInstance = function()
{
    if (LayoutTool._instance == null || LayoutTool._instance == undefined) {
        LayoutTool._instance = new LayoutTool();
    }
    return LayoutTool._instance;
}

/**
 * tauscht ein Bild aus
 */
LayoutTool.replaceImage = function(target, imgUrl)
{
	if (target == undefined || imgUrl == undefined) {
		throw new JSInvalidArgumentException("replaceImage needs two String parameters to work");
	}
	LayoutTool.getInstance().getDOMTool().setAttribute(target, 'src', imgUrl);
}


LayoutTool.highlightTeaser = function(target)
{
	if (target == undefined) {
		throw new JSInvalidArgumentException("highlightTeaser needs two String parameters to work");
	}
	var instance = LayoutTool.getInstance();
	if (instance.registryGet('lastTeaser') == target) {
		instance.getDOMTool().removeClass(target, 'doctypes_Highlight');
		instance.registryRemove('lastTeaser');
	} else {
		instance.getDOMTool().addClass(target, 'doctypes_Highlight');
		instance.registryPut('lastTeaser', target);
	}
}

LayoutTool.openVoting = function(form)
{
    var attributes = "width=490,height=500,toolbar=no,location=no,directories=no,status=no,resizable=yes,menubar=no,scrollbars=yes,copyhistory=no";
    var url = form.action;
    if (url.indexOf('?') < 0) {
        url += '?';
    } else {
        url += '&';
    }
    for (var i = 0; i < form.elements.length; i++) {
        var type = form.elements[i].type
        var name = form.elements[i].name;
        var value = form.elements[i].value;
        if (!name || !value) {
            continue;
        }
        if (type == "radio" || type == "checkbox") {
            if (form.elements[i].checked) {
                url += name + "=" + value + "&";
            }
        } else {
            url += name + "=" + value + "&";
        }
    }
    LayoutTool.popup(url, 'swr3vote', attributes, true);
    return false;
}

LayoutTool.popup = function(url, name, attributes, reuse)
{
    if (!name) {
    	name= "swr3pop";
	}
    if (!attributes) {
    	attributes = 'toolbar=no,location=no,directories=no,status=no,resizable=yes,menubar=no,scrollbars=no,copyhistory=no';
	}
	var urldata = LayoutTool.processJSUrlParameter(url);
	url = urldata.url;
	var attrArray = attributes.split(',');
	for (var a = 0; a < attrArray.length; ++a) {
		var keyValue = attrArray[a].split('=');
		if (urldata.params[keyValue[0]] != undefined) {
			attrArray.splice(a, 1);
			--a;
		}
	}
	attributes = attrArray[0];
	for (var a = 1; a < attrArray.length; ++a) {
		attributes += ',' + attrArray[a];
	}
	for (var key in urldata.params) {
        if (urldata.params[key] instanceof String) {
            attributes += ',' + key + '=' + urldata.params[key];
        }
	}
	// reuse / destroy existing windows
	if (top.window[name] != null) {
		if (top.window[name].closed) {
			// if closed, destroy reference
			top.window[name] = null;
		} else if (!resue) {
			// if open and we're told not to reuse the window, close the exisiting one
			top.window[name].close();
			top.window[name] = null;
		} else {
//			alert("reusing");
			// if open en we should reuse the window, just set the new url and return
			var win = top.window[name];
			if (win.document.location.href != url) {
//				alert("setting location to...");
				win.document.location.href = url;
			}
			return win;
		}
	}
	// create new window
    var win = window.open(url, name, attributes);
    win.focus();
	return win;
}

var SWR3AM = null;
LayoutTool.openSAM = function(url, func)
{
	var urlparams = LayoutTool.getQueryParameter(url);
	var atype = urlparams['type'];
	var aid   = urlparams['aid'];
	var ainfo = urlparams['ainfo'];
	var page  = 'http://www.swr3.de/wraps/musik/webradio/audioplayer/index.php?type=live&aid=&ainfo=';
	if (atype == 'audio') {
		page = 'http://www.swr3.de/wraps/musik/webradio/audioplayer/index.php?type=audio&aid='+aid+'&ainfo='+ainfo;
	} else if (atype = "channel") {
		var channelId = new String(aid);
		if (channelId.length > 2) {
			channelId = "0" + channelId;
		}
		page = 'http://www.swr3.de/wraps/musik/webradio/audioplayer/index.php?type=channel&aid='+channelId+'&ainfo=';
	}
	var SAMstatus = null;
    if(window.SWR3AM == null || window.SWR3AM.closed == true) {
		// Fenster nicht da oder geschlossen
		SAMstatus = 'closed';
	} else {
		try {
			if (window.SWR3AM.document.location.href.indexOf('index.php')>0) {
				// geöffnet, aber noch auf Auswahlseite
				SAMstatus = 'openbutnotstarted';
			} else {
			// Fenster offen und fertsch für Funktionen
			SAMstatus = 'open';
			}
		} catch (e) {
			SAMstatus = 'openbutnotstarted';
		}

	}
    if(SAMstatus == 'closed' || SAMstatus == 'openbutnotstarted') {
        SWR3AM = null;
//		alert(page);
       	SWR3AM = window.open(page,'SWR3AM','width=520,height=680,top=20,left=20,toolbar=no,location=no,directories=no,status=no,resizable=yes,menubar=no,scrollbars=no,copyhistory=no');
        SWR3AM.focus();
    } else {
		if (typeof func == "function") {
			func();
		}
		window.SWR3AM.focus();
    }
}


LayoutTool.openChannel = function(url)
{
	var params = LayoutTool.getQueryParameter(url);
	LayoutTool.openSAM(url);
}

LayoutTool.openAudio = function(url)
{
	var params = LayoutTool.getQueryParameter(url);
	LayoutTool.openSAM(url);
}


LayoutTool.getQueryParameter = function(url)
{
	var params = new Array();
	var qStrPos = url.indexOf('?');
	if (qStrPos >= 0) {
		var query	= url.substring(qStrPos + 1);
		if (query.length > 0) {
			var qparts = query.split('&');
			for (var q = 0; q < qparts.length; ++q) {
				var valuePos = qparts[q].indexOf('=');
				if (valuePos >= 0) {
					var key =	unescape(qparts[q].substring(0, valuePos));
					var value =	unescape(qparts[q].substring(valuePos + 1));
					if (key.length > 0) {
						params.push([key, value]);
						params[key] = value;
					}
				}
			}
		}
	}
	return params;
}

LayoutTool.processJSUrlParameter = function(url)
{
	var jsParams = new Object();
	var qStrPos = url.indexOf('?');
	if (qStrPos >= 0) {
		var query	= url.substring(qStrPos + 1);
		url			= url.substr(0, qStrPos);
		if (query.length > 0) {
			var qparts = query.split('&');
			for (var q = 0; q < qparts.length; ++q) {
				var uePart = unescape(qparts[q]);
				if (uePart.indexOf(LayoutTool.JS_QUERYPARAM_PREFIX) == 0) {
					var vPos = uePart.indexOf('=');
					if (vPos >= 0) {
						var key   = uePart.substring(LayoutTool.JS_QUERYPARAM_PREFIX.length, vPos)
						var value = uePart.substring(vPos + 1);
						if (key.length > 0) {
							jsParams[key] = value;
							qparts.splice(q,1);
							--q;
						}
					}
				}
			}
			if (qparts.length > 0) {
				query = qparts[0];
				for (var q = 1; q < qparts.length; ++q) {
					query += '&' + qparts[q];
				}
				url += '?' + query;
			}
		}
	}
	return {url: url, params: jsParams};
}


LayoutTool.convertPxToEm = function(px)
{
	return (px * parseFloat('0.0625'));
}


LayoutTool.getCompactTeaser = function(id)
{
	var teaser;
	if (id == null || id == undefined) {
		teaser = LayoutTool.getInstance().registryGet('__lastCT');
	} else {
		teaser = LayoutTool.getInstance().registryGet('__compactTeaser#' + id);
		if (teaser == null || teaser == undefined) {
			teaser = new CompactTeaser(id);
			LayoutTool.getInstance().registryPut('__compactTeaser#' + id, teaser);
		}
		LayoutTool.getInstance().registryPut('__lastCT', teaser);
	}
	return teaser;
}


LayoutTool.addOnLoadHandler = function(funcObj, params, target)
{
	var instance = LayoutTool.getInstance();
	instance._onloadHandlers.push(new Array(funcObj, params, target));
}


LayoutTool.getPageSize = function()
{
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
    var pageHeight = 0;
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
    var pageWidth = 0;
	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	return new Array(pageWidth,pageHeight,windowWidth,windowHeight)
}


LayoutTool.getPageYScroll = function()
{
	var yScroll = 0;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}
    return yScroll;
}


LayoutTool.setPageYScroll = function(yScroll)
{
	if (self.pageYOffset) {
		self.pageYOffset = yScroll;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		document.documentElement.scrollTop = yScroll;
	} else if (document.body) {// all other Explorers
		document.body.scrollTop = yScroll;
	}
}


LayoutTool.prototype.getMousePosition = function(evt)
{
    var posx = 0;
    var posy = 0;
    if (!evt) evt = window.event;
    if (evt.pageX || evt.pageY) 	{
        posx = evt.pageX;
        posy = evt.pageY;
    }
    else if (evt.clientX || evt.clientY) 	{
        posx = evt.clientX + document.body.scrollLeft
            + document.documentElement.scrollLeft;
        posy = evt.clientY + document.body.scrollTop
            + document.documentElement.scrollTop;
    }
    return {x: posx, y: posy};
}

LayoutTool.EXPANDABLE_CONTAINERS = new Array();

LayoutTool.expandContent = function(el, evt)
{
    var instance = LayoutTool.getInstance();;
    var content = instance._findExpandableContent(el);
    if (content != null) {
        var id = instance._getExpandableContentId(content);
        LayoutTool.clearExpandableContainers(id);
        var pos = instance.getMousePosition(evt);
        var timeout = setTimeout (function() {LayoutTool.collapseContent(el) }, 2500);
        var container = instance._createExpandableContentContainer(id, content, pos);
        var parent = document.getElementById('pagelook_contentWrapper');
        result = parent.appendChild(container);
        instance._addHandlers(result);
        LayoutTool.EXPANDABLE_CONTAINERS.push(new Array(id, timeout));
    }
}



LayoutTool.collapseContent = function(el)
{
    var instance = LayoutTool.getInstance();;
    var content = instance._findExpandableContent(el);
    if (content) {
        var id = instance._getExpandableContentId(content);
    } else {
        var idAttr = el.getAttribute('id');
        var idPos  = idAttr.lastIndexOf('#');
        if (idPos >= 0) {
            var id = idAttr.substr(idPos)
        }
    }
    if (id != null) {
        instance.collapseContainer(id);
    }
}


LayoutTool.clearExpandableContainers = function(retainId)
{
    var instance = LayoutTool.getInstance();;
    for (var i = 0; i < LayoutTool.EXPANDABLE_CONTAINERS.length; i++) {
        var data = LayoutTool.EXPANDABLE_CONTAINERS[i];
        instance.collapseContainer(data[0], data[1]);
    }
    LayoutTool.EXPANDABLE_CONTAINERS = new Array();
}


LayoutTool.prototype._addHandlers = function(container)
{
    container.onmouseover = function()
        {
            var idAttr = this.getAttribute('id');
            var idPos  = idAttr.lastIndexOf('#');
            var id = idAttr.substr(idPos)
            for (var i = 0; i < LayoutTool.EXPANDABLE_CONTAINERS.length; i++) {
                var data = LayoutTool.EXPANDABLE_CONTAINERS[i];
                if (id == data[0]) {
                    clearTimeout(data[1]);
                    break;
                }
            }
        }

    container.onmouseout = function()
        {
            var idAttr = this.getAttribute('id');
            var el = document.getElementById(idAttr);
            var timeout = setTimeout (function() { LayoutTool.collapseContent(el) }, 5000);
            var idPos  = idAttr.lastIndexOf('#');
            var id = idAttr.substr(idPos)
            for (var i = 0; i < LayoutTool.EXPANDABLE_CONTAINERS.length; i++) {
                var data = LayoutTool.EXPANDABLE_CONTAINERS[i];
                if (id == data[0]) {
                    data[1] = timeout;
                    break;
                }
            }
        }
}

LayoutTool.prototype.collapseContainer = function(id, timeout)
{
    var container = document.getElementById('expandableContentContainer' + id);
    if (container != null) {
        var parent = container.parentNode;
        parent.removeChild(container);
        if (timeout != null) {
            clearTimeout(timeout);
        }
    }
}


LayoutTool.prototype._getExpandableContentId = function(content)
{
    var idAttr = content.getAttribute('id');
    var idPos  = idAttr.lastIndexOf('#');
    if (idPos < 0) {
        return false;
    }
    return idAttr.substr(idPos);
}

LayoutTool.prototype._createExpandableContentContainer = function(id, content, pos)
{
    var container = document.createElement("div")
    container.setAttribute('id', 'expandableContentContainer' + id);
    container.className = 'expandableContentContainer doctypes_Container';
    if (document.all) {
        container.style['left'] = (pos.x - 170) + 'px';
        container.style['top'] = (pos.y - 160) + 'px';
    } else {
        container.style['left'] = (pos.x - 30) + 'px';
        container.style['top'] = (pos.y - 150) + 'px';
    }
    var wrapper = document.createElement("div");
    wrapper.className = 'doctypes_Content';
    for (var i = 0; i < content.childNodes.length; i++) {
        var clone = content.childNodes[i].cloneNode(true);
        wrapper.appendChild(clone);
    }
    container.appendChild(wrapper);
    return container;
}


LayoutTool.prototype._findExpandableContent = function(el)
{
    for (var i = 0; i < el.childNodes.length; i++) {
        if (el.childNodes[i].nodeType == 1) {
            var id = el.childNodes[i].getAttribute('id');
            if (id != null && id.indexOf('expandableContent') == 0) {
                 return el.childNodes[i];
            }
        }
    }
    return null;
}


window.onload = function()
{
	var instance = LayoutTool.getInstance();
	for (var x = 0; x < instance._onloadHandlers.length; ++x) {
		var funcObj = instance._onloadHandlers[x][0];
		var params  = instance._onloadHandlers[x][1];
		var target = instance._onloadHandlers[x][2];
		if (target == null || target == undefined) {
			target = funcObj;
		}
		funcObj.call(target, params);
	}
}



/**
 * returns the instance's DOMTool
 * @access	public
 * @return	DOMTool
 */
LayoutTool.prototype.getDOMTool = function()
{
	return this._domTool;
}

LayoutTool.prototype.registryPut = function(key, value)
{
	this._registry[key] = value;
}

LayoutTool.prototype.registryRemove = function(key)
{
	this._registry[key] = undefined;
}


LayoutTool.prototype.registryGet = function(key)
{
	if (this._registry[key] != undefined) {
		return this._registry[key];
	}
}


function CompactTeaser(idOrEl)
{
	if (idOrEl == undefined) {
		throw new JSInvalidArgumentException("CompactTeaser needs an element/element id to work");
	} else if (typeof(idOrEl) == "string") {
		try {
	        this._el = DOMTool.getInstance().getElementById(idOrEl);
        } catch(e) {
        	this._el = idOrEl;
        }
    } else {
        this._el = idOrEl;
    }
    this._childs = new Array();
}

CompactTeaser.prototype.addTeaser = function(idOrEl)
{
	var el = null;
	if (idOrEl == undefined) {
		throw new JSInvalidArgumentException("addTeaser needs an element/element id to work");
	} else if (typeof(idOrEl) == "string") {
        el = DOMTool.getInstance().getElementById(idOrEl);
    } else {
        el = idOrEl;
    }
	this._childs.push({i: el.id, e: el, a: false});
}

CompactTeaser.prototype.setActive = function(idOrEl)
{
	var el = null;
	if (idOrEl == undefined) {
		throw new JSInvalidArgumentException("addTeaser needs an element/element id to work");
	} else if (typeof(idOrEl) == "string") {
        el = DOMTool.getInstance().getElementById(idOrEl);
    } else {
        el = idOrEl;
    }
    var id = el.id;
	for (var c = 0; c < this._childs.length; ++c) {
		if (this._childs[c].i == id) {
			this._childs[c].a = true;
			break;
		}
	}
}

CompactTeaser.prototype.update = function()
{
	var maxH = 0;
	if (typeof(this._el) == 'string') {
        this._el = DOMTool.getInstance().getElementById(this._el);
	}
	for (var c = 0; c < this._childs.length; ++c) {
		var el = this._childs[c].e;
	    var displayValue = el.style.display;
	    el.style.display = 'block';
		var elH = (el.offsetHeight) ? el.offsetHeight : el.style.pixelHeight;
	    el.style.display = displayValue;
		if (maxH < elH) {
			maxH = elH;
		}
	}
	if (maxH == 0) {
		LayoutTool.addOnLoadHandler(this.update, null, this);
	} else {
		var domTool = DOMTool.getInstance();
		var padH = maxH + 7;
		domTool.setCSSProperty(this._el, 'paddingTop', LayoutTool.convertPxToEm(padH) + 'em');
		var cssRatio = parseFloat('76%');
		var activeTeaser = null;
		for (c = 0; c < this._childs.length; ++c) {
			var child = this._childs[c].e;
			domTool.addClass(child, 'doctypes_CompactTeaser_dynamic');
			if (this._childs[c].a) {
				activeTeaser = child;
			}
			domTool.setCSSProperty(child, 'height', LayoutTool.convertPxToEm(maxH * (100/cssRatio)) + 'em');
		}
		if (activeTeaser != null) {
			domTool.addClass(activeTeaser, 'doctypes_CompactTeaser_active');
		}
	}
}


function GalleryTool()
{
	this.container		= null;
	this.isCreated		= false;
	this.isVisible		= false;
	this.currentUrl		= GalleryTool.DEFAULT_URL;
}


GalleryTool.getInstance = function()
{
    if (GalleryTool._instance == null || GalleryTool._instance == undefined) {
        GalleryTool._instance = new GalleryTool();
    }
    return GalleryTool._instance;
}


GalleryTool.prototype.show = function(url)
{
	if (!this.isCreated) {
		this.create();
	}
	this.hideHTMLObjects();
	var wrapper = document.getElementById(GalleryTool.WRAPPER_ID);
    var galTop = LayoutTool.getPageYScroll();
	wrapper.style.top = galTop + 'px';
	wrapper.style.visibility = 'hidden';
	var content = document.getElementById(GalleryTool.CONTENT_ID);
	content.src = url;
	if (content != null) {
		if (!this.isVisible) {
			this.container.style.display = 'block';
			this.isVisible = true;
		}
		return false;
	}
}


GalleryTool.prototype.hide = function()
{
	if (this.isCreated && this.isVisible) {
		this.container.style.display = 'none';
		this.isVisible = false;
		this.restoreHTMLObjects();
		return false;
	}
}


GalleryTool.prototype.create = function()
{
	if (this.isCreated) {
		this.destroy();
	}
	container = document.createElement(GalleryTool.CONTAINER_TAGNAME);
	container.id = GalleryTool.ID;
	container.className = GalleryTool.CLASSNAME;
	container.innerHTML = GalleryTool.INNER_HTML;
	var pageSize = LayoutTool.getPageSize();
	container.style.height = pageSize[1] + "px";
	container.onclick = function()
	{
		GalleryTool.getInstance().hide();
	}
	var documentBody = document.getElementsByTagName('body')[0];
	documentBody.appendChild(container);
	this.isCreated = true;
	this.container = container;
}


GalleryTool.prototype.destroy = function()
{
	if (this.isCreated) {
		if (this.isVisible) {
			this.hide();
		}
		var container = document.getElementById(GalleryTool.ID);
		var documentBody = document.getElementsByTagName('body')[0];
		documentBody.removeChild(container);
		this.isCreated = false;
		this.container = null;
	}
}


GalleryTool.prototype.update = function(size, doc)
{
//    alert("updating...");
	var pageSize = LayoutTool.getPageSize();
	var winWidth  = pageSize[2];
	var winHeight = pageSize[3];
	var docWidth  = size[0];
	var docHeight = size[1];
	var galWidth  = size[2];
	var galHeight = size[3];
//    alert('win: ' + winWidth + ', ' + winHeight + ', doc: ' + docWidth + ', ' + docHeight + ' gal: ' + galWidth + ', ' + galHeight);
	if (docWidth > galWidth) {
		galWidth =  (docWidth <= winWidth) ? docWidth : winWidth;
    }
	if (docHeight > galHeight) {
		galHeight =  (docHeight <= winHeight) ? docHeight + 5 : winHeight;
	} else if (docHeight < galHeight) {
        galHeight = docHeight + 5;
    }
//    alert('win: ' + winWidth + ', ' + winHeight + ', doc: ' + docWidth + ', ' + docHeight + ' gal: ' + galWidth + ', ' + galHeight);
	var content = document.getElementById(GalleryTool.CONTENT_ID);
	content.style.width = galWidth + 'px';
	content.style.height = galHeight + 'px';
	var wrapper = document.getElementById(GalleryTool.WRAPPER_ID);
    var galTop = (LayoutTool.getPageYScroll() + 20);
	//galTop += Math.round((winHeight - galHeight) / 2);
	wrapper.style.top = galTop + 'px';
	wrapper.style.display = 'block';
	wrapper.style.visibility = 'visible';
}



GalleryTool.prototype.hideHTMLObjects = function()
{
	var objects = document.getElementsByTagName('object');
	for (var o = 0; o < objects.length; ++o) {
		objects[0].style.visibility = 'hidden';
	}
}


GalleryTool.prototype.restoreHTMLObjects = function()
{
	var objects = document.getElementsByTagName('object');
	for (var o = 0; o < objects.length; ++o) {
		objects[0].style.visibility = 'visible';
	}
}


GalleryTool._instance			 = null;
GalleryTool.CONTAINER_TAGNAME	 = 'div';
GalleryTool.CLASSNAME            = 'gallery';
GalleryTool.ID		 		     = GalleryTool.CLASSNAME + (Math.round(new Date().getTime()));
GalleryTool.WRAPPER_ID			 = GalleryTool.ID + '_Wrapper';
GalleryTool.CONTENT_ID			 = GalleryTool.ID + '_Content';
GalleryTool.DEFAULT_URL			 = 'about:blank'
GalleryTool.INNER_HTML 			 = '<div class="' + GalleryTool.CLASSNAME + '_Overlay"></div>';
GalleryTool.INNER_HTML			+= '<div id="' + GalleryTool.WRAPPER_ID + '" class="' + GalleryTool.CLASSNAME + '_Wrapper">';
/* removed
GalleryTool.INNER_HTML 			+= '    <div class="' + GalleryTool.CLASSNAME + '_CloseBtn"><a href="#" onClick="top.GalleryTool.getInstance().hide(); return false">X</a></div>';
*/
GalleryTool.INNER_HTML 			+= '    <iframe name="' + GalleryTool.CONTENT_ID  +'" id="' + GalleryTool.CONTENT_ID + '" class="' + GalleryTool.CLASSNAME + '_Content" src="' + GalleryTool.DEFAULT_URL + '" frameborder="no" width="600" height="400" style="width: 100%, height: 100%" scrolling="no"></iframe>';
GalleryTool.INNER_HTML 			+= '</div>';
GalleryTool.WIDTH_CORRECTION    = 1;
GalleryTool.HEIGHT_CORRECTION   = 5;