function onEr() {
	return true;
}

function layerrefresh()
{
	document.location.reload();
}

window.onerror = onEr;
window.onresize = layerrefresh;

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function hpInit(prelist, ff)
{
	MM_preloadImages('images/blank.gif');
	if (prelist!="")
	{
		var spl = prelist.split("|");
		for (var f=0;f<spl.length;f++)
			MM_preloadImages(spl[f]);
	}
	if (ff!="")
		eval("document.sendPage."+ff+".focus();");
}

function Hover( objImage, imageName )
{
	objImage.src = imageName;
}

function slideSwitch()
{
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function()
{
    setInterval( "slideSwitch()", 4000 );
    $('#introanim').fadeOut( 3000 );
});

// ######### eShop #########################
var gCurHG = "";
var gCurUG = "";
var gCurSearchText = "";
var gIsFav = false;
var gOldHG = "";
var gOldUG = "";

function HeaderBack(id)
{
	document.getElementById( 'header1' ).className = "bck"+id+"1";
	document.getElementById( 'header2' ).className = "bck"+id+"2";
	document.getElementById( 'header3' ).className = "bck"+id+"3";
}
function ShowHGLink(id)
{
	if ( gOldHG != "" )
	{
		document.getElementById( gOldHG ).className = "shopgrplink";
	}
	document.getElementById( id ).className = "shopgrplinkhigh";
	gOldHG = id;
}
function ShowUGLink(id)
{
	if ( gOldUG != "" )
	{
		document.getElementById( gOldUG ).className = "shopgrplink";
	}
	document.getElementById( id ).className = "shopgrplinkhigh";
	gOldUG = id;
}
function CurUGLInk()
{
	if ( gOldUG != "" )
	{
		document.getElementById( gOldUG ).className = "shopgrplinkhigh";
	}
}

function NavMainGroup()
{
	frames['eshop'].location.href = "FruchtExpress.asp?page=1000";
	gIsFav = false;
}
function NavFavMainGroup()
{
	frames['eshop'].location.href = "FruchtExpress.asp?page=1003";
	gIsFav = true;
}
function NavUnderGroup( id )
{
	if ( gIsFav )
	{
		frames['eshop'].location.href = "FruchtExpress.asp?page=1003&view=1&data="+id;
	} else {
		frames['eshop'].location.href = "FruchtExpress.asp?page=1000&view=1&data="+id;
	}
	gCurHG = id;
	gCurUG = "";
	gOldUG = "";
	gCurSearchText = "";

	var headerID = parseInt(id);
	var backID = 1;
	switch ( headerID )
	{
		case 8:
		case 75:
		case 60:
		case 70:
		case 79:
		case 55:
		case 51:
		case 58:
		case 62:
		case 64:
			backID = 1;
		break;
		case 20:
		case 10:
		case 29:
		case 16:
		case 14:
		case 21:
			backID = 2;
		break;
		case 50:
		case 59:
		case 42:
		case 33:
		case 44:
		case 48:
		case 38:
		case 30:
		case 47:
		case 40:
		case 46:
		case 35:
		case 36:
			backID = 3;
		break;
		case 25:
		case 1:
		case 66:
		case 6:
		case 26:
		case 22:
		case 2:
		case 4:
		case 18:
			backID = 4;
		break;
	}

	HeaderBack(backID);
}
function NavProductGroup( id, id2 )
{
	frames['eshop'].location.href = "FruchtExpress.asp?page=1000&view=2&data="+id+"&subdata="+id2;
	gCurHG = id;
	gCurUG = id2;
	gCurSearchText = "";
}
function UpdateProductGroup()
{
	if ( gCurSearchText == "" )
	{
		if ( gCurUG == "" )
		{
			frames['eshop'].location.href = "FruchtExpress.asp?page=1000&view=2&data="+gCurHG;
		} else {
			frames['eshop'].location.href = "FruchtExpress.asp?page=1000&view=2&data="+gCurHG+"&subdata="+gCurUG;
		}
	} else {
		frames['eshop'].location.href = "FruchtExpress.asp?page=1050&view=3&data="+gCurSearchText;
	}
}
function NavSonderGroup()
{
	frames['eshop'].location.href = "FruchtExpress.asp?page=1002";
}
function NavTasteGroup()
{
	frames['eshop'].location.href = "FruchtExpress.asp?page=1002&view=1";
}
function ExecBuy( id, anzahl, view )
{
	var anz = anzahl+"";
	anz = anz.replace( ",", "." );
	if ( !isNaN(anz) )
	{
		frames['eshop'].location.href = "FruchtExpress.asp?page=1050&view="+view+"&data=" + id + "&subdata=" + anz;
	} else {
		alert("Keine g&uuml;ltige Zahl.\n");
	}
}
function ExecFav( hg, ug )
{
	if ( gIsFav )
	{
		frames['eshop'].location.href = "FruchtExpress.asp?page=1050&view=5&data=" + hg + "&subdata=" + ug;
	} else {
		frames['eshop'].location.href = "FruchtExpress.asp?page=1050&view=4&data=" + hg + "&subdata=" + ug;
	}
}
function ExecSearch( searchtext )
{
	if ( searchtext != "" )
	{
		frames['eshop'].location.href = "FruchtExpress.asp?page=1050&view=3&data="+searchtext;
		gCurSearchText = searchtext;
	}
	return false;
}
function NavBasket()
{
	frames['eshop'].location.href = "FruchtExpress.asp?page=1001";
}
function NavSubmitBasket( beschreibung )
{
	document.location.href = "FruchtExpress.asp?page=104&data=" + beschreibung;
}

function PrintBasket()
{
	var basketPrint = document.basket.basketprint.value;
	var txtBasket = '<html><body><textarea style="width : 100%; height : 100%; font-size : 11px; border-width : 0px;">'+basketPrint+'</textarea></html>';
	var fenster=window.open("", "Print", "menubar,width=565,height=550");
	fenster.document.open();
	fenster.document.write(txtBasket);
	fenster.document.close();
	fenster.print();
}
