
    //
    var image_dir = "img/";
	if(window.event) {window.event.cancelBubble = true;}
    // what to do when page is loaded
    //
    function localstart () {
        set_multi_image_teaser_event_handler ();
        set_use_first_ahref_event_handler ();
        set_z_index (700);
        set_gallery_borders ();
        //set_subteaserbox_event_handler();
        pngreplace ();
				set_rating_list_event_handler();
				set_headlinelist_event_handler();
				set_exchange_teaser_event_handler();
				start_homepic_rotation();
				get_bg();
    }

	//prepare exchange teaser and call the mouseover event of the first LI item

	function set_exchange_teaser_event_handler() {
        var div =  $cn ("div", "exchange-teaser");
        for (var i = 0; i < div.length; i++) {
			var li = div[i].getElementsByTagName('ul')[0].getElementsByTagName('li')[0];
			li.className = 'active';
			li.onmouseover.call(li);
        }
    }

	function show_teaser(el, id) {
		var li = el.parentNode.getElementsByTagName('li');
		var div = document.getElementById(id);
		var div_arr = div.parentNode.getElementsByTagName('div');

		for ( i=0; i < li.length; i++) {
			li[i].className = el == li[i] ? li[i].className = 'active' : '';
		}

		for ( j=0; j < div_arr.length; j++) {
			div_arr[j].style.display = div_arr[j].id == id ? 'block' : 'none';
		}
	}

	function show_teaser_dynamic(el, id) {
		var div = document.getElementById(id);
		var div_arr = div.parentNode.parentNode.getElementsByTagName('div');
		var li_class = /exchange-li-/;
		var sf_class = /sf_teaser/;
		var ico_class = /icon-div/;
		var replace_active = /[t\ ]active/;

		for ( j=0; j < div_arr.length; j++) {
			if (li_class.test(div_arr[j].className)) {
				div_arr[j].className = div_arr[j].className.replace(replace_active, "");
				if (div_arr[j] == el) div_arr[j].className = div_arr[j].className + " active";
			} else if ( (!(sf_class.test(div_arr[j].className))) && (!(ico_class.test(div_arr[j].className)))) {
				div_arr[j].style.display = div_arr[j].id == id ? 'block' : 'none';
				div_arr[j].style.zIndex = div_arr[j].id == id ? '10' : '1';
			}
		}
	}

	// -----------------------------------------------------
    //
    // subhome teaser box
    //
    // -----------------------------------------------------

    // Make the whole subhome teaser box clickable
    // use second a-tag's href
    //
    function set_subteaserbox_event_handler () {

        var curr_div, h5, h4, a, div =  $cn ("div", "sub-teaser-box");
        for (var i = 0; i < div.length; i++) {

            div[i].onclick  =  function () {

                a =  this.getElementsByTagName("a");
                if (typeof a[1] != "undefined") {
                    self.location.href =  a[1].href;
                    return false;
                }
                // if there's no second hyperlink, we use the first
                if (typeof a[0] != "undefined") {
                    self.location.href =  a[0].href;
                    return false;
                }
            }

        }
    }



    // replace png's for ie6 with imageLoader
    // loop all images owning the class "pngreplace"
    //
    function pngreplace () {

        // who the f*** are you
        //
        var appname =  navigator.appName.toLowerCase();
        var appvers =  navigator.appVersion.toLowerCase();
        var ie6     =  !!(appname.indexOf("microsoft internet explorer") != -1 && appvers.indexOf("msie 6.") != -1 && !window.opera);
        if (!ie6) return; // the good-ones leave here

        var new_src =  "/images/myself/blind.gif"
        var pngs    =  $cn ("img", "pngreplace");
        for (var i = 0; i < pngs.length; i++) {

            var curr_src            =  pngs[i].src;
            pngs[i].src             =  new_src;
            pngs[i].style.filter    =  "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + curr_src + "', sizingMethod='scale')";
        }
    }


    function toggle_display(id, stat) {
        document.getElementById(id).style.display =  stat? "" : "none";
        return false;
    }


    // get elements by tag and class name
    //
    function $cn (el, class_name) {

        var curr_class, all_obj, ret_obj = [], temp;

        all_obj =   document.getElementsByTagName(el);
        for (i = 0; i < all_obj.length; i++) {

            // no match at all
            //
            if(all_obj[i].className.indexOf (class_name) == -1) continue;

            // in case we have more then one class
            //
            temp =   "," + all_obj[i].className.split(" ").join(",") + ",";
            if (temp.indexOf("," + class_name + ",") == -1) continue;

            ret_obj[ret_obj.length] =   all_obj[i];
        }
        return ret_obj;
    }


    // -----------------------------------------------------
    //
    // teaser boxes with dhtml list-selects
    //
    // -----------------------------------------------------
    //

    // loop select dhtml
    // set z-index to avoid list diappears under next select box
    //
    function set_z_index (start_idx) {

        var div =  $cn ("div", "teaser-select");
        for (var i = 0; i < div.length; i++) {
            div[i].style.zIndex = start_idx -i;
        }
    }

    // callback function for dhtml select
    // can be called after select is done
    // use argument "callf"
    // for args use "callf_args"
    // scope: list_expander
    //
    function update (args) {
        if (args) args = args.join();

        if(this.li_el.getAttribute('remote_url')){
           //
           _updateLookbookDropdowns(this.li_el.getAttribute('remote_url'), this.id);
        }

        // reset dropdowns
        this.reset_list();
        var id      =  this.id;
        var parent  =   _select.ref[id].parentNode;
        // parent.style.zIndex =  "0";
        // $(id).style.display  = "none";
    }

    // create select object
    //
    var _select =  {

        obj         :  [],
        ref         :  [],
        li          :  [],
        sel         :  [],
        callf       :  [],
        callf_args  :  [],
        curr        :  false,

        expand      :  function (id, args) {

            this.ref[id]        =  document.getElementById(id);
            this.li[id]         =  this.ref[id].getElementsByTagName("li");
            this.sel[id]        =  0;
            this.callf[id]      =  0;
            this.callf_args[id] =  false;

            try {
                if (args) {
                    for (i in args) {
                        this[i][id] =  args[i];
                    }
                }
            } catch (err) {
                alert(err);
            }

            this.obj[id]    =  new list_expander (id);
        }

    }

    // create expand_object
    //
    function list_expander (id,args) {

        // remember if ul was clicked
        //
        this.ulclick    =  true;

        // if other list is open close first
        //
        if (_select.curr) {
            this.reset_list();
        }

        // remember current id
        // get parent element and set z-index
        //
        _select.curr                    =  id;
        var parent                      =   _select.ref[id].parentNode;
        _select.ref[id].style.display   =  "";
        parent.style.zIndex             =  "200";

        // init event handler
        //
        this.set_ul_event_handler(id);
        this.set_document_onkeyup(id);
        this.set_document_onclick(id);
        this.set_document_onkeydown(id);
    }

    // set eventhandler for document onkeydown
    // just cancel browser's standard behavior
    // because we use arrow keys for dhtml-
    // select up and down
    //
    list_expander.prototype.set_document_onkeydown =  function (id) {

        document.onkeydown =  function (e) {
            var e = e? e : window.event;
            return (e.keyCode == 38 || e.keyCode == 40)? false : true;
        }
    }

    // set eventhandler for document onkeyup
    // a closure keeps object and some properties
    //
    list_expander.prototype.set_document_onkeyup =  function (id) {

        var obj             =  this;
        document.onkeyup    =  function (e) {

            obj.e   =  e;
            obj.id  =  id;
            obj.handle_document_onkeyup();
            return false;
        }
    }

    // execute onkeyup eventhandler
    // find out which key was pressed: arrows or enter
    // do tasks depending on key
    //
    list_expander.prototype.handle_document_onkeyup =  function () {

        var id      =  this.id;
        var e       =  this.e? this.e : window.event;

        // arrow up or down
        //
        switch (e.keyCode) {

            case 38:
                this.select_up(id);
                break;
            case 40:
                this.select_down(id);
                break;
            case 13:
                this.li_el =  _select.li[id][_select.sel[id]];
                if (_select.callf[id]) {
                    var x =  self[_select.callf[id]];
                    x.call(this, _select.callf_args[id]);
                } else {
                    var li_url          =  _select.li[id][_select.sel[id]].getElementsByTagName("a")[0].href;
                    self.location.href  =  li_url;
                }
                break;
            default:
                return false;
        }
        return false;
    }

    // set eventhandler for document onkeyup
    // a closure keeps object and some properties
    //
    list_expander.prototype.set_document_onclick =  function (id) {

        var obj     =  this;
        document.onclick =  function (e) {
            obj.e   =  e;
            obj.id  =  id;

            // do reset only if click outside of ul
            // set flag false
            //
            if (!obj.ulclick) {
                obj.reset_list();

                /*
                // testout
                //
                var txt =  document.createTextNode("doc_onclick");
                var br  =  document.createElement("br");
                document.getElementsByTagName("p")[0].appendChild(br);
                document.getElementsByTagName("p")[0].appendChild(txt);
                */
            }
            obj.ulclick =  false;
        }
    }

    // reset list and hide it
    // called by document onclick or in case different lists get opened
    //
    list_expander.prototype.reset_list =  function () {

        var curr            =  document.getElementById(_select.curr);
        var parent          =  curr.parentNode;
        curr.style.display  = "none";
        // parent.style.zIndex =  "100";
        parent.style.zIndex =  "0";
        curr.onclick        =  null;
        document.onclick    =  null;
        document.onkeyup    =  null;
        document.onkeydown  =  null;
        _select.curr        =  false;
        this.ulclick        =  true;
    }

    // set eventhandler for document onkeyup
    // a closure keeps object and some properties
    //
    list_expander.prototype.set_ul_event_handler  =  function (id) {

        var obj =  this;

        // reset flag to remember ul onclick and stop document onclick
        //
        _select.ref[id].onclick =  function(e) {
            obj.ulclick =  true;
        }

        // loop all li elements within list
        // set onmouseover/out and onclick eventhandler
        // blur a tag
        //
        for (var i = 0; i < _select.li[id].length; i++) {

            // set or reset classes list items
            //
            if (i == 0) _select.li[id][i].className =  "sel";
            else        _select.li[id][i].className =  "norm";

            _select.li[id][i].onmouseover =  function () {
                this.className =  "sel";
            }

            _select.li[id][i].onmouseout  =  function (e) {
                this.className =  "norm";
            }

            _select.li[id][i].onclick =  function () {

                if (_select.callf[id]) {
                    obj.li_el   =  this;
                    var x       =  self[_select.callf[id]];
                    x.call(obj, _select.callf_args[id]);
                } else {
                    self.location.href =  this.getElementsByTagName("a")[0].href;
                }
            }

            var a =  _select.li[id][i].getElementsByTagName("a");
            if (a.length > 0) {
                a[0].onclick =  function () {
                    this.blur();
                    if (_select.callf[id]) return false;
                }
            }
        }
        return false;
    }

    // set selected list item when down key was pressed
    //
    list_expander.prototype.select_down =  function (id) {

        _select.sel[id] ++;
        if (_select.sel[id] == _select.li[id].length) _select.sel[id] = 0;
        this.select_scroll(id);
        this.select_sel(id);
    }

    // set selected list item when up key was pressed
    //
    list_expander.prototype.select_up =  function (id) {

        _select.sel[id] --;
        if (_select.sel[id] < 0) _select.sel[id] = _select.li[id].length -1;
        this.select_scroll(id);
        this.select_sel(id);
    }

    // reset al list element's classes exept selected item
    //
    list_expander.prototype.select_sel =  function (id) {

        for (var i = 0; i < _select.li[id].length; i++) {
            _select.li[id][i].className   =  (_select.sel[id] == i)? "sel" : "norm";
        }
    }

    // set scroll top by counting out ul and list hights and offset tops
    //
    list_expander.prototype.select_scroll =  function (id) {

        var li_pos  =  _select.li[id][_select.sel[id]].offsetTop;
        var li_ht   =  _select.li[id][_select.sel[id]].offsetHeight;
        var ul_ht   =  _select.ref[id].offsetHeight;

        if (li_pos > ul_ht -li_ht) {
            _select.ref[id].scrollTop = li_pos - ul_ht + li_ht;
        } else {
            _select.ref[id].scrollTop = 0;
        }
    }


    // -----------------------------------------------------
    //
    // cookie helpers
    //
    // -----------------------------------------------------
    //
    // read cookie
    //
    function getCookie(cname) {
        var dc   =  document.cookie;
        if(dc.indexOf(cname + "=") != -1) {
            var anf  =  dc.indexOf(cname) + cname.length + 1;
            var ende =  (dc.indexOf(";", anf) != -1)? dc.indexOf(";", anf) : dc.length;
            return unescape(dc.substring(anf,ende));
        } else {
            return null;
        }
    }

    // set cookie
    //
    function setCookie(cname,value,expd,exph,expm) {

        var duration, exp;
        duration =  864e5 * parseInt(expd);
        duration += 36e5 * parseInt(exph);
        duration += 6e4 * parseInt(expm);

        // nc-mac time bug
        var past =  new Date(1970,0,1,12);
        if(past.toGMTString().indexOf("02") > 0) duration -= 864e5;

        // expire festlegen,0
        exp =  new Date();
        exp =  new Date(exp.getTime() + duration);

        // cookie setzen
        document.cookie = cname + '=' + escape(value) + '; expires=' + exp.toGMTString() + "; path=/";
    }


    // -----------------------------------------------------
    //
    // controlls scriptaculous sliding effect to make
    // sure div does not reopen when el is clicked 2 times
    //
    // -----------------------------------------------------
    //
    var store_current_runnings = {};
    function ctrl_slider (id) {

        // make sure to stop nervous clickers
        //
        try {
            if (store_current_runnings[id]) {
                //alert(id + " läuft grade");
                return;
            }

        } catch (err) {
            // alert(err)
        }
        store_current_runnings[id] =  true;

        if ($(id).style.display) {
            Effect.SlideDown(id,{
                duration:0.4,
                afterFinish: function () {
                    store_current_runnings[id] =  false;
                }
            })
        } else {
            Effect.SlideUp(id,{
                duration:0.4,
                afterFinish: function () {
                    store_current_runnings[id] =  false;
                }
            })
        }
    }


    function ctrl_sidebar (id) {

        // make sure to stop nervous clickers
        //
        try {
            if (store_current_runnings[id]) {
                // alert(id + " läuft grade");
                return;
            }

        } catch (err) {
            // alert(err)
        }
        store_current_runnings[id] =  true;
        _slide.slideMove(id,{callf:set_slider_state});

    }

    // this is called after sidebar-sliding is done.
    // unlocks controll-function that is locked
    // while sidebar-sliding is running
    // set bg image via class name
    //
    function set_slider_state () {
        store_current_runnings[this.id] =  false;
        _slide.ref[this.id].className   =  (parseInt(_slide.ref[this.id].style.width) > 0)? "zoom-sidebar-open" : "zoom-sidebar-close";
    }

    // helper to create array from arguments
    //
    function $A (iterable) {
        var result = [];
        for (var i = 0; i < iterable.length; i++) {
            result.push(iterable[i]);
        }
        return result;
    }

    // since scriptaculous do not offer a sliding sidewards
    // jw proudly presents something simpel & homemade
    // Attention! this object needs some prototype functions!
    //
    var _slide = {

        obj         :  [],
        ref         :  [],
        child       :  [],
        callf       :  [],
        calla       :  [],
        speed       :  [],
        size        :  [],
        runner      :  [],
        current     :  [],
        positions   :  [],
        slideMove   : function (id, args) {

            try {

                this.ref[id]        =  document.getElementById(id);
                this.child[id]      =  false;
                this.callf[id]      =  false;
                this.calla[id]      =  false;
                this.speed[id]      =  22; // default speed
                this.current[id]    =  this.current[id]? this.current[id] : 0;
                if (this.runner[id]) clearInterval(this.runner[id]);
                this.runner[id]     =  false

                if (args) {
                    for (i in args) {
                        this[i][id] =  args[i];
                    }
                }
            } catch (err) {
                // alert(err);
            }
            this.obj[id]    =  new slider (id);
        }
    }

    function slider (id) {

        this.id =  id;

        try {
            if (!_slide.child[id])      _slide.child[id]        =  this.get_child();
            if (!_slide.size[id])       _slide.size[id]         =  this.get_dimensions();
            if (!_slide.positions[id])  _slide.positions[id]    =  this.get_positions();

        } catch (err) {
            alert (err);
        }
        this.init_slider ();
    }

    slider.prototype.init_slider = function () {

        if (parseInt(_slide.ref[this.id].style.width) > 0) {
            document.getElementById(this.id).style.overflow =  "hidden";
            _slide.runner[this.id] =  window.setInterval(this.slide_close.bind(this), 10);
        } else {
            _slide.runner[this.id] =  window.setInterval(this.slide_open.bind(this), 10);
        }
    }

    slider.prototype.slide_open = function () {

        if (_slide.current[this.id] < _slide.positions[this.id].length -1) {
            _slide.current[this.id] ++;
            _slide.ref[this.id].style.width =   _slide.positions[this.id][_slide.current[this.id]] + "px";
        } else {
            clearInterval(_slide.runner[this.id]);
            document.getElementById(this.id).style.overflow =  "";
            if (_slide.callf[this.id]) _slide.callf[this.id].call(this,false);
        }
    }

    slider.prototype.slide_close = function () {

        if (_slide.current[this.id] > 0) {
            _slide.current[this.id] --;
            _slide.ref[this.id].style.width =   _slide.positions[this.id][_slide.current[this.id]] + "px";
        } else {
            clearInterval(_slide.runner[this.id]);
            if (_slide.callf[this.id]) _slide.callf[this.id].call(this, false);
        }
    }

    // get first child tag of an element
    // ignore childs that are no tags
    // ignore comments (tag name "!", ie only)
    //
    slider.prototype.get_child = function () {
        while (_slide.ref[this.id].hasChildNodes()) {
            if (_slide.ref[this.id].firstChild.tagName == null || _slide.ref[this.id].firstChild.tagName == "!") _slide.ref[this.id].removeChild(_slide.ref[this.id].firstChild);
            else {
                // alert(_slide.ref[this.id].firstChild.tagName)
                return _slide.ref[this.id].firstChild;
            }
        }
    }

    // get size of child tag
    //
    slider.prototype.get_dimensions = function () {
        var hd  =  _slide.child[this.id].offsetHeight;
        var wd  =  _slide.child[this.id].offsetWidth;
        return [wd, hd];
    }

    // count sliding positions depending on speed
    //
    slider.prototype.get_positions = function () {

        var temp                    =  0
        var arr                     =  [];
        var speed                   =  _slide.speed[this.id];
        while (temp < _slide.size[this.id][0]) {
            arr[arr.length] =  temp;
            temp            =  Math.floor(temp + speed);
        }
        arr[arr.length] = _slide.size[this.id][0];
        return arr;
    }


    // -----------------------------------------------------
    //
    // col3 teaserbox multi image
    //
    // -----------------------------------------------------

    // set onmouseover/onclick for multi-image-teaser
    //
    function set_multi_image_teaser_event_handler () {

        // get all divs that own class "multi-image-teaser"
        //
        var li, image, a, div =  $cn ("div", "multi-image-teaser");
        for (var i = 0; i < div.length; i++) {

            // get all list-elements of a "multi-image-teaser"
            //
            li =  div[i].getElementsByTagName("li");
            for (var j = 0; j < li.length; j++) {

                image   =  li[j].getElementsByTagName("img")[0];
                a       =  li[j].getElementsByTagName("a")[0];

                // if we loop the first list-element
                // set z-index of image higher in order to
                // display the first list image at the beginning
                //
                if (j == 0) {
                    image.style.zIndex  =  100;
                    //a.className         += "-color";
                }

                // add index as aproperty
                //
                li[j].idx =  j;

                // now set eventhandler onmouseover
                //
                li[j].onmouseover   =  function () {

                    var curr_li     =  this.parentNode.getElementsByTagName("li");
                    var curr_idx    =  this.idx;
                    var curr_img, curr_a;

                    // loop all list-elements
                    // check if index matches with current index
                    // lower or higher image's z-index if selected
                    // now make sure a's class name does not contain "-color"
                    // append "-color" to class name or replace depending on if selected
                    //
                    for (var k = 0; k < curr_li.length; k++) {
                        curr_img                =  curr_li[k].getElementsByTagName("img")[0];
                        curr_a                  =  curr_li[k].getElementsByTagName("a")[0];
                        curr_img.style.zIndex   =  (k == curr_idx)? 100 : 10;
                        //curr_a.className        =  curr_a.className.replace("-color", "");
                        //curr_a.className        =  (k == curr_idx)? curr_a.className + "-color" : curr_a.className.replace("-color", "");
                    }
                }

                // now make whole li clickable
                //
                li[j].onclick  =  function () {

                    // get first a-element
                    // set location.href depending on a's href
                    //
                    var a               =  this.getElementsByTagName("a")[0];
                    self.location.href  =  a.href;
                }
            }
        }
    }


    // -----------------------------------------------------
    //
    // make teaserbox "use-first-ahref" clickable
    //
    // -----------------------------------------------------
    //
    function set_use_first_ahref_event_handler () {

        var a, div =  $cn ("div", "use-first-ahref");
        for (var i = 0; i < div.length; i++) {

            div[i].onclick  =  function () {
                a = this.getElementsByTagName("a");
                if (typeof a[0] != "undefined") {
                    self.location.href =  a[0].href;
                    return false;
                }
            }
        }
    }


    // -----------------------------------------------------
    //
    // gallery teaser: add layout borders. yeah, it's a hack
    //
    // -----------------------------------------------------
    //
    function set_gallery_borders () {

        try {
            var a, inner_div, img, div =  $cn ("div", "gallery-box");
            for (var i = 0; i < div.length; i++) {

                inner_divs      =  div[i].getElementsByTagName("div");

                // avail?
                //
                if (inner_divs.length) inner_div =  inner_divs[0];
                else return false;

                img             =  document.createElement("img");
                img.src         =  "/img/bg_gallery_bd.gif";
                img.className   =  "bd";
                inner_div.appendChild(img);
            }

        } catch (err) {
            alert(err)
        }
    }


		// --------------------------------------------------------------
		// open window
		// --------------------------------------------------------------

