function contentfix() {
  var y = document.documentElement.scrollTop;
  $('.TMP_Content').toggle();
  $('.TMP_Content').toggle();
  window.scrollTo(0, y);
}

$(document).ready(function () {
  if ($.browser.msie) {
    window.setTimeout("contentfix()", 500);
  }
    $(".LinkShare").next("ul").children("li").children("a").each(function (i) {
        if (($(this).attr("href").indexOf("xing") != -1) && ($('html')[0].lang != "de" && $('html')[0].lang != "at" && $('html')[0].lang != "ch")) {
            $(this).attr("href", "http://www.linkedin.com/shareArticle?mini=true&url=" + escape(document.URL));
            $(this).children("img").attr("src", "fileadmin/images/linkedin_icon.png");
        } else {
            $(this).attr("href", $(this).attr("href") + escape(document.URL));
        }
    });
    $("a.LinkMail").click(function () {
        $("Body").append('\
                     <div id="Layer" style=""> </div>\
                     <div id="LightBox" style="top:10%;margin-top:0;!left:40%;z-index:999999;" class="Small SeiteVersenden">\
                     <div class="LightBoxArea">\
                     <div class="LightBoxTop">\
                     <a href="#" class="ClosedLink"> </a>\
                     <div class="LightBoxMain">\
                     <h3>\
                     <img src="fileadmin/images/pagesend_' + $('html')[0].lang + '.gif" alt="" border="0">\
                     </h3>\
                     <div class="">\
                     <iframe width="320" style="height:490px;!height:520px" frameborder="0" src="/index.php?id=28&tipUrl=' + document.URL + '&eID=tipafriend&lang=' + $('html')[0].lang + '">\
                     </iframe>\
                     </div>\
                     </div>\
                     </div>\
                     </div>\
                     </div>\
                     ');
        $("#LightBox a.ClosedLink").click(function () {
            $("#Layer,#LightBox").remove();
            return false;
        })
        return false;
    });
    $("#SocialMedia li:last").live('click', function (e) {
        if (($.browser.msie && e.button == 1)) { //(!$.browser.msie && e.button == 0) || 
            return false;
        } else if (e.button == 2) {
            return false;
        }
    });
    // -------------------------------------------------------------- featuredcontentglider
    $('.flashcontent').each(function (index) {
/*$(this).append('<object type="application/x-shockwave-flash" data="'+$(this).children("a").attr("href")+'" style="width:'+$(this).children("a").children("img").width()+'px; height:'+$(this).children("a").children("img").height()+'px">\
        <param name="quality" value="high">\
        <a href="'+$(this).children("a").attr("alt")+'">\
          <img src="'+$(this).children("a").children("img").attr("src")+'" alt="Get Adobe Flash player">\
        </a>\
              </object>');*/
        $(this).append('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="' + $(this).children("a").children("img").width() + '" height="' + $(this).children("a").children("img").height() + '" id="' + $(this).children("a").attr("href") + '" align="middle">\
    <param name="movie" value="' + $(this).children("a").attr("href") + '"/>\
      <param name="wmode" value="transparent">\
    <!--[if !IE]>-->\
    <object type="application/x-shockwave-flash" data="' + $(this).children("a").attr("href") + '" width="' + $(this).children("a").children("img").width() + '" height="' + $(this).children("a").children("img").height() + '">\
        <param name="movie" value="' + $(this).children("a").attr("href") + '"/>\
                <param name="wmode" value="transparent">\
    <!--<![endif]-->\
        <a href="' + $(this).children("a").attr("alt") + '">\
          <img src="' + $(this).children("a").children("img").attr("src") + '" alt="Get Adobe Flash player">\
        </a>\
    <!--[if !IE]>-->\
    </object>\
    <!--<![endif]-->\
</object>');
        $(this).children("a").hide();
    });
    // -------------------------------------------------------------- featuredcontentglider
    featuredcontentglider.init({
        gliderid: "kompetenzarea",
        //ID of main glider container
        contentclass: "glidecontent",

        //Shared CSS class name of each glider content
        togglerid: "p-select",
        //ID of toggler container
        remotecontent: "",
        //Get gliding contents from external file on server? "filename" or "" to disable
        selected: 0,
        //Default selected content index (0=1st)
        persiststate: false,
        //Remember last content shown within browser session (true/false)?
        speed: 500,
        //Glide animation duration (in milliseconds)
        direction: "rightleft",
        //set direction of glide: "updown", "downup", "leftright", or "rightleft"
        autorotate: true,
        //Auto rotate contents (true/false)?
        autorotateconfig: [5000, 5] //if auto rotate enabled, set [milliseconds_btw_rotations, cycles_before_stopping]
    })
    // -------------------------------------------------------------- Dropdown
    $('.Items').selectbox();
    $('.Language').selectbox({
        inputClass: 'selectboxLanguage',
        containerClass: "selectbox-wrapper language"
        // hoverClass :"current",
        // currentClass : "selected" 
    });
    $('.Filtern').selectbox({
        inputClass: 'selectbox filtern'
        // containerClass : "selectbox-wrapper",
        // hoverClass :"current",
        // currentClass : "selected" 
    });
    // neu 
    $('.FilternKat').selectbox({
        inputClass: 'selectbox kategorie'
    });
    // neu: ende
    $('#Hauptkategorie').change(function (ev) {
        $("#Inactv").hide();
        if ($('#Hauptkategorie').val() !== "00") {
            $("#Inactv").hide();
        } else {
            $("#Inactv").show();
        }
        $(".unterkategorie").hide();
        $("#Unterkategorie" + $('#Hauptkategorie').val()).show();
    });
    $('.InactiveFilter').selectbox({
        inputClass: 'selectbox filtern inactive'
        // containerClass : "selectbox-wrapper",
        // hoverClass :"current",
        // currentClass : "selected" 
    });
    $('.PageStatus').selectbox({
        inputClass: 'selectboxPages',
        containerClass: "selectbox-wrapper pages"
        // hoverClass :"current",
        // currentClass : "selected" 
    });
    $('.Anrede').selectbox({
        inputClass: 'selectboxAnrede'
        // containerClass : "selectbox-wrapper anrede"
        // hoverClass :"current",
        // currentClass : "selected" 
    });
    $('.Land').selectbox({
        inputClass: 'selectboxLand'
        //containerClass : "selectbox-wrapper land"
        // hoverClass :"current",
        // currentClass : "selected" 
    });
    $('.Country').selectbox({
        inputClass: 'selectboxCountry',
        containerClass: "selectbox-wrapper"
        // hoverClass :"current",
        // currentClass : "selected" 
    });
    $('.selectbox-wrapper.pages').click(function () {
        $(".ListStatus form:first").submit();
    })
    $("Form[name$='news'] .thema ul li").click(function () {
        var thema = $(this).attr("id");
        var myurl = thema.split("_input_");
        location.href = $("base").attr("href") + "/" + myurl[1] + "?no_cache=1";
        return false;
    }); /* marina */
    $("Form[name$='news'] .year ul li").click(function () {
        var thema = $(this).attr("id");
        var myurl = thema.split("_input_");
        location.href = $("base").attr("href") + "/" + myurl[1] + "?no_cache=1";
        return false;
    });
    $("Form[name$='downloads'] .year ul li").click(function () {
        var thema = $(this).attr("id");
        var myurl = thema.split("_input_");
        location.href = $("base").attr("href") + "/" + myurl[1] + "?no_cache=1";
        return false;
    });
    $("Form[name$='getdoclang'] .selectbox-wrapper ul li").click(function () {
        var thema = $(this).attr("id");
        var myurl = thema.split("_input_");
        location.href = $("base").attr("href") + "/" + myurl[1];
        return false;
    });
    $("Form[name$='downloads'] .thema ul li").click(function () {
        var thema = $(this).attr("id");
        var myurl = thema.split("_input_");
        location.href = $("base").attr("href") + "/" + myurl[1] + "?no_cache=1";
        return false;
    });
    $("Form[name$='limit'] .selectbox-wrapper ul li").click(function () {
        var val = $(this).attr("id");
        var myurl = val.split("_input_");
        location.href = $("base").attr("href") + "/" + myurl[1];
        return false;
    });
/*  $("Form[name$='limit'] .selectbox-wrapper ul li").click(function (){    
    $("Form[name$='limit']").submit()
  })   
  
  $("Form[name$='catform'] .selectbox-wrapper ul li").click(function (){    
    $("Form[name$='catform']").submit();
  })
  */
    /* marina: end  */
    $("Form[name$='region'] .selectbox-wrapper ul li").click(function () {
        $("Form[name$='region']").submit()
    })
    $("Form[name$='country'] .selectbox-wrapper ul li").click(function () {
        $("Form[name$='country']").submit()
    })
    $("Form[name$='dispatcher'] .selectbox-wrapper ul li").click(function () {
        $("Form[name$='dispatcher']").submit();
    })
    //  $("Form[name$='getdoclang'] .selectbox-wrapper ul li").click(function (){
    //    $("Form[name$='getdoclang']").submit();
    //  })    
    // -------------------------------------------------------------- Dropdown Country Select
    $(".selectbox-wrapper.language ul li").click(function () {
        document.location.href = $("base").attr("href") + "/" + $("select.Language option:eq(" + $(this).index() + ")").val();
    })
    // ------------------------------------------------------------- mycarousel vert
    jQuery('#mycarousel.verti').jcarousel({
        vertical: true,
        scroll: 3
    });
    // ------------------------------------------------------------- Layer
    $(".seite_versenden").click(function () {
        $("#Layer").show();
        $(".SeiteVersenden").show();
        return false;
    });
    $(".dank").click(function () {
        $("#Layer").show();
        $(".SeiteDank").show();
        $(".SeiteVersenden").hide();
        return false;
    });
    $(".ClosedLink").click(function () {
        $("#Layer").hide();
        $("#LightBox").hide();
        $(".SeiteVersenden").hide();
        $(".SeiteDank").hide();
        return false;
    });
    // ------------------------------------------------------------- mycarousel hori
    jQuery('#mycarousel.hori').jcarousel({
        vertical: false,
        scroll: 3
    });
    $("#mycarousel.hori li a span").hide();
    $("#mycarousel.hori li a").click(function () {
        $(".FotoKarussell_Left").html(' \
                <div class="SubrubrikenHeadline"> \
                  <h4><img src="' + $(this).children(".hlsrc").children("img").attr("src") + '"></h4> \
                  <h5><img src="' + $(this).children(".slsrc").children("img").attr("src") + '"></h5> \
                </div> \
                <a href="' + $(this).children(".link").text() + '"><img id="bigimg" src="' + $(this).attr("href") + '"></a> \
     ');
        $(".FotoKarussell_Right").html(' \
              <p>' + $(this).children(".text").text() + '</p> \
              <p><a href="' + $(this).children(".link").text() + '">' + $(this).children(".linktitel").text() + '</a></p> \
     ');
        //$('.CM_SF_FotoKarussell').wrap('<table width="100%" cellpadding="0" cellspacing="0" border="0"><tbody><tr><td valign="top"></td></tr></tbody></table>');
        $('#bigimg').load(function () {
            if ($.browser.msie) {
                var y = document.documentElement.scrollTop;
                $('.CM_SF_FotoKarussell').toggle();
                $('.CM_SF_FotoKarussell').toggle();
                $('.TMP_Content').toggle();
                $('.TMP_Content').toggle();
                window.scrollTo(0, y);
            }
        });
        return false;
    });
    if ($.browser.msie) {
        //$(".TMP_Content").wrapInner('<table width="100%" cellpadding="0" cellspacing="0" border="0"><tbody><tr><td valign="top"></td></tr></tbody></table>');
        var y = document.documentElement.scrollTop;
        $('.TMP_Content').toggle();
        $('.TMP_Content').toggle();
        window.scrollTo(0, y);
        $(".TMP_Content").click(function () {
            if (!$(this).find("form").length) {
                var y = document.documentElement.scrollTop;
                $('.TMP_Content').toggle();
                $('.TMP_Content').toggle();
                window.scrollTo(0, y);
            }
        });
        $(".ListStatusContent").click(function () {
            var y = document.documentElement.scrollTop;
            $('.TMP_Content').toggle();
            $('.TMP_Content').toggle();
            window.scrollTo(0, y);
        });
    }
    // ------------------------------------------------------------- mycarousel openBigImage
    if ($('.FotoOriginal').length != 0) {
        $('.FotoOriginal img').attr("src", $('.jcarousel-item a').attr("href"));
        $('.FotoOriginal').append("<p>" + $('.jcarousel-item a').attr("title") + "</p>")
        $('.jcarousel-item a').click(function () {
            var clickedItem = $(this);
            $('.FotoOriginal p').slideUp(500, function () {
                $('.FotoOriginal img').fadeOut(500, function () {
                    $('.FotoOriginal img').attr("src", clickedItem.attr("href"));
                    $('.FotoOriginal p').text(clickedItem.attr("title"));
                    $('.FotoOriginal img').fadeIn(500, function () {
                        $('.FotoOriginal p').slideDown(500);
                    });
                });
            });
            return false;
        });
    }
    // ------------------------------------------------------------- lightbox  
    $('a.LinkZoom').lightBox();
    // ------------------------------------------------------------- Scrollpane  
    $('.scroll-pane').jScrollPane({
        showArrows: true,
        verticalDragMaxHeight: 35,
        autoReinitialise: true
    });
    // ------------------------------------------------------------- Scrollpane  2
    if ($('#LightBox').length != 0) {
        $(".window").click(function () {
            $("Body").append('<div id="Layer"> </div>');
            var clickedWindow = $(this).attr("title");
            $("." + clickedWindow).show();
            $(".ClosedLink").click(function () {
                $("#Layer").remove();
                $("." + clickedWindow).hide();
                return false;
            });
            return false;
        })
        $('.scroll-pane').jScrollPane({
            showArrows: true,
            verticalDragMaxHeight: 35,
            autoReinitialise: true
        });
    }
    // ------------------------------------------------------------- clearfield  
    $('text,textarea:not(#tx_srsendcard_pi1_card_signature,#tx_srsendcard_pi1_card_message, #tx_srsendcard_pi1_card_title),.TextField').clearField();
    // ---------------------------------------------------- Checkbox & Radio-Button  
    $('.Checkbox').click(function () {
        $('.ErrorCheckbox').parent().addClass("ErrorCheckbox");
        var checkbox = $(this).children("input:checkbox");
        $(this).toggleClass("Checked");
        $(checkbox).attr('checked', $(this).hasClass("Checked"));
    });
    $('.Radio').click(function () {
        $('.ErrorRadio').parent().addClass("ErrorRadio");
        var radioButton = $(this).children("input:radio");
        var radioGroupName = radioButton.attr("name");
        $("input[name='" + radioGroupName + "']").parent().removeClass("RadioChecked");
        $(this).addClass("RadioChecked");
    });
    // ------------------------------------------------------------- createPageSendLightwindow  

    function createPageSendLightwindow(iframeURL) {
        $("Body").append('\
                     <div id="Layer" style=""> </div>\
                     <div id="LightBox" style="top:10%;margin-top:0;!left:40%;z-index:999999;" class="Small SeiteVersenden">\
                     <div class="LightBoxArea">\
                     <div class="LightBoxTop">\
                     <a href="#" class="ClosedLink"> </a>\
                     <div class="LightBoxMain">\
                     <h3>\
                     <img src="fileadmin/images/pagesend_' + $('html')[0].lang + '.gif" alt="" border="0">\
                     </h3>\
                     <div class="">\
                     <iframe width="320" style="height:490px;!height:520px" frameborder="0" src="/index.php?id=28&tipUrl=' + document.URL + '&eID=tipafriend&lang=' + $('html')[0].lang + '">\
                     </iframe>\
                     </div>\
                     </div>\
                     </div>\
                     </div>\
                     </div>\
                     ');
        $("#LightBox a.ClosedLink").click(function () {
            $("#Layer,#LightBox").remove();
            return false;
        })
    }
/*function createPageSendLightwindow() {
    var appendlightboxString = ' \
  <div id="Layer" style=""> </div> \
  <div id="LightBox" style="top:10%;margin-top:0" class="Small SeiteVersenden"> \
    <div class="LightBoxArea"> \
      <div class="LightBoxTop"> \
        <a href="#" class="ClosedLink"> </a> \
        <div class="LightBoxMain"> \
          <h3><img src="images/tt_seite_versenden.gif" alt="" border="0" /></h3> \
          <div class="LightBoxMainArea">  \
            <p>Bitte füllen Sie die nachfolgenden Eingabefelder aus.</p> \
            <form action=".html" class="Formular"> \
              <p><label><strong>Ihr Name*</strong></label> \
              <input type="text" value="" class="TextField W280" /></p> \
               \
              <p><label class="Error"><strong>Ihr E-Mail*</strong></label> \
              <input type="text" value="" class="TextField W280 Error" /></p> \
               \
              <p><label><strong>Empfänger Name*</strong></label> \
              <input type="text" value="" class="TextField W280" /></p> \
               \
              <p><label><strong>Empfänger E-Mail*</strong></label> \
              <input type="text" value="" class="TextField W280" /></p> \
               \
              <p class="TextSmall">Die mit einem * gekennzeichneten Felder müssen ausgefüllt werden.</p> \
              <div style="clear: both;"> \
                <div class="Checkbox"><input type="checkbox" value="" /></div>  \
                <span class="CheckboxLabel">Ich erkläre mich damit einverstanden, dass meine Daten gespeichert werden ...<br /> \
                Weitere Informationen finden Sie in der<br /> \
                <a href="#">Datenschutzregelung</a>\
                </span>\
              </div>\
              <p class="Error">Bitte füllen Sie die rot markierten Felder korrekt aus.</p> \
              <div style="display: inline-block;width: 280px;text-align: right;margin: 0; padding: 0;"> \
                <div style="float: right;"> \
                <!-- Button Link --> \
                <div class="BtnLeft"> \
                  <div class="BtnRight"> \
                    <input type="submit" value="versenden" class="dank" />  \
                  </div> \
                </div></div> \
                <!-- <input type="image" src="images/btn_versenden.png" /> --> \
              </div> \
              </form>  \
              </div> <!-- Ende: LightBoxMainArea --> \
        </div> <!-- Ende: LightBoxMain --> \
        <div class="LightBoxBottom"> </div> \
      </div> \
    </div> <!-- Ende: LightBoxArea --> \
  </div> <!-- Ende: LightBox --> ';

        $("body").append(appendlightboxString);
        $('#LightBox .ClosedLink').click(function () {
            $('#LightBox, #Layer').remove();
            return false;
        });
    }*/
});
(function ($) {
    $.fn.clearField = function (settings) {
        settings = jQuery.extend({
            blurClass: 'clearFieldBlurred',
            activeClass: 'clearFieldActive',
            attribute: 'rel',
            value: ''
        }, settings);
        return $(this).each(function () {
            var el = $(this);
            settings.value = el.val();
            if (el.attr(settings.attribute) == undefined) {
                el.attr(settings.attribute, el.val()).addClass(settings.blurClass);
            } else {
                settings.value = el.attr(settings.attribute);
            }
            el.focus(function () {
                if (el.val() == el.attr(settings.attribute)) {
                    el.val('').removeClass(settings.blurClass).addClass(settings.activeClass);
                }
            });
            el.blur(function () {
                if (el.val() == '') {
                    el.val(el.attr(settings.attribute)).removeClass(settings.activeClass).addClass(settings.blurClass);
                }
            });
        });
    };
})(jQuery);
// ------------------------------------------------------------- Menü
var timeout = 500;
var closetimer = 0;
var ddmenuitem = 0;

