var AC_FL_RunContent = 0;
var DetectFlashVer = 0;

/////////////////////// js START from standard.js ///////////////////////
function show(showid) {
  if(document.getElementById)
  	document.getElementById("main_start_over"+showid).style.display = "block";
}

function hidde(hiddeid) {
  if(document.getElementById)
  	document.getElementById("main_start_over"+hiddeid).style.display = "none";
}

function show1(showid) {
  if(document.getElementById)
  	document.getElementById("zeige"+showid).style.display = "block";
  var ges = 1;
}

function hidde1(hiddeid) {
  if(document.getElementById)
  	document.getElementById("zeige"+hiddeid).style.display = "none";
  var ges = 1;
}

function showdiv(showid) {
  if(document.getElementById)
    document.getElementById("hidde"+showid).style.visibility = "visible";
}

function hiddediv(hiddeid) {
  if(document.getElementById)
    document.getElementById("hidde"+hiddeid).style.visibility = "hidden";
}

function zauberervolumen(grundgeb, grundtraffic, megabyte_preis) {
	document.leistung.entgeld_i.value = grundgeb;
	document.leistung.transfer_inkl.value = grundtraffic;
	document.leistung.megabytepreis.value = megabyte_preis;
  document.leistung.onlinezeit_gesamt.value = "";
	document.leistung.onlinezeit.value = "";
}

function zaubererzeit(grundgeb, grundminuten, minuten_preis) {
	document.leistung.entgeld_i.value = grundgeb;
	document.leistung.onlinezeit_inkl.value = grundminuten;
	document.leistung.minutenpreis.value = minuten_preis;
	document.leistung.transfer_gesamt.value  = "";
	document.leistung.traffic.value = "";
}

function machaufscreenshoot(sid) {
	newwin = window.open('http://www.primacom.de/portal/downloads.php?sid="+sid+"', 'pop', 'scrollbars = no, status = no, resizable = yes, toolbar = no, width = 405, height = 405');
	newwin.focus();
}

function machaufnews(sid) {
	newwin = window.open('http://www.primacom.de/portal/portal_news.php?sid="+sid+"', 'pop', 'scrollbars = no, status = no, resizable = yes, toolbar = no, width = 405, height = 405');
	newwin.focus();
}

function machaufsec(sid) {
	newwin=window.open('http://www.primacom.de/portal/warnungen.php?sid="+sid+"', 'pop', 'scrollbars = no, status = no, resizable = yes, toolbar = no, width = 405, height = 405');
	newwin.focus();
}

function machauf(id, type) {
	newwin=window.open('http://www.primacom.de/produkte/primatv/player.php?id="+id+"&type="+type+"', 'pop', 'scrollbars = no, status = no, resizable = yes, toolbar = no, width = 395, height = 305');
	newwin.focus();
}

function primatalk(name, type) {
	newwin=window.open('http://www.primacom.de/produkte/player.php?name="+name+"&type="+type+"', 'pop', 'scrollbars = no, status = no, resizable = yes, toolbar = no, width = 320, height = 305');
	newwin.focus();
}

function popup_stream(kbit) {
	newwin=window.open('http://www.primacom.de/portal/radioblaustream.php?stream=on&audio="+kbit+"', 'pop', 'screenX = 0, screenY = 0, scrollbars = yes, status = no, resizable = yes, toolbar = no, width = 420, height = 360');
	newwin.focus();
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_nbGroup(event, grpName) { //v3.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    if ((nbArr = document[grpName]) != null)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = args[i+1];
      nbArr[nbArr.length] = img;
  } }
}


function internet_rfs_popup() {
  F = window.open("https://my.primacom.net/rfs/rfs.php", "Transitionsdetails", "width=450, height=400, menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes");
}

function thisMovie(movieName) {
  var isIE = navigator.appName.indexOf("Microsoft") != -1;
  return (isIE) ? window[movieName] : document[movieName];
}

function makeCall(what) {
	switch(what) {
		case "phone":
    	thisMovie("triple_play3").showPhone();
      break;
		case "tv":
    	thisMovie("triple_play3").showTV();
      break;
		case "web":
    	thisMovie("triple_play3").showWeb();
      break;
		default:
    	thisMovie("triple_play3").showNothing();
      break;
	}
}

function jsFunc(str) {
	document.inForm.inField.value = "AS > Hello " + str;
}

function trcol_on(trn, col) {
	mbgc = trn.style.backgroundColor;
	trn.style.backgroundColor = col;
}

function trcol_off(trn) {
	trn.style.backgroundColor = mbgc;
}
/////////////////////// js ENDE from standard.js ///////////////////////

/////////////////////// js START from ajax.js ///////////////////////
/******************** Hilfs-Funktionen ********************/
// Debug-Console vorhanden?
if(!window.console)
console = { log: function(msg) {} };


/**
 * this function determines whether the event is the equivalent of the microsoft
 * mouseleave or mouseenter events.
 *
 * http://www.dynamic-tools.net/toolbox/isMouseLeaveOrEnter
 */