function openWindow(u,w,h)
{
	wndShow=window.open(u,'popup','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=' + w + ',height=' + h + ',screenX=50,screenY=50,top=50,left=50');
	wndShow.focus();
}

    function use_link_and_run(el) {
        var a =  el.getElementsByTagName("a");
        if (!a.length) return;
        self.location.href  =   a[0].href;
        //alert(a[0].href)
        return false;
    }

    function toggle_view_preview (el) {

        var curr_class  =  el.parentNode.className;
        var next_class  =  (curr_class.indexOf("div-preview") != -1)? "div-view" : "div-preview";
        var li          =  el.parentNode.parentNode;
        var divs        =  li.getElementsByTagName("div");

        for (var i = 0; i < divs.length; i++) {
            divs[i].style.display =  (divs[i].className.indexOf(curr_class) != -1)? "none" : "block";
        }
    }

	var posX = 0;
	var posY = 0;

	document.onmousemove = function(e) {
		if (document.all) {
			posX = event.x + document.body.scrollLeft + 10;
			posY = event.y + document.body.scrollTop + 20;
		}
		else {
			posX = e.pageX + 10;
			posY = e.pageY + 20;
		}

		if(document.getElementById('style_preview')) {
			    div = document.getElementById('style_preview');
				div.style.top = posY + 'px';
				div.style.left = posX + 'px';
		}
	}

	
	function mouse_over(el, color, background, subtag) {
		if(color) { el.style.color = '#' + color; }
		if(background) { el.style.backgroundColor = '#' + background; }
		if(subtag) {
			if(color) { el.getElementsByTagName(subtag)[0].style.color = '#' + color; }
			if(background) { el.getElementsByTagName(subtag)[0].style.backgroundColor = '#' + background; }
		}
	}

	function mouse_out(el, color, background, subtag) {
		if(color) { el.style.color = '#' + color; }
		if(background) { el.style.backgroundColor = '#' + background; }
		if(subtag) {
			if(color) { el.getElementsByTagName(subtag)[0].style.color = '#' + color; }
			if(background) { el.getElementsByTagName(subtag)[0].style.backgroundColor = '#' + background; }
		}
	}

	function set_headlinelist_event_handler() {
            var list =  $cn("ol", "headlinelist");
            var li;
			for (var i = 0; i < list.length; i++) {

                ol =  list[i];
				li =  ol.getElementsByTagName("li");
                for (var j = 0; j < li.length; j++) {
					if(!li[j].className.match('sel')) {
						li[j].onmouseover =  function () {
	                        mouse_over(this, 'FFFFFF', '94B2C6', 'a');

	                    }

						li[j].onmouseout =  function () {
	                        mouse_out(this, '84A2BD', 'DEE7EF', 'a');

	                    }
					}
					li[j].onclick = function () {
	                    self.location.href = this.getElementsByTagName('a')[0].href;

	                }
                }
            }
        }

	function set_rating_list_event_handler() {

            // preload "on" image
            //
            var radio_on        =  new Image();
                radio_on.src    =  image_dir + "/finder/list_radio_on.gif";

            // get all forms that own class "rating-box"
            // get ul and loop list elements
            // add onclick handler
            //
            var div =  $cn("div", "rating-box");
            var ul, li, label;
            for (var i = 0; i < div.length; i++) {

                ul =  div[i].getElementsByTagName("ul")[0];
                li =  ul.getElementsByTagName("li");
                for (var j = 0; j < li.length; j++) {
                    li[j].onclick =  function () {
                        toggle_list_radio(this);
                    }
					li[j].getElementsByTagName("label")[0].onclick =  function () {
                        toggle_list_radio(this);
                    }
                }
            }
        }

        function toggle_list_radio(el) {
            var lower = true;
			var rd;
            var ul =  el.parentNode;
            var li =  ul.getElementsByTagName("li");
            for (var i = 0; i < li.length; i++) {
                rd =  li[i].getElementsByTagName("input")[0];
                if (li[i] == el) {
                    li[i].className =  "rd-on";
                    rd.checked      =  true;
					lower = false;
                } else {
                    if(lower) {
						li[i].className =  "rd-on";
						rd.checked      =  false;
					} else {
						li[i].className =  "rd-off";
	                    rd.checked      =  false;
					}
                }
            }
        }

