var featuredcontentglider = {csszindex:0, ajaxloadingmsg:"<b>Fetching Content. Please wait...</b>", glide:function(a, b, d) {
  b = parseInt(b);
  b >= a.$contentdivs.length && (alert("No content exists at page " + (b + 1) + "! Loading 1st page instead."), b = 0);
  var c = a.$contentdivs.eq(b);
  if(a.$togglerdiv.attr("lastselected") == null || parseInt(a.$togglerdiv.attr("lastselected")) != b) {
    var e = a.$toc.eq(b);
    a.$next.attr("loadpage", b < a.$contentdivs.length - 1 ? b + 1 + "pg" : "0pg");
    a.$prev.attr("loadpage", b == 0 ? a.$contentdivs.length - 1 + "pg" : b - 1 + "pg");
    c.css(a.leftortop, d == "previous" ? -a.startpoint : a.startpoint).css("zIndex", this.csszindex++);
    c.animate(a.leftortop == "left" ? {left:0} : {top:0}, a.speed);
    a.$toc.removeClass("selected");
    e.addClass("selected");
    a.$togglerdiv.attr("lastselected", b + "pg")
  }
}, getremotecontent:function(a) {
  a.$glider.html(this.ajaxloadingmsg);
  $.ajax({url:a.remotecontent, error:function(b) {
    a.$glider.html("Error fetching content.<br />Server Response: " + b.responseText)
  }, success:function(b) {
    a.$glider.html(b);
    featuredcontentglider.setuptoggler(a)
  }})
}, aligncontents:function(a) {
  a.$contentdivs = $("#" + a.gliderid + " ." + a.contentclass);
  a.$contentdivs.css(a.leftortop, a.startpoint).css({height:a.$glider.height(), visibility:"visible"})
}, setuptoggler:function(a) {
  this.aligncontents(a);
  a.$togglerdiv.hide();
  a.$toc.each(function(b) {
    $(this).attr("pagenumber", b + "pg");
    b > a.$contentdivs.length - 1 && $(this).css({display:"none"})
  });
  $("#" + a.togglerid + " .next, #" + a.togglerid + " .prev").click(function(b) {
    featuredcontentglider.glide(a, this.getAttribute("loadpage"), this.getAttribute("buttontype"));
    b.preventDefault()
  });
  a.$toc.click(function(b) {
    featuredcontentglider.glide(a, this.getAttribute("pagenumber"));
    b.preventDefault()
  });
  a.$togglerdiv.fadeIn(1E3, function() {
    featuredcontentglider.glide(a, a.selected);
    if(a.autorotate == true) {
      a.stepcount = 0, a.totalsteps = a.$contentdivs.length * a.autorotateconfig[1], featuredcontentglider.autorotate(a)
    }
  });
  a.$togglerdiv.click(function() {
    featuredcontentglider.cancelautorotate(a.togglerid)
  })
}, autorotate:function(a) {
  window[a.togglerid + "timer"] = setInterval(function() {
    a.totalsteps > 0 && a.stepcount >= a.totalsteps ? clearInterval(window[a.togglerid + "timer"]) : (a.$next.click(), a.stepcount++)
  }, a.speed + a.autorotateconfig[0])
}, cancelautorotate:function(a) {
  window[a + "timer"] && clearInterval(window[a + "timer"])
}, getCookie:function(a) {
  a = RegExp(a + "=[^;]+", "i");
  return document.cookie.match(a) ? document.cookie.match(a)[0].split("=")[1] : null
}, setCookie:function(a, b) {
  document.cookie = a + "=" + b
}, init:function(a) {
  $(document).ready(function() {
    a.$glider = $("#" + a.gliderid);
    a.$togglerdiv = $("#" + a.togglerid);
    a.$toc = a.$togglerdiv.find(".toc");
    a.$next = a.$togglerdiv.find(".next");
    a.$prev = a.$togglerdiv.find(".prev");
    a.$prev.attr("buttontype", "previous");
    var b = a.persiststate ? featuredcontentglider.getCookie(a.gliderid) : a.selected;
    a.selected = isNaN(parseInt(b)) ? a.selected : b;
    a.leftortop = /up/i.test(a.direction) ? "top" : "left";
    a.heightorwidth = /up/i.test(a.direction) ? a.$glider.height() : a.$glider.width();
    a.startpoint = /^(left|up)/i.test(a.direction) ? -a.heightorwidth : a.heightorwidth;
    typeof a.remotecontent != "undefined" && a.remotecontent.length > 0 ? featuredcontentglider.getremotecontent(a) : featuredcontentglider.setuptoggler(a);
    $(window).bind("unload", function() {
      a.$togglerdiv.unbind("click");
      a.$toc.unbind("click");
      a.$next.unbind("click");
      a.$prev.unbind("click");
      a.persiststate && featuredcontentglider.setCookie(a.gliderid, a.$togglerdiv.attr("lastselected"));
      a = null
    })
  })
}};
featuredcontentglider = {csszindex:0, ajaxloadingmsg:"<b>Fetching Content. Please wait...</b>", glide:function(a, b, d) {
  b = parseInt(b);
  b >= a.$contentdivs.length && (alert("No content exists at page " + (b + 1) + "! Loading 1st page instead."), b = 0);
  var c = a.$contentdivs.eq(b);
  if(a.$togglerdiv.attr("lastselected") == null || parseInt(a.$togglerdiv.attr("lastselected")) != b) {
    var e = a.$toc.eq(b);
    a.$next.attr("loadpage", b < a.$contentdivs.length - 1 ? b + 1 + "pg" : "0pg");
    a.$prev.attr("loadpage", b == 0 ? a.$contentdivs.length - 1 + "pg" : b - 1 + "pg");
    c.css(a.leftortop, d == "previous" ? -a.startpoint : a.startpoint).css("zIndex", this.csszindex++);
    c.animate(a.leftortop == "left" ? {left:0} : {top:0}, a.speed);
    a.$toc.removeClass("selected");
    e.addClass("selected");
    a.$togglerdiv.attr("lastselected", b + "pg")
  }
}, getremotecontent:function(a) {
  a.$glider.html(this.ajaxloadingmsg);
  $.ajax({url:a.remotecontent, error:function(b) {
    a.$glider.html("Error fetching content.<br />Server Response: " + b.responseText)
  }, success:function(b) {
    a.$glider.html(b);
    featuredcontentglider.setuptoggler(a)
  }})
}, aligncontents:function(a) {
  a.$contentdivs = $("#" + a.gliderid + " ." + a.contentclass);
  a.$contentdivs.css(a.leftortop, a.startpoint).css({height:a.$glider.height(), visibility:"visible"})
}, setuptoggler:function(a) {
  this.aligncontents(a);
  a.$togglerdiv.hide();
  a.$toc.each(function(b) {
    $(this).attr("pagenumber", b + "pg");
    b > a.$contentdivs.length - 1 && $(this).css({display:"none"})
  });
  $("#" + a.togglerid + " .next, #" + a.togglerid + " .prev").click(function(b) {
    featuredcontentglider.glide(a, this.getAttribute("loadpage"), this.getAttribute("buttontype"));
    b.preventDefault()
  });
  a.$toc.click(function(b) {
    featuredcontentglider.glide(a, this.getAttribute("pagenumber"));
    b.preventDefault()
  });
  a.$togglerdiv.fadeIn(1E3, function() {
    featuredcontentglider.glide(a, a.selected);
    if(a.autorotate == true) {
      a.stepcount = 0, a.totalsteps = a.$contentdivs.length * a.autorotateconfig[1], featuredcontentglider.autorotate(a)
    }
  });
  a.$togglerdiv.click(function() {
    featuredcontentglider.cancelautorotate(a.togglerid)
  })
}, autorotate:function(a) {
  window[a.togglerid + "timer"] = setInterval(function() {
    a.totalsteps > 0 && a.stepcount >= a.totalsteps ? clearInterval(window[a.togglerid + "timer"]) : (a.$next.click(), a.stepcount++)
  }, a.speed + a.autorotateconfig[0])
}, cancelautorotate:function(a) {
  window[a + "timer"] && clearInterval(window[a + "timer"])
}, getCookie:function(a) {
  a = RegExp(a + "=[^;]+", "i");
  return document.cookie.match(a) ? document.cookie.match(a)[0].split("=")[1] : null
}, setCookie:function(a, b) {
  document.cookie = a + "=" + b
}, init:function(a) {
  $(document).ready(function() {
    a.$glider = $("#" + a.gliderid);
    a.$togglerdiv = $("#" + a.togglerid);
    a.$toc = a.$togglerdiv.find(".toc");
    a.$next = a.$togglerdiv.find(".next");
    a.$prev = a.$togglerdiv.find(".prev");
    a.$prev.attr("buttontype", "previous");
    var b = a.persiststate ? featuredcontentglider.getCookie(a.gliderid) : a.selected;
    a.selected = isNaN(parseInt(b)) ? a.selected : b;
    a.leftortop = /up/i.test(a.direction) ? "top" : "left";
    a.heightorwidth = /up/i.test(a.direction) ? a.$glider.height() : a.$glider.width();
    a.startpoint = /^(left|up)/i.test(a.direction) ? -a.heightorwidth : a.heightorwidth;
    typeof a.remotecontent != "undefined" && a.remotecontent.length > 0 ? featuredcontentglider.getremotecontent(a) : featuredcontentglider.setuptoggler(a);
    $(window).bind("unload", function() {
      a.$togglerdiv.unbind("click");
      a.$toc.unbind("click");
      a.$next.unbind("click");
      a.$prev.unbind("click");
      a.persiststate && featuredcontentglider.setCookie(a.gliderid, a.$togglerdiv.attr("lastselected"));
      a = null
    })
  })
}};