function isMouseLeaveOrEnter(e, handler) {
    if (e.type != 'mouseout' && e.type != 'mouseover')
    return false;

    var reltg = e.relatedTarget ?
                    e.relatedTarget :
                    e.type == 'mouseout' ?
                        e.toElement :
                        e.fromElement;

    /* previous line translates to:
    var relatedTarget = e.relatedTarget;
    if(!relatedTarget) {
        if(e.type == 'mouseout') {
            relatedTarget = e.toElement;
        } else {
            relatedTarget = e.fromElement;
        }
    }
    */

    while(reltg && reltg != handler)
    reltg = reltg.parentNode;

    return (reltg != handler);
}

function FadeEffect(element){
       new Effect.Fade(element,
       { duration:1});
   }
   function ShowEffect(element){
       new Effect.Appear(element,
       {duration:1, from:0.0, to:1.0});
   }


/******************************************************************************/

var SuggestBox = Class.create();
SuggestBox.prototype = {

    /**
     * Konstruktor
     */
    initialize: function() {

        //console.log('Args:' + $H(arguments[0]).inspect());

        // Optionen
        this.options = Object.extend({

            field:      null,            // Form-Feld, zu dem die Suggestbox gehört
            options:   $A(),             // Auswahl, die angezeigt werden soll
            className: 'pc_autosuggest', // Klassenname für container-div

            onSelect:   null,            // Callbackfunktion, wenn eine Option gewählt wurde

            singleChoiceAutocomplete: true,      // Feld füllen, wenn nur eine Option?

            threshold: 200              // Keine Anzeige, wenn mehr Optionen

        }, arguments[0] || {});

        // Wenn kein InputField angegeben wurde, macht eine SuggestBox keinen Sinn
        if(!this.options.field)
        return false;

        this.field = $(this.options.field);

        this.lastValue = this.options.lastValue;

        ////console.log()

        // Momentan per Hover oder Cursortasten gewähltes  Element
        this.highlighted = null;

        // ID des div's nach dem Feld benennen
        var containerId = this.field.id + '_autosuggest';

        //console.log('Container ID: ' + containerId);

        // Div erzeugen
        this.container = $(document.createElement('div'));
        this.container.id = containerId;

        // Klassenname setzen
        this.container.addClassName(this.options.className);

        // Default-Styles
        this.container.setStyle({
            display:  'none',
            position: 'absolute',
            /*width:    this.field.getStyle('width'),*/
            overflow: 'auto'
        });

        ////console.log('insert into dom');
        document.body.appendChild(this.container);

        // Container auf Pos. des Formfelds setzen
        // (y-offset: Höhe des Feldes, damit Feld noch zu sehen ist u. das Ganze nach Dropdown aussieht)
        new Position.clone(this.field, this.container, {
            setWidth:  true,
            setHeight: false,
            offsetTop: this.field.getHeight()
        });

        //console.log('set up event handlers');

        /***** Event-Handling *****/
        // Container verstecken, wenn Klick außerhalb
        $(document).observe('click', function(event) {
            if(!isMouseLeaveOrEnter(event, this.container))
            FadeEffect(containerId);
        }.bind(this));



        // Keyup's:
        // (aus irgendeinem Grund frißt IE (6?) Up/Down nicht als Keypress, sonder keyup/down)
        //
        // Up-Down: nächstes/vorheriges El. auswählen
        this.field.observe('keyup', function(event) {

            var listElements = [];

            if(this.container.descendants() && this.container.descendants().length > 0)
            listElements = this.container.descendants()[0].descendants();

            // Down -> nächste Opt oder 1., wenn vorher keine oder letzte
            if(event.keyCode == Event.KEY_DOWN) {
                //console.log('KeyDown');

               if(!this.highlighted || this.highlighted == listElements[listElements.length - 1]) {
                   this.highlighted = listElements[0];
               } else {
                   this.highlighted = this.highlighted.next();
               }

               this.setHighlight();
               return;
            }

            // Up -> vorherige
            else if(event.keyCode == Event.KEY_UP) {

                if(!this.highlighted || this.highlighted == listElements[0]) {
                   this.highlighted = listElements[listElements.length - 1];
               } else {
                   this.highlighted = this.highlighted.previous();
               }

               this.setHighlight();
               return;
            }

        }.bind(this));

        // Keypresses
        // (und Return frißt er nicht als keyup/down)
        // Return: ausgewähltes El. wählen
        // Esc.: abbrechen
        this.field.observe('keypress', function(event) {

            if(event.keyCode == Event.KEY_ESC) {
                this.container.hide();
                return;
            }

            // Return -> auswählen
            else if(event.keyCode == Event.KEY_RETURN || event.keyCode == Event.KEY_TAB) {

                if(this.highlighted) {
                    this.select(this.field, this.highlighted.innerHTML);
                    this.highlighted = null;
                }

                this.hide();

                // Wenn Return, Eventpropagation stoppen, sonst wird Formular abgeschickt
                if(event.keyCode == Event.KEY_RETURN)
                Event.stop(event);

                return;
           }


        }.bind(this));

        this.field.observe('focus', function(event) {

            if(this.options.options.length >= 2 && $F(this.field).length >= 2)
            this.show();

        }.bind(this));

        /*
        this.field.observe('blur', function(event) {

            this.hide();

        }.bind(this));
        */

        this.updateOptions(this.options.options);
    },

    select: function(field, value) {
        $(field).value = value;

        this.lastSelectedValue = value;

        if(this.options.onSelect)
        this.options.onSelect(this.field, $F(this.field));
    },

    /**
     * Optionen, die in der Box erscheinen sollen, setzen
     */
    updateOptions: function(options) {

        //console.log('Update options');

        this.options.options = $A(options);

        ////console.log('Options:' + this.options.options.inspect());

        // Wenn keine oder mehr als 200 Optionen, kein Suggest
        if(this.options.options.length == 0
           || (this.options.threshold != null && this.options.options.length > this.options.threshold)) {

            //console.log('Above threshold (' + this.options.threshold + ')');

            this.hide();
            return;
        }

        // Wenn nur eine Option, diese direkt ins Feld eintragen & Container verstecken
        if(this.options.options.length == 1 && this.options.singleChoiceAutocomplete) {

            //console.log('LastVal:' + this.lastValue);

            if(this.lastValue != this.options.options[0]) {
                this.field.value = this.options.options[0];
                this.lastValue   = this.options.options[0];
            }

            this.hide();
            return;
        }

        // Wenn Inhalt seit letzter Auswhl niicht geändert -> Box nicht anzeigen
        if(this.lastSelectedValue && this.field.value == this.lastSelectedValue) {
            this.hide();
            return;
        }

        // Sonst Liste aufbauen und im Container zeigen
        this.populateContainer();

        this.show();
    },

    /**
     * Liste mit den anzuizeigenden Optionen aufbauen
     */
    populateContainer: function() {

        ////console.log('populateContainer');

        // Erstmal leermachen
        this.container.innerHTML = '';

        // Liste erzeugen
        this.list = $(document.createElement('ul'));
        this.list.addClassName('autosuggest_list');

        // Listeninhalte erzeugen
        this.options.options.each(function(opt) {

            var listElement = $(document.createElement('li'));
            listElement.setStyle({ cursor: 'pointer' });
            listElement.addClassName('autosuggest_element');
            listElement.innerHTML = opt;

            ////console.log('click 4 li');

            // Bei Klick wird dieses Element ausgewählt
            listElement.observe('click', function() {
                //console.log('set val to: ' + opt);

                this.select(this.field, opt);
                this.field.value = opt;
                this.hide();
            }.bind(this));

            Event.observe(listElement, 'mouseover', function(event) {

                this.highlighted = Event.element(event);
                this.setHighlight();

            }.bind(this));

            this.list.appendChild(listElement);
        }.bind(this));

        this.container.appendChild(this.list);
        this.highlighted = null;
    },

    /**
     *
     */
    show: function() {
        if(this.container) {
            //this.populateContainer();
            //this.container.show();
            ShowEffect(this.container);
        }
    },

    /**
     *
     */
    hide: function() {
        if(this.container) {
        //this.container.hide();
        FadeEffect(this.container);
        }
    },

    /**
     *
     */
    setHighlight: function() {

        ////console.log('Selected: ' + this.highlighted.innerHTML)

        $$('#'+this.container.id+' ul li').each(function(element) {

            if(element == this.highlighted) {
                element.addClassName('highlight');
            } else {
                element.removeClassName('highlight');
            }

        }.bind(this));

        var containerHeight    = this.container.getHeight();
        var borderTopWidth     = parseInt(this.container.getStyle('border-top-width').sub('px', ''));
        var borderBottomWidth  = parseInt(this.container.getStyle('border-bottom-width').sub('px', ''));

        var pad = borderTopWidth + borderBottomWidth + 1;
        var containerNettoHeight = containerHeight - pad;

        var elementOffset = Position.positionedOffset(this.highlighted)[1];
        var elementHeight = this.highlighted.getHeight();

        if(this.highlighted == $$('#'+this.container.id+' ul li').first()) {
            this.container.scrollTop = 0;
        }

        else if(this.highlighted == $$('#'+this.container.id+' ul li').last()) {
            this.container.scrollTop = this.container.getHeight();
        }

        else if(elementOffset >= containerNettoHeight) {
            this.container.scrollTop += elementHeight;
        }

        else if(elementOffset < (this.container.scrollTop - elementHeight)) {
            this.container.scrollTop -= elementHeight;
        }
    }
};

