var d = document;
var NeuesFenster = 0;
var	g_Element = null;
var	g_Elements = null;
var	g_Counter = 0;

var arrBestseller = null;
var arrGoodDeals = null;

// ===========================================================================
// Frames - Start
// ===========================================================================

// ===========================================================================
//	Funktionsname:			UpdateOneFrame()
//	Funktionsbeschreibung:	Ein Frame neu laden.
// ---------------------------------------------------------------------------
//	Parameter:				iFrame	-	Framenummer
//							strURL	-	Link
//
//	Erstelldatum:			23.02.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function UpdateOneFrame( iFrame, strURL )
{
	var	UpdateFrame = null;
	
	if ( parent != null )
	{
		UpdateFrame = parent.frames[ iFrame ];
		if ( UpdateFrame != null )
		{
			UpdateFrame.location.href = strURL;
		} // if
		else
		{
			if (window.opener != null)
			{
				if (window.opener.parent != null)
				{
					UpdateFrame = window.opener.parent.frames[ iFrame ];
					if ( UpdateFrame != null )
					{
						UpdateFrame.location.href = strURL;
					} // if
					else
					{
						//alert( "frame null" );
					} // else
				} // if
				else
				{
					//alert( "parent null" );
				} // else
			} // if
			else
			{
				//alert( "opener null" );
			} // else
		} // else
	} // if
	else
	{
		//alert( "parent null" );
	} // else
} // UpdateOneFrame
	
// ===========================================================================
//	Funktionsname:			UpdateTwoFrames()
//	Funktionsbeschreibung:	Zwei Frames neu laden.
// ---------------------------------------------------------------------------
//	Parameter:				iFrame1	-	Framenummer 1
//							iFrame2	-	Framenummer 2
//							strURL1	-	Link 1
//							strURL2	-	Link 2
//
//	Erstelldatum:			23.02.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function UpdateTwoFrames( iFrame1, iFrame2, strURL1, strURL2 )
{
	UpdateOneFrame( iFrame1, strURL1 );
	UpdateOneFrame( iFrame2, strURL2 );
} // UpdateTwoFrame
	
// ===========================================================================
//	Funktionsname:			UpdateThreeFrames()
//	Funktionsbeschreibung:	Drei Frames neu laden.
// ---------------------------------------------------------------------------
//	Parameter:				iFrame1	-	Framenummer 1
//							iFrame2	-	Framenummer 2
//							iFrame3	-	Framenummer 3
//							strURL1	-	Link 1
//							strURL1	-	Link 1
//							strURL3	-	Link 3
//
//	Erstelldatum:			23.02.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function UpdateThreeFrames( iFrame1, iFrame2, iFrame3, strURL1, strURL2, strURL3 )
{
	UpdateOneFrame( iFrame1, strURL1 );
	UpdateOneFrame( iFrame2, strURL2 );
	UpdateOneFrame( iFrame3, strURL3 );
} // UpdateThreeFrames
	
// ===========================================================================
// Frames - Ende
// ===========================================================================

// ===========================================================================
// Bilder - Start
// ===========================================================================

// ===========================================================================
//	Funktionsname:			ActivateImage()
//	Funktionsbeschreibung:	Bild beim überfahren mit der Maus "aktivieren".
// ---------------------------------------------------------------------------
//	Parameter:				Image	-	Bild
//
//	Erstelldatum:			23.02.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function ActivateImage( Image )
{
	if ( d.images != null )
	{
		if ( Image != null )
		{
       		var	Src = Image.src;
       		var	On = Src.lastIndexOf( "off.gif" );
       	
       		if ( On != -1 )
       		{
       			var	NewSrc = Src.substring( 0, On ) + "on.gif";
				Image.src = NewSrc;
			} // if
		} // if
	} // if
} // ActivateImage

// ===========================================================================
//	Funktionsname:			DeactivateImage()
//	Funktionsbeschreibung:	Bild beim überfahren mit der Maus "deaktivieren".
// ---------------------------------------------------------------------------
//	Parameter:				Image	-	Bild
//
//	Erstelldatum:			23.02.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function DeactivateImage( Image )
{
	if ( Image.lowsrc == "active" )
	{
		return;
	} // if
	
	if ( d.images != null )
	{
		if ( Image != null )
		{
       		var	Src = Image.src;
       		var	Off = Src.lastIndexOf( "on.gif" );
       	
       		if ( Off != -1 )
       		{
       			var	NewSrc = Src.substring( 0, Off ) + "off.gif";
       			
				Image.src = NewSrc;
			} // if
		} // if
	} // if
} // DeactivateImage

var	iTimeout = 0;
var	Image_Timeout = null;
var	AktRandomImage = -1;

// ===========================================================================
//	Funktionsname:			LoadRandomImage_Event()
//	Funktionsbeschreibung:	Bilder wahllos anzeigen.
// ---------------------------------------------------------------------------
//	Parameter:				iIntervall	-	Intervall in Millisekunden
//							iMax		-	Maximale Anzahl an Bilder
//
//	Erstelldatum:			03.03.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function LoadRandomImage_Event( iMax )
{
	var	Elements = null;
	var	strImage = "";
	
	strImage = "/images/Random/" + QuersummeAktuelleUhrzeit( iMax ) + ".jpg";
	
	Elements = d.getElementsByName( "randomimage" );
	if ( Elements[ 0 ] == null )
	{
		//alert( "Keine Zufallsbilder auf der Seite: Nächstes Bild wäre " + strImage );
		return;
	} // if
	
	if ( Image_Timeout != null )
	{
		AktRandomImage++;
		
		if ( Elements[ AktRandomImage ] != null )
		{
			Elements[ AktRandomImage ].src = strImage;
		} // if
		else
		{
			AktRandomImage = 0;
			if ( Elements[ AktRandomImage ] != null )
			{
				Elements[ AktRandomImage ].src = strImage;
			} // if
			else
			{
				//alert( "Keine Zufallsbilder auf der Seite: Nächstes Bild wäre " + strImage );
			} // else
		} // else
	} // if
	
	Image_Timeout = window.setTimeout( "LoadRandomImage_Event( " + iMax + " )", iTimeout );
} // LoadRandomImage_Event

// ===========================================================================
//	Funktionsname:			ActivateRandomImageTimeout()
//	Funktionsbeschreibung:	Den Timer starten.
// ---------------------------------------------------------------------------
//	Parameter:				
//
//	Erstelldatum:			03.03.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function ActivateRandomImageTimeout( iIntervall, iMax )
{
	iTimeout = iIntervall;
	LoadRandomImage_Event( "" + iMax + "" );
} // ActivateRandomImageTimeout

