// Banneraustausch Funktion
bannerPlace = -1;
kitzLink = -1;
mallLink = -1;
zuerLink = -1;
flashBanner = -1;

function initBanners()
{
	if (bannerPlace == -1){
		bannerPlace = document.getElementById('banner');
		bannerPlace.rootClass = (bannerPlace.className != '') ? bannerPlace.className : '';
		
		kitzLink = document.getElementById('kitzbuehel').getElementsByTagName('a')[0];
		mallLink = document.getElementById('mallorca').getElementsByTagName('a')[0];
		
		zuerLink = document.getElementById('zuerich');
		if (!zuerLink) zuerLink = document.getElementById('zuerichEN');
		zuerLink = zuerLink.getElementsByTagName('a')[0];
	}
}

function setBanner(clipName, src, buttonPic)
{
	if (bannerPlace == -1) return;
	if (flashBanner == -1) flashBanner = findFlash('welcome_flash');
	
	resetBackground(kitzLink);
	resetBackground(mallLink);
	resetBackground(zuerLink);
	
	// Hintergrund des FlashBanners und des Buttons einstellen, sowie den Click übertragen
	try{
		flashBanner.fadeTo(clipName);
		flashBanner.setLink(src.href);
	}catch(e){};
	
	setBackground(src, buttonPic);
	setHref(bannerPlace, src);
}

function resetBanner()
{
	if (bannerPlace == -1) return;
	
	// Hintergrund des Banners zurücksetzen
	try{
		flashBanner.fadeTo('');
		flashBanner.setLink(false);
	}catch(e){};
	
	resetHref(bannerPlace);
	
	// Hintergrund der Buttons zurücksetzen
	resetBackground(kitzLink);
	resetBackground(mallLink);
	resetBackground(zuerLink);
}

function setBackground(el, img)
{
	el.style.backgroundImage = 'url('+img+')';
}

function resetBackground(el)
{
	el.style.backgroundImage = '';
}

function setHref(el, src)
{
	el.linkAtt = src.href;
	el.className = 'cursorOver';
}

function resetHref(el)
{
	el.linkAtt = '';
	
	if (typeof(el.rootClass) != 'undefined') el.className = el.rootClass;
	else el.className = '';
}

function linkTo(el)
{
	if (typeof(el.linkAtt) == 'undefined' || el.linkAtt == '' || el.linkAtt == 'javascript:;') return;
	location.href = el.linkAtt;
}

function playPRTV()
{
	try{findFlash('prtv_flash').mouseover();} catch(e){};
}

function stopPRTV()
{
	try{findFlash('prtv_flash').mouseout();} catch(e){};
}

function openStandardLayer(href)
{
	Shadowbox.open({
        player:     'iframe',
        content:    href
    });
}

function openCustomLayer(width, height, href) {
	Shadebox.open({
        player:     'iframe',
        content:    href,
		width:		width,
		height:		height
    });
}

function openInvestbox(href)
{
	// Für Private Invest
	Shadebox.open({
        player:     'iframe',
        content:    href,
        width:      980,
        height:     960
    });
}

function openInspirebox(href)
{
	// Für Private Inspirations
	Shadebox.open({
        player:     'iframe',
        content:    href,
        width:      738,
        height:     960
    });
}

function openMobilebox(href)
{
	// Für Mobile Layer
	Shadebox.open({
        player:     'iframe',
        content:    href,
        width:      530,
        height:     530
    });
}

function closeMobileLayer()
{
	Shadebox.close();
}

function closeInvestLayer()
{
	closeMobileLayer();
}

function closeInspirationsLayer()
{
	closeMobileLayer();
}

function searchFulltext(f, lang)
{
	if (f.q.value != ''){
		Shadowbox.open({
			player:     'iframe',
			content:    '/group/search.php?lang='+lang+'&q='+escape(f.q.value)
		});
	}
	return false;
}