/******************************************************************************/

/**
 *
 */
var Verfuegbarkeit = Class.create();

// Static members
Verfuegbarkeit.selectTemplate =   '<select name="#{name}" id="#{id}" class="#{classes}">#{content}</select>';
Verfuegbarkeit.optionTemplate =    '<option value="#{value}">#{text}</option>';
Verfuegbarkeit.textinputTemplate = '<input type="text" class=#{classes}" name="#{name}" id="#{id}" value="#{value}" />';

Verfuegbarkeit.prototype = {

    /**
     *
     */
    initialize: function() {

        //console.log('Verfuegbarkeit.initialize()');


        this.options = Object.extend({

            formId:        null,
            inputClass:    null,
            inputIdPrefix: null,
            requestUrl:    null

        }, arguments[0] || {})

        this.fields     = {};
        this.fieldsById = {};

        this.inFocus = null;

        this.suggestBoxes = {};

        //console.log($(this.options.formId).inspect());

        $$('input').each(function(field) {

            if(!field.id)
            return;

            if((field.id).substr(0, this.options.inputIdPrefix.length) != this.options.inputIdPrefix)
            return;

            if(field.type == 'hidden')
            return;

            field = $(field);

            var fieldName = field.id.substr(this.options.inputIdPrefix.length);

            //console.log('Setup array for ' + fieldName);

            var fieldArray = {
                id:           field.id,
                fieldName:    fieldName,
                defaultValue: $F(field.id+'_default'),
                initialValue: $F(field),
                lastValue:    $F(field),
                filled:       false
            };

            this.fields[fieldName]    = fieldArray;
            this.fieldsById[field.id] = fieldArray;

            // Kein Autcomplete für Hausnummer

            //console.log('Setup events');

            // Focus auf Feld überwachen, bei Erstklick Inhalt löschen
            field.observe('focus', function() {
                this.inFocus = fieldName;

                if($F(field) == this.fields[fieldName]['defaultValue'])
                field.value = '';

                this.checkField(field, null);

            }.bind(this));

            // Blur überwachen, wenn nach Verlassen leer, wieder mit Default füllen
            field.observe('blur', function() {

                if($F(field).strip() == '')
                field.value = this.fields[fieldName]['defaultValue'];

            }.bind(this));

            // Browser-eigenes autocomplete abschalten
            field.setAttribute("autocomplete", "off");

            // Feldinhalt überwachen (nicht nummer)
            if(fieldName != 'nr')
            new Form.Element.Observer(field, 0.3, this.checkField.bind(this));
        }.bind(this));
    },

    /**
     * Wird aufgerufen, wenn ein Feldinhalt verändert wurde
     * Prüft, ob der eingegebene Wert gültig ist
     */
    checkField: function(element, value) {
        ////console.log('CheckField');

        if(this.fieldsById[element.id]['name'] == 'nr')
        return;

        // Im Zweifel das Feld anhand der ID holen
        var field = null;
        if(element.id) {
            field = $(element.id);
        } else {
            field = $(element);
        }

        // Nr nicht checke

        //console.log('checkFeld ' + field.inspect());

        // und den gelieferten Wert mit dem aktuellen überchreiben
        value = $F(field);

        var fieldName = field.id.substr(this.options.inputIdPrefix.length);

        // Wert geändert?
        if(value == this.fields[fieldName]['lastValue'])
        return;


        // Wert(e) prüfen
        // (nur grundsätzliches Zeug)

        // Ort - egal, solange nicht leer
        //if(fieldName == 'ort') {
        //    if($F(field).strip() == '')
        //    return;
        //}

        // Wert merken
        this.fields[fieldName]['lastValue'] = value;

        if(this.inFocus == fieldName && this.checkIsRequestable())
        this.fireRequest();
    },

    /**
     *
     */
    checkIsRequestable: function() {

        // PLZ
        if(this.inFocus == 'plz') {

            //console.log('Check plz');

            // Wenn Ort leer & PLZ vollständig: Sprung nach Ort,
            // aber keinen Request absetzen
            if(this.fields['plz']['lastValue'].length == 5
            	&& this.fields['plz']['lastValue'] != ''
               && this.fields['plz']['lastValue'] != this.fields['plz']['defaultValue']) {

                // Autofokus hat Nebeneffekt, erstmal aus
                FadeEffect($(this.fields['plz']['id']+'_autosuggest'));
                if(this.fields['ort']['lastValue'] == this.fields['ort']['defaultValue'])
                	$(this.fields['ort']['id']).focus();
                else if(this.fields['ort']['lastValue'] != this.fields['ort']['defaultValue'])
                	$(this.fields['strasse']['id']).focus();
                return true;
            }

            // Wenn Ort nicht leer, PLZ aber schon: Suche nach PLZ über Ort
            if(this.fields['ort']['lastValue'] != ''
               && this.fields['ort']['lastValue'] != this.fields['ort']['defaultValue']) {
                //console.log('PLZsuche')
                return true;
            }

            /*
            ret = (this.fields['plz']['lastValue'].length == 5);

            if(ret)
            this.fields['plz']['filled'] = true;

            return ret;
            */
            return (this.fields['plz']['lastValue'].strip() != ''
                    && this.fields['plz']['lastValue'] != this.fields['plz']['defaultValue']
                    && this.fields['plz']['lastValue'].strip().length >= 2);
        }


        // Ort
        if(this.inFocus == 'ort') {

            //console.log('Check ort');

            // Wenn PLZ gesetzt: Suche PLZ->Ort
            if(this.fields['plz']['lastValue'].length == 5) {
                return true;
            }

             // todo onselect ort from list click select what ever autofocus set to strasse
            //$(this.fields['ort']['id']+'_autosuggest').observe('click', function() {
            //if(this.fields['ort']['id'].clicked == true) {
            //FadeEffect($(this.fields['ort']['id']+'_autosuggest'));
            //$(this.fields['strasse']['id']).focus();
            //return true;
            //}
            //}.bind(this));

            // mind. 2 Zeichen
            return (this.fields['ort']['lastValue'].strip() != ''
                    && this.fields['ort']['lastValue'] != this.fields['ort']['defaultValue']
                    && this.fields['ort']['lastValue'].strip().length >= 2);

        }

        // Straße -> mind. 2 Zeichen
        if(this.inFocus == 'strasse') {
            return (this.fields['strasse']['lastValue'].strip() != '' // nicht leer
                    && this.fields['strasse']['lastValue'] != this.fields['strasse']['defaultValue']  // nicht default
                    && this.fields['strasse']['lastValue'].strip().length >= 2); //
        }

        // Hausnummer -> PLZ, Ort, Strasse müssen ausgefüllt sein
        if(this.inFocus == 'nr') {

            return (this.fields['plz']['lastValue'].strip() != ''
                    && this.fields['ort']['lastValue'].strip() != ''
                    && this.fields['strasse']['lastValue'].strip() != '');

        }

        return false;
    },

    /**
     *
     */
    fireRequest: function() {

        //console.log('fireRequest');

        // Construct request
        var request = { focus: this.inFocus };

        $H(this.fields).keys().each(function(fieldName) {

            var fieldId = (this.fields[fieldName]['id']);

            var value = $F(fieldId);

            if(value == this.fields[fieldName]['defaultValue'])
            value = '';

            request[fieldName] = value;

        }.bind(this));

        //console.log('Request: ' + $H(request).inspect());

        this.lastRequest = new Ajax.Request(this.options.requestUrl, {
            method:       'post',
            parameters:   request,
            evalJSON:     true,
            sanitizeJSON: true,

            onSuccess:    this.handleResponse.bind(this)
        });
    },

    /**
     *
     */
    handleResponse: function(t, json) {

        if(t.request != this.lastRequest) {
            //console.log('Dump response');
            return;
        }

        eval('response=' + t.responseText);

        //console.log('Response: ' + $H(response).inspect());

        // Fokus in PLZ
        if(response['focus'] == 'plz') {

            if(this.fields['ort'].lastValue.strip() != '') {
                this.createSuggestbox(this.fields['plz']['id'], response['plz']);
            }

            return;
        }

        if(response['focus'] == 'strasse') {
            this.createSuggestbox(this.fields['strasse']['id'], response['strasse']);

            if(response['strasse'].length == 1
                && ($F(this.fields['strasse']['id']) != this.fields['strasse']['defaultValue']
                    && $F(this.fields['strasse']['id']).strip() != '')) {
            FadeEffect($(this.fields['strasse']['id']+'_autosuggest'));
            $(this.fields['nr']['id']).focus();
            }

            return;
        }

        if(response['focus'] == 'ort') {

            this.createSuggestbox(this.fields['ort']['id'], response['ort']);

            if(response['ort'].length == 1
                && ($F(this.fields['ort']['id']) != this.fields['ort']['defaultValue']
                    && $F(this.fields['ort']['id']).strip() != '')) {
            FadeEffect($(this.fields['ort']['id']+'_autosuggest'));
            $(this.fields['strasse']['id']).focus();
            }
            //if(response['ort'].length == 1
                //&& ($F(this.fields['plz']['id']) == this.fields['plz']['defaultValue']
                    //|| $F(this.fields['plz']['id']).strip() == '')) {

                //console.log('1 Ort, filling plz');

                //this.createSuggestbox(this.fields['plz']['id'], response['plz']);

                //if(response['plz'].length > 1)
                //$(this.fields['plz']['id']).focus();
            //}

            return;
        }

        if(response['focus'] == 'nr') {

            if(response['nr'].length == 1) {
                $(this.fields['nr']['id']).value = response['nr'][0]
            } else {
                this.createSuggestbox(this.fields['nr']['id'], response['nr']);
            }
        }
    },

    createTextField: function(fieldId, value) {

        var currentField = $(fieldId);

        if(!currentField)
        return false;

        if(currentField.tagName.toLowerCase() == 'input' && currentField.getAttribute('type') == 'text') {

            currentField.value = value;

        } else {

            currentField.replace(new Template(Verfuegbarkeit.textinputTemplate).evaluate({
                name:    currentField.getAttribute('name'),
                id:      fieldId,
                value:   value,
                classes: $A(currentField.classNames()).join(' ')
            }));
        }
    },

    /**
     *
     */
    createDropdown: function(fieldId, opts) {

        // Momentanes Feld holen
        var currentField = $(fieldId);

        if(!currentField)
        return false;

        var options = $A();
        opts.each(function(opt) {
            options.push(new Template(Verfuegbarkeit.optionTemplate).evaluate({
                value: opt,
                text:  opt
            }));
        });

        if(currentField.tagName.toLowerCase() == 'select') {

            currentField.update(options.join(' '));

        } else {

            // Altes gegen neues Feld austauschen
            currentField.replace(new Template(Verfuegbarkeit.selectTemplate).evaluate({
                name:    currentField.getAttribute('name'),
                id:      fieldId,
                classes: $A(currentField.classNames()).join(' '),
                content: options.join(' ')
            }));
        }
    },

    /**
     *
     */
    createSuggestbox: function(fieldId, suggestions) {

        var field = $(fieldId);

        if(this.suggestBoxes[fieldId]) {

            //console.log('reuse sb');

            var box =  this.suggestBoxes[fieldId];
            box.updateOptions(suggestions);

        } else {

            //console.log('new sb');
            //console.log('Suggestions: ' + $A(suggestions).inspect());
            //console.log('initVal: ' + this.fieldsById[fieldId]['initialValue']);

            // Wenn PLZ, keine maximale Anzahl
            //var threshold = (this.fields['plz']['id'] == fieldId) ? null : 200;

            this.suggestBoxes[fieldId] = new SuggestBox({
                field:     field,
                options:   suggestions,
                lastValue: this.fieldsById[fieldId]['initialValue']/*,

                onSelect: function(field, value) { console.log('onSelect ' + $(field).inspect() +': ' + value );}*/
            });
        }
    }
};