// ===========================================================================
//	Funktionsname:			DeactivateRandomImageTimeout()
//	Funktionsbeschreibung:	Den Timer beenden.
// ---------------------------------------------------------------------------
//	Parameter:				
//
//	Erstelldatum:			03.03.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function DeactivateRandomImageTimeout()
{
	if ( Image_Timeout != null )
	{
		window.clearTimeout( Image_Timeout );
		Image_Timeout = null;
	} // if
} // DeactivateRandomImageTimeout

// ===========================================================================
//	Funktionsname:			QuersummeAktuelleUhrzeit()
//	Funktionsbeschreibung:	Bildet die Quersumme der aktuellen Uhrzeit.
// ---------------------------------------------------------------------------
//	Parameter:				iMax	-	Maximale Anzahl an Bilder
//
//	Erstelldatum:			03.03.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function QuersummeAktuelleUhrzeit( iMax )
{
	var	i = 0;
	var	iQuersumme = 0;
	var	strQuersumme = "";
	var	dAktdate = new Date();
	var	iCount = parseInt( iMax );
	
	strQuersumme = "" + dAktdate.getSeconds() + dAktdate.getMilliseconds();
	for( i = 0; ( i < strQuersumme.length ); i++ )
	{
		iQuersumme += parseInt( strQuersumme.charAt( i ) );
	} // for
	while ( iQuersumme > iCount )
	{
		iQuersumme -= iCount;
	} // while
	
	strQuersumme = iQuersumme.toString();
	
	return( strQuersumme );
} // QuersummeAktuelleUhrzeit

// ===========================================================================
//	Funktionsname:			SumOfDigitsActTime()
//	Funktionsbeschreibung:	Bildet die Quersumme der aktuellen Uhrzeit.
// ---------------------------------------------------------------------------
//	Parameter:				iMax	-	Maximaler Wert
// ===========================================================================
function SumOfDigitsActTime(iMax)
{
	var	i = 0;
	var	iResult = 0;
	var	dAktdate = new Date();
	var	iCount = parseInt(iMax);
	var sTemp = "" + dAktdate.getSeconds() + dAktdate.getMilliseconds();

    if (iCount > 0)
    {
	    for(i = 0; (i < sTemp.length); i++)
	    {
		    iResult += parseInt(sTemp.charAt(i));
	    } // for
    	
	    while (iResult > iCount)
	    {
		    iResult -= iCount;
	    } // while
	} // if
	else
	{
	    iResult = 0;
	} // else
	
	return(iResult);
} // SumOfDigitsActTime

var iLastPosGoodDeals = 0;
var iLastPosBestseller = 0;
var	objGoodDealTimeout = null;
var	objBestsellerTimeout = null;
var	iAktGoodDealImage = -1;
var	iAktBestsellerImage = -1;

// ===========================================================================
//	Funktionsname:			LoadGoodDeal_Event()
//	Funktionsbeschreibung:	Bilder wahllos anzeigen.
// ---------------------------------------------------------------------------
//	Parameter:				iTO		-	Timout
// ===========================================================================
function LoadGoodDeal_Event(iTO)
{
    var	iTries = 0;

    if (arrGoodDeals == null)
    {
        return;
    } // if

    var iMax = (arrGoodDeals.length - 1);
    var iPos = SumOfDigitsActTime(iMax);
	var	sImage = "";
	var sEvent = ("LoadGoodDeal_Event(" + iTO + ")");
	var sElements = "td_gooddeals_"

    while ((iLastPosGoodDeals == iPos) && (iTries < 10))
    {
        iPos = SumOfDigitsActTime(iMax);
	iTries = iTries + 1;
    } // while
    iLastPosGoodDeals = iPos;

	sImage = arrGoodDeals[iPos];
	
    if (sImage == null)
    {
        return;
    } // if

	iTimeout = iTO;

    objGoodDealTimeout = LoadRandomItemImageLink_Event(iMax, sImage, sEvent, sElements, iAktGoodDealImage, objGoodDealTimeout);
} // LoadGoodDeal_Event

// ===========================================================================
//	Funktionsname:			LoadBestseller_Event()
//	Funktionsbeschreibung:	Bilder wahllos anzeigen.
// ---------------------------------------------------------------------------
//	Parameter:				iTO		-	Timout
// ===========================================================================
function LoadBestseller_Event(iTO)
{
    var	iTries = 0;

    if (arrBestseller == null)
    {
        return;
    } // if

    var iMax = (arrBestseller.length - 1);
    var iPos = SumOfDigitsActTime(iMax);
	var	sImage = "";
	var sEvent = ("LoadBestseller_Event(" + iTO + ")");
	var sElements = "td_bestseller_"

    while ((iLastPosBestseller == iPos) && (iTries < 10))
    {
        iPos = SumOfDigitsActTime(iMax);
	iTries = iTries + 1;
    } // while
    iLastPosBestseller = iPos;

	sImage = arrBestseller[iPos];
	
    if (sImage == null)
    {
        return;
    } // if

	iTimeout = iTO;

    objBestsellerTimeout = LoadRandomItemImageLink_Event(iMax, sImage, sEvent, sElements, iAktBestsellerImage, objBestsellerTimeout);
} // LoadBestseller_Event

// ===========================================================================
//	Funktionsname:			LoadRandomItemImageLink_Event()
//	Funktionsbeschreibung:	Bilder incl. Link wahllos anzeigen.
// ---------------------------------------------------------------------------
//	Parameter:				iMax		-	Maximale Anzahl an Bilder
//                          sImage      -   Bildname
//                          sEvent      -   Funktion
//                          sElements   -   Elemente
//                          iAktImage   -   aktuelles Bild
//                          objTimeout  -   Timeout-Objekt
// ===========================================================================
function LoadRandomItemImageLink_Event(iMax, sImage, sEvent, sElements, iAktImage, objTimeout)
{
    var arrSplit = null;
	var	Element = null;
	var Elements = null;
	var ChildElements = null;

	if (objTimeout != null)
	{
		iAktImage++;

    	Element = d.getElementById(sElements + iAktImage);
		if (Element == null )
		{
			iAktImage = 0;
        	Element = d.getElementById(sElements + iAktImage);
		} // if
		if (Element != null )
		{
		    arrSplit = sImage.split("|");
	    	if ( navigator.appName == "Microsoft Internet Explorer" )
            {
		        Element.firstChild.href = arrSplit[0];
		        Element.firstChild.firstChild.src = arrSplit[1];
   		        Element.lastChild.nodeValue = "";
		        if (arrSplit[2] != null)
		        {
    		        Element.lastChild.firstChild.nodeValue = arrSplit[2];
    		        Element.lastChild.lastChild.nodeValue = arrSplit[3];
		        } // if
		        else
		        {
    		        Element.lastChild.firstChild.nodeValue = "";
    		        Element.lastChild.lastChild.nodeValue = "";
		        } // if
            } // if
            else
            {
                Elements = Element.childNodes;
		        Elements[1].href = arrSplit[0];
	            ChildElements = Elements[1].childNodes;
		        ChildElements[0].src = arrSplit[1]
	            ChildElements = Elements[3].childNodes;
		        if (arrSplit[2] != null)
		        {
    		        ChildElements[0].nodeValue = arrSplit[2];
    		        ChildElements[2].nodeValue = arrSplit[3];
		        } // if
		        else
		        {
    		        ChildElements[0].nodeValue = "";
    		        ChildElements[2].nodeValue = "";
		        } // if
            } // else
		} // if
		else
		{
			//alert("Keine Zufallsbilder auf der Seite: Nächstes Bild wäre " + sImage);
		} // else
	} // if

	switch (sElements.toLowerCase())
	{
	    case "td_gooddeals_" : iAktGoodDealImage = iAktImage;
	    case "td_bestseller_" : iAktBestsellerImage = iAktImage;
	} // switch
	
   	objTimeout = window.setTimeout(sEvent, iTimeout);
   	
	return objTimeout;
} // LoadRandomItemImageLink_Event

