function initBG(){
	if (document.images)
	{
		pic1= new Image(100,25); 
  		pic1.src="/calimero/frontend/skin/bg1.png"; 
  		pic2= new Image(100,25); 
  		pic2.src="/calimero/frontend/skin/bg2.png"; 
  		
	}
	$('bg_dummy').style.backgroundImage = "url(/calimero/frontend/skin/bg1.png)";
	$('main_div').style.backgroundImage = "url(/calimero/frontend/skin/bg2.png)";
	window.setTimeout('hideDummy();',3000);
}

function hideDummy(){
	$('bg_dummy').fade({ duration: 1.5, from: 1, to: 0 });
	window.setTimeout('showDummy();',6000);
}

function showDummy(){
	$('bg_dummy').appear();
	window.setTimeout('hideDummy();',6000);
}

function LoadPic(pic){
	if (document.images)
	{
		pic1= new Image(100,25); 
		pic1.src="/calimero/frontend/skin/"+pic; 
	}
}
function showBG(bg){
	LoadPic(bg);
	$('main_div').style.backgroundImage = "url(/calimero/frontend/skin/"+bg+")";
}

function switchBG(bg1,bg2){
	LoadPic(bg1);
	LoadPic(bg2);
	$('bg_dummy').style.backgroundImage = "url(/calimero/frontend/skin/"+bg1+")";
	$('main_div').style.backgroundImage = "url(/calimero/frontend/skin/"+bg2+")";
	window.setTimeout('hideDummy();',3000);
}

function bg(pic){
	LoadPic(pic);
	$('bg_dummy').style.backgroundImage = "url(/calimero/frontend/skin/"+pic+")";
}

function setMenu(i){
	document.observe("dom:loaded", function() {
	  $('menu_link_'+i).addClassName("menu_top_link_selected");
	  if(i == 5){ // || i == 4){
		$('mitte_mitte').style.marginLeft = "77px";
		$('mitte_mitte').style.width = "338px";
		$$('.back_link').each(function(el){
			el.style.left = "271px";
		});
		}
	});
	
	
}
function switch_icon(el){
	var src = el.src;
	if(src.search(/_grau/) != -1){
		el.src = src.replace(/_grau/,"");
	}else{
		el.src = src.replace(/\.png/,"_grau.png");
	}
}

function formatCaption(title, currentArray, currentIndex, currentOpts) {
	var link = '';
	var ausdruck = /(.*?)link\((.*)\,(.*)\)(.*)/;
	if(title && title.length && ausdruck.test(title)){
		ausdruck.exec(title);
		link = '<a class="title_link" href="'+ RegExp.$3 +'" target="_blank">'+ RegExp.$2 +'</a>';
		return '' + '<b>' + RegExp.$1 + link + RegExp.$4 + '</b>'; // + ' Bild ' + (currentIndex + 1) + ' von ' + currentArray.length + '';
	}
    return '' + (title && title.length ? '<b>' + title + link + '</b>' : '' ); // + ' Bild ' + (currentIndex + 1) + ' von ' + currentArray.length + '';
}