/////////////////////// js ENDE from ajax.js ///////////////////////

/////////////////////// js START from blurlink.js ///////////////////////
var browserName = navigator.appName;
var browserVer = parseInt(navigator.appVersion);
var version = "";
var msie4 = (browserName == "Microsoft Internet Explorer" && browserVer >= 4);
if((browserName == "Netscape" && browserVer >= 3) || msie4 || browserName == "Konqueror" || browserName == "Opera") {
	version = "n3";
}
else {
	version = "n2";
}

function blurLink(theObject) {
	if(msie4)	{
		theObject.blur();
	}
}
/////////////////////// js ENDE from blurlink.js ///////////////////////

/////////////////////// js START from alttxt.js ///////////////////////
/*********************************************************************************************

ALTTXT V1.6
BY: BRIAN GOSSELIN OF SCRIPTASYLUM.COM

INSTRUCTIONS:

1: PUT THESE DIVS IN THE END OF THE BODY AREA:

   <div id="navtxt" class="navtext" style="visibility:hidden; position:absolute; top:0px; left:-400px; z-index:10000; padding:10px"></div>

2: NEXT, PLACE THIS STYLE DECLARATION IN THE HEAD SECTION OF YOUR PAGE (JUST CHANGE YOUR SETTINGS):

   .navtext {
   width:235px;
   font-size:8pt;
   font-family:verdana;
   border-width:2px;
   border-style:outset;
   border-color:#006BAE;
   layer-background-color:#FFF6D9;
   background-color:#FFF6D9;
   color:black;
   }

3: THEN, SET THE 6 SETTINGS BELOW ( dofade, centertext, xoffset, yoffset, mousefollow, and hideDelay ) AS DESIRED.

4: LASTLY ADD THE MOUSEOVER/MOUSEOUT EVENT HANDLERS TO EACH LINK THAT YOU WANT THIS EFFECT FOR:

     EXAMPLE: <a href="scriptasylum.com" onmouseover="writetxt(  'Popup text')" onmouseout="writetxt(0)">Link text</a>

NOTES:

  > YOU CAN CAUSE A BOX *NOT* TO DISAPPEAR ONCE THE MOUSE LEAVES THE LINK BY SIMPLY OMITTING THE
    onmouseout="writetxt(0)" PART. THIS WILL CAUSE THE CURRENT BOX TO REMAIN VISIBLE. THIS IS BEST
    USED WHEN mousefollow MODE IS DISABLED (SET TO false).

  > YOU CAN SET THE PADDING STYLE ATTRIBUTE *ONLY* IN THE navtxt DIV ITSELF AND *NOT* IN THE STYLE
    SHEET AT THE TOP OF THE PAGE. OTHERWISE NS4 DISPLAYS SOME WEIRD BEHAVIOR. ALSO, THE PADDING ATTRIBUTE
    ONLY HAS AN EFFECT IN IE4+ AND NS6+.

*********************************************************************************************/