// ===========================================================================
//	Funktionsname:			DeactivateRandomItemImageTimeout()
//	Funktionsbeschreibung:	Den Timer beenden.
// ===========================================================================
function DeactivateRandomItemImageTimeout(objTimeout)
{
	if (objTimeout != null)
	{
		window.clearTimeout(objTimeout);
		objTimeout = null;
	} // if
} // DeactivateRandomItemImageTimeout

// ===========================================================================
// Bilder - Ende
// ===========================================================================

// ===========================================================================
// Zahlen - Start
// ===========================================================================

// ===========================================================================
//	Funktionsname:			IsNaturalNum()
//	Funktionsbeschreibung:	Handel es sich um eine natürliche Zahl (0, 1, 2, ...).
// ---------------------------------------------------------------------------
//	Parameter:				strID		-	ID des Objektes
//							strError	-	Fehlertext aus Navision
//
//	Erstelldatum:			25.02.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function IsNaturalNum( strID, strError )
{
	var	Element = null;
	var	strNum = "";
	var	iPos = 0;
	
	Element = d.getElementById( strID );
	
	if ( Element != null )
	{
		strNum = Element.value;
		
		if ( ( isNaN( strNum ) ) ||
			 ( parseInt( strNum ) != strNum ) ||
			 ( parseInt( strNum ) < 0 ) )
		{
			alert( strError.replace( "%1", strNum ) );
			Element.focus();
			return false;
		} // if
	} // if
	else
	{
		Element = d.getElementsByName( strID );
	
		if ( Element[ 0 ] != null )
		{
			while ( Element[ iPos ] != null )
			{
				strNum = Element[ iPos ].value;
				
				if ( ( isNaN( strNum ) ) ||
					 ( parseInt( strNum ) != strNum ) ||
					 ( parseInt( strNum ) < 0 ) )
				{
					Element[ iPos ].focus();
					alert( strError.replace( "%1", strNum ) );
					return false;
				} // if
				
				iPos++;
			} // while
		} // if
		else
		{
			alert( "Kein gültiges Element: " + strID );
			return false;
		} // else
	} // else
	
	return true;
} // IsNaturalNum

// ===========================================================================
// Zahlen - Ende
// ===========================================================================

// ===========================================================================
// Datum - Start
// ===========================================================================

// ===========================================================================
//	Funktionsname:			IsDateValid()
//	Funktionsbeschreibung:	Handel es sich um ein gültiges Datum der Form
//							TT.MM.JJJJ?
// ---------------------------------------------------------------------------
//	Parameter:				strID		-	ID des Objektes
//							strError	-	Fehlertext aus Navision
//
//	Erstelldatum:			07.06.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function IsDateValid( strID, strError )
{
	var	Element = null;
	var	strDate = "";
	
	Element = d.getElementById( strID );
	
	if ( Element != null )
	{
		strDate = Element.value;
	} // if
	else
	{
		Element = d.getElementsByName( strID );
	
		if ( Element[ 0 ] != null )
		{
			strDate = Element[ 0 ].value;
		} // if
		else
		{
			alert( "Kein gültiges Element: " + strID );
			return false;
		} // else
	} // else


	if ( ( strDate != "" ) &&
		 ( ( strDate.length != 10 ) ||
		   ( strDate.charAt( 2 ) != "." ) ||
		   ( strDate.charAt( 5 ) != "." ) ) )
	{
		alert( strError.replace( "%1", strDate ) );
		Element.focus();
		return false;
	} // if
	
	return true;
} // IsDateValid

// ===========================================================================
// Datum - Ende
// ===========================================================================

// ===========================================================================
// Bilder - Start
// ===========================================================================

// ===========================================================================
//	Funktionsname:			ReloadImage()
//	Funktionsbeschreibung:	Bild neu laden.
// ---------------------------------------------------------------------------
//	Parameter:				strID		-	ID des Objektes
//							strName		-	Bildname mit Pfad
//							strAlt		-	Alt-Tag
//							iNewPos		-	neue Position des Bildes
//							iMaxPos		-	Maximaler Index
//
//	Erstelldatum:			25.02.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function ReloadImage( strID, strName, strAlt, iNewPos, iMaxPos )
{
	var	Element = null;
	
	Element = d.getElementById( strID );
	
	if ( Element != null )
	{
		Element.src = strName;
		Element.alt = strAlt;
		
		if ( iNewPos > -1 )
		{
			SetNewNavigateValues( iNewPos, iMaxPos );
		} // if
	} // if
	
	Element = d.getElementById( "BigImage" );
	
	if ( Element != null )
	{
		Element.value = strName.replace( "M_", "L_" );
	} // if
} // ReloadImage

// ===========================================================================
//	Funktionsname:			ShowImage()
//	Funktionsbeschreibung:	Bild in neuen Fenster anzeigen.
// ---------------------------------------------------------------------------
//	Parameter:				strImage	-	Bildname
//
//	Erstelldatum:			28.02.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function ShowImage( strImage )
{
	var	strOpenString = "";
	var	iTop = 100;
	var	iLeft = 200;
	
	//iTop = Math.round( ( document.parentWindow.screen.height - 500 ) / 2 )
	//iLeft = Math.round( ( document.parentWindow.screen.width - 450 ) / 2 )
	
	strOpenString = "resizable=yes, scrollbars=yes, width=650, height=550, left=" + iLeft + ", top=" + iTop;
	window.open( "cp_productimage.asp?PageNo=CP_PRODUCTIMAGE&image=" + strImage , "", strOpenString );
} // ShowImage

