﻿//gaydgets.js muss unbedingt vorher eingebunden werden
function OverGaydgetIcon() {
	if (gaydgets[0].Icon.getAttribute('stay') == 'no') {
		gaydgets[0].Icon.style.backgroundImage = gaydgets[0].Icon.style.backgroundImage.replace('.png', '_gold.png');
	}
}
function OutGaydgetIcon() {
	if (gaydgets[0].Icon.getAttribute('stay') == 'no') {
		gaydgets[0].Icon.style.backgroundImage = gaydgets[0].Icon.style.backgroundImage.replace('_gold', '');
	}
}
function ToggleGaydgetLayer() {
    if (gaydgets[0].closed) {
        OverGaydgetIcon();
		if (document.getElementById('FixedContent') != null) { document.getElementById('FixedContent').style.zIndex = '-1'; }
		if (document.getElementById('SaveButtonId') != null) { document.getElementById('SaveButtonId').style.display = 'none'; }
		gaydgets[0].Icon.setAttribute('stay', 'yes');OutGaydgetIcon(); 
	} else { setTimeout('CloseGaydgetLayerDelay()', 250); }
}
function CloseGaydgetLayerDelay() {
	if (gaydgets[0].motion == null) {
		if (document.getElementById('FixedContent') != null) { document.getElementById('FixedContent').style.zIndex = '1'; }
		if (document.getElementById('SaveButtonId') != null) { document.getElementById('SaveButtonId').style.display = 'block'; }
		gaydgets[0].Icon.setAttribute('stay', 'no'); OutGaydgetIcon();
	} else { setTimeout('CloseGaydgetLayerDelay()', 250); }
}
function GaydgetLayerInit() {
	if (!isInit) { isInit = true;
		if (gaydgets[0].Icon != null) {
			for (var i = 0; i < srcs.length; i++) { imgs[i] = document.createElement('IMG'); imgs[i].src = srcs[i]; }
			gaydgets[0].Icon.setAttribute('stay', 'no');
			addEvent(gaydgets[0].Icon, 'click', ToggleGaydgetLayer);
			if (document.getElementById('gaydget1')!= null && document.getElementById('MeineButtonDiv') != null)
			    document.getElementById('MeineButtonDiv').style.top = document.getElementById('gaydget1').offsetTop + 4 + 'px'
			if (document.getElementById('GaydgetDetail') != null) {
				addEvent(document.getElementById('GaydgetDetail'), 'click', ToggleGaydgetLayer);
			}
			if (document.getElementById('FixedContent') != null) {
				if (document.getElementById('FixedContent').style.zIndex != '') {
					OverGaydgetIcon(); gaydgets[0].Icon.setAttribute('stay', 'yes');
				}
			}
		}
	}
}
var imgs = [];
var srcs = ['/art/royal/images/graphbut_wide_gold.png','/art/royal/images/graphbut_narrow_gold.png','/art/royal/images/icons/featuredvideos_gold.png','/art/royal/images/icons/community_gold.png','/art/royal/images/icons/msgcenter_gold.png','/art/royal/images/icons/Galerie_gold.png','/art/royal/images/icons/date_gold.png'];
var isInit = false;
addEvent(window, 'load', GaydgetLayerInit);