var dofade=false;       // ENABLES FADE-IN EFFECT (FOR IE4+ AND NS6 ONLY)

var centertext=false;  // CENTERS THE TEXT INSIDE THE BOX. YOU CAN'T SIMPLY DO THIS VIA "STYLE" BECAUSE OF NS4.
                       // OTHERWISE, TEXT IS LEFT-JUSTIFIED.

var xoffset=9;         // HORIZONTAL PIXEL COUNT FROM CURSOR

var yoffset=30;        // VERTICAL PIXEL COUNT FROM CURSOR

var mousefollow=false; // ENABLES MOUSE FOLLOW MODE WHERE THE BOX CONTINUES TO FOLLOW THE MOUSE. SET TO false TO
                       // LOCK THE BOX WHEREVER IT INITIALLY APPEARS.

var hideDelay=200;     // DELAY IN MILLISECONDS ( 1 SECOND = 1000 MILLISECONDS) FROM WHEN YOU HOVER OUT OF LINK
                       // AND THE BOX DISAPPEARS ONLY WHEN "mousefollow" IS SET TO "false".
                       // THIS WILL GIVE THE USER TIME TO CLICK A LINK OR WHATEVER IN THE BOX BEFORE IT DISAPPEARS.

////////////////////////////// NO NEED TO EDIT BEYOND THIS POINT //////////////////////////////////////