// ===========================================================================
//	Funktionsname:			ShowAktDetailImage()
//	Funktionsbeschreibung:	Aktuell gwähltes Bild in neuen Fenster anzeigen.
// ---------------------------------------------------------------------------
//	Parameter:				
//
//	Erstelldatum:			28.02.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function ShowAktDetailImage(sItemno)
{
	var	iAktPos = 0;
	var	strImage = "";
	var	strOpenString = "";
	var	iTop = 50;
	var	iLeft = 50;
	var	Element = null;

	Element = d.getElementById( "BigImage" );
	if ( Element != null )
	{
		strImage = Element.value;
	} // if
	
	//iTop = Math.round( ( document.parentWindow.screen.height - 500 ) / 2 )
	//iLeft = Math.round( ( document.parentWindow.screen.width - 450 ) / 2 )
	
	strOpenString = "resizable=yes, scrollbars=yes, width=650, height=550, left=" + iLeft + ", top=" + iTop;
	window.open( "cp_productimage.asp?PageNo=CP_PRODUCTIMAGE&itemno=" + sItemno + "&image=" + strImage , "", strOpenString );
} // ShowAktDetailImage

// ===========================================================================
//	Funktionsname:			LoadPrevImage()
//	Funktionsbeschreibung:	Vorheriges Bild laden.
// ---------------------------------------------------------------------------
//	Parameter:				iMaxPos		-	höchster Index
//							strID		-	ID des zu setzeneden Bildes
//
//	Erstelldatum:			28.02.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function LoadPrevImage( strID, iMaxPos )
{
	SetNewImageValues( strID, -1, iMaxPos );
} // LoadPrevImage

// ===========================================================================
//	Funktionsname:			LoadNextImage()
//	Funktionsbeschreibung:	Nächstes Bild laden.
// ---------------------------------------------------------------------------
//	Parameter:				iMaxPos		-	höchster Index
//							strID		-	ID des zu setzeneden Bildes
//
//	Erstelldatum:			28.02.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function LoadNextImage( strID, iMaxPos )
{
	SetNewImageValues( strID, 1, iMaxPos );
} // LoadNextImage

// ===========================================================================
//	Funktionsname:			SetNewImageValues( iDirection )
//	Funktionsbeschreibung:	Die neuen Werte setzen.
// ---------------------------------------------------------------------------
//	Parameter:				iDirection	-	+1 oder -1
//							iMaxPos		-	höchster Index
//							strID		-	ID des zu setzeneden Bildes
//
//	Erstelldatum:			28.02.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function SetNewImageValues( strID, iDirection, iMaxPos )
{
	var	iNewPos	= 0;
	var	Element = null;
	
	if ( iDirection < 0 )
	{
		iDirection = -1;
	} // if
	else
	{
		iDirection = 1;
	} // else
	
	Element = d.getElementById( "akt_image" );
	if ( Element != null )
	{
		iNewPos = parseInt( Element.value ) + iDirection;
	} // if
	
	Element = d.getElementById( "img_" + iNewPos );
	
	if ( Element != null )
	{
		ReloadImage( strID, Element.value, "", iNewPos, iMaxPos );
	} // if
} // SetNewImageValues

// ===========================================================================
//	Funktionsname:			SetNewNavigateValues()
//	Funktionsbeschreibung:	Die neuen Werte setzen.
// ---------------------------------------------------------------------------
//	Parameter:				iNewPos		-	neue Position
//
//	Erstelldatum:			28.02.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function SetNewNavigateValues( iNewPos, iMaxPos )
{
	var	i = 0;
	var	Element = null;
	var	Element_Next = null;
	var	Element_Prev = null;
	
	Element = d.getElementById( "akt_image" );
	Element_Prev = d.getElementById( "prev_img" );
	Element_Next = d.getElementById( "next_img" );
	
	if ( ( Element == null ) || ( Element_Prev == null ) || ( Element_Next == null ) )
		return;
	
	if ( iNewPos <= 0 )
	{
		Element_Prev.style.visibility = "hidden";
		if ( Element_Next.style.visibility != "visible" )
			Element_Next.style.visibility = "visible";
		iNewPos = 0;
	} // if
	else
	{
		if ( iNewPos >= iMaxPos )
		{
			Element_Next.style.visibility = "hidden";
			if ( Element_Prev.style.visibility != "visible" )
				Element_Prev.style.visibility = "visible";
			iNewPos = iMaxPos;
		} // else
		else
		{
			if ( Element_Prev.style.visibility != "visible" )
				Element_Prev.style.visibility = "visible";
			if ( Element_Next.style.visibility != "visible" )
				Element_Next.style.visibility = "visible";
		} // else
	} // else

	Element.value = iNewPos;
	
	for( i = 0; i <= iMaxPos; i++ )
	{
		Element = d.getElementById( "imageref_" + i );
		if ( Element != null )
		{
			if ( i == iNewPos )
			{
				Element.style.color = "red";
			} // if
			else
			{
				Element.style.color = "#6699CC";
			} // else
		} // if
	} // for
} // SetNewNavigateValues

// ===========================================================================
// Bilder - Ende
// ===========================================================================

// ===========================================================================
// Allgemeines - Start
// ===========================================================================

// ===========================================================================
//	Funktionsname:			HideOrShowElements()
//	Funktionsbeschreibung:	Elemente verstecken oder anzeigen.
// ---------------------------------------------------------------------------
//	Parameter:				strElementname	-	Elementname
//							fHide			-	Verstecken
//
//	Erstelldatum:			01.03.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function HideOrShowElements( strElementname, fHide )
{
	var	i = 0;
	var	strStyle = "visible";
	var	Elements = null;
	
	if ( fHide == true )
	{
		strStyle = "hidden";
	} // if
	
	Elements = d.getElementsByName( strElementname );
	while ( Elements[ i ] != null )
	{
		Elements[ i ].style.visibility = strStyle;
		i++;
	} // while
} // HideOrShowElements

// ===========================================================================
//	Funktionsname:			HideElements()
//	Funktionsbeschreibung:	Elemente verstecken.
// ---------------------------------------------------------------------------
//	Parameter:				strElementname	-	Elementname
//
//	Erstelldatum:			01.03.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function HideElements( strElementname )
{
	HideOrShowElements( strElementname, true );
} // HideElements

// ===========================================================================
//	Funktionsname:			ShowElements()
//	Funktionsbeschreibung:	Elemente anzeigen.
// ---------------------------------------------------------------------------
//	Parameter:				strElementname	-	Elementname
//
//	Erstelldatum:			01.03.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function ShowElements( strElementname )
{
	HideOrShowElements( strElementname, false );
} // ShowElements