/* homepage dynamic teaser */
function change_homepic_myself(link_id)
{
		var id_arr = link_id.split("_");
		var img_name = "homepic_" + id_arr[1];

		// setting each picture invisible and each link as not active
		for (i = 1; i < 5; i++) {
			eval('document.getElementById("homelink_' + i + '").className ="";');
			eval('document.getElementById("homepic_' + i + '").style.display = "none";');
		}
		// display the chosen picture
		eval('document.getElementById("' + img_name + '").style.display = "block";');
		eval('document.getElementById("homelink_' + id_arr[1] + '").className ="active";');
}

function rotate_homepic_step(id_num) {
	if (!stop_rotation) {
		link_id = "homepic_" + id_num;
		change_homepic_myself(link_id);
		act_id++;
		if (act_id > 4) act_id = 1;
		is_running = 0;
		if (!stop_rotation) rotate_homepic();
	} else {
		is_running = 0;
	}
}

function rotate_homepic(mouseout_id) {
	if (mouseout_id) {
		var id_arr = mouseout_id.split("_");
		stop_rotation = false;
		act_id =  parseInt(id_arr[1]) + 1;
		if (act_id > 4) act_id = 1;
	}
	if (is_running == 0) {
		is_running = 1;
		if (act_id == 0) {
			act_id = 1;
			window.setTimeout("rotate_homepic_step(act_id)", 1000);
		} else {
			window.setTimeout("rotate_homepic_step(act_id)", 4000);
		}
	}
}