function jsddm_open() {
    jsddm_canceltimer();
    jsddm_close();
    ddmenuitem = $(this).find('ul').css('visibility', 'visible');
}

function jsddm_close() {
    if (ddmenuitem) ddmenuitem.css('visibility', 'hidden');
}

function jsddm_timer() {
    closetimer = window.setTimeout(jsddm_close, timeout);
}

function jsddm_canceltimer() {
    if (closetimer) {
        window.clearTimeout(closetimer);
        closetimer = null;
    }
}
$(document).ready(function () {
    $('#jsddm > li').bind('mouseover', jsddm_open)
    $('#jsddm > li').bind('mouseout', jsddm_timer)
    $('#jsddm02 > li').bind('mouseover', jsddm_open)
    $('#jsddm02 > li').bind('mouseout', jsddm_timer)
    $('#SocialMedia > li').bind('mouseover', jsddm_open)
    $('#SocialMedia > li').bind('mouseout', jsddm_timer)
    $('#SocialMediaHome > li').bind('mouseover', jsddm_open)
    $('#SocialMediaHome > li').bind('mouseout', jsddm_timer)
});
document.onclick = jsddm_close;
var featuredcontentglider = {
    csszindex: 100,
    ajaxloadingmsg: '<b>Fetching Content. Please wait...</b>',
    glide: function (config, showpage, isprev) {
        var selected = parseInt(showpage)
        if (selected >= config.$contentdivs.length) { //if no content exists at this index position
            selected = 0
        }
        var $target = config.$contentdivs.eq(selected)
        //Test for toggler not being initialized yet, or user clicks on the currently selected page):
        if (config.$togglerdiv.attr('lastselected') == null || parseInt(config.$togglerdiv.attr('lastselected')) != selected) {
            var $selectedlink = config.$toc.eq(selected)
            config.$next.attr('loadpage', (selected < config.$contentdivs.length - 1) ? selected + 1 + 'pg' : 0 + 'pg')
            config.$prev.attr('loadpage', (selected == 0) ? config.$contentdivs.length - 1 + 'pg' : selected - 1 + 'pg')
            var startpoint = (isprev == "previous") ? -config.startpoint : config.startpoint
            $target.css(config.leftortop, startpoint).css("zIndex", this.csszindex++) //hide content so it's just out of view before animating it
            var endpoint = (config.leftortop == "left") ? {
                left: 0
            } : {
                top: 0
            } //animate it into view
            $target.animate(endpoint, config.speed)
            config.$toc.removeClass('selected')
            $selectedlink.addClass('selected')
            config.$togglerdiv.attr('lastselected', selected + 'pg')
            $("#p-select.glidecontenttoggler .selected img").hide();
            $("#p-select.glidecontenttoggler .selected p img").show();
        }
    },
    getremotecontent: function (config) {
        config.$glider.html(this.ajaxloadingmsg)
        $.ajax({
            url: config.remotecontent,
            error: function (ajaxrequest) {
                config.$glider.html(ajaxrequest.responseText)
            },
            success: function (content) {
                config.$glider.html(content)
                featuredcontentglider.setuptoggler(config)
            }
        })
    },
    aligncontents: function (config) {
        config.$contentdivs = $("#" + config.gliderid + " ." + config.contentclass)
        config.$contentdivs.css(config.leftortop, config.startpoint).css({
            height: config.$glider.height(),
            visibility: 'visible'
        }) //position content divs so they're out of view:
    },
    setuptoggler: function (config) {
        this.aligncontents(config)
        config.$togglerdiv.hide()
        config.$toc.each(function (index) {
            $(this).attr('pagenumber', index + 'pg')
            if (index > (config.$contentdivs.length - 1)) $(this).css({
                display: 'none'
            }) //hide redundant "toc" links
        })
        var $nextandprev = $("#" + config.togglerid + " .next, #" + config.togglerid + " .prev")
        $nextandprev.click(function (event) { //Assign click behavior to 'next' and 'prev' links
            featuredcontentglider.glide(config, this.getAttribute('loadpage'), this.getAttribute('buttontype'))
            event.preventDefault() //cancel default link action
        })
        config.$toc.click(function (event) { //Assign click behavior to 'toc' links
            featuredcontentglider.glide(config, this.getAttribute('pagenumber'))
            $("#p-select.glidecontenttoggler img").show();
            $(this).children("img").hide();
            $(this).children("p img").show();
            //event.preventDefault()
        })
        config.$togglerdiv.fadeIn(1000, function () {
            featuredcontentglider.glide(config, config.selected)
            if (config.autorotate == true) { //auto rotate contents?
                config.stepcount = 0 //set steps taken
                config.totalsteps = config.$contentdivs.length * config.autorotateconfig[1] //Total steps limit: num of contents x num of user specified cycles)
                featuredcontentglider.autorotate(config)
            }
        })
        config.$togglerdiv.click(function () {
            featuredcontentglider.cancelautorotate(config.togglerid)
        })
    },
    autorotate: function (config) {
        var rotatespeed = config.speed + config.autorotateconfig[0]
        window[config.togglerid + "timer"] = setInterval(function () {
            if (config.totalsteps > 0 && config.stepcount >= config.totalsteps) {
                clearInterval(window[config.togglerid + "timer"])
            } else {
                config.$next.click()
                config.stepcount++
            }
        }, rotatespeed)
    },
    cancelautorotate: function (togglerid) {
        if (window[togglerid + "timer"]) clearInterval(window[togglerid + "timer"])
    },
    getCookie: function (Name) {
        var re = new RegExp(Name + "=[^;]+", "i") //construct RE to search for target name/value pair
        if (document.cookie.match(re)) //if cookie found
        return document.cookie.match(re)[0].split("=")[1] //return its value
        return null
    },
    setCookie: function (name, value) {
        document.cookie = name + "=" + value
    },
    init: function (config) {
        $(document).ready(function () {
            config.$glider = $("#" + config.gliderid)
            config.$togglerdiv = $("#" + config.togglerid)
            config.$toc = config.$togglerdiv.children('.toc')
            config.$next = config.$togglerdiv.children('.next')
            config.$prev = config.$togglerdiv.children('.prev')
            config.$prev.attr('buttontype', 'previous')
            var selected = (config.persiststate) ? featuredcontentglider.getCookie(config.gliderid) : config.selected
            config.selected = (isNaN(parseInt(selected))) ? config.selected : selected //test for cookie value containing null (1st page load) or "undefined" string  
            config.leftortop = (/up/i.test(config.direction)) ? "top" : "left" //set which CSS property to manipulate based on "direction"
            config.heightorwidth = (/up/i.test(config.direction)) ? config.$glider.height() : config.$glider.width() //Get glider height or width based on "direction"
            config.startpoint = (/^(left|up)/i.test(config.direction)) ? -config.heightorwidth : config.heightorwidth //set initial position of contents based on "direction"
            if (typeof config.remotecontent != "undefined" && config.remotecontent.length > 0) featuredcontentglider.getremotecontent(config)
            else featuredcontentglider.setuptoggler(config)
            $(window).bind('unload', function () { //clean up and persist
                config.$togglerdiv.unbind('click')
                config.$toc.unbind('click')
                config.$next.unbind('click')
                config.$prev.unbind('click')
                if (config.persiststate) featuredcontentglider.setCookie(config.gliderid, config.$togglerdiv.attr('lastselected'))
                config = null
            })
        })
    }
}