// ===========================================================================
//	Funktionsname:			SetLinkActiveAndHideElements()
//	Funktionsbeschreibung:	Link aktiv setzen und Elemente verstecken.
// ---------------------------------------------------------------------------
//	Parameter:				strElementname	-	Elementname
//
//	Erstelldatum:			01.03.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function SetLinkActiveAndHideElements( strElementname, Image )
{
	var	i = 0;

	HideLocations( '', 1 )
	HideElements( strElementname );
	if ( d.images != null )
	{
		while ( d.images[ i ] != null )
		{
			d.images[ i ].lowsrc = "";
			DeactivateImage( d.images[ i ] );
			i++;
		} // while
		
		ActivateImage( Image );
		Image.lowsrc = "active";
	} // if
} // SetLinkActiveAndHideElements

// ===========================================================================
//	Funktionsname:			SetLowSource()
//	Funktionsbeschreibung:	Den Wert für lowsrc initialisieren.
// ---------------------------------------------------------------------------
//	Parameter:
//
//	Erstelldatum:			01.03.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function SetLowSource()
{
	var	i = 0;
	var	Src = "";

	if ( d.images != null )
	{
		while ( d.images[ i ] != null )
		{
			Src = d.images[ i ].src;
			if ( Src.lastIndexOf( "on.gif" ) != -1 )
			{
				d.images[ i ].lowsrc = "active";
			} else
			{
				d.images[ i ].lowsrc = "";
			} // else
			
			i++;
		} // while
	} // if
} // SetLowSource

// ===========================================================================
//	Funktionsname:			SetNavigationPath()
//	Funktionsbeschreibung:	Den Wert für "Wo bin ich" setzen.
// ---------------------------------------------------------------------------
//	Parameter:				strText		-	"Wo bin ich" - Text
//							strPath		-	"Wo bin ich" - Pfad
//							strLevel	-	Welches Level
//							fHREF		-	Link oder nur Text
//							iFrame		-	Welches Frame
//
//	Erstelldatum:			07.03.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function SetNavigationPath( strText, strPath, strLevel, fHREF, iFrame )
{
	var	Element = null;
	var	Element_1_h = null;
	var	Element_2 = null;
	var	Element_2_h = null;
	var	Element_3 = null;
	var	NavPathFrame = null;
	var	strPathLocal = strPath;
	var	Element_Level = null;
	
	if ( strText == "" )
	{
		strText = "&#160;"
	} // if

	if ( parent != null )
	{
		NavPathFrame = parent.frames[ iFrame ];
		if ( NavPathFrame != null )
		{
			Element = parent.frames[ iFrame ].document.getElementById( "LocationString" );
			if (Element != null )
			{
				Element.style.visibility = "visible";
						
				Element_1_h = parent.frames[ iFrame ].document.getElementById( "LocationString_1_h" );
				Element_2 = parent.frames[ iFrame ].document.getElementById( "LocationString_2" );
				Element_2_h = parent.frames[ iFrame ].document.getElementById( "LocationString_2_h" );
				Element_3 = parent.frames[ iFrame ].document.getElementById( "LocationString_3" );
				Element_Level = parent.frames[ iFrame ].document.getElementById( "thirdlevel" );
			
				switch ( strLevel )
				{
					case "1" :
						if ( Element_Level != null )
						{
							Element_Level.style.visibility = "visible";
						} // if
						Element_1_h.style.visibility = "visible";
						Element_1_h.href = strPath;
						Element_1_h.firstChild.nodeValue = strText;
						Element_2.style.visibility = "hidden";
						Element_2.firstChild.nodeValue = "&#160;";
						Element_2_h.style.visibility = "hidden";
						Element_2_h.href = "";
						Element_2_h.firstChild.nodeValue = "";
						Element_3.style.visibility = "hidden";
						Element_3.firstChild.nodeValue = "&#160;";
						break;
					case "2" :
						if ( fHREF == "0" )
						{
							Element_2.style.visibility = "visible";
							Element_2.firstChild.nodeValue = "  >  " + strText;
							Element_2_h.style.visibility = "hidden";
							Element_2_h.href = "&#160;";
							Element_2_h.firstChild.nodeValue = "&#160;";
						} // if
						else
						{
							Element_2.style.visibility = "visible";
							Element_2.firstChild.nodeValue =  "  >  ";
							Element_2_h.style.visibility = "visible";
							Element_2_h.href = strPath;
							Element_2_h.firstChild.nodeValue = strText;
						} // else
						Element_3.style.visibility = "hidden";
						Element_3.firstChild.nodeValue = "&#160;";
						break;
					case "3" :
						Element_3.style.visibility = "visible";
						Element_3.firstChild.nodeValue = "  >  " + strText;
						break;
					default :
						Element.style.visibility = "hidden";
						Element_1_h.style.visibility = "hidden";
						Element_1_h.href = "";
						Element_1_h.firstChild.nodeValue = "&#160;";
						Element_2.style.visibility = "hidden";
						Element_2.firstChild.nodeValue = "&#160;";
						Element_2_h.style.visibility = "hidden";
						Element_2_h.href = "";
						Element_2_h.firstChild.nodeValue = "&#160;";
						Element_3.style.visibility = "hidden";
						Element_3.firstChild.nodeValue = "&#160;";
				} // switch	
			} // if
		} // if
		else
		{
			//alert( "frame null" );
		} // else
	} // if
	else
	{
		//alert( "parent null" );
	} // else
} // SetNavigationPath