function start_homepic_rotation() {
	if (document.getElementById("homepic_1")) {
		act_id = 0;
		is_running = 0;
		stop_rotation = false;
		rotate_homepic();
	}
}

function stop_homepic_rotation() {
	stop_rotation = true;
}

function mouseover_homepic(link_id) {
	stop_homepic_rotation();
	change_homepic_myself(link_id);
}

function change_bg(bg_style){

		for(i=1; i<=3; i++){

			if (document.getElementById("style" + i)){

					document.getElementById("style" + i).className = "";

			}

		}



		if (document.getElementById("style" + bg_style)){

				document.getElementById("style" + bg_style).className = "activ";

		}



		document.body.style.backgroundImage="url('../img/bg" + bg_style + ".jpg')";

		setCookie('bg_style',bg_style,30,0,0);

}


function get_bg(){

		var bg_style_onload;

		bg_style_onload = getCookie('bg_style');

		if (bg_style_onload != null && bg_style_onload != ""){

				change_bg(bg_style_onload);

		} else {

				//Default-Hintergrund

				change_bg('0')

		}

		//alert(bg_style_onload);

}


function set_class(el) {
		el.className = el.className + " link_activ";
}

function delete_class(el) {
		var replace_active = /[t\ ]link_activ/;
		el.className = el.className.replace(replace_active, "");
}

