/* (C) VIOSYS AG                                                          */
/* Umwandeln eines Preis-Strings in einen Centbetrag.                     */
/* Tausenderpunkte und Dezimaltrennzeichen (Komma) werden entfernt.       */

function floatkonvert( wert, vmmwst )
{
	s = new String( wert );
	// wenn vmmwst gesetzt, dann den Punkt durch Komma ersetzen
	if ( vmmwst == true ) {
		while ( s.indexOf( '.' ) >= 0 ) {
			s = s.substring( 0, s.indexOf( '.' ) ) + "," + s.substring( s.indexOf( '.' )+1, s.length );
		}
	} else {
		// zuerst alle Tausenderpunkte löschen
		i = s.indexOf( '.' );
		while ( i >= 0 )
		{
			s = s.substring( 0, i ) + s.substring( i+1, s.length );
			i = s.indexOf( '.' );
		}
	}
	// Komma entfernen
	i = s.indexOf( ',' );
	if ( i >= 0 )
	{
		var n = s.length - i - 1;
		if ( n >= 2 )
		{
			s = s.substring( 0, i ) + s.substring( i+1, i+3 );
		}
		else
		{
			s = s.substring( 0, i ) + s.substring( i+1, s.length );
			for ( j = 0; j < 2 - n; j++ ) s = s + "0";
		}
	}
	else
	{
		s = s + "00";
	}
	// alle führenden Nullen entfernen
	while ( s.length > 1 && s.charAt( 0 ) == "0" )
	{
		s = s.substring( 1, s.length );
	}

	// Sind nur Ziffern enthalten?
	if ( isFinite(s) )
	{
		return s;	// s ist innerhalb des verarbeitaren Zahlenbereichs
	}
	else			
	{
		return "0";	// sonst: Zahl ist zu groß oder Wert enthält Buchstaben
	}
}

// Ausgabe eines Preises (Floatwertes) in Cent mit 2 Nachkommastellen und Tausenderpunkten.
function floatoutput( wert )
{
	var s = new String( wert );
	
	
	// negativer Wert ?
	var minusz = 0;	
	if ( s.substring( 0, 1 ) == "-" ) 
	{
		minusz = 1;
		s = s.substring( 1, s.length );
	}

	
	// ist ein Punkt enthalten (Floatwert mit Nachkommastellen)
	var i = s.indexOf( '.' );	
	if ( i >= 0 )
	{
		// Rundung: erste Nachkommastelle merken
		var r = parseInt( s.substring( i+1, i+2 ), 10 );
		// alle Nachkommastellen entfernen
		s = s.substring( 0, i );
		// Rundung erforderlich ?  (0..4 -> abrunden, 5..9 -> aufrunden)
		if ( r >= 5 ) s = String( parseInt( s, 10 ) + 1 );
	}


	// falls der Betrag < 100 Cent ist, werden führende Nullen eingefügt
	if ( s.length == 0 ) s = "000"; 
	if ( s.length == 1 ) s = "00" + s; 
	if ( s.length == 2 ) s = "0" + s; 

	// Dezimaltrennung = Komma
	s = s.substring( 0, s.length - 2 ) + "," + s.substring( s.length - 2, s.length );


	// Tausenderpunkte einfügen
	// --> Position des Kommas suchen
	var j = s.indexOf( ',' );
	while ( j >= 4 )
	{
		j = j - 3;
		s = s.substring( 0, j ) + "." + s.substring( j, s.length );
	}
	
	if ( minusz == 1 )
	{
		s = "-" + s;
	}


	return s;
}

// Mehrwertsteuerbetrag aus Nettowert berechnen
function calcMwSt( netto, mwst, vmmwst, output )
{
	var w = parseInt( floatkonvert( netto, false ), 10 );
	var m = parseInt( floatkonvert( mwst, vmmwst  ), 10 );
	w = w * m / 10000;		
	if ( output == "kdvalue" )
     {
          return floatoutput( w );
     }
     else
     {
          return document.write( floatoutput( w ) );
     }
}

// Mehrwertsteuerbetrag aus Bruttowert berechnen
function calcBruttoMwSt( brutto, mwst, vmmwst, output )
{
	var w = parseInt( floatkonvert( brutto, false ), 10 );
	var m = parseInt( floatkonvert( mwst, vmmwst  ), 10 );
	w = w - w / (1+m/10000);		
	if ( output == "kdvalue" )
     {
          return floatoutput( w );
     }
     else
     {
          return document.write( floatoutput( w ) );
     }
}

// Bruttobetrag berechnen
function calcBrutto( netto, mwst, vmmwst, output )
{
	var m = parseInt( floatkonvert( mwst, vmmwst  ), 10 ) + 10000;
	var n = parseInt( floatkonvert( netto, false ), 10 );
	var b = n * m / 10000;
	if ( output == "kdvalue" )
     {
          return floatoutput( b );
     }
     else
     {
          return document.write( floatoutput( b ) );
     }
}

function getValueInt( formobject )
{
	if ( formobject && formobject.value.length > 0 )
	{
		var wert = parseInt( formobject.value, 10 );
		if ( isNaN( wert ) == false ) return wert;
	}
	return 0;
}


function checkValueInt( formobject )
{
	if ( formobject )
	{
		formobject.value = getValueInt( formobject );
	}
}

function setValueCurrency( formobject, wert )
{
	if ( formobject )
	{
		formobject.value = floatoutput( wert );
	}
}

function checkValueCurrency( formobject )
{
	if ( formobject )
	{
		formobject.value = floatoutput( floatkonvert( formobject.value, false ) );
	}
}


function getValueCurrency( formobject )
{
	if ( formobject )
	{
		return floatkonvert( formobject.value, false );
	}
	return 0;
}


function checkValueIntFract1( formobject )
{
	if ( formobject )
	{
		var wert = parseInt( floatkonvert( formobject.value, false ), 10 );
		wert = parseInt( (wert+5)/10, 10 );

		s = new String( wert );

		// falls der Wert < 10 Cent ist, werden führende Nullen eingefügt
		while ( s.length < 2 ) s = "0" + s;

		// Dezimaltrennung = Komma
		s = s.substring( 0, s.length - 1 ) + "," + s.substring( s.length - 1, s.length );

		formobject.value = s;	
	}
}


function getValueDate( formobject, onlytag )
{
	if ( formobject && formobject.value && formobject.value.length > 0 )
	{
    	var text = formobject.value;

        if ( text.length == 8 && text.indexOf( "." ) < 0 )
        {
            text = text.substr( 0, 2 ) + "." + text.substr( 2, 2 ) + "." + text.substr( 4, 4 );
        }

		var p1 = text.indexOf( "." );
		if ( p1 > 0 )
		{
			var text_tag = text.substr( 0, p1 );
			var text_rest = text.substr( p1+1 );

			var p2 = text_rest.indexOf( "." );
			if ( p2 > 0 )	// Es wurden Tag, Monat und Jahr
			{		
				var text_monat = text_rest.substr( 0, p2 );
				var text_jahr  = text_rest.substr( p2+1 );
			}
			else
			{
                // Es wurden nur Monat und Jahr eingegeben
				var text_monat = text_tag;
				var text_jahr  = text_rest;
			}

			// Wandlung der Werte in Zahlen
			var tag   = parseInt( text_tag, 10 );	// Basis 10 muss angegeben werden, damit bei führender 0 keine Oktalzahlen vermutet werden (-> Problem bei "08" und "09")
			var monat = parseInt( text_monat, 10 );	// Basis 10 muss angegeben werden, damit bei führender 0 keine Oktalzahlen vermutet werden (-> Problem bei "08" und "09")
			var jahr  = parseInt( text_jahr, 10 );	// Basis 10 muss angegeben werden, damit bei führender 0 keine Oktalzahlen vermutet werden (-> Problem bei "08" und "09")

			// Prüfung der Gültigkeit
			if ( isNaN(tag) == false && tag >= 1 && tag <= 31 && isNaN(monat) == false && monat >= 1 && monat <= 12 && isNaN(jahr) == false && jahr > 0 )
			{
				// wurde das Jahr 4-stellig eingegeben?
				if ( jahr < 100 )
				{
					if ( jahr < 10 ) jahr += 2000; else jahr += 1900;
				}

                if ( onlytag > 0 )
                {
                    tag = onlytag;
                }

				// manche Monate haben 30, andere 31 Tage
				if ( tag < 31 || monat == 1 || monat == 3 || monat == 5 || monat == 7 || monat == 8 || monat == 10 || monat == 12 )
				{
					// Prüfung auf Schaltjahr
					if ( monat != 2 || tag <= 28 || (tag == 29 && jahr%4 == 0 && (jahr%400 == 0 || jahr%100 != 0)))
					{
						var tag2 = String(tag);
						var monat2 = String(monat);
						
						if ( tag2.length < 2 ) tag2 = "0" + tag2;
						if ( monat2.length < 2 ) monat2 = "0" + monat2;
					
						return tag2 + "." + monat2 + "." + jahr;
					}
				}
			}
		}

        return "TT.MM.JJJJ";
	}

    // wenn nichts übergeben wurde, wird auch nichts zurückgegeben
	return "";
}

function getValueTime( formobject )
{
	if ( formobject && formobject.value && formobject.value.length > 0 )
	{
		var text = formobject.value;
		
		var p1 = text.indexOf( ":" );
		if ( p1 > 0 )
		{
			var text_stunde = text.substr( 0, p1 );
			var text_minute = text.substr( p1+1 );

			// Wandlung der Werte in Zahlen
			var stunde = parseInt( text_stunde, 10 );	// Basis 10 muss angegeben werden, damit bei führender 0 keine Oktalzahlen vermutet werden (-> Problem bei "08" und "09")
			var minute = parseInt( text_minute, 10 );	// Basis 10 muss angegeben werden, damit bei führender 0 keine Oktalzahlen vermutet werden (-> Problem bei "08" und "09")
		}
		else
		{
			// Wandlung der Werte in Zahlen
			var stunde = parseInt( text, 10 );	// Basis 10 muss angegeben werden, damit bei führender 0 keine Oktalzahlen vermutet werden (-> Problem bei "08" und "09")
			var minute = 0;	// Basis 10 muss angegeben werden, damit bei führender 0 keine Oktalzahlen vermutet werden (-> Problem bei "08" und "09")
		}

		// Prüfung der Gültigkeit
		if ( isNaN(stunde) == false && stunde >= 0 && stunde <= 23 && isNaN(minute) == false && minute >= 0 && minute <= 59 )
		{
			var minute_text = "";
			if ( minute < 10 )
			{
				minute_text = "0" + minute;
			}
			else
			{
				minute_text = minute;
			}
			return stunde + ":" + minute_text;
		}
	}
	return "H:MM";
}