// ===========================================================================
//	Funktionsname:			HideLocations()
//	Funktionsbeschreibung:	Die Locationpfade verstecken.
// ---------------------------------------------------------------------------
//	Parameter:				strLevel	-	Ab welchem Level
//							iFrame		-	Weches Frame
//
//	Erstelldatum:			07.03.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function HideLocations( strLevel, iFrame )
{
	var	Element = null;
	var	Element_1_h = null;
	var	Element_2 = null;
	var	Element_2_h = null;
	var	Element_3 = null;
	var	NavPathFrame = null;
	var	Element_Level = null;

	if ( parent != null )
	{
		NavPathFrame = parent.frames[ iFrame ];
		if ( NavPathFrame != null )
		{
			Element = parent.frames[ iFrame ].document.getElementById( "LocationString" );
			Element_1_h = parent.frames[ iFrame ].document.getElementById( "LocationString_1_h" );
			Element_2 = parent.frames[ iFrame ].document.getElementById( "LocationString_2" );
			Element_2_h = parent.frames[ iFrame ].document.getElementById( "LocationString_2_h" );
			Element_3 = parent.frames[ iFrame ].document.getElementById( "LocationString_3" );
			Element_Level = parent.frames[ iFrame ].document.getElementById( "thirdlevel" );
			
			switch ( strLevel )
			{
				case "1" :
					if ( Element_Level != null )
					{
						Element_Level.style.visibility = "hidden";
					} // if
					Element.style.visibility = "hidden";
					Element_1_h.style.visibility = "hidden";
					Element_1_h.firstChild.nodeValue = "&#160;";
					Element_2.style.visibility = "hidden";
					Element_2.firstChild.nodeValue = "&#160";
					Element_2_h.style.visibility = "hidden";
					Element_2_h.href = "";
					Element_2_h.firstChild.nodeValue = "&#160;";
					Element_3.style.visibility = "hidden";
					Element_3.firstChild.nodeValue = "&#160";
					break;
				case "2" :
					Element_2.style.visibility = "visible";
					Element_2.firstChild.nodeValue = "  >  " + Element_2_h.firstChild.nodeValue;
					Element_2_h.style.visibility = "hidden";
					Element_2_h.firstChild.nodeValue = "&#160;";
					Element_3.style.visibility = "hidden";
					Element_3.firstChild.nodeValue = "&#160";
					break;
				default :
					if ( Element_Level != null )
					{
						Element_Level.style.visibility = "hidden";
					} // if
					Element.style.visibility = "hidden";
					Element_1_h.style.visibility = "hidden";
					Element_1_h.href = "";
					Element_1_h.firstChild.nodeValue = "&#160;";
					Element_2.style.visibility = "hidden";
					Element_2.firstChild.nodeValue = "&#160";
					Element_2_h.style.visibility = "hidden";
					Element_2_h.href = "";
					Element_2_h.firstChild.nodeValue = "&#160;";
					Element_3.style.visibility = "hidden";
					Element_3.firstChild.nodeValue = "&#160";
			} // switch	
		} // if
		else
		{
			//alert( "frame null" );
		} // else
	} // if
	else
	{
		//alert( "parent null" );
	} // else
} // HideLocations

// ===========================================================================
//	Funktionsname:			UpdateBasketItems
//	Funktionsbeschreibung:	Anzahl Elemente im Warenkorb setzen.
// ---------------------------------------------------------------------------
//	Parameter:				iItems		-	Positionen
//
//	Erstelldatum:			20.09.2006
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function UpdateBasketItems( iItems )
{
	var	Element = null;
	var	NavPathFrame = null;
	
	if ( parent != null )
	{
		NavPathFrame = parent.frames[ 0 ];
		if ( NavPathFrame != null )
		{
			Element = NavPathFrame.document.getElementById( "basketitems" );
			Element.firstChild.nodeValue = iItems;
		} // if
	} // if
	else
	{
		//alert( "parent null" );
	} // else
} // UpdateBasketItems

// ===========================================================================
//	Funktionsname:			IsValidSQLPart
//	Funktionsbeschreibung:	Handelt es sich um einen gültigen SQL-Teil.
//							Also keine Dinge wie "--", ";", "'", "delete", etc.
//							Stichwort "SQL-Injection"
// ---------------------------------------------------------------------------
//	Parameter:				strStringToProof	-	Zu prüfende zeichenkette
//							strError			-	Fehlermeldung
//
//	Erstelldatum:			06.04.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function IsValidSQLPart( strStringToProof, strError )
{
    // | -> oder
    // \ -> kennzeichnet nachfolgendes Zeichen als literal
    // \b -> Wortgrenze
    // (...) -> vorgegebener String
    // [...] -> Gruppe von Zeichen
    // [^...] -> Gruppe ausgeschlossener Zeichen
    // * -> vorhergehendes Zeichen kein oder mehrere Male
    // Treffer bei:
    // (exec|cmd|href|<script|alert|javascript) findet: exec oder cmd oder ...
    // [;'] findet: ; oder '
    // (\-\-) findet: --
    // \\ findet: \
    // (<%) findet: <%
    // (((<)|(&lt;))[^>]*((&gt;)|(>))) findet: jeden html-tag, der mit < oder &lt; beginnt und mit > oder &gt; geschlossen wird
    // (\b(insert|alter|delete|modify|into|table|drop|select|where|or|update|grant)\b) findet: insert mit Wortgrenze oder alter mit Wortgrenze oder ...
    
    // Somit also
    
	//	|		: bedeutet "oder"
	//	(\-\-)	: keine zwei aufeinanderfolgende Bindestriche (da Bindestrich besondere Bedeutung
	//			  hat muss das \ davorgesetzt werden. Das bedeutet dann, dass genau nach dem Zeichen
	//			  gesucht werden soll).
	//	[;'"]	: Kein Semikolon, kein Hochkomma, kein doppeltes Hochkomma
	//	\b...\b	: einzelnes Wort. "alter" wird gefunden, "alternativ" nicht
	//	\gi		: g bedeutet, dass das Ergebnis zischengespeichert wird
	//			: i bedeutet, dass es NCHT Case-sensitive ist.
	
	//var	locRegExp = /[;'"]|(\-\-)|\bselect\b|\bdelete\b|\binsert\b|\bmodify\b|\balter\b|\bdrop\b|\bexec\b/gi;
	
    // Suchmuster/Pattern ohne Berücksichtigung des "einfachen Hochkommas" und der <>-Tags
    var locRegExp = /(exec|cmd|href|<script|alert|javascript)|[;]|(\-\-)|\\|(<%)|(\b(insert|alter|modify|into|table|drop|select|where|update|grant)\b)/gi;
	
	var	retRegExp = null;
	var	strErrormessage = strError;

	if ( strErrormessage == "" )
	{
		strErrormessage = "Sie haben ungültige Zeichen im eingegebenen Text verwendet.\nBitte korrigieren Sie Ihre Eingaben.\nUngültige Zeichen:";
	} // if
			
	retRegExp = strStringToProof.match( locRegExp );
	if ( retRegExp != null )
	{
		alert( strErrormessage + " " + retRegExp + "!" );
		return false;
	} // if

	return true;
} // IsValidSQLPart

// ===========================================================================
//	Funktionsname:			IsStringLenOK()
//	Funktionsbeschreibung:	Ist die Stringlänge ok.
// ---------------------------------------------------------------------------
//	Parameter:				strElementname	-	Elementname
//							iMinLen			-	Mindestanzahl an Zeichen
//							strMsg			-	Text bei falscher Anzahl
//
//	Erstelldatum:			04.04.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function IsStringLenOK( strElementname, iMinLen, strMsg )
{
	var	strMessage = strMsg;
	var	Element = null;
	var	strString = "";
	
	Element = d.getElementById( strElementname );
	if ( Element != null )
	{
		strString = Element.value;
	} // if
	
	if ( strString.length >= parseInt( iMinLen ) )
	{
		return true;
	} // if
	else
	{
		if ( strMessage == "" )
		{
			strMessage = "Es müssen mindestens %1 Zeichen angegeben werden!"
		} // if
		alert( strMessage.replace( "%1", iMinLen ) );
		return false;
	} // else
} // IsStringLenOK

var	iWaitingTimeout = 0;
var	Waiting_Timeout = null;