function setAdIframeSrc(iframeId, iframeSrc)
{

        // debug
        var debug_el = $('qc_debug_container');
        if(debug_el){
           //
           debug_el.value = debug_el.value + '; call 2 id=> ' + iframeId + ' with=> ' + iframeSrc;
        }

        if(iframeId=='ifAd1' || iframeId=='ifAd2'){
            //
	        var iframe_el = $(iframeId);
	        var iframe_name = 'iframe_' + iframeId;
	        if(iframe_el){
	           var img = frames[iframe_name].document.getElementById('img');
	           // var img = iframe_el.document.getElementById('img');
	           if(img) img.src = iframeSrc;
	           else debug_el.value = debug_el.value + '; iframe.img not found';
	        }
	        else debug_el.value = debug_el.value + '; iframe not found';
        }
        else{
          //
		  var lmnt = $(iframeId);
		  if((lmnt) && (iframeSrc)){
			lmnt.src = iframeSrc;
		  }
        }


		// alert(' iframeID => '  + iframeId);
		// alert(' iframeSrc => ' + iframeSrc);
		// var lmnt = $(iframeId);
		// if ((lmnt) && (iframeSrc)) {
		//	lmnt.src = iframeSrc;
		// }
}



function showPreview(src) {

		if(!document.getElementById('style_preview')) {

			var div = document.createElement('div');

			    div.id = 'style_preview';

				div.innerHTML = '<img src="' + src + '" alt="preview" />';

				div.style.position = 'absolute';

				div.style.top = posY +  'px';

				div.style.left = posX + 'px';

				div.style.zIndex = 99999;

				document.body.appendChild(div);

		}

	}



	function hidePreview () {

		if(document.getElementById('style_preview')) {

			    document.body.removeChild(document.getElementById('style_preview'));

		}

	}