function getValueTimeInt( text )
{
	if ( text.length > 0 )
	{
		
		var p1 = text.indexOf( ":" );
		if ( p1 > 0 )
		{
			var text_stunde = text.substr( 0, p1 );
			var text_minute = text.substr( p1+1 );

			// Wandlung der Werte in Zahlen
			var stunde = parseInt( text_stunde, 10 );	// Basis 10 muss angegeben werden, damit bei führender 0 keine Oktalzahlen vermutet werden (-> Problem bei "08" und "09")
			var minute = parseInt( text_minute, 10 );	// Basis 10 muss angegeben werden, damit bei führender 0 keine Oktalzahlen vermutet werden (-> Problem bei "08" und "09")
		}
		else
		{
			// Wandlung der Werte in Zahlen
			var stunde = parseInt( text, 10 );	// Basis 10 muss angegeben werden, damit bei führender 0 keine Oktalzahlen vermutet werden (-> Problem bei "08" und "09")
			var minute = 0;	// Basis 10 muss angegeben werden, damit bei führender 0 keine Oktalzahlen vermutet werden (-> Problem bei "08" und "09")
		}

		// Prüfung der Gültigkeit
		if ( isNaN(stunde) == false && stunde >= 0 && isNaN(minute) == false && minute >= 0 && minute <= 59 )
		{
			return stunde * 60  + minute;
		}
	}
	return 0;
}

function getValueDateSQL( text )
{
	if ( text.length > 0 )
	{
		var p1 = text.indexOf( "." );
		if ( p1 > 0 )
		{
			var text_tag = text.substr( 0, p1 );
			var text_rest = text.substr( p1+1 );

			var p2 = text_rest.indexOf( "." );
			if ( p2 > 0 )	// Es wurden Tag, Monat und Jahr
			{		
				var text_monat = text_rest.substr( 0, p2 );
				var text_jahr = text_rest.substr( p2+1 );
			}
			else	// Es wurden nur Monat und Jahr eingegeben
			{
				var text_monat = text_tag;
				var text_jahr = text_rest;
			}

			// Wandlung der Werte in Zahlen
			var tag = parseInt( text_tag, 10 );	// Basis 10 muss angegeben werden, damit bei führender 0 keine Oktalzahlen vermutet werden (-> Problem bei "08" und "09")
			var monat = parseInt( text_monat, 10 );	// Basis 10 muss angegeben werden, damit bei führender 0 keine Oktalzahlen vermutet werden (-> Problem bei "08" und "09")
			var jahr = parseInt( text_jahr, 10 );	// Basis 10 muss angegeben werden, damit bei führender 0 keine Oktalzahlen vermutet werden (-> Problem bei "08" und "09")

			// Prüfung der Gültigkeit
			if ( isNaN(tag) == false && tag >= 1 && tag <= 31 && isNaN(monat) == false && monat >= 1 && monat <= 12 && isNaN(jahr) == false && jahr > 0 )
			{
				// wurde das Jahr 4-stellig eingegeben?
				if ( jahr < 100 )
				{
					if ( jahr < 10 ) jahr += 2000; else jahr += 1900;
				}

				// manche Monate haben 30, andere 31 Tage
				if ( tag < 31 || monat == 1 || monat == 3 || monat == 5 || monat == 7 || monat == 8 || monat == 10 || monat == 12 )
				{
					// Prüfung auf Schaltjahr
					if ( monat != 2 || tag <= 28 || (tag == 29 && jahr%4 == 0 && (jahr%400 == 0 || jahr%100 != 0)))
					{
						return jahr + "-" + monat + "-" + tag;
					}
				}
			}
		}
	}
	return "";
}

function getValueDateInt( text )
{
	if ( text.length > 0 )
	{
	
		var p1 = text.indexOf( "." );
		if ( p1 > 0 )
		{
			var text_tag = text.substr( 0, p1 );
			var text_rest = text.substr( p1+1 );

			var p2 = text_rest.indexOf( "." );
			if ( p2 > 0 )	// Es wurden Tag, Monat und Jahr
			{		
				var text_monat = text_rest.substr( 0, p2 );
				var text_jahr = text_rest.substr( p2+1 );
			}
			else	// Es wurden nur Monat und Jahr eingegeben
			{
				var text_monat = text_tag;
				var text_jahr = text_rest;
			}

			// Wandlung der Werte in Zahlen
			var tag = parseInt( text_tag, 10 );	// Basis 10 muss angegeben werden, damit bei führender 0 keine Oktalzahlen vermutet werden (-> Problem bei "08" und "09")
			var monat = parseInt( text_monat, 10 );	// Basis 10 muss angegeben werden, damit bei führender 0 keine Oktalzahlen vermutet werden (-> Problem bei "08" und "09")
			var jahr = parseInt( text_jahr, 10 );	// Basis 10 muss angegeben werden, damit bei führender 0 keine Oktalzahlen vermutet werden (-> Problem bei "08" und "09")

			// Prüfung der Gültigkeit
			if ( isNaN(tag) == false && tag >= 1 && tag <= 31 && isNaN(monat) == false && monat >= 1 && monat <= 12 && isNaN(jahr) == false && jahr > 0 )
			{
				// wurde das Jahr 4-stellig eingegeben?
				if ( jahr < 100 )
				{
					if ( jahr < 10 ) jahr += 2000; else jahr += 1900;
				}

				// manche Monate haben 30, andere 31 Tage
				if ( tag < 31 || monat == 1 || monat == 3 || monat == 5 || monat == 7 || monat == 8 || monat == 10 || monat == 12 )
				{
					// Prüfung auf Schaltjahr
					if ( monat != 2 || tag <= 28 || (tag == 29 && jahr%4 == 0 && (jahr%400 == 0 || jahr%100 != 0)))
					{
						return (jahr * 12 + monat) * 31 + tag;
					}
				}
			}
		}
	}
	return 0;
}


function checkValueDate( formobject )
{
	if ( formobject )
	{
		formobject.value = getValueDate( formobject, 0 );
	}
}

// setzt das Datum ggf. auf den 1. des Monats
function checkValueDate1( formobject )
{
	if ( formobject )
	{
		formobject.value = getValueDate( formobject, 1 );
	}
}

function checkValueTime( formobject )
{
	if ( formobject )
	{
		formobject.value = getValueTime( formobject );
	}
}


function getRadioValue( formobject )
{
	if ( formobject )
	{
		for ( var i=0; i < formobject.length; i++ )
		{	
			if ( formobject[i].checked == true )
			{
				return formobject[i].value;
			}
		}
	}
	return '';
}

function checkEmail( formobject, errortext )
{
	if ( formobject )
	{
		var text = formobject.value;
		var laenge = text.length;
		if ( laenge > 0 )
		{
			var error = 0;

			var punkt = text.lastIndexOf( "." );
			var at = text.lastIndexOf( "@" );

			// Punkt und @-Zeichen müssen vorhanden sein
			if ( punkt < 0 ) error = 1;
			if ( at < 0 ) error = 1;
			// der letzte Punkt muss nach dem @-Zeichen stehen
			if ( punkt >= 0 && at >= 0 && punkt < at ) error = 1;
			// nach dem letzten Punkt müssen noch mind. 2 Zeichen folgen
			if ( laenge - punkt - 1 < 2 ) error = 1;
			// vor dem @-Zeichen muessen mind. 2 Zeichen stehen
			if ( at < 2 ) error = 1;
			// zwischen Punkt und @-Zeichen muessen mind. 3 Zeichen stehen
			if ( punkt - at -1 < 3 ) error = 1;

			// es darf kein Leerzeichen enthalten sein
			for ( var i=0; i < laenge; i++ )
			{
				if ( text.charAt(i) == ' ' ) error = 1;
			}

			if ( error == 1 )
			{
				if ( errortext && errortext.length > 0 )
				{
					alert( errortext );
				}
				return false;
			}
		}
	}
	return true;
}


// FJ, 28.03.2006
// die Formular-Buttons sollen nach Klick sofort disabled werden
// automatisches enablen


var button = "";
var button_bgcolor = "";
var button_color = "";
var button_bgimage = "";
var lasttime = 0;

function ButtonEnable()
{
	var jetzt = new Date();
	if ( jetzt.getTime() - lasttime < 1500 )
	{
		lasttime = jetzt.getTime();
		setTimeout( "ButtonEnable();", 1000 );
	}
	else
	{

		if ( button )
		{
			button.disabled = false;
			button.style.backgroundColor = button_bgcolor;
			button.style.color = button_color;
			button.style.backgroundImage = button_bgimage;
		}
	}
}


function ButtonDisable( object )
{
	button = object;
	if ( button )
	{
		button.disabled = true;

		button_bgimage = object.style.backgroundImage;
		button_bgcolor = object.style.backgroundColor;
		button_color = object.style.color;
		button.style.backgroundImage = 'none';
		button.style.backgroundColor = '#dddddd';
		button.style.color = '#aaaaaa';

		var jetzt = new Date();
		lasttime = jetzt.getTime();
		setTimeout( "ButtonEnable();", 1000 );
	}
}



function enableButton( button )
{
    if ( button )
    {
        button.disabled = false;

		button.style.backgroundImage = 'none';
		button.style.backgroundColor = '#d4d0c8';
		button.style.color = '#000000';
    }

    return;
}

function disableButton( button )
{
    if ( button )
    {
        button.disabled = true;

		button.style.backgroundImage = 'none';
		button.style.backgroundColor = '#dddddd';
		button.style.color = '#999999';
    }

    return;
}


function setCheckedValue(objid, value)
{
    // Liste aller input-Felder ermitteln
    list = document.getElementById(objid).getElementsByTagName("input");
    for(x = 0; x < list.length; x++)
    {
        if( list[x].type == "checkbox" )
        {
            list[x].checked = value;
        }
    }
}

function countCheckedValues( objid )
{
    var anzahl = 0;

    // Liste aller input-Felder ermitteln
    list = document.getElementById(objid).getElementsByTagName("input");
    for(x = 0; x < list.length; x++)
    {
        if( list[x].type == "checkbox" )
        {
            if ( list[x].checked == true )
            {
                anzahl = anzahl + 1;
            }
        }
    }

    return anzahl;
}

function disableField( obj )
{
    if ( obj )
    {
        obj.disabled = true;
        obj.style.backgroundColor = '#dddddd';
	    obj.style.color = '#999999';

        return true;
    }

    return false;
}

