var mt__crtlang = 'en';
var spi__crti = 1;
var spi__st1_crti = 1;
var spi__st2_crti = 1;
var spi__st3_crti = 1;
var spi__pollopt = -1;

function pausescroller(content, divId, divClass, delay) {
    this.content = content //message array content
    this.tickerid = divId //ID of ticker div to display information
    this.delay = delay //Delay between msg change, in miliseconds.
    this.mouseoverBol = 0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
    this.hiddendivpointer = 1 //index of message array for hidden div
    document.write('<div id="' + divId + '" class="' + divClass + '" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="' + divId + '1">' + content[0] + '</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="' + divId + '2">' + content[1] + '</div></div>')
    var scrollerinstance = this
    if (window.addEventListener) //run onload in DOM2 browsers
        window.addEventListener("load", function() { scrollerinstance.initialize() }, false)
    else if (window.attachEvent) //run onload in IE5.5+
        window.attachEvent("onload", function() { scrollerinstance.initialize() })
    else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
        setTimeout(function() { scrollerinstance.initialize() }, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize = function() {
    this.tickerdiv = document.getElementById(this.tickerid)
    this.visiblediv = document.getElementById(this.tickerid + "1")
    this.hiddendiv = document.getElementById(this.tickerid + "2")
    this.visibledivtop = parseInt(pausescroller.getCSSpadding(this.tickerdiv))
    //set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
    this.visiblediv.style.width = this.hiddendiv.style.width = this.tickerdiv.offsetWidth - (this.visibledivtop * 2) + "px"
    this.getinline(this.visiblediv, this.hiddendiv)
    this.hiddendiv.style.visibility = "visible"
    var scrollerinstance = this
    document.getElementById(this.tickerid).onmouseover = function() { scrollerinstance.mouseoverBol = 1 }
    document.getElementById(this.tickerid).onmouseout = function() { scrollerinstance.mouseoverBol = 0 }
    if (window.attachEvent) //Clean up loose references in IE
        window.attachEvent("onunload", function() { scrollerinstance.tickerdiv.onmouseover = scrollerinstance.tickerdiv.onmouseout = null })
    setTimeout(function() { scrollerinstance.animateup() }, this.delay)
}

// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup = function() {
    var scrollerinstance = this
    if (parseInt(this.hiddendiv.style.top) > (this.visibledivtop + 5)) {
        this.visiblediv.style.top = parseInt(this.visiblediv.style.top) - 5 + "px"
        this.hiddendiv.style.top = parseInt(this.hiddendiv.style.top) - 5 + "px"
        setTimeout(function() { scrollerinstance.animateup() }, 50)
    }
    else {
        this.getinline(this.hiddendiv, this.visiblediv)
        this.swapdivs()
        setTimeout(function() { scrollerinstance.setmessage() }, this.delay)
    }
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs = function() {
    var tempcontainer = this.visiblediv
    this.visiblediv = this.hiddendiv
    this.hiddendiv = tempcontainer
}

pausescroller.prototype.getinline = function(div1, div2) {
    div1.style.top = this.visibledivtop + "px"
    div2.style.top = Math.max(div1.parentNode.offsetHeight, div1.offsetHeight) + "px"
}

pausescroller.prototype.setmessage = function() {
    var scrollerinstance = this
    if (this.mouseoverBol == 1) //if mouse is currently over scoller, do nothing (pause it)
        setTimeout(function() { scrollerinstance.setmessage() }, 100)
    else {
        var i = this.hiddendivpointer
        var ceiling = this.content.length
        this.hiddendivpointer = (i + 1 > ceiling - 1) ? 0 : i + 1
        this.hiddendiv.innerHTML = this.content[this.hiddendivpointer]
        this.animateup()
    }
}

pausescroller.getCSSpadding = function(tickerobj) { //get CSS padding value, if any
    if (tickerobj.currentStyle)
        return tickerobj.currentStyle["paddingTop"]
    else if (window.getComputedStyle) //if DOM2
        return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
    else
        return 0
}

/*** Temporary text filler function. Remove when deploying template. ***/
var gibberish = ["This is just some filler text", "Welcome to Dynamic Drive CSS Library", "Demo content nothing to read here"]
function filltext(words) {
    for (var i = 0; i < words; i++)
        document.write(gibberish[Math.floor(Math.random() * 3)] + " ")
}

function bookmark() {

    var x = window.location;
    bookmarksite('Jordysoft', x);
    //alert(x);
}

function bookmarksite(title, URL) {
    if (window.sidebar) // firefox
        window.sidebar.addPanel(title, URL, "");
    else if (window.opera && window.print) { // opera
        var elem = document.createElement('a');
        elem.setAttribute('href', URL);
        elem.setAttribute('title', title);
        elem.setAttribute('rel', 'sidebar');
        elem.click();
    }
    else if (document.all)// ie
        window.external.AddFavorite(URL, title);
}

function clearSearchBox() {
    if (document.getElementById("txtSearch") != null) {
        var str = document.getElementById("txtSearch").value;
        if (str == "Keywords") {
            document.getElementById("txtSearch").value = "";
        }
    }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// RATING PROGRAMS
function prog__rate(pid, rating)
{
	var ax = new Ajax("/dyn-prograte.php", { data: 'p='+pid+'&r='+rating, evalScripts: true, update: $("rater__fb"), method: 'post' });
	ax.request();
}

// RATING PROGRAMS
function news__rate(pid, rating)
{
	var ax = new Ajax("/dyn-newsrate.php", { data: 'n='+pid+'&r='+rating, evalScripts: true, update: $("rater__fb"), method: 'post' });
	ax.request();
}

// RSS ICON EFFECTS
function rss_lighten(obj)
{
	obj.src = '/base_img/rss_on.gif';
}
function rss_darken(obj, icon)
{
	obj.src = '/base_img/rss_'+icon+'.gif';
}

// NEWS SPOT SWITCHING
function news__spot_next(x)
{
	$("___spoth2_"+news__spot_crt).style.display = 'none';
	$("___spota_"+news__spot_crt).style.display = 'none';

	news__spot_crt++;
	if(news__spot_crt > x) news__spot_crt = 1;
	$("__spot_idx").setText(news__spot_crt);

	$("___spoth2_"+news__spot_crt).style.display = 'block';
	$("___spota_"+news__spot_crt).style.display = 'block';
}
function news__spot_prev(x)
{
	$("___spoth2_"+news__spot_crt).style.display = 'none';
	$("___spota_"+news__spot_crt).style.display = 'none';

	news__spot_crt--;
	if(news__spot_crt < 1) news__spot_crt = x;
	$("__spot_idx").setText(news__spot_crt);

	$("___spoth2_"+news__spot_crt).style.display = 'block';
	$("___spota_"+news__spot_crt).style.display = 'block';
}

// BOOKMARKING 
function bookmark_msg(){
	var isie = 0;

	if(document.all) isie = 1;

	if(isie == 1)
	{
		window.external.AddFavorite(location.href, document.title); 
		return false;
	}
	else
	{
		alert("Your web-browser does not support automatic addition of favourites/bookmarks.\n\n"+
				"You will have to use a key-combination or menu option specific to your browser:\n"+
				"  - in Mozilla/Mozilla Firefox try: Ctrl-D\n"+
				"  - in Opera try Ctrl-T\n"+
				"  - for other browsers consult the program's help system/documentation\n\n\n"+
				"NOTE: The key combinations above will bookmark the page you were browsing at that moment.");

		return false;
	}
}

// QUICK SEARCH FORM VALIDATE
function qsearch_validate(src_field)
{
	if((src_field.value != undefined) && (src_field.value != "") && (src_field.value != "Keyword")) return true;
	else return false;
}

// COPY TO CLIPBOARD
function copy__clip(inElement)
{
	var flashcopier = 'flashcopier';
	if(!document.getElementById(flashcopier))
	{
		var divholder = document.createElement('div');
		divholder.id = flashcopier;
		document.body.appendChild(divholder);
	}
	
	document.getElementById(flashcopier).innerHTML = '';
	var divinfo = '<embed src="http://www.jordysoft.net/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(inElement.value)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
	document.getElementById(flashcopier).innerHTML = divinfo;
}

//homepage previous, next softwares
function spi__sbtbsw(i, type) {
    var crti = 0;
    var fact = 0;

    if (type == 'prev') fact = -1;
    else fact = 1;

    if (i == 1) {
        var MAXT = 3;
        if (spi__crti == 1) MAXT = 7;
        else if (spi__crti == 4) MAXT = 5;

        crti = spi__st1_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = MAXT;
        else if (crti > MAXT) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st1_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }

    else if (i == 2) {
        crti = spi__st2_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = 5;
        else if (crti > 5) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st2_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }

    else if (i == 3) {
        crti = spi__st3_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = 5;
        else if (crti > 5) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st3_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }
    else if (i == 4) {
        crti = spi__st3_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = 5;
        else if (crti > 5) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st3_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }
    else if (i == 5) {
        crti = spi__st3_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = 5;
        else if (crti > 5) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st3_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }
    else if (i == 6) {
        crti = spi__st3_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = 5;
        else if (crti > 5) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st3_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }
    else if (i == 7) {
        crti = spi__st3_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = 5;
        else if (crti > 5) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st3_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }
    else if (i == 8) {
        crti = spi__st3_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = 5;
        else if (crti > 5) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st3_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }
    else if (i == 9) {
        crti = spi__st3_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = 5;
        else if (crti > 5) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st3_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }
    else if (i == 10) {
        crti = spi__st3_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = 5;
        else if (crti > 5) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st3_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }
    else if (i == 11) {
        crti = spi__st3_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = 5;
        else if (crti > 5) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st3_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }
    else if (i == 12) {
        crti = spi__st3_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = 5;
        else if (crti > 5) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st3_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }
    else if (i == 13) {
        crti = spi__st3_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = 5;
        else if (crti > 5) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st3_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }
    else if (i == 14) {
        crti = spi__st3_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = 5;
        else if (crti > 5) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st3_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }
    else if (i == 15) {
        crti = spi__st3_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = 5;
        else if (crti > 5) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st3_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }
    else if (i == 16) {
        crti = spi__st3_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = 5;
        else if (crti > 5) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st3_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }
    else if (i == 17) {
        crti = spi__st3_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = 5;
        else if (crti > 5) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st3_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }
    else if (i == 18) {
        crti = spi__st3_crti;
        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'none';

        crti += fact;
        if (crti < 1) crti = 5;
        else if (crti > 5) crti = 1;

        $('boxc__' + spi__crti + '_' + i + '_' + crti).style.display = 'block';

        spi__st3_crti = crti;
        $('boxi__' + spi__crti + '_' + i).setHTML(crti);
    }
}

//content slider
var featuredcontentslider = {

    //3 variables below you can customize if desired:
    ajaxloadingmsg: '<div style="margin: 20px 0 0 20px"><img src="loading.gif" /> Fetching slider Contents. Please wait...</div>',
    bustajaxcache: true, //bust caching of external ajax page after 1st request?
    enablepersist: true, //persist to last content viewed when returning to page?

    settingcaches: {}, //object to cache "setting" object of each script instance

    jumpTo: function(fcsid, pagenumber) { //public function to go to a slide manually.
        this.turnpage(this.settingcaches[fcsid], pagenumber)
    },

    ajaxconnect: function(setting) {
        var page_request = false
        if (window.ActiveXObject) { //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
            try {
                page_request = new ActiveXObject("Msxml2.XMLHTTP")
            }
            catch (e) {
                try {
                    page_request = new ActiveXObject("Microsoft.XMLHTTP")
                }
                catch (e) { }
            }
        }
        else if (window.XMLHttpRequest) // if Mozilla, Safari etc
            page_request = new XMLHttpRequest()
        else
            return false
        var pageURL = setting.contentsource[1]
        page_request.onreadystatechange = function() {
            featuredcontentslider.ajaxpopulate(page_request, setting)
        }
        document.getElementById(setting.id).innerHTML = this.ajaxloadingmsg
        var bustcache = (!this.bustajaxcache) ? "" : (pageURL.indexOf("?") != -1) ? "&" + new Date().getTime() : "?" + new Date().getTime()
        page_request.open('GET', pageURL + bustcache, true)
        page_request.send(null)
    },

    ajaxpopulate: function(page_request, setting) {
        if (page_request.readyState == 4 && (page_request.status == 200 || window.location.href.indexOf("http") == -1)) {
            document.getElementById(setting.id).innerHTML = page_request.responseText
            this.buildpaginate(setting)
        }
    },

    buildcontentdivs: function(setting) {
        if (document.getElementById(setting.id) != null) {
            var alldivs = document.getElementById(setting.id).getElementsByTagName("div")
            for (var i = 0; i < alldivs.length; i++) {
                if (this.css(alldivs[i], "contentdiv", "check")) { //check for DIVs with class "contentdiv"
                    setting.contentdivs.push(alldivs[i])
                    alldivs[i].style.display = "none" //collapse all content DIVs to begin with
                }
            }
        }
    },

    buildpaginate: function(setting) {
        this.buildcontentdivs(setting)
        var sliderdiv = document.getElementById(setting.id)
        var pdiv = document.getElementById("paginate-" + setting.id)
        var phtml = ""
        var toc = setting.toc
        var nextprev = setting.nextprev
        if (typeof toc == "string" && toc != "markup" || typeof toc == "object") {
            for (var i = 1; i <= setting.contentdivs.length; i++) {
                phtml += '<a href="#' + i + '" class="toc">' + (typeof toc == "string" ? toc.replace(/#increment/, i) : toc[i - 1]) + '</a> '
            }
            phtml = (nextprev[0] != '' ? '<a href="#prev" class="prev">' + nextprev[0] + '</a> ' : '') + phtml + (nextprev[1] != '' ? '<a href="#next" class="next">' + nextprev[1] + '</a>' : '')
            pdiv.innerHTML = phtml
        }
        if (pdiv != null) {
            var pdivlinks = pdiv.getElementsByTagName("a")
            var toclinkscount = 0 //var to keep track of actual # of toc links
            for (var i = 0; i < pdivlinks.length; i++) {
                if (this.css(pdivlinks[i], "toc", "check")) {
                    if (toclinkscount > setting.contentdivs.length - 1) { //if this toc link is out of range (user defined more toc links then there are contents)
                        pdivlinks[i].style.display = "none" //hide this toc link
                        continue
                    }
                    pdivlinks[i].setAttribute("rel", ++toclinkscount) //store page number inside toc link
                    pdivlinks[i][setting.revealtype] = function() {
                        featuredcontentslider.turnpage(setting, this.getAttribute("rel"))
                        return false
                    }
                    setting.toclinks.push(pdivlinks[i])
                }
                else if (this.css(pdivlinks[i], "prev", "check") || this.css(pdivlinks[i], "next", "check")) { //check for links with class "prev" or "next"
                    pdivlinks[i].onclick = function() {
                        featuredcontentslider.turnpage(setting, this.className)
                        return false
                    }
                }
            }

            this.turnpage(setting, setting.currentpage, true)
            if (setting.autorotate[0]) { //if auto rotate enabled
                pdiv[setting.revealtype] = function() {
                    featuredcontentslider.cleartimer(setting, window["fcsautorun" + setting.id])
                }
                sliderdiv["onclick"] = function() { //stop content slider when slides themselves are clicked on
                    featuredcontentslider.cleartimer(setting, window["fcsautorun" + setting.id])
                }
                setting.autorotate[1] = setting.autorotate[1] + (1 / setting.enablefade[1] * 50) //add time to run fade animation (roughly) to delay between rotation
                this.autorotate(setting)
            }
        }
    },

    URLparamselect: function(fcsid) {
        var result = window.location.search.match(new RegExp(fcsid + "=(\\d+)", "i")) //check for "?featuredcontentsliderid=2" in URL
        return (result == null) ? null : parseInt(RegExp.$1) //returns null or index, where index (int) is the selected tab's index
    },

    turnpage: function(setting, thepage, autocall) {
        var currentpage = setting.currentpage //current page # before change
        var totalpages = setting.contentdivs.length
        var turntopage = (/prev/i.test(thepage)) ? currentpage - 1 : (/next/i.test(thepage)) ? currentpage + 1 : parseInt(thepage)
        turntopage = (turntopage < 1) ? totalpages : (turntopage > totalpages) ? 1 : turntopage //test for out of bound and adjust
        if (turntopage == setting.currentpage && typeof autocall == "undefined") //if a pagination link is clicked on repeatedly
            return
        setting.currentpage = turntopage
        if (setting.contentdivs.length > 0)
            setting.contentdivs[turntopage - 1].style.zIndex = ++setting.topzindex
        this.cleartimer(setting, window["fcsfade" + setting.id])
        setting.cacheprevpage = setting.prevpage
        if (setting.enablefade[0] == true) {
            setting.curopacity = 0
            this.fadeup(setting)
        }
        if (setting.enablefade[0] == false) { //if fade is disabled, fire onChange event immediately (verus after fade is complete)
            setting.contentdivs[setting.prevpage - 1].style.display = "none" //collapse last content div shown (it was set to "block")
            setting.onChange(setting.prevpage, setting.currentpage)
        }
        if (setting.contentdivs.length > 0) {
            setting.contentdivs[turntopage - 1].style.visibility = "visible"
            setting.contentdivs[turntopage - 1].style.display = "block"
        }
        if (setting.prevpage <= setting.toclinks.length) //make sure pagination link exists (may not if manually defined via "markup", and user omitted)
            this.css(setting.toclinks[setting.prevpage - 1], "selected", "remove")
        if (turntopage <= setting.toclinks.length) //make sure pagination link exists (may not if manually defined via "markup", and user omitted)
            this.css(setting.toclinks[turntopage - 1], "selected", "add")
        setting.prevpage = turntopage
        if (this.enablepersist)
            this.setCookie("fcspersist" + setting.id, turntopage)
    },

    setopacity: function(setting, value) { //Sets the opacity of targetobject based on the passed in value setting (0 to 1 and in between)
        var targetobject = setting.contentdivs[setting.currentpage - 1]
        if (targetobject != null) {
            if (targetobject.filters && targetobject.filters[0]) { //IE syntax
                if (typeof targetobject.filters[0].opacity == "number") //IE6
                    targetobject.filters[0].opacity = value * 100
                else //IE 5.5
                    targetobject.style.filter = "alpha(opacity=" + value * 100 + ")"
            }
            else if (typeof targetobject.style.MozOpacity != "undefined") //Old Mozilla syntax
                targetobject.style.MozOpacity = value
            else if (typeof targetobject.style.opacity != "undefined") //Standard opacity syntax
                targetobject.style.opacity = value
        }
        setting.curopacity = value
    },


    fadeup: function(setting) {
        if (setting.curopacity < 1) {
            this.setopacity(setting, setting.curopacity + setting.enablefade[1])
            window["fcsfade" + setting.id] = setTimeout(function() { featuredcontentslider.fadeup(setting) }, 50)
        }
        else { //when fade is complete
            if (setting.cacheprevpage != setting.currentpage) //if previous content isn't the same as the current shown div (happens the first time the page loads/ script is run)
                setting.contentdivs[setting.cacheprevpage - 1].style.display = "none" //collapse last content div shown (it was set to "block")
            setting.onChange(setting.cacheprevpage, setting.currentpage)
        }
    },

    cleartimer: function(setting, timervar) {
        if (typeof timervar != "undefined") {
            clearTimeout(timervar)
            clearInterval(timervar)
            if (setting.cacheprevpage != setting.currentpage) { //if previous content isn't the same as the current shown div
                setting.contentdivs[setting.cacheprevpage - 1].style.display = "none"
            }
        }
    },

    css: function(el, targetclass, action) {
        var needle = new RegExp("(^|\\s+)" + targetclass + "($|\\s+)", "ig")
        if (action == "check")
            return needle.test(el.className)
        else if (action == "remove")
            el.className = el.className.replace(needle, "")
        else if (action == "add")
            el.className += " " + targetclass
    },

    autorotate: function(setting) {
        window["fcsautorun" + setting.id] = setInterval(function() { featuredcontentslider.turnpage(setting, "next") }, setting.autorotate[1])
    },

    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(setting) {
        var persistedpage = this.getCookie("fcspersist" + setting.id) || 1
        var URLselectedpage = this.URLparamselect(setting.id) //returns null or index from: mypage.htm?featuredcontentsliderid=index
        this.settingcaches[setting.id] = setting //cache "setting" object
        setting.contentdivs = []
        setting.toclinks = []
        setting.topzindex = 0
        setting.currentpage = URLselectedpage || ((this.enablepersist) ? persistedpage : 1)
        setting.prevpage = setting.currentpage
        setting.revealtype = "on" + (setting.revealtype || "click")
        setting.curopacity = 0
        setting.onChange = setting.onChange || function() { }
        if (setting.contentsource[0] == "inline")
            this.buildpaginate(setting)
        if (setting.contentsource[0] == "ajax")
            this.ajaxconnect(setting)
    }

}
//end content slider

//MooTools, My Object Oriented Javascript Tools. Copyright (c) 2006-2007 Valerio Proietti, <http://mad4milk.net>, MIT Style License.

var MooTools = { version: "1.11" }; function $defined(A) { return (A != undefined); } function $type(B) {
    if (!$defined(B)) { return false; } if (B.htmlElement) {
        return "element";
    } var A = typeof B; if (A == "object" && B.nodeName) { switch (B.nodeType) { case 1: return "element"; case 3: return (/\S/).test(B.nodeValue) ? "textnode" : "whitespace"; } } if (A == "object" || A == "function") {
        switch (B.constructor) {
            case Array: return "array";
            case RegExp: return "regexp"; case Class: return "class";
        } if (typeof B.length == "number") { if (B.item) { return "collection"; } if (B.callee) { return "arguments"; } } 
    } return A;
} function $merge() {
    var C = {}; for (var B = 0; B < arguments.length; B++) {
        for (var E in arguments[B]) {
            var A = arguments[B][E]; var D = C[E]; if (D && $type(A) == "object" && $type(D) == "object") {
                C[E] = $merge(D, A);
            } else { C[E] = A; } 
        } 
    } return C;
} var $extend = function() { var A = arguments; if (!A[1]) { A = [this, A[0]]; } for (var B in A[1]) { A[0][B] = A[1][B]; } return A[0]; }; var $native = function() {
    for (var B = 0, A = arguments.length;
B < A; B++) { arguments[B].extend = function(C) { for (var D in C) { if (!this.prototype[D]) { this.prototype[D] = C[D]; } if (!this[D]) { this[D] = $native.generic(D); } } }; } 
};
$native.generic = function(A) { return function(B) { return this.prototype[A].apply(B, Array.prototype.slice.call(arguments, 1)); }; }; $native(Function, Array, String, Number);
function $chk(A) { return !!(A || A === 0); } function $pick(B, A) { return $defined(B) ? B : A; } function $random(B, A) { return Math.floor(Math.random() * (A - B + 1) + B); } function $time() {
    return new Date().getTime();
} function $clear(A) { clearTimeout(A); clearInterval(A); return null; } var Abstract = function(A) { A = A || {}; A.extend = $extend; return A; }; var Window = new Abstract(window);
var Document = new Abstract(document); document.head = document.getElementsByTagName("head")[0]; window.xpath = !!(document.evaluate); if (window.ActiveXObject) {
    window.ie = window[window.XMLHttpRequest ? "ie7" : "ie6"] = true;
} else {
    if (document.childNodes && !document.all && !navigator.taintEnabled) { window.webkit = window[window.xpath ? "webkit420" : "webkit419"] = true; } else {
        if (document.getBoxObjectFor != null) {
            window.gecko = true;
        } 
    } 
} window.khtml = window.webkit; Object.extend = $extend; if (typeof HTMLElement == "undefined") {
    var HTMLElement = function() { }; if (window.webkit) {
        document.createElement("iframe");
    } HTMLElement.prototype = (window.webkit) ? window["[[DOMElement.prototype]]"] : {};
} HTMLElement.prototype.htmlElement = function() { }; if (window.ie6) {
    try {
        document.execCommand("BackgroundImageCache", false, true);
    } catch (e) { } 
} var Class = function(B) {
    var A = function() {
        return (arguments[0] !== null && this.initialize && $type(this.initialize) == "function") ? this.initialize.apply(this, arguments) : this;
    }; $extend(A, this); A.prototype = B; A.constructor = Class; return A;
}; Class.empty = function() { }; Class.prototype = { extend: function(B) {
    var C = new this(null); for (var D in B) {
        var A = C[D];
        C[D] = Class.Merge(A, B[D]);
    } return new Class(C);
}, implement: function() { for (var B = 0, A = arguments.length; B < A; B++) { $extend(this.prototype, arguments[B]); } } 
}; Class.Merge = function(C, D) {
    if (C && C != D) {
        var B = $type(D);
        if (B != $type(C)) { return D; } switch (B) {
            case "function": var A = function() { this.parent = arguments.callee.parent; return D.apply(this, arguments); }; A.parent = C; return A;
            case "object": return $merge(C, D);
        } 
    } return D;
}; var Chain = new Class({ chain: function(A) { this.chains = this.chains || []; this.chains.push(A); return this; }, callChain: function() {
    if (this.chains && this.chains.length) {
        this.chains.shift().delay(10, this);
    } 
}, clearChain: function() { this.chains = []; } 
}); var Events = new Class({ addEvent: function(B, A) {
    if (A != Class.empty) {
        this.$events = this.$events || {}; this.$events[B] = this.$events[B] || [];
        this.$events[B].include(A);
    } return this;
}, fireEvent: function(C, B, A) {
    if (this.$events && this.$events[C]) {
        this.$events[C].each(function(D) {
            D.create({ bind: this, delay: A, "arguments": B })();
        }, this);
    } return this;
}, removeEvent: function(B, A) { if (this.$events && this.$events[B]) { this.$events[B].remove(A); } return this; } 
}); var Options = new Class({ setOptions: function() {
    this.options = $merge.apply(null, [this.options].extend(arguments));
    if (this.addEvent) { for (var A in this.options) { if ($type(this.options[A] == "function") && (/^on[A-Z]/).test(A)) { this.addEvent(A, this.options[A]); } } } return this;
} 
}); Array.extend({ forEach: function(C, D) { for (var B = 0, A = this.length; B < A; B++) { C.call(D, this[B], B, this); } }, filter: function(D, E) {
    var C = []; for (var B = 0, A = this.length;
B < A; B++) { if (D.call(E, this[B], B, this)) { C.push(this[B]); } } return C;
}, map: function(D, E) {
    var C = []; for (var B = 0, A = this.length; B < A; B++) {
        C[B] = D.call(E, this[B], B, this);
    } return C;
}, every: function(C, D) { for (var B = 0, A = this.length; B < A; B++) { if (!C.call(D, this[B], B, this)) { return false; } } return true; }, some: function(C, D) {
    for (var B = 0, A = this.length;
B < A; B++) { if (C.call(D, this[B], B, this)) { return true; } } return false;
}, indexOf: function(C, D) {
    var A = this.length; for (var B = (D < 0) ? Math.max(0, A + D) : D || 0; B < A; B++) {
        if (this[B] === C) {
            return B;
        } 
    } return -1;
}, copy: function(D, C) { D = D || 0; if (D < 0) { D = this.length + D; } C = C || (this.length - D); var A = []; for (var B = 0; B < C; B++) { A[B] = this[D++]; } return A; }, remove: function(C) {
    var B = 0;
    var A = this.length; while (B < A) { if (this[B] === C) { this.splice(B, 1); A--; } else { B++; } } return this;
}, contains: function(A, B) { return this.indexOf(A, B) != -1; }, associate: function(C) {
    var D = {}, B = Math.min(this.length, C.length);
    for (var A = 0; A < B; A++) { D[C[A]] = this[A]; } return D;
}, extend: function(C) { for (var B = 0, A = C.length; B < A; B++) { this.push(C[B]); } return this; }, merge: function(C) {
    for (var B = 0, A = C.length;
B < A; B++) { this.include(C[B]); } return this;
}, include: function(A) { if (!this.contains(A)) { this.push(A); } return this; }, getRandom: function() {
    return this[$random(0, this.length - 1)] || null;
}, getLast: function() { return this[this.length - 1] || null; } 
}); Array.prototype.each = Array.prototype.forEach; Array.each = Array.forEach; function $A(A) {
    return Array.copy(A);
} function $each(C, B, D) { if (C && typeof C.length == "number" && $type(C) != "object") { Array.forEach(C, B, D); } else { for (var A in C) { B.call(D || C, C[A], A); } } } Array.prototype.test = Array.prototype.contains;
String.extend({ test: function(A, B) { return (($type(A) == "string") ? new RegExp(A, B) : A).test(this); }, toInt: function() { return parseInt(this, 10); }, toFloat: function() {
    return parseFloat(this);
}, camelCase: function() { return this.replace(/-\D/g, function(A) { return A.charAt(1).toUpperCase(); }); }, hyphenate: function() {
    return this.replace(/\w[A-Z]/g, function(A) {
        return (A.charAt(0) + "-" + A.charAt(1).toLowerCase());
    });
}, capitalize: function() { return this.replace(/\b[a-z]/g, function(A) { return A.toUpperCase(); }); }, trim: function() {
    return this.replace(/^\s+|\s+$/g, "");
}, clean: function() { return this.replace(/\s{2,}/g, " ").trim(); }, rgbToHex: function(B) { var A = this.match(/\d{1,3}/g); return (A) ? A.rgbToHex(B) : false; }, hexToRgb: function(B) {
    var A = this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
    return (A) ? A.slice(1).hexToRgb(B) : false;
}, contains: function(A, B) { return (B) ? (B + this + B).indexOf(B + A + B) > -1 : this.indexOf(A) > -1; }, escapeRegExp: function() {
    return this.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1");
} 
}); Array.extend({ rgbToHex: function(D) {
    if (this.length < 3) { return false; } if (this.length == 4 && this[3] == 0 && !D) { return "transparent"; } var B = []; for (var A = 0; A < 3;
A++) { var C = (this[A] - 0).toString(16); B.push((C.length == 1) ? "0" + C : C); } return D ? B : "#" + B.join("");
}, hexToRgb: function(C) {
    if (this.length != 3) { return false; } var A = [];
    for (var B = 0; B < 3; B++) { A.push(parseInt((this[B].length == 1) ? this[B] + this[B] : this[B], 16)); } return C ? A : "rgb(" + A.join(",") + ")";
} 
}); Function.extend({ create: function(A) {
    var B = this;
    A = $merge({ bind: B, event: false, "arguments": null, delay: false, periodical: false, attempt: false }, A); if ($chk(A.arguments) && $type(A.arguments) != "array") {
        A.arguments = [A.arguments];
    } return function(E) {
        var C; if (A.event) { E = E || window.event; C = [(A.event === true) ? E : new A.event(E)]; if (A.arguments) { C.extend(A.arguments); } } else {
            C = A.arguments || arguments;
        } var F = function() { return B.apply($pick(A.bind, B), C); }; if (A.delay) { return setTimeout(F, A.delay); } if (A.periodical) { return setInterval(F, A.periodical); } if (A.attempt) {
            try {
                return F();
            } catch (D) { return false; } 
        } return F();
    };
}, pass: function(A, B) { return this.create({ "arguments": A, bind: B }); }, attempt: function(A, B) {
    return this.create({ "arguments": A, bind: B, attempt: true })();
}, bind: function(B, A) { return this.create({ bind: B, "arguments": A }); }, bindAsEventListener: function(B, A) {
    return this.create({ bind: B, event: true, "arguments": A });
}, delay: function(B, C, A) { return this.create({ delay: B, bind: C, "arguments": A })(); }, periodical: function(A, C, B) {
    return this.create({ periodical: A, bind: C, "arguments": B })();
} 
}); Number.extend({ toInt: function() { return parseInt(this); }, toFloat: function() { return parseFloat(this); }, limit: function(B, A) {
    return Math.min(A, Math.max(B, this));
}, round: function(A) { A = Math.pow(10, A || 0); return Math.round(this * A) / A; }, times: function(B) { for (var A = 0; A < this; A++) { B(A); } } 
}); var Element = new Class({ initialize: function(D, C) {
    if ($type(D) == "string") {
        if (window.ie && C && (C.name || C.type)) {
            var A = (C.name) ? ' name="' + C.name + '"' : "";
            var B = (C.type) ? ' type="' + C.type + '"' : ""; delete C.name; delete C.type; D = "<" + D + A + B + ">";
        } D = document.createElement(D);
    } D = $(D); return (!C || !D) ? D : D.set(C);
} 
}); var Elements = new Class({ initialize: function(A) {
    return (A) ? $extend(A, this) : this;
} 
}); Elements.extend = function(A) { for (var B in A) { this.prototype[B] = A[B]; this[B] = $native.generic(B); } }; function $(B) {
    if (!B) { return null; } if (B.htmlElement) {
        return Garbage.collect(B);
    } if ([window, document].contains(B)) { return B; } var A = $type(B); if (A == "string") { B = document.getElementById(B); A = (B) ? "element" : false; } if (A != "element") {
        return null;
    } if (B.htmlElement) { return Garbage.collect(B); } if (["object", "embed"].contains(B.tagName.toLowerCase())) { return B; } $extend(B, Element.prototype); B.htmlElement = function() { };
    return Garbage.collect(B);
} document.getElementsBySelector = document.getElementsByTagName; function $$() {
    var D = []; for (var C = 0, B = arguments.length; C < B; C++) {
        var A = arguments[C];
        switch ($type(A)) {
            case "element": D.push(A); case "boolean": break; case false: break; case "string": A = document.getElementsBySelector(A, true); default: D.extend(A);
        } 
    } return $$.unique(D);
} $$.unique = function(G) {
    var D = []; for (var C = 0, A = G.length; C < A; C++) {
        if (G[C].$included) { continue; } var B = $(G[C]); if (B && !B.$included) {
            B.$included = true;
            D.push(B);
        } 
    } for (var F = 0, E = D.length; F < E; F++) { D[F].$included = null; } return new Elements(D);
}; Elements.Multi = function(A) {
    return function() {
        var D = arguments;
        var B = []; var G = true; for (var E = 0, C = this.length, F; E < C; E++) { F = this[E][A].apply(this[E], D); if ($type(F) != "element") { G = false; } B.push(F); } return (G) ? $$.unique(B) : B;
    };
}; Element.extend = function(A) {
    for (var B in A) {
        HTMLElement.prototype[B] = A[B]; Element.prototype[B] = A[B]; Element[B] = $native.generic(B); var C = (Array.prototype[B]) ? B + "Elements" : B;
        Elements.prototype[C] = Elements.Multi(B);
    } 
}; Element.extend({ set: function(A) {
    for (var C in A) {
        var B = A[C]; switch (C) {
            case "styles": this.setStyles(B); break; case "events": if (this.addEvents) {
                    this.addEvents(B);
                } break; case "properties": this.setProperties(B); break; default: this.setProperty(C, B);
        } 
    } return this;
}, inject: function(C, A) {
    C = $(C); switch (A) {
        case "before": C.parentNode.insertBefore(this, C);
            break; case "after": var B = C.getNext(); if (!B) { C.parentNode.appendChild(this); } else { C.parentNode.insertBefore(this, B); } break; case "top": var D = C.firstChild; if (D) {
                C.insertBefore(this, D);
                break;
            } default: C.appendChild(this);
    } return this;
}, injectBefore: function(A) { return this.inject(A, "before"); }, injectAfter: function(A) {
    return this.inject(A, "after");
}, injectInside: function(A) { return this.inject(A, "bottom"); }, injectTop: function(A) { return this.inject(A, "top"); }, adopt: function() {
    var A = []; $each(arguments, function(B) {
        A = A.concat(B);
    }); $$(A).inject(this); return this;
}, remove: function() { return this.parentNode.removeChild(this); }, clone: function(C) {
    var B = $(this.cloneNode(C !== false)); if (!B.$events) {
        return B;
    } B.$events = {}; for (var A in this.$events) { B.$events[A] = { keys: $A(this.$events[A].keys), values: $A(this.$events[A].values) }; } return B.removeEvents();
}, replaceWith: function(A) {
    A = $(A);
    this.parentNode.replaceChild(A, this); return A;
}, appendText: function(A) { this.appendChild(document.createTextNode(A)); return this; }, hasClass: function(A) {
    return this.className.contains(A, " ");
}, addClass: function(A) { if (!this.hasClass(A)) { this.className = (this.className + " " + A).clean(); } return this; }, removeClass: function(A) {
    this.className = this.className.replace(new RegExp("(^|\\s)" + A + "(?:\\s|$)"), "$1").clean();
    return this;
}, toggleClass: function(A) { return this.hasClass(A) ? this.removeClass(A) : this.addClass(A); }, setStyle: function(B, A) {
    switch (B) {
        case "opacity": return this.setOpacity(parseFloat(A));
        case "float": B = (window.ie) ? "styleFloat" : "cssFloat";
    } B = B.camelCase(); switch ($type(A)) {
        case "number": if (!["zIndex", "zoom"].contains(B)) { A += "px"; } break; case "array": A = "rgb(" + A.join(",") + ")";
    } this.style[B] = A; return this;
}, setStyles: function(A) {
    switch ($type(A)) {
        case "object": Element.setMany(this, "setStyle", A); break; case "string": this.style.cssText = A;
    } return this;
}, setOpacity: function(A) {
    if (A == 0) { if (this.style.visibility != "hidden") { this.style.visibility = "hidden"; } } else {
        if (this.style.visibility != "visible") {
            this.style.visibility = "visible";
        } 
    } if (!this.currentStyle || !this.currentStyle.hasLayout) { this.style.zoom = 1; } if (window.ie) { this.style.filter = (A == 1) ? "" : "alpha(opacity=" + A * 100 + ")"; } this.style.opacity = this.$tmp.opacity = A;
    return this;
}, getStyle: function(C) {
    C = C.camelCase(); var A = this.style[C]; if (!$chk(A)) {
        if (C == "opacity") { return this.$tmp.opacity; } A = []; for (var B in Element.Styles) {
            if (C == B) {
                Element.Styles[B].each(function(F) {
                    var E = this.getStyle(F);
                    A.push(parseInt(E) ? E : "0px");
                }, this); if (C == "border") { var D = A.every(function(E) { return (E == A[0]); }); return (D) ? A[0] : false; } return A.join(" ");
            } 
        } if (C.contains("border")) {
            if (Element.Styles.border.contains(C)) {
                return ["Width", "Style", "Color"].map(function(E) {
                    return this.getStyle(C + E);
                }, this).join(" ");
            } else {
                if (Element.borderShort.contains(C)) {
                    return ["Top", "Right", "Bottom", "Left"].map(function(E) {
                        return this.getStyle("border" + E + C.replace("border", ""));
                    }, this).join(" ");
                } 
            } 
        } if (document.defaultView) { A = document.defaultView.getComputedStyle(this, null).getPropertyValue(C.hyphenate()); } else {
            if (this.currentStyle) {
                A = this.currentStyle[C];
            } 
        } 
    } if (window.ie) { A = Element.fixStyle(C, A, this); } if (A && C.test(/color/i) && A.contains("rgb")) {
        return A.split("rgb").splice(1, 4).map(function(E) {
            return E.rgbToHex();
        }).join(" ");
    } return A;
}, getStyles: function() { return Element.getMany(this, "getStyle", arguments); }, walk: function(A, C) {
    A += "Sibling"; var B = (C) ? this[C] : this[A];
    while (B && $type(B) != "element") { B = B[A]; } return $(B);
}, getPrevious: function() { return this.walk("previous"); }, getNext: function() { return this.walk("next"); }, getFirst: function() {
    return this.walk("next", "firstChild");
}, getLast: function() { return this.walk("previous", "lastChild"); }, getParent: function() { return $(this.parentNode); }, getChildren: function() {
    return $$(this.childNodes);
}, hasChild: function(A) { return !!$A(this.getElementsByTagName("*")).contains(A); }, getProperty: function(D) {
    var B = Element.Properties[D]; if (B) {
        return this[B];
    } var A = Element.PropertiesIFlag[D] || 0; if (!window.ie || A) { return this.getAttribute(D, A); } var C = this.attributes[D]; return (C) ? C.nodeValue : null;
}, removeProperty: function(B) {
    var A = Element.Properties[B];
    if (A) { this[A] = ""; } else { this.removeAttribute(B); } return this;
}, getProperties: function() { return Element.getMany(this, "getProperty", arguments); }, setProperty: function(C, B) {
    var A = Element.Properties[C];
    if (A) { this[A] = B; } else { this.setAttribute(C, B); } return this;
}, setProperties: function(A) { return Element.setMany(this, "setProperty", A); }, setHTML: function() {
    this.innerHTML = $A(arguments).join("");
    return this;
}, setText: function(B) {
    var A = this.getTag(); if (["style", "script"].contains(A)) {
        if (window.ie) {
            if (A == "style") { this.styleSheet.cssText = B; } else {
                if (A == "script") {
                    this.setProperty("text", B);
                } 
            } return this;
        } else { this.removeChild(this.firstChild); return this.appendText(B); } 
    } this[$defined(this.innerText) ? "innerText" : "textContent"] = B; return this;
}, getText: function() {
    var A = this.getTag(); if (["style", "script"].contains(A)) {
        if (window.ie) {
            if (A == "style") { return this.styleSheet.cssText; } else {
                if (A == "script") {
                    return this.getProperty("text");
                } 
            } 
        } else { return this.innerHTML; } 
    } return ($pick(this.innerText, this.textContent));
}, getTag: function() { return this.tagName.toLowerCase(); }, empty: function() {
    Garbage.trash(this.getElementsByTagName("*"));
    return this.setHTML("");
} 
}); Element.fixStyle = function(E, A, D) {
    if ($chk(parseInt(A))) { return A; } if (["height", "width"].contains(E)) {
        var B = (E == "width") ? ["left", "right"] : ["top", "bottom"];
        var C = 0; B.each(function(F) { C += D.getStyle("border-" + F + "-width").toInt() + D.getStyle("padding-" + F).toInt(); }); return D["offset" + E.capitalize()] - C + "px";
    } else {
        if (E.test(/border(.+)Width|margin|padding/)) {
            return "0px";
        } 
    } return A;
}; Element.Styles = { border: [], padding: [], margin: [] }; ["Top", "Right", "Bottom", "Left"].each(function(B) {
    for (var A in Element.Styles) {
        Element.Styles[A].push(A + B);
    } 
}); Element.borderShort = ["borderWidth", "borderStyle", "borderColor"]; Element.getMany = function(B, D, C) {
    var A = {}; $each(C, function(E) { A[E] = B[D](E); }); return A;
}; Element.setMany = function(B, D, C) { for (var A in C) { B[D](A, C[A]); } return B; }; Element.Properties = new Abstract({ "class": "className", "for": "htmlFor", colspan: "colSpan", rowspan: "rowSpan", accesskey: "accessKey", tabindex: "tabIndex", maxlength: "maxLength", readonly: "readOnly", frameborder: "frameBorder", value: "value", disabled: "disabled", checked: "checked", multiple: "multiple", selected: "selected" });
Element.PropertiesIFlag = { href: 2, src: 2 }; Element.Methods = { Listeners: { addListener: function(B, A) {
    if (this.addEventListener) {
        this.addEventListener(B, A, false);
    } else { this.attachEvent("on" + B, A); } return this;
}, removeListener: function(B, A) {
    if (this.removeEventListener) { this.removeEventListener(B, A, false); } else {
        this.detachEvent("on" + B, A);
    } return this;
} }
}; window.extend(Element.Methods.Listeners); document.extend(Element.Methods.Listeners); Element.extend(Element.Methods.Listeners); var Garbage = { elements: [], collect: function(A) {
    if (!A.$tmp) {
        Garbage.elements.push(A);
        A.$tmp = { opacity: 1 };
    } return A;
}, trash: function(D) {
    for (var B = 0, A = D.length, C; B < A; B++) {
        if (!(C = D[B]) || !C.$tmp) { continue; } if (C.$events) {
            C.fireEvent("trash").removeEvents();
        } for (var E in C.$tmp) { C.$tmp[E] = null; } for (var F in Element.prototype) { C[F] = null; } Garbage.elements[Garbage.elements.indexOf(C)] = null; C.htmlElement = C.$tmp = C = null;
    } Garbage.elements.remove(null);
}, empty: function() { Garbage.collect(window); Garbage.collect(document); Garbage.trash(Garbage.elements); } 
}; window.addListener("beforeunload", function() {
    window.addListener("unload", Garbage.empty);
    if (window.ie) { window.addListener("unload", CollectGarbage); } 
}); Elements.extend({ filterByTag: function(A) {
    return new Elements(this.filter(function(B) {
        return (Element.getTag(B) == A);
    }));
}, filterByClass: function(A, C) { var B = this.filter(function(D) { return (D.className && D.className.contains(A, " ")); }); return (C) ? B : new Elements(B); }, filterById: function(C, B) {
    var A = this.filter(function(D) {
        return (D.id == C);
    }); return (B) ? A : new Elements(A);
}, filterByAttribute: function(B, A, D, E) {
    var C = this.filter(function(F) {
        var G = Element.getProperty(F, B); if (!G) { return false; } if (!A) {
            return true;
        } switch (A) {
            case "=": return (G == D); case "*=": return (G.contains(D)); case "^=": return (G.substr(0, D.length) == D); case "$=": return (G.substr(G.length - D.length) == D);
            case "!=": return (G != D); case "~=": return G.contains(D, " ");
        } return false;
    }); return (E) ? C : new Elements(C);
} 
}); function $E(A, B) {
    return ($(B) || document).getElement(A);
} function $ES(A, B) { return ($(B) || document).getElementsBySelector(A); } $$.shared = { regexp: /^(\w*|\*)(?:#([\w-]+)|\.([\w-]+))?(?:\[(\w+)(?:([!*^$]?=)["']?([^"'\]]*)["']?)?])?$/, xpath: { getParam: function(B, D, E, C) {
    var A = [D.namespaceURI ? "xhtml:" : "", E[1]];
    if (E[2]) { A.push('[@id="', E[2], '"]'); } if (E[3]) { A.push('[contains(concat(" ", @class, " "), " ', E[3], ' ")]'); } if (E[4]) {
        if (E[5] && E[6]) {
            switch (E[5]) {
                case "*=": A.push("[contains(@", E[4], ', "', E[6], '")]');
                    break; case "^=": A.push("[starts-with(@", E[4], ', "', E[6], '")]'); break; case "$=": A.push("[substring(@", E[4], ", string-length(@", E[4], ") - ", E[6].length, ' + 1) = "', E[6], '"]');
                    break; case "=": A.push("[@", E[4], '="', E[6], '"]'); break; case "!=": A.push("[@", E[4], '!="', E[6], '"]');
            } 
        } else { A.push("[@", E[4], "]"); } 
    } B.push(A.join("")); return B;
}, getItems: function(B, E, G) {
    var F = []; var A = document.evaluate(".//" + B.join("//"), E, $$.shared.resolver, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (var D = 0, C = A.snapshotLength;
D < C; D++) { F.push(A.snapshotItem(D)); } return (G) ? F : new Elements(F.map($));
} 
}, normal: { getParam: function(A, C, E, B) {
    if (B == 0) {
        if (E[2]) {
            var D = C.getElementById(E[2]);
            if (!D || ((E[1] != "*") && (Element.getTag(D) != E[1]))) { return false; } A = [D];
        } else { A = $A(C.getElementsByTagName(E[1])); } 
    } else {
        A = $$.shared.getElementsByTagName(A, E[1]);
        if (E[2]) { A = Elements.filterById(A, E[2], true); } 
    } if (E[3]) { A = Elements.filterByClass(A, E[3], true); } if (E[4]) {
        A = Elements.filterByAttribute(A, E[4], E[5], E[6], true);
    } return A;
}, getItems: function(A, B, C) { return (C) ? A : $$.unique(A); } 
}, resolver: function(A) { return (A == "xhtml") ? "http://www.w3.org/1999/xhtml" : false; }, getElementsByTagName: function(D, C) {
    var E = [];
    for (var B = 0, A = D.length; B < A; B++) { E.extend(D[B].getElementsByTagName(C)); } return E;
} 
}; $$.shared.method = (window.xpath) ? "xpath" : "normal"; Element.Methods.Dom = { getElements: function(A, H) {
    var C = [];
    A = A.trim().split(" "); for (var E = 0, D = A.length; E < D; E++) {
        var F = A[E]; var G = F.match($$.shared.regexp); if (!G) { break; } G[1] = G[1] || "*"; var B = $$.shared[$$.shared.method].getParam(C, this, G, E);
        if (!B) { break; } C = B;
    } return $$.shared[$$.shared.method].getItems(C, this, H);
}, getElement: function(A) { return $(this.getElements(A, true)[0] || false); }, getElementsBySelector: function(A, E) {
    var D = [];
    A = A.split(","); for (var C = 0, B = A.length; C < B; C++) { D = D.concat(this.getElements(A[C], true)); } return (E) ? D : $$.unique(D);
} 
}; Element.extend({ getElementById: function(C) {
    var B = document.getElementById(C);
    if (!B) { return false; } for (var A = B.parentNode; A != this; A = A.parentNode) { if (!A) { return false; } } return B;
}, getElementsByClassName: function(A) {
    return this.getElements("." + A);
} 
}); document.extend(Element.Methods.Dom); Element.extend(Element.Methods.Dom); Element.extend({ getValue: function() {
    switch (this.getTag()) {
        case "select": var A = [];
            $each(this.options, function(B) { if (B.selected) { A.push($pick(B.value, B.text)); } }); return (this.multiple) ? A : A[0]; case "input": if (!(this.checked && ["checkbox", "radio"].contains(this.type)) && !["hidden", "text", "password"].contains(this.type)) {
                break;
            } case "textarea": return this.value;
    } return false;
}, getFormElements: function() {
    return $$(this.getElementsByTagName("input"), this.getElementsByTagName("select"), this.getElementsByTagName("textarea"));
}, toQueryString: function() {
    var A = []; this.getFormElements().each(function(D) {
        var C = D.name; var E = D.getValue(); if (E === false || !C || D.disabled) { return; } var B = function(F) {
            A.push(C + "=" + encodeURIComponent(F));
        }; if ($type(E) == "array") { E.each(B); } else { B(E); } 
    }); return A.join("&");
} 
}); var XHR = new Class({ options: { method: "post", async: true, onRequest: Class.empty, onSuccess: Class.empty, onFailure: Class.empty, URLEncoded: true, encoding: "utf-8", autoCancel: false, headers: {} }, setTransport: function() {
    this.transport = (window.XMLHttpRequest) ? new XMLHttpRequest() : (window.ie ? new ActiveXObject("Microsoft.XMLHTTP") : false);
    return this;
}, initialize: function(A) {
    this.setTransport().setOptions(A); this.options.isSuccess = this.options.isSuccess || this.isSuccess; this.headers = {}; if (this.options.URLEncoded && this.options.method == "post") {
        var B = (this.options.encoding) ? "; charset=" + this.options.encoding : "";
        this.setHeader("Content-type", "application/x-www-form-URLencoded" + B);
    } if (this.options.initialize) { this.options.initialize.call(this); } 
}, onStateChange: function() {
    if (this.transport.readyState != 4 || !this.running) {
        return;
    } this.running = false; var A = 0; try { A = this.transport.status; } catch (B) { } if (this.options.isSuccess.call(this, A)) { this.onSuccess(); } else { this.onFailure(); } this.transport.onreadystatechange = Class.empty;
}, isSuccess: function(A) { return ((A >= 200) && (A < 300)); }, onSuccess: function() {
    this.response = { text: this.transport.responseText, xml: this.transport.responseXML };
    this.fireEvent("onSuccess", [this.response.text, this.response.xml]); this.callChain();
}, onFailure: function() { this.fireEvent("onFailure", this.transport); }, setHeader: function(A, B) {
    this.headers[A] = B;
    return this;
}, send: function(A, C) {
    if (this.options.autoCancel) { this.cancel(); } else { if (this.running) { return this; } } this.running = true; if (C && this.options.method == "get") {
        A = A + (A.contains("?") ? "&" : "?") + C;
        C = null;
    } this.transport.open(this.options.method.toUpperCase(), A, this.options.async); this.transport.onreadystatechange = this.onStateChange.bind(this); if ((this.options.method == "post") && this.transport.overrideMimeType) {
        this.setHeader("Connection", "close");
    } $extend(this.headers, this.options.headers); for (var B in this.headers) { try { this.transport.setRequestHeader(B, this.headers[B]); } catch (D) { } } this.fireEvent("onRequest");
    this.transport.send($pick(C, null)); return this;
}, cancel: function() {
    if (!this.running) { return this; } this.running = false; this.transport.abort(); this.transport.onreadystatechange = Class.empty;
    this.setTransport(); this.fireEvent("onCancel"); return this;
} 
}); XHR.implement(new Chain, new Events, new Options); var Ajax = XHR.extend({ options: { data: null, update: null, onComplete: Class.empty, evalScripts: false, evalResponse: false }, initialize: function(B, A) {
    this.addEvent("onSuccess", this.onComplete);
    this.setOptions(A); this.options.data = this.options.data || this.options.postBody; if (!["post", "get"].contains(this.options.method)) {
        this._method = "_method=" + this.options.method;
        this.options.method = "post";
    } this.parent(); this.setHeader("X-Requested-With", "XMLHttpRequest"); this.setHeader("Accept", "text/javascript, text/html, application/xml, text/xml, */*");
    this.URL = B;
}, onComplete: function() {
    if (this.options.update) { $(this.options.update).empty().setHTML(this.response.text); } if (this.options.evalScripts || this.options.evalResponse) {
        this.evalScripts();
    } this.fireEvent("onComplete", [this.response.text, this.response.xml], 20);
}, request: function(A) {
    A = A || this.options.data; switch ($type(A)) {
        case "element": A = $(A).toQueryString();
            break; case "object": A = Object.toQueryString(A);
    } if (this._method) { A = (A) ? [this._method, A].join("&") : this._method; } return this.send(this.URL, A);
}, evalScripts: function() {
    var B, A;
    if (this.options.evalResponse || (/(ecma|java)script/).test(this.getHeader("Content-type"))) { A = this.response.text; } else {
        A = []; var C = /<script[^>]*>([\s\S]*?)<\/script>/gi;
        while ((B = C.exec(this.response.text))) { A.push(B[1]); } A = A.join("\n");
    } if (A) { (window.execScript) ? window.execScript(A) : window.setTimeout(A, 0); } 
}, getHeader: function(A) {
    try {
        return this.transport.getResponseHeader(A);
    } catch (B) { } return null;
} 
}); Object.toQueryString = function(B) {
    var C = []; for (var A in B) { C.push(encodeURIComponent(A) + "=" + encodeURIComponent(B[A])); } return C.join("&");
}; Element.extend({ send: function(A) { return new Ajax(this.getProperty("action"), $merge({ data: this.toQueryString() }, A, { method: "post" })).request(); } });

//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion() {
    var version;
    var axo;
    var e;

    // NOTE: new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

    try {
        // version will be set for 7.X or greater players
        axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
        version = axo.GetVariable("$version");
    } catch (e) {
    }

    if (!version) {
        try {
            // version will be set for 6.X players only
            axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");

            // installed player is some revision of 6.0
            // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
            // so we have to be careful. 

            // default to the first public version
            version = "WIN 6,0,21,0";

            // throws if AllowScripAccess does not exist (introduced in 6.0r47)		
            axo.AllowScriptAccess = "always";

            // safe to call for 6.0r47 or greater
            version = axo.GetVariable("$version");

        } catch (e) {
        }
    }

    if (!version) {
        try {
            // version will be set for 4.X or 5.X player
            axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
            version = axo.GetVariable("$version");
        } catch (e) {
        }
    }

    if (!version) {
        try {
            // version will be set for 3.X player
            axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
            version = "WIN 3,0,18,0";
        } catch (e) {
        }
    }

    if (!version) {
        try {
            // version will be set for 2.X player
            axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
            version = "WIN 2,0,0,11";
        } catch (e) {
            version = -1;
        }
    }

    return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer() {
    // NS/Opera version >= 3 check for Flash plugin in plugin array
    var flashVer = -1;

    if (navigator.plugins != null && navigator.plugins.length > 0) {
        if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
            var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
            var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
            var descArray = flashDescription.split(" ");
            var tempArrayMajor = descArray[2].split(".");
            var versionMajor = tempArrayMajor[0];
            var versionMinor = tempArrayMajor[1];
            var versionRevision = descArray[3];
            if (versionRevision == "") {
                versionRevision = descArray[4];
            }
            if (versionRevision[0] == "d") {
                versionRevision = versionRevision.substring(1);
            } else if (versionRevision[0] == "r") {
                versionRevision = versionRevision.substring(1);
                if (versionRevision.indexOf("d") > 0) {
                    versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
                }
            }
            var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
        }
    }
    // MSN/WebTV 2.6 supports Flash 4
    else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
    // WebTV 2.5 supports Flash 3
    else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
    // older WebTV supports Flash 2
    else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
    else if (isIE && isWin && !isOpera) {
        flashVer = ControlVersion();
    }
    return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) {
    versionStr = GetSwfVer();
    if (versionStr == -1) {
        return false;
    } else if (versionStr != 0) {
        if (isIE && isWin && !isOpera) {
            // Given "WIN 2,0,0,11"
            tempArray = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
            tempString = tempArray[1]; 		// "2,0,0,11"
            versionArray = tempString.split(","); // ['2', '0', '0', '11']
        } else {
            versionArray = versionStr.split(".");
        }
        var versionMajor = versionArray[0];
        var versionMinor = versionArray[1];
        var versionRevision = versionArray[2];

        // is the major.revision >= requested major.revision AND the minor version >= requested minor
        if (versionMajor > parseFloat(reqMajorVer)) {
            return true;
        } else if (versionMajor == parseFloat(reqMajorVer)) {
            if (versionMinor > parseFloat(reqMinorVer))
                return true;
            else if (versionMinor == parseFloat(reqMinorVer)) {
                if (versionRevision >= parseFloat(reqRevision))
                    return true;
            }
        }
        return false;
    }
}

function AC_AddExtension(src, ext) {
    if (src.indexOf('?') != -1)
        return src.replace(/\?/, ext + '?');
    else
        return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) {
    var str = '';
    if (isIE && isWin && !isOpera) {
        str += '<object ';
        for (var i in objAttrs) {
            str += i + '="' + objAttrs[i] + '" ';
        }
        str += '>';
        for (var i in params) {
            str += '<param name="' + i + '" value="' + params[i] + '" /> ';
        }
        str += '</object>';
    }
    else {
        str += '<embed ';
        for (var i in embedAttrs) {
            str += i + '="' + embedAttrs[i] + '" ';
        }
        str += '> </embed>';
    }

    document.write(str);
}

function AC_FL_RunContent() {
    var ret =
    AC_GetArgs
    (arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
    AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent() {
    var ret =
    AC_GetArgs
    (arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
    AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType) {
    var ret = new Object();
    ret.embedAttrs = new Object();
    ret.params = new Object();
    ret.objAttrs = new Object();
    for (var i = 0; i < args.length; i = i + 2) {
        var currArg = args[i].toLowerCase();

        switch (currArg) {
            case "classid":
                break;
            case "pluginspage":
                ret.embedAttrs[args[i]] = args[i + 1];
                break;
            case "src":
            case "movie":
                args[i + 1] = AC_AddExtension(args[i + 1], ext);
                ret.embedAttrs["src"] = args[i + 1];
                ret.params[srcParamName] = args[i + 1];
                break;
            case "onafterupdate":
            case "onbeforeupdate":
            case "onblur":
            case "oncellchange":
            case "onclick":
            case "ondblClick":
            case "ondrag":
            case "ondragend":
            case "ondragenter":
            case "ondragleave":
            case "ondragover":
            case "ondrop":
            case "onfinish":
            case "onfocus":
            case "onhelp":
            case "onmousedown":
            case "onmouseup":
            case "onmouseover":
            case "onmousemove":
            case "onmouseout":
            case "onkeypress":
            case "onkeydown":
            case "onkeyup":
            case "onload":
            case "onlosecapture":
            case "onpropertychange":
            case "onreadystatechange":
            case "onrowsdelete":
            case "onrowenter":
            case "onrowexit":
            case "onrowsinserted":
            case "onstart":
            case "onscroll":
            case "onbeforeeditfocus":
            case "onactivate":
            case "onbeforedeactivate":
            case "ondeactivate":
            case "type":
            case "codebase":
            case "id":
                ret.objAttrs[args[i]] = args[i + 1];
                break;
            case "width":
            case "height":
            case "align":
            case "vspace":
            case "hspace":
            case "class":
            case "title":
            case "accesskey":
            case "name":
            case "tabindex":
                ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i + 1];
                break;
            default:
                ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i + 1];
        }
    }
    ret.objAttrs["classid"] = classid;
    if (mimeType) ret.embedAttrs["type"] = mimeType;
    return ret;
}
