window.cookieFunc = {
    createCookie: function(name,value,days) {
      value = escape(value);//value.replace(/;/g, '\\\\;');
      
    	if (days) {
    		var date = new Date();
    		date.setTime(date.getTime()+(days*24*60*60*1000));
    		var expires = "; expires="+date.toGMTString();
    	}
    	else var expires = "";
    	document.cookie = name+"="+value+expires+"; path=/";
    },
    
    readCookie: function(name) {
    	var nameEQ = name + "=";
    	var ca = document.cookie.split(';');
    	for(var i=0;i < ca.length;i++) {
    		var c = ca[i];
    		while (c.charAt(0)==' ') c = c.substring(1,c.length);
    		if (c.indexOf(nameEQ) == 0) return unescape(c.substring(nameEQ.length,c.length));
    	}
    	return null;
    },
    
    eraseCookie: function(name) {
    	window.cookieFunc.createCookie(name,"",-1);
    }
}

window.pageFunc = {
    iOrigPid: 0,
    iPid: 0,
    sIds: 'ul#menu_main > li, ul#menu_sub > li, ul#menu_meta > li',
    iSpeed: 500,
    jsonScreenCss: { "position": "absolute", "top": -1, "left": -1, "background-color": "#ffffff" },
    aPages: [ ],
    bTabWithPlayer: 0,
    
    initPos: function() {
        window.pageFunc.jsonScreenCss.top = (jQuery('div.screen').position().top) + 'px';
        window.pageFunc.jsonScreenCss.left = jQuery('div.screen').position().left + 'px';
        
        //window.pageFunc.oPages = new Object();
    },
    
    showScreen: function(iPid) {
        $.history.load(iPid);
        
        sUrl = jQuery('a#menu_link_' + iPid).attr('href');
        //if (sUrl == '/') sUrl = '/index.php?id=1';
        //else if (sUrl == '/en.html') sUrl = '/index.php?id=1&L=1';
        //alert(window.pageFunc.iSpeed);
        if (iPid == 1) {
            if (sUrl == 'en.html') sUrl = 'index.php?id=1&L=1';
            else sUrl = 'index.php?id=1';
        }
        
        var iFadeSpeed = window.pageFunc.iSpeed;
        
        //alert(sUrl);
        //$.get('index.php', { "id":  iPid, "type": 69 }, function(sData, sStatus) {
        //$.get(sUrl, { "type": 69 }, function(sData, sStatus) {
        if (window.pageFunc.aPages[iPid]) {
            window.pageFunc.showScreenContent(window.pageFunc.aPages[iPid], iFadeSpeed);
        }
        else {
            $.get(sUrl, { }, function(sData, sStatus) {
                window.pageFunc.aPages[iPid] = sData;
                window.pageFunc.showScreenContent(window.pageFunc.aPages[iPid], iFadeSpeed);
            });
        }
    },
    
    showScreenContent: function(sData, iFadeSpeed) {
        //var iCut = sData.indexOf('<ul id="footer">') - 26;
        //var sHtml = sData.substring(sData.indexOf('<div class="screen">') + 20, iCut);
        var sHtml = sData.substring(sData.indexOf('<div class="screen">') + 20, sData.indexOf('<ul id="footer">'));
        sHtml = sHtml.substring(0, sHtml.lastIndexOf('</div>'));
        
        var sTitle = sData.substring(sData.indexOf('<title>') + 7, sData.indexOf('</title>'));
        document.title = sTitle;
        
        jQuery('div.screen').css(window.pageFunc.jsonScreenCss).fadeOut(iFadeSpeed, function() { jQuery(this).remove(); });
        //jQuery(document.createElement('div')).addClass('screen').css('display', 'none').html(sHtml).appendTo('div#container').fadeIn(iFadeSpeed, function() {
        
        jQuery(document.createElement('div')).addClass('screen').css('display', 'none').html(sHtml).insertBefore('ul#footer').fadeIn(iFadeSpeed, function() {
            //jQuery('div.screen a.internal-link').click(function() { return window.pageFunc.menuClick(this); });
            window.pageFunc.addVerticalTabs();
            
            jQuery('div.ajax_include').each(function() {
          	    var oThis = this;
          	    
          	    $.get('/fileadmin/proxy.php', { 'url': jQuery(this).text() }, function(sData, sStatus) {
          	        jQuery(oThis).text(sData.replace(/document\.write\(/g, 'jQuery("#'+jQuery(oThis).attr('id')+'").append('));
          	    });
          	});
        });
        
        //var sLang = jQuery('ul#menu_meta li#lang a').attr('href');
        //alert(sLang.substr(0, sLang.indexOf('id=') + 3) + iOldPid);
        //jQuery('ul#menu_meta li#lang a').attr('href', sLang.substr(0, sLang.indexOf('id=') + 3) + window.pageFunc.iPid + sLang.substr(sLang.indexOf('id=') + 3 + String(iOldPid).length));
        
        var sLang = sData.substring(sData.indexOf('<li id="lang">') + 14, sData.indexOf('</a></li>') + 4);
        jQuery('ul#menu_meta li#lang').html(sLang);
        
        //if (jQuery('li#lang a').attr('href') == '') jQuery('li#lang a').attr('href', '/index.php?id=1');
        //else if (jQuery('li#lang a').attr('href') == 'en.html') jQuery('li#lang a').attr('href', '/index.php?id=1&L=1');
        
        jQuery('div.screen div.promobar div.referenzen').each(function() { window.pageFunc.addSwitcher(this); });
        jQuery('div.screen div.tabbox').each(function() { window.pageFunc.addSwitcher(this); });
        window.pageFunc.addSliders();
        window.pageFunc.addNewsSliders();
        window.pageFunc.addButtonHover();
    },
    
    menuClick: function(oThis) {
    		var iOldPid = window.pageFunc.iPid;
    		//alert(jQuery(oThis).html());
        
        //window.pageFunc.iPid = parseInt(jQuery(oThis).attr('href').substr(jQuery(oThis).attr('href').indexOf('id=') + 3));
        window.pageFunc.iPid = parseInt(jQuery(oThis).attr('id').substr(10));
        if (isNaN(window.pageFunc.iPid)) window.pageFunc.iPid = 1;
        
        //if (!window.pageFunc.iPid) window.pageFunc.iPid = 1;
        
        //window.cookieFunc.createCookie('curr_pid', window.pageFunc.iPid);
        
        if (jQuery(oThis).parent('li').parent('ul[id^=menu_]').length || jQuery(oThis).parent('div[id^=header]').length) {
            if (!jQuery(oThis).parent('li').hasClass('active')) {
                window.pageFunc.showScreen(window.pageFunc.iPid);
                
                jQuery(window.pageFunc.sIds).find('ul > li').removeClass('active');
                //jQuery(window.pageFunc.sIds).find('ul > li').each(function() { alert(jQuery(this).html()); });
                
                if (!jQuery(oThis).parent('li').hasClass('current')) {
                    if (jQuery(window.pageFunc.sIds).filter('.active, .current' ).children('ul').length) {
                        jQuery(window.pageFunc.sIds).filter('.active, .current' ).children('ul').slideUp(window.pageFunc.iSpeed, function() { jQuery(this).parent('li').removeClass('active').removeClass('current'); });
                    }
                    else {
                        jQuery(window.pageFunc.sIds).removeClass('active').removeClass('current');
                    }
                    
                    if (jQuery(oThis).parent('li').children('ul').length) {
                        //jQuery(oThis).parent('li').addClass('active').children('ul').each(function() { alert(jQuery(this).html()); });
                        jQuery(oThis).parent('li').addClass('active').children('ul').css('display', 'none').slideDown(window.pageFunc.iSpeed, function() { jQuery(this).parent('li').addClass('active'); });
                    }
                    else {
                        jQuery(oThis).parent('li').addClass('active');
                    }
                    
                }
                else {
                    jQuery(oThis).parent('li').removeClass('current').addClass('active');
                } 
            }
        }
        else if (!jQuery(oThis).parent('li').hasClass('active')) {
            var iL = jQuery(oThis).parent('li').parent('ul:visible').length;
            
            window.pageFunc.showScreen(window.pageFunc.iPid);
            
            //jQuery(oThis).parent('li').addClass('active').siblings('li').removeClass('active').parent('ul').parent('li').removeClass('active').addClass('current');
            //alert(jQuery(oThis).parent('li').parent('ul').not(':visible').length);
            if (iL) {
                jQuery(window.pageFunc.sIds).removeClass('active').removeClass('current').find('ul > li').removeClass('active');
                jQuery(oThis).parent('li').addClass('active').parent('ul').parent('li').addClass('current');
                
                // 3. Ebene
                if (jQuery(oThis).parent('li').parent('ul').parent('li').parent('ul').parent('li').length) jQuery(oThis).parent('li').parent('ul').parent('li').parent('ul').parent('li').addClass('current');
                
                if (jQuery(oThis).parent('li').children('ul').length) {
                    jQuery(oThis).parent('li').removeClass('active').children('ul').css('display', 'none').slideDown(window.pageFunc.iSpeed, function() { jQuery(this).parent('li').addClass('active'); });
                }
                // 2. Ebene - andere 3. Ebene einfahren
                else if (jQuery(oThis).parent('li').siblings('li').children('ul').length) {
                    jQuery(oThis).parent('li').siblings('li').children('ul').slideUp(window.pageFunc.iSpeed, function() { jQuery(this).parent('li').removeClass('active').removeClass('current'); });
                }
            }
            else {
                //jQuery(window.pageFunc.sIds).removeClass('active').removeClass('current').find('ul > li').removeClass('active');
                
                // 3. Ebene
                //jQuery(window.pageFunc.sIds).filter('.active, .current' ).children('ul').slideUp(window.pageFunc.iSpeed, function() { jQuery(this).parent('li').removeClass('active').removeClass('current'); }).children('li').removeClass('active');
                jQuery(window.pageFunc.sIds).filter('.active, .current' ).find('ul').slideUp(window.pageFunc.iSpeed, function() { jQuery(this).parent('li').removeClass('active').removeClass('current'); }).find('li').removeClass('active');
                
                jQuery(oThis).parent('li').addClass('active').parent('ul').slideDown(window.pageFunc.iSpeed, function() { jQuery(this).parent('li').addClass('current'); });
            }
       }
       
       jQuery(oThis).blur();
       return false;
    },
    
    historyLoad: function(iPid) {
        if (iPid && (window.pageFunc.iPid != iPid) && jQuery('a#menu_link_' + iPid).length) window.pageFunc.menuClick(jQuery('a#menu_link_' + iPid));
        else if (!iPid && (window.pageFunc.iOrigPid != window.pageFunc.iPid)) window.pageFunc.menuClick(jQuery('a#menu_link_' + window.pageFunc.iOrigPid));
    },
    
    addSlidersOLD: function() {
        jQuery('div.screen h4.content_klapper').each(function() {
      	   // var sDisplay = (jQuery(this).next('span.content_klapper').text().length > 0) ? 'inline' : 'none';
      	    jQuery(this).css('margin-bottom', '40px').next('span.content_klapper').css({ "display": "inline" }).next('div.content_klapper').css({ "display": "none" });//, "overflow": "hidden" });
      	    
            jQuery(this).unbind('click').click(function() {
                jQuery(this).children('a').blur();
                
      	        if (jQuery(this).next('span.content_klapper').next('div.content_klapper').css('display') != 'block') {
      	            jQuery(this).css('margin-bottom', '0px').next('span.content_klapper').css('margin-top', '4px').fadeOut(window.pageFunc.iSpeed).next('div.content_klapper').slideDown(window.pageFunc.iSpeed);
      	            jQuery(this).children('a').addClass('active');
      	        }
      	        else {
      	            jQuery(this).next('span.content_klapper').fadeIn(window.pageFunc.iSpeed).next('div.content_klapper').slideUp(window.pageFunc.iSpeed, function() {
      	                jQuery(this).prev('span.content_klapper').css('margin-top', ($.browser.msie ? '4px' : '-36px')).prev('h4.content_klapper').css('margin-bottom', '40px').children('a').removeClass('active').blur();
      	            });
      	        }
      	        
      	        return false;
            });
      	});
    },
    
    addSliders: function() {
        jQuery('div.screen a.content_klapper').each(function() {
      	    jQuery(this).prev('div.content_klapper').hide().children('p.bodytext:first').css('margin-top', 0).parent().children('p.bodytext:last').css('margin-bottom', 0);
      	    jQuery(this).css({ "display": "inline" }).filter(':empty').text('mehr lesen');
      	    
      	    jQuery.data(this, 'orig_html', jQuery(this).html());
      	    var oThis = this;
      	    
            jQuery(this).unbind('click').click(function() {
                jQuery(this).blur();
                
      	        if (jQuery(this).prev('div.content_klapper').css('display') != 'block') {
      	            jQuery(this).prev('div.content_klapper').slideDown(window.pageFunc.iSpeed, function() {
      	                jQuery(oThis).html('schlie&szlig;en');
      	            });
      	        }
      	        else {
      	            jQuery(this).prev('div.content_klapper').slideUp(window.pageFunc.iSpeed, function() {
      	                jQuery(oThis).html(jQuery.data(oThis, 'orig_html'));
      	            });
      	        }
      	        
      	        return false;
            });
      	});
    },
    
    addSwitcher: function(oThis) {
        var iSpeed = 2000;
        
        var sSel = 'a.logo';
        
        if (jQuery(oThis).children('div.video').length) {
            jQuery(oThis).children('a.prev, a.next').css('display', 'inline');
        }
        
        if (jQuery(oThis).hasClass('tabbox') && jQuery(oThis).parent().hasClass('promobar')) {
            sSel = 'div.frame';
            var iSpeed = 6000;
        }
        else if (jQuery(oThis).hasClass('tabbox')) {
            sSel = 'div.elem';
            var iSpeed = 6000;
        }
        
        var iNum = jQuery(oThis).find(sSel).length;
        
        var showNum = function(iCurr) {
            if (jQuery(oThis).hasClass('tabbox') && (iNum > 1)) {
                jQuery(oThis).find('h3 span').remove();
                jQuery(oThis).children('h3').append('<span> - ' + iCurr + ' von ' + iNum + '</span>');
            }
        };
        var nextElem = function() {
            var iCurr = jQuery(oThis).find(sSel + ':visible').prevAll(sSel).length + 1;
            
            if (iCurr >= iNum) iCurr = 0;
            jQuery(oThis).find(sSel + ':visible').fadeOut(window.pageFunc.iSpeed);
            jQuery(oThis).find(sSel + ':eq('+iCurr+')').fadeIn(window.pageFunc.iSpeed);
            
            showNum(iCurr + 1);
            
            return false;
        };
        var prevElem = function() {
            var iCurr = jQuery(oThis).find(sSel + ':visible').prevAll(sSel).length - 1;
            
            if (iCurr < 0) iCurr = iNum - 1;
            jQuery(oThis).find(sSel + ':visible').fadeOut(window.pageFunc.iSpeed);
            jQuery(oThis).find(sSel + ':eq('+iCurr+')').fadeIn(window.pageFunc.iSpeed);
            
            showNum(iCurr + 1);
            
            return false;
        };
        var doTimeout = function() {
            if (jQuery(oThis).children('a.prev').css('display') == 'none') {
                nextElem();                
            }
            
            if (jQuery(oThis).children(':visible').length) window.setTimeout(doTimeout, iSpeed);
        };
        
        jQuery(oThis).find(sSel).not(':first').css('display', 'none');
        
        if (iNum > 1) window.setTimeout(doTimeout, iSpeed);
        
        jQuery(oThis).children('a.prev').click(function() { this.blur(); return prevElem(); });
        jQuery(oThis).children('a.next').click(function() { this.blur(); return nextElem(); });
        
        jQuery(oThis).find('a.prev, a.next').css('top', parseInt(jQuery(oThis).innerHeight() / 2 - 8) + 'px');
        showNum(1);
        
        if (jQuery(oThis).find('a.prev').css('display') == 'none') {
            jQuery(oThis).mouseover(function() { jQuery(oThis).find('a.prev, a.next').css('display', 'inline'); })
                    .mouseout(function()  { jQuery(oThis).find('a.prev, a.next').css('display', 'none'  ); });
        }
        
        if (iNum == 1) {
            jQuery(oThis).find('a.prev, a.next').css('visibility', 'hidden');
        }
    },
    
    addNewsSliders: function() {
        jQuery('form.defform span.sliderSpan').each(function() {
      	    jQuery('form.defform span#' + jQuery(this).attr('id').substr(6)).slideUp('fast');
      	    
      	    var aVal = new Array();
  	        jQuery('form.defform span#' + jQuery(this).attr('id').substr(6)).children('input[type=checkbox]:checked').each(function() { aVal.push(jQuery(this).attr('value')); });
  	        jQuery('form.defform span#' + jQuery(this).attr('id').substr(6) + '_info').text(aVal.join(', '));
  	        jQuery('form.defform span#' + jQuery(this).attr('id').substr(6) + '_info').html(jQuery('form.defform span#' + jQuery(this).attr('id').substr(6) + '_info').html() + '&nbsp;');
      	    
      	    /*
      	    jQuery('form.defform span#' + jQuery(this).attr('id').substr(6)).change(function() {
      	        var aVal = new Array();
      	        
      	        jQuery(this).children('input[type=checkbox]:checked').each(function() { aVal.push(jQuery(this).text()); });
      	        
      	        jQuery('form.defform span#' + jQuery(this).attr('id') + '_info').text(aVal.join(', '));
      	    }).change();
      	    */
      	    jQuery('form.defform span#' + jQuery(this).attr('id').substr(6) + ' input[type=checkbox]').click(function() {
      	        var aVal = new Array();
      	        
      	        //jQuery(this).children('option:selected').each(function() { aVal.push(jQuery(this).text()); });
      	        jQuery(this).parent().children('input[type=checkbox]:checked').each(function() { aVal.push(jQuery(this).attr('value')); });
      	        
      	        jQuery('form.defform span#' + jQuery(this).parent().attr('id') + '_info').text(aVal.join(', '));
      	        jQuery('form.defform span#' + jQuery(this).parent().attr('id') + '_info').html(jQuery('form.defform span#' + jQuery(this).parent().attr('id') + '_info').html() + '&nbsp;');
      	    });//.change();
      	}).click(function() {
      	    if (jQuery('form.defform span#' + jQuery(this).attr('id').substr(6) + ':visible').length) {
      	        jQuery(this).removeClass('sliderSpanActive').html('bearbeiten');
      	        
      	        jQuery('form.defform span#' + jQuery(this).attr('id').substr(6)).slideUp('fast', function() {
      	            
      	        });
      	    }
      	    else {
      	        jQuery(this).addClass('sliderSpanActive').html('schlie&szlig;en');
      	        
      	        jQuery('form.defform span#' + jQuery(this).attr('id').substr(6)).slideDown('fast', function() {
      	            
      	        });
      	    }
      	});
    },
    
    addButtonHover: function() {
        jQuery('input[type=image], img[src*=img/button_][src$=.png]').unbind('mouseover').mouseover(function() {
            if ((jQuery(this).attr('src').indexOf('button_') != -1) || (jQuery(this).attr('src').indexOf('arrow.png') != -1)) {
                jQuery(this).attr('src', jQuery(this).attr('src').substr(0, jQuery(this).attr('src').length - 4) + '_active.png');
            }
        }).unbind('mouseout').mouseout(function() {
            if (((jQuery(this).attr('src').indexOf('button_') != -1) || (jQuery(this).attr('src').indexOf('arrow_active.png') != -1)) && (jQuery(this).attr('src').indexOf('_active') != -1)) {
                jQuery(this).attr('src', jQuery(this).attr('src').substr(0, jQuery(this).attr('src').length - 11) + '.png');
            }
        });
    },
    
    oVerticalTimer: null,
    
    addVerticalTabsOLD: function() {
        jQuery('div.box_tab_vert div.img_bottom a.tab').each(function() {
            //if (jQuery(this).attr('href') == '') jQuery(this).css('cursor', 'default').click(function() {  jQuery(this).blur(); return false; });
            if (jQuery(this).attr('href') == '') jQuery(this).click(function() {  jQuery(this).blur(); return false; });
            else jQuery(this).addClass('tab_link');
        }).unbind('mouseover').mouseover(function() {
      	    var oThis = this;
      	    
      	    if (window.pageFunc.oVerticalTimer && jQuery(oThis).hasClass('tab_active')) {
      	        window.clearTimeout(window.pageFunc.oVerticalTimer);
      	        window.pageFunc.oVerticalTimer = null;
      	    }
      	    else if (!jQuery(oThis).hasClass('tab_active')) {
      	        if (window.pageFunc.oVerticalTimer) {
      	            window.clearTimeout(window.pageFunc.oVerticalTimer);
      	            window.pageFunc.oVerticalTimer = null;
      	        }
      	        
      	        window.pageFunc.oVerticalTimer = window.setTimeout(function() {
              	    jQuery(oThis).parent().children('a.tab').removeClass('tab_active');
              	    
              	    jQuery(oThis).addClass('tab_active').parent().children('div.tab').fadeOut(100, function() {
              	        jQuery(oThis).parent().children('div.tab').html(jQuery(oThis).next('span.tab').html()).fadeIn(100, function() {
              	            tb_init(jQuery(this).find('a.thickbox'));
              	        }).find('img').each(function() {
              	            if (jQuery(this).css('float') == 'right') jQuery(this).css('margin', '-25px -14px 0 0')
              	        });
              	    });
              	}, 250);
          	}
      	});
      	
      	jQuery('div.box_tab_vert div.img_bottom div.tab').mouseover(function() {
      	    if (window.pageFunc.oVerticalTimer) {
  	            window.clearTimeout(window.pageFunc.oVerticalTimer);
  	            window.pageFunc.oVerticalTimer = null;
  	        }
  	    });
      	
      	jQuery('div.box_tab_vert div.img_bottom a.tab:last').css('margin-bottom', '-1px');
      	//var oThis = jQuery('div.box_tab_vert div.img_bottom a.tab:first');
      	//jQuery(oThis).addClass('tab_active').css('margin-top', '-1px').parent().children('div.tab').hide().html(jQuery(oThis).next('span.tab').html()).fadeIn(100)
      	//    .find('img').each(function() { if (jQuery(this).css('float') == 'right') jQuery(this).css('margin', '-25px -14px 0 0') });
      	
      	jQuery('div.box_tab_vert div.img_bottom').each(function() {
      	    var oThis =  jQuery(this).find('a.tab:first');
      	    
      	    jQuery(oThis).addClass('tab_active').css('margin-top', '-1px').parent().children('div.tab').hide().html(jQuery(oThis).next('span.tab').html()).fadeIn(100, function() {
                tb_init(jQuery(this).find('a.thickbox'));
            }).find('img').each(function() { if (jQuery(this).css('float') == 'right') jQuery(this).css('margin', '-25px -14px 0 0') });
        });
    },
    
    addVerticalTabs: function() {
        //alert('d');
        jQuery('div.box_tab_vert div.img_bottom a.tab').each(function() {
            
            jQuery(this).attr('href', '#');
            
            // Links mit alt^=tb_ --> tb_relAttr, title = capture
            //jQuery(this).next('span.tab').find('a img[alt^=tb_]').each(function() {
            //    jQuery(this).parent('a').addClass('thickbox').attr({ 'rel': jQuery(this).attr('alt').substr(3), 'title': jQuery(this).attr('title') });
            //});
            
            //tb_init(jQuery(this).next('span.tab').find('a.thickbox'));
            //tb_init(jQuery(this).next('span.tab').find('a.thickbox'));
            
        }).unbind('click').click(function() {
      	    var oThis = this;
      	    
      	    if (!jQuery(oThis).hasClass('tab_active')) {
      	        jQuery(this).parent().parent().each(function() {
      	            //jQuery('div#container_menu').append('c: ' + encodeURI(document.title + $.data(this)) + '<br />');
      	            window.cookieFunc.createCookie(encodeURI(document.title + $.data(this)), jQuery(oThis).prevAll('a.tab').length);
      	        });
      	        
          	    jQuery(oThis).parent().children('a.tab').removeClass('tab_active');
          	    
          	    jQuery(oThis).addClass('tab_active').parent().children('div.tab').fadeOut(100, function() {
          	        jQuery(oThis).parent().children('div.tab').html(jQuery(oThis).next('span.tab').html()).fadeIn(100, function() {
          	            //tb_init(jQuery(this).find('a.thickbox'));
          	            
          	            /*
          	            if (window.pageFunc.oFadethumbTimeout) {
          	                window.clearTimeout(window.pageFunc.oFadethumbTimeout);
          	                window.pageFunc.oFadethumbTimeout = null;
          	            }
          	            window.pageFunc.initFadethumb(this, oThis);
          	            */
          	            
          	            jQuery(this).find('a[href$=.swf]').each(function() {
          	                var sFunc   = String(jQuery(this).attr('onclick'));
                            var iWidth  = parseInt(sFunc.substr(sFunc.indexOf('width=') +  6, 3));
                            var iHeight = parseInt(sFunc.substr(sFunc.indexOf('height=') + 7, 3));
                            var sFlash  = jQuery(this).attr('href');
                            var sId     = String(Math.random()).substr(2);
                            
                            jQuery(this).attr('onclick', function() { return function() { } });
                            
                            jQuery(this).click(function() {
                                jQuery(document.createElement('div')).css('display', 'none').attr('id', 'tb_flash_container_'+sId).html(
                                    '<div id="tb_flash_'+sId+'">&nbsp;</div>'
                                ).appendTo('body');
                                
                                tb_show(null, '#TB_inline?height='+iHeight+'&width='+iWidth+'&inlineId=tb_flash_container_'+sId, false);
                                jQuery('div#tb_flash_container_'+sId).remove();
                                
                                // +'<scr'+'ipt>var so = new SWFObject("'+sFlash+'", "DCI", '+iWidth+', '+iHeight+', "6", "#ffffff"); so.write("tb_flash_'+sId+'");<\/scr'+'ipt>'
                                var so = new SWFObject(sFlash, "DCI", iWidth, iHeight, "6", "#ffffff");
                                //so.addVariable('file', sFlash);
                                so.write('tb_flash_'+sId);
    		                        
    		                        return false;
    		                    });
          	            });
          	            
          	            
		                    // jQuery(this).find('span.rgmediaimages-player').each(function() {
		                        // window.pageFunc.bTabWithPlayer = 1;
		                        
		                        //var oPlayer = document.getElementById(jQuery(this).children('embed').attr('id'));
		                        //alert(jQuery(this).attr('id'));
		                        //if (oPlayer) 
		                        //oPlayer.sendEvent('PLAY', 'true');
		                    // });
          	            
          	            jQuery(this).find('a[href*=#c]').each(function() {
          	                jQuery(this).click(function() {
          	                    var sTab = jQuery(this).attr('href').substr(jQuery(this).attr('href').indexOf('#c') + 1);
          	                    
          	                    if (jQuery('a#' + sTab).length) jQuery('a#' + sTab).next('a.tab').click();
          	                    
          	                    jQuery(this).blur();
          	                    return false;
          	                });
          	            }); 
          	            
          	        }).find('img').each(function() {
          	            if (jQuery(this).css('float') == 'right') jQuery(this).css('margin', '-25px -14px 0 0')
          	        });
          	    });
          	}
          	
          	jQuery(this).blur();
          	return false;
      	});
      	
      	jQuery('div.box_tab_vert div.img_bottom div.tab').mouseover(function() {
      	    if (window.pageFunc.oVerticalTimer) {
  	            window.clearTimeout(window.pageFunc.oVerticalTimer);
  	            window.pageFunc.oVerticalTimer = null;
  	        }
  	    });
      	
      	jQuery('div.box_tab_vert div.img_bottom a.tab:last').css('margin-bottom', '-1px');
      	
      	jQuery('div.box_tab_vert div.img_bottom').each(function() {
      	    //jQuery('div#container_menu').append('r: ' + encodeURI(document.title + $.data(this)) + '<br />');
      	    var iTab = -1;
      	    
      	    jQuery(this).parent().each(function() {
      	        //jQuery('div#container_menu').append('r: ' + encodeURI(document.title + $.data(this)) + '<br />');
      	        iTab = parseInt(window.cookieFunc.readCookie(encodeURI(document.title + $.data(this))));
      	    });
      	    
      	    var oThis = (iTab > -1) ? jQuery(this).find('a.tab:eq('+iTab+')') : jQuery(this).find('a.tab:first');
      	    
      	    jQuery(oThis).click();
      	    //if (!$.browser.msie || (parseInt(jQuery.browser.version) >= 7)) jQuery(this).find('a.tab:first').css('margin-top', '-1px');
      	    jQuery(this).find('a.tab:first').css('margin-top', '-1px');
      	    
      	    //jQuery(oThis).addClass('tab_active').css('margin-top', '-1px').parent().children('div.tab').hide().html(jQuery(oThis).next('span.tab').html()).fadeIn(100, function() {
            //    tb_init(jQuery(this).find('a.thickbox'));
            //}).find('img').each(function() { if (jQuery(this).css('float') == 'right') jQuery(this).css('margin', '-25px -14px 0 0') });
        });
    },
    
    oFadethumbTimeout: null,
    
    initFadethumb: function(oDiv, oTab) {
        /*
        var iC   = 0;
        //alert(jQuery(oTab).next('span.tab').find('img.jso_Thumb').get(0));
        var aImg = $.data(jQuery(oTab).next('span.tab').find('img.jso_Thumb').get(0), 'thumbs');
        var iL   = aImg.length;
        
        if (aImg) {
            jQuery(oDiv).find('img.full').css('z-index', 100);
            
            var switchImg = function() {
                iC++;
                if (iC >= iL) iC = 0;
                
                oImg = new Image();// preload image
    	          oImg.src = aImg[iC];
                
                jQuery(oDiv).find("img.jso_Thumb").fadeOut(200, function() {
                    jQuery(this).attr('src', oImg.src).fadeIn(200);
                    
                    oTimeout = window.setTimeout(switchImg, 3000);
                });
            }
            
            oTimeout = window.setTimeout(switchImg, 3000);
        }
        */
        
        jQuery('img.jso_Thumb:visible').each(function() {
        	var iW 		 = 0;
        	var iH 		 = 0;
        	var sOrgPath = jQuery(this).parent('a.preview').attr('href');
        	
        	jQuery(this).parent('a.preview').children('img.jso_Thumb').each(function() {
        		if (jQuery(this).height() > iH) iH = jQuery(this).height();
        		
        		if (jQuery(this).width() > iW) iW = jQuery(this).width();
        		
        		
        		var sPath = jQuery(this).attr('src').substr(jQuery(this).attr('src').lastIndexOf('/') + 1);
        		//alert(jQuery(this).parent('a.preview').parent('div.gallery_thickbox').children('a[href$="'+sPath+'"]').length);
        		if (jQuery(this).parent('a.preview').parent('div.gallery_thickbox').children('a[href$="'+sPath+'"]').length) {
        			jQuery.data(this, 'link', jQuery(this).parent('a.preview').parent('div.gallery_thickbox').children('a[href$="'+sPath+'"]').attr('href'));
        			//alert(sPath);
        		}
        		else {
        			jQuery.data(this, 'link', sOrgPath);
        		}
        	});
        	
        	jQuery(this).parent('a.preview').css({ 'overflow': 'hidden', 'width': iW + 'px', 'height': iH + 'px' });
        });
        
        jQuery('img.jso_Thumb').parent().children('img.full').css('z-index', 100);
            
        var switchImg = function() {
            jQuery('img.jso_Thumb:visible').each(function() {
                jQuery(this).fadeOut(200, function() {
                	var jN = null;
                	
                    if (jQuery(this).next('img.jso_Thumb').length) jN = jQuery(this).next('img.jso_Thumb');
                    else jN = jQuery(this).parent().children('img.jso_Thumb:first');
                    
                    jN.fadeIn(200);
                    
                    // Tut nicht gscheit, da dann das Bild als erstes und dann spŠter in der Liste nochmal kommt
                    // Evtl. den Link auf's gro§e Bild ersetzen durch den orginal href vom ersten Link?
                    //jN.parent('a.preview').attr('href', jQuery.data(jN.get(0), 'link'));
                });
            });
            
            oTimeout = window.setTimeout(switchImg, 3000);
        }
        
        oTimeout = window.setTimeout(switchImg, 3000);
    }
}

jQuery(document).ready(function() {
    window.pageFunc.iPid = 0;//window.cookieFunc.readCookie('curr_pid');
    window.pageFunc.initPos();
    
    //div#header a, 
    
    
    // ÜBERBLEND-EFFEKT RAUSGENOMMEN
  	/*
    jQuery('ul#menu_main li a, ul#menu_sub li a, ul#menu_meta li a').click(function() { return window.pageFunc.menuClick(this); });
    
    jQuery('ul#menu_meta li#lang a').unbind('click').click(function() {
    		//window.cookieFunc.deleteCookie('curr_pid');
    		//window.location.href = jQuery(this).attr('href');
    		
    		//return false;
  	});
  	
  	//jQuery('div.screen a.internal-link').click(function() { return window.pageFunc.menuClick(this); });
  	
  	window.pageFunc.iOrigPid = parseInt(jQuery('ul li.active a').attr('id').substr(10));
    if (isNaN(window.pageFunc.iOrigPid)) window.pageFunc.iOrigPid = 1;
    
  	$.history.init(window.pageFunc.historyLoad);
  	
  	var iUrlParam = document.location.href.indexOf('#');
  	if (iUrlParam > -1) {
  	    var iPidUrl = parseInt(document.location.href.substr(iUrlParam + 1));
  	    
  	    if (iPidUrl && jQuery('a#menu_link_' + iPidUrl).length && !jQuery('a#menu_link_' + iPidUrl).parent('li').hasClass('active')) {
  	        // Animationszeit auf 0
  	        var iOld = window.pageFunc.iSpeed;
  	        jQuery('div.screen').css('visibility', 'hidden');
  	        window.pageFunc.iSpeed = 0;
  	        
  	        window.pageFunc.menuClick(jQuery('a#menu_link_' + iPidUrl));
  	        
  	        window.pageFunc.iSpeed = iOld;
  	    }
  	}
  	*/
  	
  	jQuery('div.screen div.promobar div.referenzen').each(function() { window.pageFunc.addSwitcher(this); });
  	jQuery('div.screen div.tabbox').each(function() { window.pageFunc.addSwitcher(this); });
  	window.pageFunc.addSliders();
  	window.pageFunc.addNewsSliders();
  	window.pageFunc.addButtonHover();
  	window.pageFunc.addVerticalTabs();
  	window.pageFunc.initFadethumb();
  	
  	
  	jQuery('input.inlineLabel').each(function() {
  	    jQuery.data(this, 'inlineLabel', jQuery(this).attr('value'));
  	    
  	    jQuery(this).focus(function() { if (jQuery(this).attr('value') == jQuery.data(this, 'inlineLabel')) this.value = ''; })
  	            .blur(function() { if (jQuery(this).attr('value') == '') this.value = jQuery.data(this, 'inlineLabel'); });
  	});
  	
  	/*
  	//jQuery('div.ajax_include').css('display', 'block');//.each(function() { jQuery(this).html('<script type="text/javascript" src="' + jQuery(this).text() + '"></script>'); }).css('display', 'block');
  	jQuery('div.ajax_include').each(function() {
  	    var oThis = this;
  	    
  	    $.get('/fileadmin/proxy.php', { 'url': encodeURI(jQuery(this).text()), 'id': jQuery(this).attr('id') }, function(sData, sStatus) {
  	        jQuery(oThis).html(sData);
  	        
  	        //sData = sData.replace(/lt \+ '\/script>'/g, "lt + '\\/script>'");
  	        
  	        //sData = sData.replace(/<scr'\+'ipt type=\\'text\/javascript\\'>    document\.write\(/g, '<a name="asd" id="tickergogogo_'+jQuery(oThis).attr('id')+'" \/><script type="text\/javascript">jQuery("#tickergogogo_'+jQuery(oThis).attr('id')+'").after("<scr"+"ipt>alert(\"asd\");<\/scr"+"ipt>"+');
  	        //sData = sData.replace(/document\.write\(wAD\);/g, 'jQuery("#'+jQuery(oThis).attr('id')+'").html(wAD);');
  	        
  	        //jQuery(oThis).text(sData);
  	        //jQuery(oThis).css('white-space', 'pre').text('dd<scr'+'ipt>' + sData + '<\/scri'+'pt>');
  	        //jQuery(oThis).after('d<scr'+'ipt>alert("gogo");' + sData + '<\/scri'+'pt>d');
  	        
  	        //eval(sData);
  	        //<script type='text/javascript'>    document.write
  	        
  	        //jQuery(oThis).before('<script type="text/javascript">' + sData.replace(/document\.write\(/g, 'jQuery("#'+jQuery(oThis).attr('id')+'").append(') + '<\/script>');
  	        
  	        //eval(sData.replace(/document\.write\(/g, 'jQuery("#'+jQuery(oThis).attr('id')+'").html(jQuery("#'+jQuery(oThis).attr('id')+'").html() + '));
  	        //eval(sData.replace(/document\.write\(/g, 'document.getElementById("'+jQuery(oThis).attr('id')+'").innerHTML = (jQuery("#'+jQuery(oThis).attr('id')+'").html() + '));
  	    });
  	});
  	*/
  	
  	jQuery('div#container_menu ul#menu_main li.spacer').each(function() {
  		var aElems 	  = new Array();
  		var bContinue = false;
  		var bHide	  = true;
  		
  		jQuery(this).nextAll().each(function() {
  			if (jQuery(this).hasClass('spacer')) {
  				bContinue = true;
  			}
  			else if (!bContinue) {
  				aElems.push(jQuery(this).children('a').attr('id'));
  				
  				if (jQuery(this).hasClass('active') || jQuery(this).hasClass('current')) bHide = false;
  			}
  		});
  		
  		var sElems = 'a#' + aElems.join(', a#');
  		
  		if (bHide) {
  			jQuery(sElems).parent().hide();
  		}
  		else {
  			jQuery(this).css('background-image', 'url(http://dci.sg-web.eu/fileadmin/img/bg_navi_left_open_off.gif)');
  		}
  		
  		jQuery(this).css('cursor', 'pointer').click(function() {
  			if (jQuery('a#' + aElems[0] + ':visible').length) {
  				jQuery(sElems).parent().slideUp('fast');
  				jQuery(this).css('background-image', 'url(http://dci.sg-web.eu/fileadmin/img/bg_navi_left_closed_on.gif)');
  			}
  			else {
  				jQuery(sElems).parent().slideDown('fast');
  				jQuery(this).css('background-image', 'url(http://dci.sg-web.eu/fileadmin/img/bg_navi_left_open_on.gif)');
  			}
  			
  			jQuery(this).css('cursor', 'pointer');
  		}).mouseover(function() {
  			jQuery(this).css('background-image', jQuery(this).css('background-image').substr(0, jQuery(this).css('background-image').length - 8) + 'on.gif)');
  		}).mouseout(function() {
  			jQuery(this).css('background-image', jQuery(this).css('background-image').substr(0, jQuery(this).css('background-image').length - 7) + 'off.gif)');
  		});
  	});
  	
  	// Bilder im RTE gesetzt, alt-Tag fängt mit tb_ an --> Thickbox setzen!
  	jQuery('div.screen').find('a img[alt^=tb_]').each(function() {
        jQuery(this).parent('a').addClass('thickbox').attr({ 'rel': jQuery(this).attr('alt').substr(3), 'title': jQuery(this).attr('title') });
    });
    // Link Titel mit tb_ --> Thickbox Ajax!
    jQuery('div.screen').find('a[title^=tb_]').each(function() {
        jQuery(this).addClass('thickbox').attr({ 'title': jQuery(this).attr('title').substr(3) });
        
        var iW = 732;
        if ($.browser.msie && (parseInt(jQuery.browser.version) < 7)) iW = 756;
        
        if (jQuery(this).attr('href').indexOf('?') == -1) jQuery(this).attr('href', jQuery(this).attr('href') + '?width='+iW+'&height=555');
    });
    
    
    
    
  	/*
  	 * Buttons - variable Breite!
  	 *
  	 */
  	var jsonDefButton = {
  	    'background'   : 'url(/fileadmin/img/bg_button_x.gif) 0 0 repeat-x',
  	    'position'     : 'relative',
  	    'padding'      : '0 33px 2px 12px',
  	    'display'      : 'inline-block',
  	    
  	    'text-decoration': 'none',
  	    'font-size'      : '11px',
  	    'line-height'    : '14px',
  	    'color'          : '#6E6E6E'
  	};
  	
  	jQuery('a.jso_defButton').css(jsonDefButton).each(function() {
  	    jQuery(document.createElement('img')).attr('src', '/fileadmin/img/bg_button_left.gif').css({ 'position': 'absolute', 'top': '0px', 'left': 0 }).appendTo(this);
  	    jQuery(document.createElement('img')).addClass('over').attr('src', '/fileadmin/img/bg_button_right.gif').css({ 'position': 'absolute', 'top': 0, 'right': 0 }).appendTo(this);
  	    
  	    jQuery(this).mouseenter(function() {
  	        jQuery(this).children('img.over').attr('src', '/fileadmin/img/bg_button_right_active.gif');
  	    }).mouseleave(function() {
  	        jQuery(this).children('img.over').attr('src', '/fileadmin/img/bg_button_right.gif');
  	    });
  	});
  	
  	
  	//alert('d');
  	// Click gallery "Thumbnails" (initializes scroller)
  	/*
  	setTimeout(function() {
      	jQuery('a.carouselBtn').each(function() {
            jQuery(this).click();
      	    alert('d');
      	});
    }, 2000);
    */
    
    
    $('div.content_statistiken').each(function() {
        var oThis = this;
        
        $.get('http://www.dci.de/fileadmin/proxy.php', { 'url': 'http://www.webdatenblatt.de/cds/extranet/default.asp?rdir=workpage.asp%3Fx%3D%26a%3DCKL' }, function(sData) {
            sData = sData.replace(/<script(.|\s)*?\/script>/ig, "");
            
            var sHtml = '<tbody><tr>';
            var iI    = 0;
            
            $('<div />').append(sData).find('td.x').parent('tr').each(function() {
                sHtml = sHtml + '<td>' + $(this).children('td.y').text() + '<br /><strong>' + $(this).children('td.x').text() + '</strong>';
                
                if ((++iI % 2) == 0) sHtml = sHtml + '</tr><tr>';
            });
            
            sHtml = sHtml + '</tr></tbody>';
            sHtml = sHtml.replace(/\*NEU/g, '<span style="color: red;">*</span>NEU');
            
            $(oThis).html('<table class="content_stats">' + sHtml + '</table>');
        });
    });
    
    
    
    
    //window.cookieFunc.createCookie('infoboards_parent', '', -1);
    
    /*
    var jClose = $('<img src="fileadmin/img/button_close.png" alt="X" />').css('margin', '0 -10px 0 10px');//.click(
    var oClose = function() {
        if ($(this).parent().hasClass('infoboards_parent')) {
            window.cookieFunc.eraseCookie('infoboards_parent');
            window.cookieFunc.eraseCookie('infoboards_parent_url');
        }
        else {
            window.cookieFunc.eraseCookie('infoboards_tab');
            window.cookieFunc.eraseCookie('infoboards_tab_url');
        }
        
        
        if (!$(this).parent().hasClass('active')) {
            $(this).parent().fadeOut(function() {
                $(this).next('a.infoboards_tab').css('margin-left', '30px');
                $(this).remove();
            });
        }
        else {
            // location.href either last normal tab or parent tab
            //var sLoc = window.cookieFunc.readCookie('infoboards_parent_url');
            
            //if (sLoc) location.href = sLoc;
            //else      
            self.location = $(this).parent().prev('a').attr('href');
        }
        
        return false;
    }
    
    $('div.reiter.infoboards div.img_top a.infoboards_tab').each(function() {
        $(this).append(jClose.clone().click(oClose));
        
        var sParent = window.cookieFunc.readCookie('infoboards_parent');
        var jParent = $(sParent);
        var sTab    = window.cookieFunc.readCookie('infoboards_tab');
        var jTab    = $(sTab);
        var sSelf   = $(document.createElement('span')).append($(this).clone()).html();
        var jSelf   = $(sSelf);
        
        if (sParent && (jSelf.attr('href') != jParent.attr('href'))) {
            window.cookieFunc.createCookie('infoboards_tab', sSelf);
            window.cookieFunc.createCookie('infoboards_tab_url', $(this).attr('href'));
            
            jParent.children('img').click(oClose);
            $(this).before(jParent.removeClass('active')).removeClass('infoboards_parent');
            //$(this).prev('a.infoboards_parent').append(jClose.clone().click(oClose)).removeClass('active');
        }
        else if (jSelf.attr('href') != jTab.attr('href')) {
            window.cookieFunc.createCookie('infoboards_parent', sSelf);
            window.cookieFunc.createCookie('infoboards_parent_url', $(this).attr('href'));
            
            var sTab = window.cookieFunc.readCookie('infoboards_tab');
            
            if (sTab) {
                var jTab = $(sTab).removeClass('active').removeClass('infoboards_parent');
                $(jTab).children('img').click(oClose);
                
                $(this).after(jTab);
                //$(this).prev('a.infoboards_parent').append(jClose.clone().click(oClose)).removeClass('active');
            }
        }
    });
    
    if (!$('div.reiter.infoboards div.img_top a.infoboards_tab').length) {
        var sParent = window.cookieFunc.readCookie('infoboards_parent');
        var sTab    = window.cookieFunc.readCookie('infoboards_tab');
        
        if (sParent) {
            jParent = $(sParent).children('img').click(oClose).parent();
            $('div.reiter.infoboards div.img_top').append(jParent.removeClass('active'));
        }
        
        if (sTab) {
            jTab = $(sTab).children('img').click(oClose).parent();
            
            if (sParent) jTab.removeClass('infoboards_parent');
            
            $('div.reiter.infoboards div.img_top').append(jTab.removeClass('active'));
        }
    }
    */
    var jClose = $('<img src="fileadmin/img/button_close.png" alt="X" />').css('margin', '0 -10px 0 10px');//.click(
    var oClose = function() {
        var sCookieLoc = window.cookieFunc.readCookie('infoboards_referer');
        var sLoc       = $(this).parent().prev('a').attr('href');
        
        if (sCookieLoc && $('div.reiter.infoboards div.img_top a[href="'+sCookieLoc+'"]').length) {
            sLoc = sCookieLoc;
        }
        else if (!sLoc) sLoc = $(this).parent().prev('span').prev('a').attr('href');
        
        if ($(this).parent().hasClass('infoboards_parent')) {
            window.cookieFunc.eraseCookie('infoboards_parent');
        }
        else {
            window.cookieFunc.eraseCookie('infoboards_tab');
        }
        
        
        if (!$(this).parent().hasClass('active')) {
            $(this).parent().fadeOut(function() {
                $(this).next('a.infoboards_tab').css('margin-left', '30px');
                $(this).remove();
            });
        }
        else {
            // location.href either last normal tab or parent tab
            //var sLoc = window.cookieFunc.readCookie('infoboards_parent_url');
            
            //if (sLoc) location.href = sLoc;
            //else      
            self.location = sLoc;
        }
        
        return false;
    }
    
    $('div.reiter.infoboards div.img_top a.infoboards_tab').each(function() {
        $(this).append(jClose.clone().click(oClose));
        
        if ($(this).prev('span').text() == $(this).parent().children('a:eq(2)').attr('href')) bParent = true;
        else bParent = false;
        
        if (bParent) {
            var sSelf = $(document.createElement('span')).append($(this).clone().removeClass('active')).html();
            
            window.cookieFunc.createCookie('infoboards_parent', sSelf);
            
            var sTab = window.cookieFunc.readCookie('infoboards_tab');
            
            if (sTab) $(this).after($(sTab).children('img').click(oClose).parent());
        }
        else {
            var sSelf = $(document.createElement('span')).append($(this).removeClass('infoboards_parent').clone().removeClass('active')).html();
             
            window.cookieFunc.createCookie('infoboards_tab', sSelf);
            
            var sParent = window.cookieFunc.readCookie('infoboards_parent');
            
            if (sParent) $(this).before($(sParent).children('img').click(oClose).parent());
            else         $(this).css('margin-left', '30px');
        }
        
        sCurr = window.cookieFunc.readCookie('infoboards_url');
        
        if (sCurr != $(this).attr('href')) {
            window.cookieFunc.createCookie('infoboards_referer', sCurr);
            window.cookieFunc.createCookie('infoboards_url', $(this).attr('href'));
        }
        
    });
    
    if ($('div.reiter.infoboards').length && !$('div.reiter.infoboards div.img_top a.infoboards_tab').length) {
        var sParent = window.cookieFunc.readCookie('infoboards_parent');
        var sTab    = window.cookieFunc.readCookie('infoboards_tab');
        
        if (sParent) {
            $('div.reiter.infoboards div.img_top').append($(sParent).children('img').click(oClose).parent());
        }
        
        if (sTab) {
            jTab = $(sTab).children('img').click(oClose).parent();
            
            if (!sParent) jTab.addClass('infoboards_parent');
            
            $('div.reiter.infoboards div.img_top').append(jTab);
        }
        
        window.cookieFunc.createCookie('infoboards_url', $('div.reiter.infoboards div.img_top a.active').attr('href'));
    }
    
    
    
    
    
    
    
    $('div.contentbox').each(function() {
        var iMarginTop = parseInt($(this).css('margin-top').substr(0, $(this).css('margin-top').length - 2));
        var iMarginBtm = parseInt($(this).css('margin-bottom').substr(0, $(this).css('margin-bottom').length - 2));
        
        $(this).css({ 'border-width': '0 1px', 'margin-top': (iMarginTop + 1) + 'px', 'margin-bottom': (iMarginBtm + 1) + 'px' });
        
  	    $(document.createElement('span')).css({ 'position': 'absolute', 'left': 0, 'top': '-1px', 'width': $(this).innerWidth(), 'height': '1px', 'background-color': '#e8e8e8' }).prependTo(this);
  	    $(document.createElement('span')).css({ 'position': 'absolute', 'left': 0, 'bottom': '-1px', 'width': $(this).innerWidth(), 'height': '1px', 'background-color': '#e8e8e8' }).appendTo(this);
  	    
  	});
  	
  	
  	
  	
  	$('a.nextDings').each(function() {
  	    var jLink = jQuery(this);
  	    
  	    var clickLink = function() {
  	        jLink.click();
  	        
  	        setTimeout(clickLink, 6000);
  	    };
  	    
  	    setTimeout(clickLink, 6000);
  	}).click(function() {
  	    var jNext = $(this).parent().children('p:visible').fadeOut(100).next('p:hidden');
  	    
  	    if (!jNext.length) jNext = $(this).parent().children('p:first');
  	    
  	    setTimeout(function() { jNext.fadeIn(100); }, 150);
  	    
  	    return false;
  	});
});