// ===========================================================================
//	Funktionsname:			Waiting_Event()
//	Funktionsbeschreibung:	Text anzeigen und ändern.
// ---------------------------------------------------------------------------
//	Parameter:				iIntervall	-	Intervall in Millisekunden
//
//	Erstelldatum:			03.03.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function Waiting_Event()
{
	var	Element = null;

	Element = d.getElementById( "waiting" );
	if ( Element != null )
	{
		if ( Waiting_Timeout != null )
		{
			Element.firstChild.nodeValue = Element.firstChild.nodeValue + " .";
		} // if
	} // if
	
	Waiting_Timeout = window.setTimeout( "Waiting_Event()", iWaitingTimeout );
} // Waiting_Event

// ===========================================================================
//	Funktionsname:			ActivateWaitingTimeout()
//	Funktionsbeschreibung:	Den Timer starten.
// ---------------------------------------------------------------------------
//	Parameter:				
//
//	Erstelldatum:			03.03.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function ActivateWaitingTimeout( iIntervall )
{
	iWaitingTimeout = iIntervall;
	Waiting_Event();
} // ActivateWaitingTimeout

// ===========================================================================
//	Funktionsname:			DeactivateWaitingTimeout()
//	Funktionsbeschreibung:	Den Timer beenden.
// ---------------------------------------------------------------------------
//	Parameter:				
//
//	Erstelldatum:			03.03.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function DeactivateWaitingTimeout()
{
	if ( Image_Timeout != null )
	{
		window.clearTimeout( Image_Timeout );
		Image_Timeout = null;
	} // if
} // DeactivateWaitingTimeout

// ===========================================================================
// Allgemeines - Ende
// ===========================================================================

// ===========================================================================
// Produktsuche - Start
// ===========================================================================

// ===========================================================================
//	Funktionsname:			ItemSearch()
//	Funktionsbeschreibung:	Produkte suchen.
// ---------------------------------------------------------------------------
//	Parameter:				strElementname	-	Elementname
//							strMessage		-	Fehlermeldung bei falscher Eingabe
//							cMarken			-	Nur Marken
//
//	Erstelldatum:			29.03.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function ItemSearch( strElementname, strMessage, cMarken )
{
	var	Element = null;
	var	strSearchstring = "";
	var	strURL = "";
	
	Element = d.getElementById( strElementname );
	if ( Element != null )
	{
		strSearchstring = Element.value;
	} // if
	
	if ( IsValidSQLPart( strSearchstring, strMessage ) == false )
	{
		return;
	} // if

	strURL = "cp_productlist.asp?PageNo=CP_PRODUCTLIST&infotext=I&sel1=0&sel2=0&selection=" + strSearchstring + "&full=0";

	if ( cMarken == "1" )
	{
		UpdateOneFrame( 2, strURL );
		UpdateOneFrame( 0, "cp_navigation_top_mark.asp?PageNo=CP_NAV_TOP_MARK&search=" + strSearchstring );
	} // if
	else
	{
		UpdateOneFrame( 3, strURL );
		UpdateOneFrame( 1, "cp_navigation_top.asp?PageNo=CP_NAVIGATION_TOP&search=" + strSearchstring );
	} // else
	
} // ItemSearch

// ===========================================================================
//	Funktionsname:			ItemFullSearch()
//	Funktionsbeschreibung:	Produkte suchen.
// ---------------------------------------------------------------------------
//	Parameter:				strElementname	-	Elementname
//							strMessage		-	Fehlermeldung bei falscher Eingabe
//							cMarken			-	Nur Marken
//
//	Erstelldatum:			29.03.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function ItemFullSearch( strElementname, strMessage, cMarken )
{
	var	Element = null;
	var	strSearchstring = "";
	var	strURL = "";
	
	Element = d.getElementById( strElementname );
	if ( Element != null )
	{
		strSearchstring = Element.value;
	} // if
	
	if ( IsValidSQLPart( strSearchstring, strMessage ) == false )
	{
		return;
	} // if

	strURL = "cp_productlist.asp?PageNo=CP_PRODUCTLIST&infotext=I&sel1=0&sel2=0&selection=" + strSearchstring + "&full=1";

	if ( cMarken == "1" )
	{
		UpdateOneFrame( 2, strURL );
		UpdateOneFrame( 0, "cp_navigation_top_mark.asp?PageNo=CP_NAV_TOP_MARK&search=" + strSearchstring );
	}
	else
	{
		UpdateOneFrame( 3, strURL );
		UpdateOneFrame( 1, "cp_navigation_top.asp?PageNo=CP_NAVIGATION_TOP&search=" + strSearchstring );
	} // else
} // ItemFullSearch

// ===========================================================================
//	Funktionsname:			ItemFullSearch_SZ()
//	Funktionsbeschreibung:	Produkte suchen.
// ---------------------------------------------------------------------------
//	Parameter:				strElementname	-	Elementname
//							strMessage		-	Fehlermeldung bei falscher Eingabe
//
//	Erstelldatum:			20.09.2006
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function ItemFullSearch_SZ( strElementname, strMessage )
{
	var	Element = null;
	var	strSearchstring = "";
	var	strURL = "";
	
	Element = d.getElementById( strElementname );
	if ( Element != null )
	{
		strSearchstring = Element.value;
	} // if
	
	if ( IsValidSQLPart( strSearchstring, strMessage ) == false )
	{
		return;
	} // if

	strURL = "cp_productlist.asp?PageNo=CP_PRODUCTLIST&infotext=I&sel1=0&sel2=0&selection=" + strSearchstring + "&full=1";

	UpdateOneFrame( 2, strURL );
	UpdateOneFrame( 0, "cp_top_sz.asp?PageNo=CP_TOP_SZ&search=" + strSearchstring );
} // ItemFullSearch_SZ

// ===========================================================================
//	Funktionsname:			SetABCNavigation()
//	Funktionsbeschreibung:	Farben der ABC-Navigationstexte ändern.
// ---------------------------------------------------------------------------
//	Parameter:				iSelected		-	Nummer des ausgewählten Buchstaben
//
//	Erstelldatum:			20.04.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function SetABCNavigation( iSelected )
{
	var	i = 0;
	var	Elements = null;
	
	Elements = d.getElementsByName( "abc_nav" );
	while ( Elements[ i ] != null )
	{
		if ( i == parseInt( iSelected ) )
		{
			Elements[ i ].style.color = "#111111";
		}
		else
		{
			Elements[ i ].style.color = "#EEEEEE";
		} // else
		
		i++;
	} // while
} // HideOrShowElements

// ===========================================================================
// Produktsuche - Ende
// ===========================================================================

// ===========================================================================
// Verfügbarkeitsprüfung - Start
// ===========================================================================