function altProps(){
this.w3c=(document.getElementById)?true:false;
this.ns4=(document.layers)?true:false;
this.ie4=(document.all && !this.w3c)?true:false;
this.ie5=(document.all && this.w3c)?true:false;
this.ns6=(this.w3c && navigator.appName.indexOf("Netscape")>=0 )?true:false;
this.w_y=0;
this.w_x=0;
this.navtxt=null;
this.boxheight=0;
this.boxwidth=0;
this.ishover=false;
this.ieop=0;
this.op_id=0;
this.oktomove=false;
this.dy=0;
}

var AT=new altProps();

function toggle_centertext(){
centertext=!centertext;
}

function toggle_mousefollow(){
mousefollow=!mousefollow;
}

function toggle_dofade(){
dofade=!dofade;
if(!dofade)AT.ieop=100;
}


function getwindowdims(){
AT.w_y=(AT.ie5||AT.ie4)?document.body.clientHeight:window.innerHeight;
AT.w_x=(AT.ie5||AT.ie4)?document.body.clientWidth:window.innerWidth;
}

function getboxwidth(){
if(AT.ns4)AT.boxwidth=(AT.navtxt.document.width)? AT.navtxt.document.width : AT.navtxt.clip.width;
else if(AT.ie4)AT.boxwidth=(AT.navtxt.style.pixelWidth)? AT.navtxt.style.pixelWidth : AT.navtxt.offsetWidth;
else AT.boxwidth=(AT.navtxt.style.width)? parseInt(AT.navtxt.style.width) : parseInt(AT.navtxt.offsetWidth);
}