function enableField( obj )
{
    if ( obj )
    {
        obj.disabled = false;
        obj.style.backgroundColor = '#ffffff';
	    obj.style.color = '#000000';

        return true;
    }

    return false;
}

function checkValuePositiveInt( formobject )
{

	checkValueInt( formobject );
	
		if(formobject.value < 0)
	{
		formobject.value = 0;
		hinweisfenster("Bitte nur positive Werte eingeben!");
	}
}


  

																			 




	



 







		

function productChange( paramid, value ) {
		var paramarray = new Array();
	var paramarray_c = 0;
			if ( value && document.getElementById( "param"+paramid+"_select" ) ) {
		var ocount = 0;
		while ( document.getElementById("param"+paramid+"_select").options[ocount] ) {
			if ( document.getElementById("param"+paramid+"_select").options[ocount].value == value ) {
				document.getElementById("param"+paramid+"_select").options.selectedIndex = ocount;
				break;
			}
			ocount++;
		}
				if ( document.getElementById("farbkarte"+paramid) ) {
			document.getElementById("farbkarte"+paramid).style.display = "none";
		}
		
	}
		var paramvalue = null;
	if ( document.getElementById( "param"+paramid ) ) { paramvalue = document.getElementById( "param"+paramid ).value; }
			if ( document.getElementById("productform" ) ) {
		for ( var formelement = 0; document.getElementById("productform" ).elements[formelement]; formelement++) {
			if ( document.getElementById("productform" ).elements[formelement].type == "select-one" ) {
								var fieldname = document.getElementById("productform" ).elements[formelement].name.substr(5);
								fieldname = fieldname.replace(/_select/g, "");
								var fieldselected = document.getElementById("productform" ).elements[formelement].options.selectedIndex;
																for ( var ocount = 0; ocount < document.getElementById("productform" ).elements[formelement].options.length; ocount++ ) {
					var text = document.getElementById("productform" ).elements[formelement].options[ocount].value;
										var found = false;
					if (  paramid == fieldname ) { found = true; }
										for (var i = 0; i < products.length && !found; i++) {
												var searchexpr = "--SPLIT--"+paramid+"::="+paramvalue+"--SPLIT--";
												searchexpr = searchexpr.replace( /\\/g, "\\\\" );
						searchexpr = searchexpr.replace( /\(/g, "\\(" );
						searchexpr = searchexpr.replace( /\)/g, "\\)" );
						searchexpr = searchexpr.replace( /\+/g, "\\+" );
						searchexpr = searchexpr.replace( /\./g, "\\." );
						searchexpr = searchexpr.replace( /\//g, "\\/" );
						searchexpr = searchexpr.replace( /\*/g, "\\*" );
						searchexpr = searchexpr.replace( /\%/g, "\\%" );
						searchexpr = eval("/"+searchexpr+"/");
						if ( products[i]["forms"].search(searchexpr) != -1 ) {
							searchexpr = eval("/--SPLIT--"+fieldname+"::="+text+"--SPLIT--/");
							if ( products[i]["forms"].search(searchexpr) != -1 ) { found = true; }
						}
					}
										if ( found ) {
						if ( document.getElementById("fext_cb_liparam"+fieldname+"_"+ocount+"_li" ) ) { document.getElementById("fext_cb_liparam"+fieldname+"_"+ocount+"_li" ).style.display = "block"; }
						document.getElementById("productform" ).elements[formelement].options[ocount].style.display = "block";
						document.getElementById("productform" ).elements[formelement].options[ocount].text = text;
						if ( document.getElementById("flyoutfk"+fieldname) && document.getElementById("farbkarte"+fieldname+"F"+ocount) ) {
							document.getElementById("farbkarte"+fieldname+"F"+ocount).style.visibility = "visible";
						}
					} else {
						if ( document.getElementById("fext_cb_liparam"+fieldname+"_"+ocount+"_li" ) ) { document.getElementById("fext_cb_liparam"+fieldname+"_"+ocount+"_li" ).style.display = "none"; }
						document.getElementById("productform" ).elements[formelement].options[ocount].style.display = "none";
						document.getElementById("productform" ).elements[formelement].options[ocount].text = "";
						if ( document.getElementById("flyoutfk"+fieldname) && document.getElementById("farbkarte"+fieldname+"F"+ocount) ) {
							document.getElementById("farbkarte"+fieldname+"F"+ocount).style.visibility = "hidden";
						}
												if ( fieldselected == ocount ) { 
							document.getElementById("productform" ).elements[formelement].options.selectedIndex = 0; fieldselected = 0;
						}
											}
				}
												fext_cb_choose( "param"+fieldname+"_"+fieldselected, "param"+fieldname );
								paramarray[paramarray_c] = fieldname+"::="+document.getElementById("productform" ).elements[formelement].options[fieldselected].value;
				paramarray_c++;
			}
		}
				for (var i = 0; i < products.length; i++) {
			var found = true;
			for (var j = 0; j < paramarray.length && found; j++) {
				var searchexpr = "--SPLIT--"+paramarray[j]+"--SPLIT--";
								searchexpr = searchexpr.replace( /\\/g, "\\\\" );
				searchexpr = searchexpr.replace( /\(/g, "\\(" );
				searchexpr = searchexpr.replace( /\)/g, "\\)" );
				searchexpr = searchexpr.replace( /\+/g, "\\+" );
				searchexpr = searchexpr.replace( /\./g, "\\." );
				searchexpr = searchexpr.replace( /\//g, "\\/" );
				searchexpr = searchexpr.replace( /\*/g, "\\*" );
				searchexpr = searchexpr.replace( /\%/g, "\\%" );
				searchexpr = eval("/"+searchexpr+"/");
								if ( products[i]["forms"].search(searchexpr) == -1 ) { found = false; }
			}
			if ( found ) {
								document.getElementById("articlecode").innerHTML = products[i]["articlecode"];
				if ( products[i]["pricestd"] ) {
										document.getElementById("price").innerHTML = products[i]["price"]+" &euro; <span class=\"pricestd\">statt <strike>"+products[i]["pricestd"]+" &euro;</strike></span>";				
				} else {
					document.getElementById("price").innerHTML = products[i]["price"]+" &euro;";
				}
				document.getElementById("el0001").value = products[i]["elid"];
								productCheckAmount( products[i]["minorderamount"], products[i]["minunit"] );
				break;
			} else {
							}
		}
	}
}

function productCheckAmount( minorde, minunit ) {
	var errorcode = 1; 	if ( document.getElementById( "menge0001" ) && document.getElementById( "submit" ) ) {
		errorcode = 0; 				var amount = document.getElementById( "menge0001" ).value;
				if ( minorde == "" ) { minorde = "0"; }
		if ( minunit == "" ) { minunit = "1"; }
				var maxorderamount = 100000;
		var reststueck = 0;
		if ( document.getElementById( "priceinforeststck" ) ) { document.getElementById( "priceinforeststck" ).style.display = "none"; }
		if ( document.getElementById( "priceinfostd" ) ) { document.getElementById( "priceinfostd" ).style.display = "block"; }
				for (var i = 0; i < products.length; i++) {
			if ( products[i]["articlecode"] == document.getElementById("articlecode").innerHTML && products[i]["avail"] ) {
				maxorderamount = parseInt( products[i]["avail"] );
				reststueck = parseInt( products[i]["reststueck"] );
				var text = products[i]["mengetext"];
				if ( text == "" ) { text = "Menge"; }
				document.getElementById( "menge0001label" ).innerHTML = text;
				break;
			}
		}
				if ( reststueck == 1 ) {
						var rst_menge = "1";
						document.getElementById( "menge0001" ).disabled = "disabled";
			document.getElementById( "menge0001" ).value = rst_menge;
			amount = rst_menge;
			if ( document.getElementById( "priceinforeststck" ) ) { document.getElementById( "priceinforeststck" ).style.display = "block"; }
			if ( document.getElementById( "priceinfostd" ) ) { document.getElementById( "priceinfostd" ).style.display = "none"; }
		} else {
						document.getElementById( "menge0001" ).disabled = "";
			document.getElementById( "menge0001" ).type = "text";
		}
				if ( amount.indexOf( "," ) >= 0 ) { amount = parseFloat( amount.replace( /\./g, "" ).replace( /,/g, "." ) ); } else { amount = parseFloat( amount ); }
		if ( minorde.indexOf( "," ) >= 0 ) { minorde = parseFloat( minorde.replace( /\./g, "" ).replace( /,/g, "." ) ); } else { minorde = parseFloat( minorde ); }
		if ( minunit.indexOf( "," ) >= 0 ) { minunit = parseFloat( minunit.replace( /\./g, "" ).replace( /,/g, "." ) ); } else { minunit = parseFloat( minunit ); }
						if ( amount >= minorde ) {
			if ( minunit == 0 || parseInt(amount*1000)%parseInt(minunit*1000) == 0 ) {
			} else {
				if ( reststueck == 0 ) { errorcode = 3; } 			}
		} else { 
			if ( reststueck == 0 ) { errorcode = 2; } 		}
				if ( amount > maxorderamount ) { 
			errorcode = 4;
						if ( reststueck == 1 ) { errorcode = 5; }
		}
						if ( document.getElementById( "basketerror2" ) ) document.getElementById( "basketerror2" ).style.display = "none";
		if ( document.getElementById( "basketerror3" ) ) document.getElementById( "basketerror3" ).style.display = "none";
		if ( document.getElementById( "basketerror4" ) ) document.getElementById( "basketerror4" ).style.display = "none";
		if ( document.getElementById( "basketerror5" ) ) document.getElementById( "basketerror5" ).style.display = "none";
				if ( errorcode == 0 ) {
									document.getElementById( "submit" ).style.backgroundPosition = "0px 0px";

			return true;
		} else {
									document.getElementById( "submit" ).style.backgroundPosition = "0px -63px";
						if ( errorcode == 2 && document.getElementById( "basketerror2" ) ) document.getElementById( "basketerror2" ).style.display = "block";
			if ( errorcode == 3 && document.getElementById( "basketerror3" ) ) document.getElementById( "basketerror3" ).style.display = "block";
			if ( errorcode == 4 && document.getElementById( "basketerror4" ) ) document.getElementById( "basketerror4" ).style.display = "block";
			if ( errorcode == 5 && document.getElementById( "basketerror5" ) ) document.getElementById( "basketerror5" ).style.display = "block";
			return false;
		}
	}
}

function productAddBasket( kdid, orid, title ) {
		var elid = -1;
	if ( document.getElementById("el0001") ) { elid = document.getElementById("el0001").value; }
	if ( elid > 0 ) {
				var amount = document.getElementById( "menge0001" ).value;
				if ( amount.indexOf( "," ) >= 0 ) { amount = parseFloat( amount.replace( /\./g, "" ).replace( /,/g, "." ) ); } else { amount = parseFloat( amount ); }
				if ( products[0]["einheit"] != 778824730 ) {
			amount = parseInt( amount );
		}
				var url = "/cgi-bin/vm/vio.matrix?";
				if ( kdid != null ) { url += "kd="+kdid; } else { url += "dummy="; }
		url += "&amp;or="+orid+"&amp;typ=SHOP_NAVI%23basket";
		url += "&amp;el0001="+elid;
		url += "&amp;menge0001="+amount;
				return GB_showCenter(title, url, 270, 410 );
	}
	return false;
}

function changeLaUse() {
	if ( document.getElementById("la_use") && document.getElementById("lablock") && document.getElementById("sb_changeaddress") ) {
		if ( document.getElementById("la_use").checked ) { 
			document.getElementById("lablock").style.display = 'block';
			document.getElementById("sb_changeaddress").value = 1;
		} else { 
			document.getElementById("lablock").style.display = 'none';
			document.getElementById("sb_changeaddress").value = 0;
		}
		return true;
	}
	return false;
}

function rebuildSearchForm( changeditem ) {
		var params  = "asearch_change="+encodeURIComponent( changeditem );
	if ( document.getElementById("search_category") )     { params += "&asearch_category="+encodeURIComponent( document.getElementById("search_category").value ); }
	if ( document.getElementById("search_color") )        { params += "&asearch_color="+encodeURIComponent( document.getElementById("search_color").value ); }
	if ( document.getElementById("search_textiletitle") ) { params += "&asearch_textiletitle="+encodeURIComponent( document.getElementById("search_textiletitle").value ); }
	if ( document.getElementById("search_textiledesign") ){ params += "&asearch_textiledesign="+encodeURIComponent( document.getElementById("search_textiledesign").value ); }
	if ( document.getElementById("search_textiletypes") ) { params += "&asearch_textiletypes="+encodeURIComponent( document.getElementById("search_textiletypes").value ); }
	if ( document.getElementById("search_manufacture") )  { params += "&asearch_manufacture="+encodeURIComponent( document.getElementById("search_manufacture").value ); }

		var tobj = null;
	tobj = document.getElementById("fext_cb_dddivsearch_category"); 	if ( changeditem != "search_category" && tobj ) { tobj.style.backgroundColor = "rgb(230,230,230)"; tobj.style.backgroundPosition = "right -25px"; }
	tobj = document.getElementById("fext_cb_dddivsearch_color"); 		if ( changeditem != "search_color" && tobj ) { tobj.style.backgroundColor = "rgb(230,230,230)"; tobj.style.backgroundPosition = "right -25px"; }
	tobj = document.getElementById("fext_cb_dddivsearch_textiletitle"); 	if ( changeditem != "search_textiletitle" && tobj ) { tobj.style.backgroundColor = "rgb(230,230,230)"; tobj.style.backgroundPosition = "right -25px"; }
	tobj = document.getElementById("fext_cb_dddivsearch_textiledesign"); 	if ( changeditem != "search_textiledesign" && tobj ) { tobj.style.backgroundColor = "rgb(230,230,230)"; tobj.style.backgroundPosition = "right -25px"; }
	tobj = document.getElementById("fext_cb_dddivsearch_textiletypes"); 	if ( changeditem != "search_textiletypes" && tobj ) { tobj.style.backgroundColor = "rgb(230,230,230)"; tobj.style.backgroundPosition = "right -25px"; }
	tobj = document.getElementById("fext_cb_dddivsearch_manufacture"); 	if ( changeditem != "search_manufacture" && tobj ) { tobj.style.backgroundColor = "rgb(230,230,230)"; tobj.style.backgroundPosition = "right -25px"; }
	
			if ( changeditem != "search_category" ) { sajax_content( "rebuildSearchForm", "search_category_wrapper", params+"&asearch_want="+encodeURIComponent( "category" ), "de"); }
	if ( changeditem != "search_color" ) { sajax_content( "rebuildSearchForm", "search_color_wrapper", params+"&asearch_want="+encodeURIComponent( "color" ), "de"); }
	if ( changeditem != "search_textiletitle" ) { sajax_content( "rebuildSearchForm", "search_textiletitle_wrapper", params+"&asearch_want="+encodeURIComponent( "textiletitle" ), "de"); }
	if ( changeditem != "search_textiledesign" ) { sajax_content( "rebuildSearchForm", "search_textiledesign_wrapper", params+"&asearch_want="+encodeURIComponent( "textiledesign" ), "de"); }
	if ( changeditem != "search_textiletypes" ) { sajax_content( "rebuildSearchForm", "search_textiletypes_wrapper", params+"&asearch_want="+encodeURIComponent( "textiletypes" ), "de"); }
	if ( changeditem != "search_manufacture" ) { sajax_content( "rebuildSearchForm", "search_manufacture_wrapper", params+"&asearch_want="+encodeURIComponent( "manufacture" ), "de"); }

	return true;
}

var topicFlyout;
function showFlyout( name ) {
	if ( topicFlyout ) { topicFlyout.style.display = "none"; }
	var flyoutobject = document.getElementById( "flyout"+name );
	if ( flyoutobject ) {
		flyoutobject.style.display = "block";
		topicFlyout = flyoutobject;
	}
}
function hideFlyout( name ) {
	var flyoutobject = document.getElementById( "flyout"+name );
	if ( flyoutobject ) {
		flyoutobject.style.display = "none";
		topicFlyout = null;
	}
}

var dd_MouseOut 	= new Array();
var dd_MouseOver 	= new Array();

function div_dropdown( id ) {
	var element = document.getElementById( id );
	if ( element ) {
		if ( element.style.display == "block") {
			window.setTimeout( "dd_slideUp( '"+id+"' )", 10 );
		} else {
			
			dd_MouseOut[ id ]  = 0;
			dd_MouseOver[ id ] = 0;
			element.style.display = "block";
			var maxheight = parseInt( element.offsetHeight );
			if ( !isNaN(maxheight) && isNaN(parseInt( element.style.maxHeight )) ) { maxheight -= 0; element.style.maxHeight = maxheight+"px"; }
			element.style.height = "0px";
			window.setTimeout( "dd_slideDown( '"+id+"' )", 10 );
		}
	}
}

function div_mouseover( id ) {
	var element = document.getElementById( id );
	if ( element ) {
		dd_MouseOver[ id ]++;
	}
}

function div_dropup( id ) {
	var element = document.getElementById( id );
	if ( element ) {
		window.setTimeout( "div_dropup2( '"+id+"' )", 300 );
	}
	return false;
}
function div_dropup2( id ) {
	var element = document.getElementById( id );
	if ( element ) {
		dd_MouseOut[ id ]++;
				if ( element.style.display == "block" && dd_MouseOut[ id ] == dd_MouseOver[ id ] ) {
			
			dd_slideUp( id );
		}
	}
	return false;
}


var dd_slideArray = new Array();

function dd_slideDown( id ) {
	var element = document.getElementById( id );
	if ( dd_slideArray[id] ) { window.clearTimeout( dd_slideArray[id] ); }
	if ( element ) {
		var height = parseInt( element.style.height );
		var maxheight = parseInt( element.style.maxHeight );
		if ( maxheight < 10 || isNaN(maxheight) ) { maxheight = parseInt( element.offsetHeight ); }
		if ( maxheight < 10 || isNaN(maxheight) ) { maxheight = 330; }
		if ( height < maxheight ) {
			height += 10; if ( height > maxheight ) { height = maxheight; }
			element.style.height = height+"px";
			dd_slideArray[id] = window.setTimeout( "dd_slideDown( '"+id+"' )", 10 );
		}
	}
}

function dd_slideUp( id ) {
	var element = document.getElementById( id );
	if ( dd_slideArray[id] ) { window.clearTimeout( dd_slideArray[id] ); }
	if ( element ) {
		var height = parseInt( element.style.height );
		if ( height > 10 ) {
			height -= 10;
			element.style.height = height+"px";
			dd_slideArray[id] = window.setTimeout( "dd_slideUp( '"+id+"' )", 10 );
		} else {
			element.style.height = "0px";
			element.style.display = "none";
			
		}
	}
}

var last_Paymentcode = "";
function choosePayment( pymntcode ) {
		if ( document.getElementById( "formPymnt"+last_Paymentcode ) ) {
		document.getElementById( "formPymnt"+last_Paymentcode ).style.display = "none";
		last_Paymentcode = "";
	}
	if ( document.getElementById( "formPymnt"+pymntcode ) ) {
				document.getElementById( "formPymnt"+pymntcode ).style.display = "block";
		last_Paymentcode = pymntcode;
	}
}








function fext_cb_dropdown( id ) {
	var element = document.getElementById( "fext_cb_dd"+id+"_list" );
	if ( element ) {
		if ( element.style.display == "block") {
			window.setTimeout( "fext_cb_slideUp( '"+id+"' )", 10 );
		} else {
			element.style.height = "0px";
			element.style.display = "block";
			window.setTimeout( "fext_cb_slideDown( '"+id+"' )", 10 );
		}
	}
}

function fext_cb_choose( id, inputid ) {
	var itemelement = document.getElementById( "fext_cb_li"+id );
	var idelement = document.getElementById( "fext_cb_li"+id+"_id" );
	var titleelement = document.getElementById( "fext_cb_li"+id+"_title" );
	var inputelement = document.getElementById( inputid );
	var textelement = document.getElementById( "fext_cb_dddiv"+inputid );
	
	if ( itemelement && idelement && titleelement && inputelement && textelement ) {
		inputelement.value = idelement.innerHTML;
		textelement.innerHTML = titleelement.innerHTML;
		fext_cb_slideUp( inputid );
	}
	return false;
}

var fext_cb_slideArray = new Array();

function fext_cb_slideDown( id ) {
	var element = document.getElementById( "fext_cb_dd"+id+"_list" );
	if ( fext_cb_slideArray[id] ) { window.clearTimeout( fext_cb_slideArray[id] ); }
	if ( element ) {
		var height = parseInt( element.style.height );
		var maxheight = parseInt( element.style.maxHeight );
		 		if ( maxheight < 10 || isNaN(maxheight) ) { maxheight = 260; }
		if ( height < maxheight ) {
			height += 10;
			element.style.height = height+"px";
			fext_cb_slideArray[id] = window.setTimeout( "fext_cb_slideDown( '"+id+"' )", 10 );
		}
	}
}

function fext_cb_slideUp( id ) {
	var element = document.getElementById( "fext_cb_dd"+id+"_list" );
	if ( fext_cb_slideArray[id] ) { window.clearTimeout( fext_cb_slideArray[id] ); }
	if ( element ) {
		var height = parseInt( element.style.height );
		if ( height > 0 ) {
			height -= 10;
			element.style.height = height+"px";
			fext_cb_slideArray[id] = window.setTimeout( "fext_cb_slideUp( '"+id+"' )", 10 );
		} else {
			element.style.height = "0px";
			element.style.display = "none";
			
		}
	}
}



var fext_rb_lastChecked = new Array(); 
function fext_rb_chooseRadio( fext_rb_radioid ) {
	if ( document.getElementById( fext_rb_radioid ) && document.getElementById( "fext_rb_"+fext_rb_radioid ) && document.getElementById( "fext_rb_img_"+fext_rb_radioid ) ) {
				var fext_rb_radioname = document.getElementById( fext_rb_radioid ).name;
				if ( fext_rb_lastChecked[ fext_rb_radioname ] && document.getElementById( "fext_rb_img_"+fext_rb_lastChecked[ fext_rb_radioname ]) ) {
			document.getElementById( "fext_rb_img_"+fext_rb_lastChecked[ fext_rb_radioname ]).style.marginTop = "-15px";
		}
		
				document.getElementById( fext_rb_radioid ).checked = true;
		
				document.getElementById( "fext_rb_img_"+fext_rb_radioid ).style.marginTop = "0px";
		
				fext_rb_lastChecked[ fext_rb_radioname ] = fext_rb_radioid;
	}
}


function stopRKey(evt) {
  var evt = (evt) ? evt : ((event) ? event : null);
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
  if ((evt.keyCode == 13) && (node.type=="text"))  {return false;}
}

document.onkeypress = stopRKey;

var browser = "";
var browserie = "";
if (navigator.appName.indexOf("Opera") != -1)
{
 browser = "opera";
}
else if (navigator.appName.indexOf("Explorer") != -1)
{
 if(window.XMLHttpRequest){browserie = "7";}else{browserie = "6";}
 browser = "ie";
}
else if (navigator.appName.indexOf("Netscape") != -1)
{
 browser = "netscape";
}
else
{
 browser = "anderer";
}
AJS={BASE_URL:"",drag_obj:null,drag_elm:null,_drop_zones:[],_cur_pos:null,getScrollTop:function(){
var t;
if(document.documentElement&&document.documentElement.scrollTop){
t=document.documentElement.scrollTop;
}else{
if(document.body){
t=document.body.scrollTop;
}
}
return t;
},addClass:function(){
var _2=AJS.forceArray(arguments);
var _3=_2.pop();
var _4=function(o){
if(!new RegExp("(^|\\s)"+_3+"(\\s|$)").test(o.className)){
o.className+=(o.className?" ":"")+_3;
}
};
AJS.map(_2,function(_6){
_4(_6);
});
},setStyle:function(){
var _7=AJS.forceArray(arguments);
var _8=_7.pop();
var _9=_7.pop();
AJS.map(_7,function(_a){
_a.style[_9]=AJS.getCssDim(_8);
});
},extend:function(_b){
var _c=new this("no_init");
for(k in _b){
var _d=_c[k];
var _e=_b[k];
if(_d&&_d!=_e&&typeof _e=="function"){
_e=this._parentize(_e,_d);
}
_c[k]=_e;
}
return new AJS.Class(_c);
},log:function(o){
if(window.console){
console.log(o);
}else{
var div=AJS.$("ajs_logger");
if(!div){
div=AJS.DIV({id:"ajs_logger","style":"color: green; position: absolute; left: 0"});
div.style.top=AJS.getScrollTop()+"px";
AJS.ACN(AJS.getBody(),div);
}
AJS.setHTML(div,""+o);
}
},setHeight:function(){
var _11=AJS.forceArray(arguments);
_11.splice(_11.length-1,0,"height");
AJS.setStyle.apply(null,_11);
},_getRealScope:function(fn,_13){
_13=AJS.$A(_13);
var _14=fn._cscope||window;
return function(){
var _15=AJS.$FA(arguments).concat(_13);
return fn.apply(_14,_15);
};
},documentInsert:function(elm){
if(typeof (elm)=="string"){
elm=AJS.HTML2DOM(elm);
}
document.write("<span id=\"dummy_holder\"></span>");
AJS.swapDOM(AJS.$("dummy_holder"),elm);
},getWindowSize:function(doc){
doc=doc||document;
var _18,_19;
if(self.innerHeight){
_18=self.innerWidth;
_19=self.innerHeight;
}else{
if(doc.documentElement&&doc.documentElement.clientHeight){
_18=doc.documentElement.clientWidth;
_19=doc.documentElement.clientHeight;
}else{
if(doc.body){
_18=doc.body.clientWidth;
_19=doc.body.clientHeight;
}
}
}
return {"w":_18,"h":_19};
},flattenList:function(_1a){
var r=[];
var _1c=function(r,l){
AJS.map(l,function(o){
if(o==null){
}else{
if(AJS.isArray(o)){
_1c(r,o);
}else{
r.push(o);
}
}
});
};
_1c(r,_1a);
return r;
},isFunction:function(obj){
return (typeof obj=="function");
},setEventKey:function(e){
e.key=e.keyCode?e.keyCode:e.charCode;
if(window.event){
e.ctrl=window.event.ctrlKey;
e.shift=window.event.shiftKey;
}else{
e.ctrl=e.ctrlKey;
e.shift=e.shiftKey;
}
switch(e.key){
case 63232:
e.key=38;
break;
case 63233:
e.key=40;
break;
case 63235:
e.key=39;
break;
case 63234:
e.key=37;
break;
}
},removeElement:function(){
var _22=AJS.forceArray(arguments);
AJS.map(_22,function(elm){
AJS.swapDOM(elm,null);
});
},_unloadListeners:function(){
if(AJS.listeners){
AJS.map(AJS.listeners,function(elm,_25,fn){
AJS.REV(elm,_25,fn);
});
}
AJS.listeners=[];
},join:function(_27,_28){
try{
return _28.join(_27);
}
catch(e){
var r=_28[0]||"";
AJS.map(_28,function(elm){
r+=_27+elm;
},1);
return r+"";
}
},getIndex:function(elm,_2c,_2d){
for(var i=0;i<_2c.length;i++){
if(_2d&&_2d(_2c[i])||elm==_2c[i]){
return i;
}
}
return -1;
},isIn:function(elm,_30){
var i=AJS.getIndex(elm,_30);
if(i!=-1){
return true;
}else{
return false;
}
},isArray:function(obj){
return obj instanceof Array;
},setLeft:function(){
var _33=AJS.forceArray(arguments);
_33.splice(_33.length-1,0,"left");
AJS.setStyle.apply(null,_33);
},appendChildNodes:function(elm){
if(arguments.length>=2){
AJS.map(arguments,function(n){
if(AJS.isString(n)){
n=AJS.TN(n);
}
if(AJS.isDefined(n)){
elm.appendChild(n);
}
},1);
}
return elm;
},getElementsByTagAndClassName:function(_36,_37,_38,_39){
var _3a=[];
if(!AJS.isDefined(_38)){
_38=document;
}
if(!AJS.isDefined(_36)){
_36="*";
}
var els=_38.getElementsByTagName(_36);
var _3c=els.length;
var _3d=new RegExp("(^|\\s)"+_37+"(\\s|$)");
for(i=0,j=0;i<_3c;i++){
if(_3d.test(els[i].className)||_37==null){
_3a[j]=els[i];
j++;
}
}
if(_39){
return _3a[0];
}else{
return _3a;
}
},isOpera:function(){
return (navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
},isString:function(obj){
return (typeof obj=="string");
},hideElement:function(elm){
var _40=AJS.forceArray(arguments);
AJS.map(_40,function(elm){
elm.style.display="none";
});
},setOpacity:function(elm,p){
elm.style.opacity=p;
elm.style.filter="alpha(opacity="+p*100+")";
},insertBefore:function(elm,_45){
_45.parentNode.insertBefore(elm,_45);
return elm;
},setWidth:function(){
var _46=AJS.forceArray(arguments);
_46.splice(_46.length-1,0,"width");
AJS.setStyle.apply(null,_46);
},createArray:function(v){
if(AJS.isArray(v)&&!AJS.isString(v)){
return v;
}else{
if(!v){
return [];
}else{
return [v];
}
}
},isDict:function(o){
var _49=String(o);
return _49.indexOf(" Object")!=-1;
},isMozilla:function(){
return (navigator.userAgent.toLowerCase().indexOf("gecko")!=-1&&navigator.productSub>=20030210);
},removeEventListener:function(elm,_4b,fn,_4d){
var _4e="ajsl_"+_4b+fn;
if(!_4d){
_4d=false;
}
fn=elm[_4e]||fn;
if(elm["on"+_4b]==fn){
elm["on"+_4b]=elm[_4e+"old"];
}
if(elm.removeEventListener){
elm.removeEventListener(_4b,fn,_4d);
if(AJS.isOpera()){
elm.removeEventListener(_4b,fn,!_4d);
}
}else{
if(elm.detachEvent){
elm.detachEvent("on"+_4b,fn);
}
}
},callLater:function(fn,_50){
var _51=function(){
fn();
};
window.setTimeout(_51,_50);
},setTop:function(){
var _52=AJS.forceArray(arguments);
_52.splice(_52.length-1,0,"top");
AJS.setStyle.apply(null,_52);
},_createDomShortcuts:function(){
var _53=["ul","li","td","tr","th","tbody","table","input","span","b","a","div","img","button","h1","h2","h3","h4","h5","h6","br","textarea","form","p","select","option","optgroup","iframe","script","center","dl","dt","dd","small","pre","i"];
var _54=function(elm){
AJS[elm.toUpperCase()]=function(){
return AJS.createDOM.apply(null,[elm,arguments]);
};
};
AJS.map(_53,_54);
AJS.TN=function(_56){
return document.createTextNode(_56);
};
},addCallback:function(fn){
this.callbacks.unshift(fn);
},bindMethods:function(_58){
for(var k in _58){
var _5a=_58[k];
if(typeof (_5a)=="function"){
_58[k]=AJS.$b(_5a,_58);
}
}
},partial:function(fn){
var _5c=AJS.$FA(arguments);
_5c.shift();
return function(){
_5c=_5c.concat(AJS.$FA(arguments));
return fn.apply(window,_5c);
};
},isNumber:function(obj){
return (typeof obj=="number");
},getCssDim:function(dim){
if(AJS.isString(dim)){
return dim;
}else{
return dim+"px";
}
},isIe:function(){
return (navigator.userAgent.toLowerCase().indexOf("msie")!=-1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1);
},removeClass:function(){
var _5f=AJS.forceArray(arguments);
var cls=_5f.pop();
var _61=function(o){
o.className=o.className.replace(new RegExp("\\s?"+cls,"g"),"");
};
AJS.map(_5f,function(elm){
_61(elm);
});
},setHTML:function(elm,_65){
elm.innerHTML=_65;
return elm;
},map:function(_66,fn,_68,_69){
var i=0,l=_66.length;
if(_68){
i=_68;
}
if(_69){
l=_69;
}
for(i;i<l;i++){
var val=fn(_66[i],i);
if(val!=undefined){
return val;
}
}
},addEventListener:function(elm,_6e,fn,_70,_71){
var _72="ajsl_"+_6e+fn;
if(!_71){
_71=false;
}
AJS.listeners=AJS.$A(AJS.listeners);
if(AJS.isIn(_6e,["keypress","keydown","keyup","click"])){
var _73=fn;
fn=function(e){
AJS.setEventKey(e);
return _73.apply(window,arguments);
};
}
var _75=AJS.isIn(_6e,["submit","load","scroll","resize"]);
var _76=AJS.$A(elm);
AJS.map(_76,function(_77){
if(_70){
var _78=fn;
fn=function(e){
AJS.REV(_77,_6e,fn);
return _78.apply(window,arguments);
};
}
if(_75){
var _7a=_77["on"+_6e];
var _7b=function(){
if(_7a){
fn(arguments);
return _7a(arguments);
}else{
return fn(arguments);
}
};
_77[_72]=_7b;
_77[_72+"old"]=_7a;
elm["on"+_6e]=_7b;
}else{
_77[_72]=fn;
if(_77.attachEvent){
_77.attachEvent("on"+_6e,fn);
}else{
if(_77.addEventListener){
_77.addEventListener(_6e,fn,_71);
}
}
AJS.listeners.push([_77,_6e,fn]);
}
});
},preloadImages:function(){
AJS.AEV(window,"load",AJS.$p(function(_7c){
AJS.map(_7c,function(src){
var pic=new Image();
pic.src
 =    src;
});
},arguments));
},forceArray:function(_7f){
var r=[];
AJS.map(_7f,function(elm){
r.push(elm);
});
return r;
},update:function(l1,l2){
for(var i in l2){
l1[i]=l2[i];
}
return l1;
},getBody:function(){
return AJS.$bytc("body")[0];
},HTML2DOM:function(_85,_86){
var d=AJS.DIV();
d.innerHTML=_85;
if(_86){
return d.childNodes[0];
}else{
return d;
}
},getElement:function(id){
if(AJS.isString(id)||AJS.isNumber(id)){
return document.getElementById(id);
}else{
return id;
}
},showElement:function(){
var _89=AJS.forceArray(arguments);
AJS.map(_89,function(elm){
elm.style.display="";
});
},bind:function(fn,_8c,_8d){
fn._cscope=_8c;
return AJS._getRealScope(fn,_8d);
},createDOM:function(_8e,_8f){
var i=0,_91;
var elm=document.createElement(_8e);
var _93=_8f[0];
if(AJS.isDict(_8f[i])){
for(k in _93){
_91=_93[k];
if(k=="style"||k=="s"){
elm.style.cssText=_91;
}else{
if(k=="c"||k=="class"||k=="className"){
elm.className=_91;
}else{
elm.setAttribute(k,_91);
}
}
}
i++;
}
if(_93==null){
i=1;
}
for(var j=i;j<_8f.length;j++){
var _91=_8f[j];
if(_91){
var _95=typeof (_91);
if(_95=="string"||_95=="number"){
_91=AJS.TN(_91);
}
elm.appendChild(_91);
}
}
return elm;
},swapDOM:function(_96,src){
_96=AJS.getElement(_96);
var _98=_96.parentNode;
if(src){
src
=AJS.getElement(src);
_98.replaceChild(src,_96);
}else{
_98.removeChild(_96);
}
return src;
},isDefined:function(o){
return (o!="undefined"&&o!=null);
}};
AJS.$=AJS.getElement;
AJS.$$=AJS.getElements;
AJS.$f=AJS.getFormElement;
AJS.$p=AJS.partial;
AJS.$b=AJS.bind;
AJS.$A=AJS.createArray;
AJS.DI=AJS.documentInsert;
AJS.ACN=AJS.appendChildNodes;
AJS.RCN=AJS.replaceChildNodes;
AJS.AEV=AJS.addEventListener;
AJS.REV=AJS.removeEventListener;
AJS.$bytc=AJS.getElementsByTagAndClassName;
AJS.$AP=AJS.absolutePosition;
AJS.$FA=AJS.forceArray;
AJS.addEventListener(window,"unload",AJS._unloadListeners);
AJS._createDomShortcuts();
AJS.Class=function(_9a){
var fn=function(){
if(arguments[0]!="no_init"){
return this.init.apply(this,arguments);
}
};
fn.prototype=_9a;
AJS.update(fn,AJS.Class.prototype);
return fn;
};
AJS.Class.prototype={extend:function(_9c){
var _9d=new this("no_init");
for(k in _9c){
var _9e=_9d[k];
var cur=_9c[k];
if(_9e&&_9e!=cur&&typeof cur=="function"){
cur=this._parentize(cur,_9e);
}
_9d[k]=cur;
}
return new AJS.Class(_9d);
},implement:function(_a0){
AJS.update(this.prototype,_a0);
},_parentize:function(cur,_a2){
return function(){
this.parent=_a2;
return cur.apply(this,arguments);
};
}};
script_loaded=true;


script_loaded=true;
AJS.fx={_shades:{0:"ffffff",1:"ffffee",2:"ffffdd",3:"ffffcc",4:"ffffbb",5:"ffffaa",6:"ffff99"},highlight:function(_1,_2){
var _3=new AJS.fx.Base();
_3.elm=AJS.$(_1);
_3.options.duration=600;
_3.setOptions(_2);
AJS.update(_3,{increase:function(){
if(this.now==7){
_1.style.backgroundColor="#fff";
}else{
_1.style.backgroundColor="#"+AJS.fx._shades[Math.floor(this.now)];
}
}});
return _3.custom(6,0);
},fadeIn:function(_4,_5){
_5=_5||{};
if(!_5.from){
_5.from=0;
AJS.setOpacity(_4,0);
}
if(!_5.to){
_5.to=1;
}
var s=new AJS.fx.Style(_4,"opacity",_5);
return s.custom(_5.from,_5.to);
},fadeOut:function(_7,_8){
_8=_8||{};
if(!_8.from){
_8.from=1;
}
if(!_8.to){
_8.to=0;
}
_8.duration=300;
var s=new AJS.fx.Style(_7,"opacity",_8);
return s.custom(_8.from,_8.to);
},setWidth:function(_a,_b){
var s=new AJS.fx.Style(_a,"width",_b);
return s.custom(_b.from,_b.to);
},setHeight:function(_d,_e){
var s=new AJS.fx.Style(_d,"height",_e);
return s.custom(_e.from,_e.to);
}};
AJS.fx.Base=new AJS.Class({init:function(_10){
this.options={onStart:function(){
},onComplete:function(){
},transition:AJS.fx.Transitions.sineInOut,duration:500,wait:true,fps:50};
AJS.update(this.options,_10);
AJS.bindMethods(this);
},setOptions:function(_11){
AJS.update(this.options,_11);
},step:function(){
var _12=new Date().getTime();
if(_12<this.time+this.options.duration){
this.cTime=_12-this.time;
this.setNow();
}else{
setTimeout(AJS.$b(this.options.onComplete,this,[this.elm]),10);
this.clearTimer();
this.now=this.to;
}
this.increase();
},setNow:function(){
this.now=this.compute(this.from,this.to);
},compute:function(_13,to){
var _15=to-_13;
return this.options.transition(this.cTime,_13,_15,this.options.duration);
},clearTimer:function(){
clearInterval(this.timer);
this.timer=null;
return this;
},_start:function(_16,to){
if(!this.options.wait){
this.clearTimer();
}
if(this.timer){
return;
}
setTimeout(AJS.$p(this.options.onStart,this.elm),10);
this.from=_16;
this.to=to;
this.time=new Date().getTime();
this.timer=setInterval(this.step,Math.round(1000/this.options.fps));
return this;
},custom:function(_18,to){
return this._start(_18,to);
},set:function(to){
this.now=to;
this.increase();
return this;
},setStyle:function(elm,_1c,val){
if(this.property=="opacity"){
AJS.setOpacity(elm,val);
}else{
AJS.setStyle(elm,_1c,val);
}
}});
AJS.fx.Style=AJS.fx.Base.extend({init:function(elm,_1f,_20){
this.parent();
this.elm=elm;
this.setOptions(_20);
this.property=_1f;
},increase:function(){
this.setStyle(this.elm,this.property,this.now);
}});
AJS.fx.Styles=AJS.fx.Base.extend({init:function(elm,_22){
this.parent();
this.elm=AJS.$(elm);
this.setOptions(_22);
this.now={};
},setNow:function(){
for(p in this.from){
this.now[p]=this.compute(this.from[p],this.to[p]);
}
},custom:function(obj){
if(this.timer&&this.options.wait){
return;
}
var _24={};
var to={};
for(p in obj){
_24[p]=obj[p][0];
to[p]=obj[p][1];
}
return this._start(_24,to);
},increase:function(){
for(var p in this.now){
this.setStyle(this.elm,p,this.now[p]);
}
}});
AJS.fx.Transitions={linear:function(t,b,c,d){
return c*t/d+b;
},sineInOut:function(t,b,c,d){
return -c/2*(Math.cos(Math.PI*t/d)-1)+b;
}};
script_loaded=true;


script_loaded=true;






        
var GB_CURRENT=null;
GB_hide=function(cb){
GB_CURRENT.hide(cb);
};
GreyBox=new AJS.Class({init:function(_2){
this.use_fx=AJS.fx;
this.type="page";
this.overlay_click_close=false;
this.salt=0;
this.root_dir=GB_ROOT_DIR;
this.callback_fns=[];
this.reload_on_close=false;
this.src_loader="/cgi-bin/vm/vio.matrix?typ=GREYBOX%23html_greybox_loader";
var _3=window.location.hostname.indexOf("www");
var _4=this.src_loader.indexOf("www");
if(_3!=-1&&_4==-1){
this.src_loader=this.src_loader.replace("://","://www.");
}
if(_3==-1&&_4!=-1){
this.src_loader=this.src_loader.replace("://www.","://");
}
this.show_loading=true;
AJS.update(this,_2);
},addCallback:function(fn){
if(fn){
this.callback_fns.push(fn);
}
},show:function(_6){
GB_CURRENT=this;
this.url=_6;
var _7=[AJS.$bytc("object"),AJS.$bytc("select")];
AJS.map(AJS.flattenList(_7),function(_8){
_8.style.visibility="hidden";
});
this.createElements();
return false;
},hide:function(cb){
var me=this;
AJS.callLater(function(){
var _b=me.callback_fns;
if(_b!=[]){
AJS.map(_b,function(fn){
fn();
});
}
me.onHide();
if(me.use_fx){
var _d=me.overlay;
AJS.fx.fadeOut(me.overlay,{onComplete:function(){
AJS.removeElement(_d);
_d=null;
},duration:300});
AJS.removeElement(me.g_window);
}else{
AJS.removeElement(me.g_window,me.overlay);
}
me.removeFrame();
AJS.REV(window,"scroll",_GB_setOverlayDimension);
AJS.REV(window,"resize",_GB_update);
var _e=[AJS.$bytc("object"),AJS.$bytc("select")];
AJS.map(AJS.flattenList(_e),function(_f){
_f.style.visibility="visible";
});
GB_CURRENT=null;
if(me.reload_on_close){
window.location.reload();
}
if(AJS.isFunction(cb)){
cb();
}
},10);
},update:function(){
this.setOverlayDimension();
this.setFrameSize();
this.setWindowPosition();
},createElements:function(){
this.initOverlay();
this.g_window=AJS.DIV({"id":"GB_window"});
AJS.hideElement(this.g_window);
AJS.getBody().insertBefore(this.g_window,this.overlay.nextSibling);
this.initFrame();
this.initHook();
this.update();
var me=this;
if(this.use_fx){
AJS.fx.fadeIn(this.overlay,{duration:300,to:0.7,onComplete:function(){
me.onShow();
AJS.showElement(me.g_window);
me.startLoading();
}});
}else{
AJS.setOpacity(this.overlay,0.7);
AJS.showElement(this.g_window);
this.onShow();
this.startLoading();
}
AJS.AEV(window,"scroll",_GB_setOverlayDimension);
AJS.AEV(window,"resize",_GB_update);
},removeFrame:function(){
try{
AJS.removeElement(this.iframe);
}
catch(e){
}
this.iframe=null;
},startLoading:function(){
if ( this.src_loader.indexOf("?") > 0 ) { this.iframe.src
=this.src_loader+"&amp;s="+this.salt++;
} else { this.iframe.src
=this.src_loader+"?s="+this.salt++; }
AJS.showElement(this.iframe);
},setOverlayDimension:function(){
var _11=AJS.getWindowSize();
if(AJS.isMozilla()||AJS.isOpera()){
AJS.setWidth(this.overlay,"100%");
}else{
AJS.setWidth(this.overlay,_11.w);
}
var _12=Math.max(AJS.getScrollTop()+_11.h,AJS.getScrollTop()+this.height);
if(_12<AJS.getScrollTop()){
AJS.setHeight(this.overlay,_12);
}else{
AJS.setHeight(this.overlay,AJS.getScrollTop()+_11.h);
}
},initOverlay:function(){
this.overlay=AJS.DIV({"id":"GB_overlay"});
if(this.overlay_click_close){
AJS.AEV(this.overlay,"click",GB_hide);
}
AJS.setOpacity(this.overlay,0);
AJS.getBody().insertBefore(this.overlay,AJS.getBody().firstChild);
},initFrame:function(){
if(!this.iframe){
var d={"name":"GB_frame","class":"GB_frame","frameBorder":0};
if(AJS.isIe()){
d.src
="javascript:false;document.write(\"\");";
}
this.iframe=AJS.IFRAME(d);
this.middle_cnt=AJS.DIV({"class":"content"},this.iframe);
this.top_cnt=AJS.DIV();
this.bottom_cnt=AJS.DIV();
AJS.ACN(this.g_window,this.top_cnt,this.middle_cnt,this.bottom_cnt);
}
},onHide:function(){
},onShow:function(){
},setFrameSize:function(){
},setWindowPosition:function(){
},initHook:function(){
}});
_GB_update=function(){
if(GB_CURRENT){
GB_CURRENT.update();
}
};
_GB_setOverlayDimension=function(){
if(GB_CURRENT){
GB_CURRENT.setOverlayDimension();
}
};
AJS.preloadImages(GB_ROOT_DIR+"/viomatrix/imgs/indicator_864.gif");
script_loaded=true;
var GB_SETS={};
function decoGreyboxLinks(){
var as=AJS.$bytc("a");
AJS.map(as,function(a){
if(a.getAttribute("href")&&a.getAttribute("rel")){
var rel=a.getAttribute("rel");
if(rel.indexOf("gb_")==0){
var _17=rel.match(/\w+/)[0];
var _18=rel.match(/\[(.*)\]/)[1];
var _19=0;
var _1a={"caption":a.title||"","url":a.href};
if(_17=="gb_pageset"||_17=="gb_imageset"){
if(!GB_SETS[_18]){
GB_SETS[_18]=[];
}
GB_SETS[_18].push(_1a);
_19=GB_SETS[_18].length;
}
if(_17=="gb_pageset"){
a.onclick=function(){
GB_showFullScreenSet(GB_SETS[_18],_19);
return false;
};
}
if(_17=="gb_imageset"){
a.onclick=function(){
GB_showImageSet(GB_SETS[_18],_19);
return false;
};
}
if(_17=="gb_image"){
a.onclick=function(){
GB_showImage(_1a.caption,_1a.url);
return false;
};
}
if(_17=="gb_page"){
a.onclick=function(){
var sp=_18.split(/, ?/);
GB_show(_1a.caption,_1a.url,parseInt(sp[1]),parseInt(sp[0]));
return false;
};
}
if(_17=="gb_page_fs"){
a.onclick=function(){
GB_showFullScreen(_1a.caption,_1a.url);
return false;
};
}
if(_17=="gb_page_center"){
a.onclick=function(){
var sp=_18.split(/, ?/);
GB_showCenter(_1a.caption,_1a.url,parseInt(sp[1]),parseInt(sp[0]));
return false;
};
}
}
}
});
}
AJS.AEV(window,"load",decoGreyboxLinks);
GB_showImage=function(_1d,url,_1f){
var _20={width:300,height:300,type:"image",fullscreen:false,center_win:true,caption:_1d,callback_fn:_1f};
var win=new GB_Gallery(_20);
return win.show(url);
};
GB_showPage=function(_22,url,_24){
var _25={type:"page",caption:_22,callback_fn:_24,fullscreen:true,center_win:false};
var win=new GB_Gallery(_25);
return win.show(url);
};
GB_Gallery=GreyBox.extend({init:function(_27){
this.parent({});
this.img_close=this.root_dir+"/viomatrix/imgs/g_close_772.gif";
AJS.update(this,_27);
this.addCallback(this.callback_fn);
},initHook:function(){
AJS.addClass(this.g_window,"GB_Gallery");
var _28=AJS.DIV({"class":"inner"});
this.header=AJS.DIV({"class":"GB_header"},_28);
AJS.setOpacity(this.header,0);
AJS.getBody().insertBefore(this.header,this.overlay.nextSibling);
var _29=AJS.TD({"id":"GB_caption","class":"caption","width":"40%"},this.caption);
var _2a=AJS.TD({"id":"GB_middle","class":"middle","width":"20%"});
var _2b=AJS.IMG({"src":this.img_close});
AJS.AEV(_2b,"click",GB_hide);
var _2c=AJS.TD({"class":"close","width":"40%"},_2b);
var _2d=AJS.TBODY(AJS.TR(_29,_2a,_2c));
var _2e=AJS.TABLE({"cellspacing":"0","cellpadding":0,"border":0},_2d);
AJS.ACN(_28,_2e);
if(this.fullscreen){
AJS.AEV(window,"scroll",AJS.$b(this.setWindowPosition,this));
}else{
AJS.AEV(window,"scroll",AJS.$b(this._setHeaderPos,this));
}
},setFrameSize:function(){
var _2f=this.overlay.offsetWidth;
var _30=AJS.getWindowSize();
if(this.fullscreen){
this.width=_2f-40;
this.height=_30.h-80;
}
AJS.setWidth(this.iframe,this.width);
AJS.setHeight(this.iframe,this.height);
AJS.setWidth(this.header,_2f);
},_setHeaderPos:function(){
AJS.setTop(this.header,AJS.getScrollTop()+10);
},setWindowPosition:function(){
var _31=this.overlay.offsetWidth;
var _32=AJS.getWindowSize();
AJS.setLeft(this.g_window,((_31-50-this.width)/2));
var _33=AJS.getScrollTop()+55;
if(!this.center_win){
AJS.setTop(this.g_window,_33);
}else{
var fl=((_32.h-this.height)/2)+20+AJS.getScrollTop();
if(fl<0){
fl=0;
}
if(_33>fl){
fl=_33;
}
AJS.setTop(this.g_window,fl);
}
this._setHeaderPos();
},onHide:function(){
AJS.removeElement(this.header);
AJS.removeClass(this.g_window,"GB_Gallery");
},onShow:function(){
if(this.use_fx){
AJS.fx.fadeIn(this.header,{to:1});
}else{
AJS.setOpacity(this.header,1);
}
}});
AJS.preloadImages(GB_ROOT_DIR+"/viomatrix/imgs/g_close_772.gif");
GB_showFullScreenSet=function(set,_36,_37){
var _38={type:"page",fullscreen:true,center_win:false};
var _39=new GB_Sets(_38,set);
_39.addCallback(_37);
_39.showSet(_36-1);
return false;
};
GB_showImageSet=function(set,_3b,_3c){
var _3d={type:"image",fullscreen:false,center_win:true,width:300,height:300};
var _3e=new GB_Sets(_3d,set);
_3e.addCallback(_3c);
_3e.showSet(_3b-1);
return false;
};
GB_Sets=GB_Gallery.extend({init:function(_3f,set){
this.parent(_3f);
if(!this.img_next){
this.img_next=this.root_dir+"/viomatrix/imgs/next_556.gif";
}
if(!this.img_prev){
this.img_prev=this.root_dir+"/viomatrix/imgs/prev_527.gif";
}
this.current_set=set;
},showSet:function(_41){
this.current_index=_41;
var _42=this.current_set[this.current_index];
this.show(_42.url);
this._setCaption(_42.caption);
this.btn_prev=AJS.IMG({"class":"left",src:this.img_prev});
this.btn_next=AJS.IMG({"class":"right",src:this.img_next});
AJS.AEV(this.btn_prev,"click",AJS.$b(this.switchPrev,this));
AJS.AEV(this.btn_next,"click",AJS.$b(this.switchNext,this));
GB_STATUS=AJS.SPAN({"class":"GB_navStatus"});
AJS.ACN(AJS.$("GB_middle"),this.btn_prev,GB_STATUS,this.btn_next);
this.updateStatus();
},updateStatus:function(){
AJS.setHTML(GB_STATUS,(this.current_index+1)+" / "+this.current_set.length);
if(this.current_index==0){
AJS.addClass(this.btn_prev,"disabled");
}else{
AJS.removeClass(this.btn_prev,"disabled");
}
if(this.current_index==this.current_set.length-1){
AJS.addClass(this.btn_next,"disabled");
}else{
AJS.removeClass(this.btn_next,"disabled");
}
},_setCaption:function(_43){
AJS.setHTML(AJS.$("GB_caption"),_43);
},updateFrame:function(){
var _44=this.current_set[this.current_index];
this._setCaption(_44.caption);
this.url=_44.url;
this.startLoading();
},switchPrev:function(){
if(this.current_index!=0){
this.current_index--;
this.updateFrame();
this.updateStatus();
}
},switchNext:function(){
if(this.current_index!=this.current_set.length-1){
this.current_index++;
this.updateFrame();
this.updateStatus();
}
}});
AJS.AEV(window,"load",function(){
AJS.preloadImages(GB_ROOT_DIR+"/viomatrix/imgs/next_556.gif",GB_ROOT_DIR+"/viomatrix/imgs/prev_527.gif");
});
GB_show=function(_45,url,_47,_48,_49){
var _4a={caption:_45,height:_47||500,width:_48||500,fullscreen:false,callback_fn:_49};
var win=new GB_Window(_4a);
return win.show(url);
};
GB_showCenter=function(_4c,url,_4e,_4f,_50){
var _51={caption:_4c,center_win:true,height:_4e||500,width:_4f||500,fullscreen:false,callback_fn:_50};
var win=new GB_Window(_51);
return win.show(url);
};
GB_showFullScreen=function(_53,url,_55){
var _56={caption:_53,fullscreen:true,callback_fn:_55};
var win=new GB_Window(_56);
return win.show(url);
};
GB_Window=GreyBox.extend({init:function(_58){
this.parent({});
this.img_header=this.root_dir+"/viomatrix/imgs/header_bg_893.gif";
this.img_close=this.root_dir+"/viomatrix/imgs/w_close_967.gif";
this.show_close_img=false;
AJS.update(this,_58);
this.addCallback(this.callback_fn);
},initHook:function(){
AJS.addClass(this.g_window,"GB_Window");
this.header=AJS.TABLE({"class":"header"});
this.header.style.backgroundImage="url("+this.img_header+")";
var _59=AJS.TD({"class":"caption"},this.caption);
var _5a=AJS.TD({"class":"close"});
if(this.show_close_img){
var _5b=AJS.IMG({"src":this.img_close});
var _5c=AJS.SPAN("Close");
var btn=AJS.DIV(_5b,_5c);
AJS.AEV([_5b,_5c],"mouseover",function(){
AJS.addClass(_5c,"on");
});
AJS.AEV([_5b,_5c],"mouseout",function(){
AJS.removeClass(_5c,"on");
});
AJS.AEV([_5b,_5c],"mousedown",function(){
AJS.addClass(_5c,"click");
});
AJS.AEV([_5b,_5c],"mouseup",function(){
AJS.removeClass(_5c,"click");
});
AJS.AEV([_5b,_5c],"click",GB_hide);
AJS.ACN(_5a,btn);
}
tbody_header=AJS.TBODY();
AJS.ACN(tbody_header,AJS.TR(_59,_5a));
AJS.ACN(this.header,tbody_header);
AJS.ACN(this.top_cnt,this.header);
if(this.fullscreen){
AJS.AEV(window,"scroll",AJS.$b(this.setWindowPosition,this));
}
},setFrameSize:function(){
if(this.fullscreen){
var _5e=AJS.getWindowSize();
overlay_h=_5e.h;
this.width=Math.round(this.overlay.offsetWidth-(this.overlay.offsetWidth/100)*10);
this.height=Math.round(overlay_h-(overlay_h/100)*10);
}
AJS.setWidth(this.header,this.width+6);
AJS.setWidth(this.iframe,this.width);
AJS.setHeight(this.iframe,this.height);
},setWindowPosition:function(){
var _5f=AJS.getWindowSize();
AJS.setLeft(this.g_window,((_5f.w-this.width)/2)-13);
if(!this.center_win){
AJS.setTop(this.g_window,AJS.getScrollTop());
}else{
var fl=((_5f.h-this.height)/2)-20+AJS.getScrollTop();
if(fl<0){
fl=0;
}
AJS.setTop(this.g_window,fl);
}
}});
AJS.preloadImages(GB_ROOT_DIR+"/viomatrix/imgs/w_close_967.gif",GB_ROOT_DIR+"/viomatrix/imgs/header_bg_893.gif");


script_loaded=true;





var sajax_debug_mode = false;
var sajax_request_type = "POST";
var sajax_target_id = "";
var sajax_failure_redirect = "";
		
function sajax_debug(text) {
 if (sajax_debug_mode)
 alert(text);
}

function sajax_init_object() {
 sajax_debug("sajax_init_object() called..")
 var A;
 var msxmlhttp = new Array('Msxml2.XMLHTTP.5.0','Msxml2.XMLHTTP.4.0','Msxml2.XMLHTTP.3.0','Msxml2.XMLHTTP','Microsoft.XMLHTTP');
 for (var i = 0; i < msxmlhttp.length; i++) {
  try {
   A = new ActiveXObject(msxmlhttp[i]);
  } catch (e) {
   A = null;
  }
 }
 if(!A && typeof XMLHttpRequest != "undefined")
  A = new XMLHttpRequest();
 if (!A)
  sajax_debug("Could not create connection object.");
 return A;
}
		
var sajax_requests = new Array();
	
function sajax_cancel() {
 for (var i = 0; i < sajax_requests.length; i++) 
  sajax_requests[i].abort();
}

function sajax_do_call(func_name, args) {
 var i, x, n;
 var uri;
 var post_data;
 var target_id;
 var returns;
 sajax_debug("in sajax_do_call().." + sajax_request_type + "/" + sajax_target_id);
 target_id = sajax_target_id;
 if (typeof(sajax_request_type) == "undefined" || sajax_request_type == "") 
  sajax_request_type = "GET";
 uri = "/cgi-bin/vm/vio.matrix";
 
 
  post_data = "rs=" + escape(func_name);
  post_data += "&rst=" + escape(sajax_target_id);
  post_data += "&rsrnd=" + new Date().getTime();
  
  post_data += "&or=1";
  post_data += "&typ=SAJAX%23sajax_response";
  for (i = 0; i < args.length-1; i++) 
   post_data = post_data + "&rsarg"+i+"=" + escape(args[i]);
 

 x = sajax_init_object();

 if (x == null) {
  if (sajax_failure_redirect != "") {
   location.href = sajax_failure_redirect;
   return false;
  } else {
   sajax_debug("NULL sajax object for user agent:\n" + navigator.userAgent);
   return false;
  }
 } else {
  x.open(sajax_request_type, uri, true);
  sajax_requests[sajax_requests.length] = x;
				
  
   x.setRequestHeader("Method", "POST " + uri + " HTTP/1.1");
   x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  

  x.onreadystatechange = function() {
   if (x.readyState != 4) 
    return;

   sajax_debug("received " + x.responseText);

   var status;
   var data;
   var data_pic;
   var txt = x.responseText.replace(/^\s*|\s*$/g,"");
   status = txt.charAt(0);
   data = txt.substring(2);
      var daten = data;
   daten = daten.split("|");
   if(daten.length>1)
    {
            target_id = daten[0].replace(/\"/g, "");
            data = daten[1];
            data_pic = daten[2];
    }

   if (status == "") {
       } else if (status == "-") 
    alert("Error: " + data);
   else {
    if(data_pic && data_pic != "\"") {
	data_pic=data_pic.replace(/\"/,"");
	data2 = "<img sr";
	data2 += "c=\"http://http://www.stoffekontor.de/viomatrix/imgs/" + data_pic + "\" alt=\"\" class=\"hinticon\" />" + data + "<div class=\"antifloat\">&nbsp;</div>";
	data = data2;
    }
    if (target_id != "") {
		var parentElement = document.getElementById(target_id);
	parentElement.innerHTML="";
	var wrappingDiv = document.createElement('div');
	wrappingDiv.innerHTML = data;
	parentElement.appendChild(wrappingDiv);
    }
    else {
     try {
      var callback;
      var extra_data = false;
      if (typeof args[args.length-1] == "object") {
       callback = args[args.length-1].callback;
       extra_data = args[args.length-1].extra_data;
      } else {
       callback = args[args.length-1];
      }
      callback(eval(data), extra_data);
     } catch (e) {
      sajax_debug("Caught error " + e + ": Could not eval " + data );
     }
    }
   }
  }
 }
			
 sajax_debug(func_name + " uri = " + uri + "/post = " + post_data);
 x.send(post_data);
 sajax_debug(func_name + " waiting..");
 delete x;
 return true;
}

function x_sajax_content() {
 sajax_do_call( "sajax_content", x_sajax_content.arguments );
}

function sajax_content(sajax_func,sajax_obj,getid,lang,feld) {
 var searchstring = getid;
 searchstring += "*SJX-SPLT*" + sajax_func;
 searchstring += "*SJX-SPLT*" + sajax_obj;
 searchstring += "*SJX-SPLT*" + lang;
 if(feld)searchstring += "*SJX-SPLT*" + feld;
 
  if ( searchstring != "" ) {
   x_sajax_content( "sajax_content", searchstring, sajax_contentresponse );
  }
 
}

function sajax_contentresponse( data ) {
 document.getElementById(sajax_obj).innerHTML = data; 
}