// ===========================================================================
//	Funktionsname:			CheckPosAvailability()
//	Funktionsbeschreibung:	Verfügbarkeit der Position prüfen.
// ---------------------------------------------------------------------------
//	Parameter:				iPos		-	Nummer der Position
//
//	Erstelldatum:			25.04.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function CheckPosAvailability( iPos )
{
	var	strExt = "";
	var	Element = null;
	var	strURL = "cp_verfuegbarkeit.asp?PageNo=CP_VERFUEGBARKEIT&itemcount=1";

	if ( iPos != "" )
	{
		strExt = "_" + iPos;
	} // if

	Element = d.getElementById( "itemno" + strExt );
	if ( Element != null )
	{
		if ( parseInt( d.getElementById( "menge" + strExt ).value ) > 0 )
		{
			strURL = strURL + "&i_1=" + d.getElementById( "itemno" + strExt ).value;
			strURL = strURL + "&v_1=" + d.getElementById( "variant" + strExt ).value;
			strURL = strURL + "&q_1=" + d.getElementById( "menge" + strExt ).value;
		
			document.location.href = strURL;
		} // if
	} // if
} // CheckPosAvailability

// ===========================================================================
//	Funktionsname:			CheckAllPosAvailability()
//	Funktionsbeschreibung:	Verfügbarkeit aller Positionen prüfen.
// ---------------------------------------------------------------------------
//	Parameter:
//
//	Erstelldatum:			26.04.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function CheckAllPosAvailability()
{
	var	iPos = 1;
	var	iCount = 0;
	var	Element = null;
	var	strURL = "cp_verfuegbarkeit.asp?PageNo=CP_VERFUEGBARKEIT";

	Element = d.getElementById( "itemno_1" );
	while ( Element != null )
	{
		if ( parseInt( d.getElementById( "menge_" + iPos ).value ) > 0 )
		{
			iCount++;
			
			strURL = strURL + "&i_" + iCount + "=" + d.getElementById( "itemno_" + iPos ).value;
			strURL = strURL + "&v_" + iCount + "=" + d.getElementById( "variant_" + iPos ).value;
			strURL = strURL + "&q_" + iCount + "=" + d.getElementById( "menge_" + iPos ).value;
		} // if
		
		iPos++;
		Element = d.getElementById( "itemno_" + iPos );
	} // while
	
	if ( iCount > 0 )
	{		
		strURL = strURL + "&itemcount=" + iCount;
		document.location.href = strURL;
	} // if
} // CheckAllPosAvailability

// ===========================================================================
// Verfügbarkeitsprüfung - Ende
// ===========================================================================

// ===========================================================================
// Artikelerfassung - Start
// ===========================================================================

// ===========================================================================
//	Funktionsname:			InsertItem()
//	Funktionsbeschreibung:	Artikel einfügen.
// ---------------------------------------------------------------------------
//	Parameter:				iPos		-	Nummer der Position
//
//	Erstelldatum:			27.04.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function InsertItem( iPos )
{
	var	Element = null;
	var	strURL = "cp_xt_additem.asp?";

	Element = d.getElementById( "itemno_" + iPos );
	if ( Element != null )
	{
		if ( parseInt( d.getElementById( "menge_" + iPos ).value ) > 0 )
		{
			strURL = strURL + "itemno=" + d.getElementById( "itemno_" + iPos ).value;
			strURL = strURL + "&menge=" + d.getElementById( "menge_" + iPos ).value;
			strURL = strURL + "&variant=" + d.getElementById( "variant_" + iPos ).value;
			strURL = strURL + "&variant1=" + d.getElementById( "variant1_" + iPos ).value;
			strURL = strURL + "&variant2=" + d.getElementById( "variant2_" + iPos ).value;
			strURL = strURL + "&returl=DETAIL";
		
			document.location.href = strURL;
		} // if
	} // if
} // InsertItem

// ===========================================================================
//	Funktionsname:			ShowSiteToPrint()
//	Funktionsbeschreibung:	Zu druckende Seite in neuen Fenster anzeigen.
// ---------------------------------------------------------------------------
//	Parameter:				strHRef	-	Link
//
//	Erstelldatum:			03.06.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function ShowSiteToPrint( strHRef )
{
	var	strOpenString = "";
	var	iTop = 50;
	var	iLeft = 50;
	
	//strOpenString = "toolbar=yes, resizable=yes, scrollbars=yes, width=850, height=650, left=" + iLeft + ", top=" + iTop;
	strOpenString = "menubar=yes, resizable=yes, scrollbars=yes, width=850, height=650, left=" + iLeft + ", top=" + iTop;
	window.open( strHRef , "", strOpenString );
} // ShowSiteToPrint

// ===========================================================================
// Artikelerfassung - Ende
// ===========================================================================

// ===========================================================================
// Tools - Start
// ===========================================================================

// ===========================================================================
//	Funktionsname:			ShowSiteInNewWindow()
//	Funktionsbeschreibung:	Eine Seite in neuem Fenster anzeigen.
// ---------------------------------------------------------------------------
//	Parameter:				strHRef		-	Link
//							vTop		-	Oben
//							vLeft		-	Links
//							vWidth		-	Breite
//							vHeight		-	Höhe
//							strName		-	Fenstername
//
//	Erstelldatum:			30.09.2005
//
//	Autor:					Mario Tarasi
//
//	Letzte Änderung:
// ===========================================================================
function ShowSiteInNewWindow( strHRef, vTop, vLeft, vWidth, vHeight, strName )
{
	var	strOpenString = "";
	var	iTop = 0;
	var	iLeft = 0;
	var	iWidth = 0;
	var	iHeight = 0;
	var	strTop = "";
	var	strLeft = "";
	var	strWidth = "";
	var	strHeight = "";

	while ( strHRef.indexOf( "|" ) != -1 )
	{
		strHRef = strHRef.replace( "|", "'" );
	} // while

	iTop = parseInt( vTop );
	iLeft = parseInt( vLeft );
	iWidth = parseInt( vWidth );
	iHeight = parseInt( vHeight );
	
	if ( isNaN( iTop ) == false )
	{
		strTop = ", top=" + iTop;
	} // if
	if ( isNaN( iLeft ) == false )
	{
		strLeft = ", left=" + iLeft;
	} // if
	if ( isNaN( iWidth ) == false )
	{
		strWidth = ", width=" + iWidth;
	} // if
	if ( isNaN( iHeight ) == false )
	{
		strHeight = ", height=" + iHeight;
	} // if
	
	strOpenString = "menubar=yes, resizable=yes, scrollbars=yes" + strTop + strLeft + strWidth + strHeight;
	
	window.open( strHRef , strName, strOpenString );
} // ShowSiteInNewWindow

// ===========================================================================
// Tools - Ende
// ===========================================================================