function getboxheight(){
if(AT.ns4)AT.boxheight=(AT.navtxt.document.height)? AT.navtxt.document.height : AT.navtxt.clip.height;
else if(AT.ie4)AT.boxheight=(AT.navtxt.style.pixelHeight)? AT.navtxt.style.pixelHeight : AT.navtxt.offsetHeight;
else AT.boxheight=parseInt(AT.navtxt.offsetHeight);
}

function movenavtxt(x,y){
if(AT.ns4)AT.navtxt.moveTo(x,y);
else{
AT.navtxt.style.left=x+'px';
AT.navtxt.style.top=y+'px';
}}

function getpagescrolly(){
if(AT.ie5||AT.ie4)return document.body.scrollTop;
else return window.pageYOffset;
}

function getpagescrollx(){
if(AT.ie5||AT.ie4)return document.body.scrollLeft;
else return window.pageXOffset;
}

function writeindiv(text){
if(AT.ns4){
AT.navtxt.document.open();
AT.navtxt.document.write(text);
AT.navtxt.document.close();
}
else AT.navtxt.innerHTML=text;
}

function writetxt(text){
if(dofade && (AT.ie4||AT.w3c))clearInterval(AT.op_id);
if(text!=0){
if(!mousefollow)clearTimeout(AT.dy);
AT.oktomove=true;
AT.ishover=true;
if(AT.ns4)text='<div class="navtext">"+((centertext)?"<center>":"")+text+((centertext)?"</center>":"")+"</div>';
if(AT.w3c||AT.ie4)AT.navtxt.style.textAlign=(centertext)?"center":"left";
writeindiv(text);
if(AT.ns4)AT.navtxt.visibility="show";
else{
AT.navtxt.style.visibility="visible";
AT.navtxt.style.display="block";
}
getboxheight();
if((AT.w3c||AT.ie4) && dofade){
if(AT.ie4||AT.ie5)AT.navtxt.style.filter="alpha(opacity=0)";
if(AT.ns6)AT.navtxt.style.MozOpacity=0;
AT.ieop=0;
AT.op_id=setInterval('incropacity()',50);
}}else{
if(mousefollow)hideAlttxt();
else AT.dy=setTimeout('hideAlttxt()',hideDelay);
}}

