
// ab- und anstellen ------------------------------
function imgon(who){
	document.getElementById(who).style.visibility = "visible";
}
function imgof(who){
	document.getElementById(who).style.visibility = "hidden";
} 

// ab- und anstellen ------------------------------
function display(who){
    document.getElementById(who).style.display = "block";;
}
function noDisplay(who){
    document.getElementById(who).style.display = "none";
}

function startHeaderSlide()
{
    iv = window.setInterval("nextHeader()", 6000);
    nowHeader = 0;
}
function nextHeader()
{    
    $("#header"+nowHeader).fadeOut(800);
    nowHeader = nowHeader + 1 < totalHeaders ? nowHeader + 1 : 0;
    $("#header"+nowHeader).fadeIn(1200);
}

function startSlideShow(immediate)
{
    if (slideInterval > 0)
    {
        window.clearInterval(slideInterval);
    }
    if (immediate)
    {
        nextImage();
    }
    slideInterval = window.setInterval("nextImage()", 3500);
    $("#galleryStart").hide();
    $("#galleryStop").show();
}

function stopSlideShow()
{
    window.clearInterval(slideInterval);
    $("#galleryStart").show();
    $("#galleryStop").hide();
}

function nextImage()
{
    var n = nowImage + 1;
    showImage(n);   
}

function showImageManual(image)
{
    stopSlideShow();
    showImage(image);
}

function showImage(image)
{    
    if (image >= totalImages)
    {
        image = 0;
    }
    
    if (nowImage != image)
    {
        id = "gallery_"+image;
        nowId = "gallery_"+nowImage;
        $("#"+nowId).fadeOut("normal");
        $("#"+id).fadeIn("normal");
        $("#galleryNumbers > #galleryNumber_"+image).removeClass("imageInactive");
        $("#galleryNumbers > #galleryNumber_"+image).addClass("imageActive");
        $("#galleryNumbers > #galleryNumber_"+nowImage).removeClass("imageActive");
        $("#galleryNumbers > #galleryNumber_"+nowImage).addClass("imageInactive"); 
        nowImage = image; 
    }
} 

function showTabItem(containerId, onId){
    // big
    var cont = document.getElementById(containerId);
    var children = cont.getElementsByTagName("div");
    k=0;
    for (i=0; i<children.length; i++)
    {
        var id = children[i].id;
        if (id.substr(id.length-2) == "_i")
        {
            //alert(id);
            display(children[i].id);
        }
        else if (id.length > 0)
        {
            //alert(id.substr(id.length-2));
            //alert(id);
            noDisplay(children[i].id);
        }
    }
    display('rissTab_'+onId+'_a');
    display('rissTab_'+onId+'_image'); 
    noDisplay('rissTab_'+onId+'_i');
} 


/* safemail func */
function safemail(name, domain, display, linkclass) {
	displayed=(display.length)<1 ? name+"@"+domain : display;
	document.write('<a class="'+linkclass+'" href="mailto:' + name + '@' + domain + '">' + displayed + '</a>');
}

/* very nice function from die-gestalten.de. thx */
function popup(url, w, h, f, x, y){
	if(navigator.userAgent.indexOf("Safari") != -1){
		w = w - 2;
	}
	var day = new Date();
	var id = day.getTime();
	var name = "ilovefu" + id;
	
	if(x == null){
		x = Math.round((screen.availWidth-w)/2);
	}
	if(y == null){
		y = Math.round((screen.availHeight-h)/2);
	}
	var features = "width="+w+",height="+h+",left="+x+",top="+y+",screenX="+x+",screenY="+y+",toolbar=no,location=no,status=no,menubar=no,history=no,titlebar=no,alwaysRaised";

	if(f != null){
		features += "," + f;
	}

	eval("var win"+id+" = window.open('"+url+"', '"+name+"', '"+features+"');");
	eval("win"+id+".moveTo("+x+","+y+");");
	eval("win"+id+".focus();");
}

function open_example_win(url, width, height) {
	popup(url,width,height, 'resizable=no,scrollbars=no')
}

function redirect_to (url) {
	location.href=url;
	return true;
}