function hideAlttxt(){
if(AT.ns4)AT.navtxt.visibility="hide";
else{
AT.navtxt.style.display="none";
AT.navtxt.style.visibility="hidden";
}
movenavtxt(-AT.boxwidth-10,0);
writeindiv('');
}

function incropacity(){
if(AT.ieop<=100){
AT.ieop+=7;
if(AT.ie4||AT.ie5)AT.navtxt.style.filter="alpha(opacity="+AT.ieop+")";
if(AT.ns6)AT.navtxt.style.MozOpacity=AT.ieop/100;
}else clearInterval(AT.op_id);
}

function moveobj(evt){
mx=(AT.ie5||AT.ie4)?event.clientX:evt.pageX;
my=(AT.ie5||AT.ie4)?event.clientY:evt.pageY;
if(AT.ishover && AT.oktomove){
margin=(AT.ie4||AT.ie5)?5:25;
if(AT.ns6)if(document.height+27-window.innerHeight<0)margin=15;
if(AT.ns4)if(document.height-window.innerHeight<0)margin=10;
if(AT.ns4||AT.ns6)mx-=getpagescrollx();
if(AT.ns4)my-=getpagescrolly();
xoff=mx+xoffset;
yoff=(my+AT.boxheight+yoffset-((AT.ns6)?getpagescrolly():0)>=AT.w_y)? -5-AT.boxheight-yoffset: yoffset;
movenavtxt( Math.min(AT.w_x-AT.boxwidth-margin , Math.max(2,xoff))+getpagescrollx(), my+yoff+((!AT.ns6)?getpagescrolly():0));
if(!mousefollow)AT.oktomove=false;
}}


window.onload=function(){
  AT.navtxt=(AT.ns4)?document.layers['navtxt']:(AT.ie4)?document.all['navtxt']:(AT.w3c)?document.getElementById('navtxt'):null;
  getboxwidth();
  getboxheight();
  getwindowdims();
  if(AT.ie4||AT.ie5&&dofade)AT.navtxt.style.filter="alpha(opacity=100)";
  AT.navtxt.onmouseover=function(){
  if(!mousefollow)clearTimeout(AT.dy);
  }
  AT.navtxt.onmouseout=function(){
  if(!mousefollow)AT.dy=setTimeout('hideAlttxt()',hideDelay);
  }
  if(AT.ns4)document.captureEvents(Event.MOUSEMOVE);
  document.onmousemove=moveobj;
  window.onresize=getwindowdims;
}
/////////////////////// js ENDE from alttxt.js ///////////////////////

/////////////////////// js START from AC_RunActiveContent.js ///////////////////////
//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
var isFirefox = (navigator.userAgent.indexOf("Firefox") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");

			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful.

			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}

	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;

	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?');
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs)
{
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
else if(!isOpera && !isFirefox)
	{
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
	}
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }

  document.write(str);
}

function AC_FL_RunContent(){
  var ret =
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret =
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();

    switch (currArg){
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace":
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "allowScriptAccess":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

/////////////////////// js ENDE from AC_RunActiveContent.js ///////////////////////

/////////////////////// js START from swfobject.js ///////////////////////
/**
 * SWFObject v1.4.2: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
 *   legal reasons.
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){
if(!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){_16.push(key+"="+_18[key]);}
return _16;
},getSWFHTML:function(){
var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){_19+=key+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}
_19+="/>";
}else{if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _1d=this.getParams();
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}
_19+="</object>";}
return _19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();
return true;
}else{
if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(){
var _23=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{
try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
catch(e){try{
var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
_23=new deconcept.PlayerVersion([6,0,21]);
axo.AllowScriptAccess="always";}
catch(e){
if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
catch(e){}}
if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return _23;};
deconcept.PlayerVersion=function(_27){
this.major=_27[0]!=null?parseInt(_27[0]):0;
this.minor=_27[1]!=null?parseInt(_27[1]):0;
this.rev=_27[2]!=null?parseInt(_27[2]):0;
};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){return false;}
return true;
};
deconcept.util={getRequestParameter:function(_29){
var q=document.location.search||document.location.hash;
if(q){
var _2b=q.substring(1).split("&");
for(var i=0;i<_2b.length;i++){
if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){
return _2b[i].substring((_2b[i].indexOf("=")+1));}}}
return "";}};
deconcept.SWFObjectUtil.cleanupSWFs=function(){
var _2d=document.getElementsByTagName("OBJECT");
for(var i=0;i<_2d.length;i++){
_2d[i].style.display="none";
for(var x in _2d[i]){if(typeof _2d[i][x]=="function"){_2d[i][x]=null;}}}};
if(typeof window.onunload=="function"){
var oldunload=window.onunload;
window.onunload=function(){
deconcept.SWFObjectUtil.cleanupSWFs();
oldunload();};
}else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}
if(Array.prototype.push==null){
Array.prototype.push=function(_30){
this[this.length]=_30;
return this.length;};}

var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject; // for legacy support
var SWFObject=deconcept.SWFObject;
/////////////////////// js ENDE from swfobject.js ///////////////////////