/*
 * Thickbox 3 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
var tb_pathToImage = "images/loadingAnimation.gif";
eval(function(p, a, c, k, e, r) {
    e = function(c) {
        return (c < a ? '': e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36))
    };
    if (!''.replace(/^/, String)) {
        while (c--) r[e(c)] = k[c] || e(c);
        k = [function(e) {
            return r[e]
        }];
        e = function() {
            return '\\w+'
        };
        c = 1
    };
    while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]);
    return p
} ('$(o).2S(9(){1u(\'a.18, 3n.18, 3i.18\');1w=1p 1t();1w.L=2H});9 1u(b){$(b).s(9(){6 t=X.Q||X.1v||M;6 a=X.u||X.23;6 g=X.1N||P;19(t,a,g);X.2E();H P})}9 19(d,f,g){3m{3(2t o.v.J.2i==="2g"){$("v","11").r({A:"28%",z:"28%"});$("11").r("22","2Z");3(o.1Y("1F")===M){$("v").q("<U 5=\'1F\'></U><4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}n{3(o.1Y("B")===M){$("v").q("<4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}3(1K()){$("#B").1J("2B")}n{$("#B").1J("2z")}3(d===M){d=""}$("v").q("<4 5=\'K\'><1I L=\'"+1w.L+"\' /></4>");$(\'#K\').2y();6 h;3(f.O("?")!==-1){h=f.3l(0,f.O("?"))}n{h=f}6 i=/\\.2s$|\\.2q$|\\.2m$|\\.2l$|\\.2k$/;6 j=h.1C().2h(i);3(j==\'.2s\'||j==\'.2q\'||j==\'.2m\'||j==\'.2l\'||j==\'.2k\'){1D="";1G="";14="";1z="";1x="";R="";1n="";1r=P;3(g){E=$("a[@1N="+g+"]").36();25(D=0;((D<E.1c)&&(R===""));D++){6 k=E[D].u.1C().2h(i);3(!(E[D].u==f)){3(1r){1z=E[D].Q;1x=E[D].u;R="<1e 5=\'1X\'>&1d;&1d;<a u=\'#\'>2T &2R;</a></1e>"}n{1D=E[D].Q;1G=E[D].u;14="<1e 5=\'1U\'>&1d;&1d;<a u=\'#\'>&2O; 2N</a></1e>"}}n{1r=1b;1n="1t "+(D+1)+" 2L "+(E.1c)}}}S=1p 1t();S.1g=9(){S.1g=M;6 a=2x();6 x=a[0]-1M;6 y=a[1]-1M;6 b=S.z;6 c=S.A;3(b>x){c=c*(x/b);b=x;3(c>y){b=b*(y/c);c=y}}n 3(c>y){b=b*(y/c);c=y;3(b>x){c=c*(x/b);b=x}}13=b+30;1a=c+2G;$("#8").q("<a u=\'\' 5=\'1L\' Q=\'1o\'><1I 5=\'2F\' L=\'"+f+"\' z=\'"+b+"\' A=\'"+c+"\' 23=\'"+d+"\'/></a>"+"<4 5=\'2D\'>"+d+"<4 5=\'2C\'>"+1n+14+R+"</4></4><4 5=\'2A\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4>");$("#Z").s(G);3(!(14==="")){9 12(){3($(o).N("s",12)){$(o).N("s",12)}$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1D,1G,g);H P}$("#1U").s(12)}3(!(R==="")){9 1i(){$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1z,1x,g);H P}$("#1X").s(1i)}o.1h=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}n 3(I==3k){3(!(R=="")){o.1h="";1i()}}n 3(I==3j){3(!(14=="")){o.1h="";12()}}};16();$("#K").C();$("#1L").s(G);$("#8").r({Y:"T"})};S.L=f}n{6 l=f.2r(/^[^\\?]+\\??/,\'\');6 m=2p(l);13=(m[\'z\']*1)+30||3h;1a=(m[\'A\']*1)+3g||3f;W=13-30;V=1a-3e;3(f.O(\'2j\')!=-1){1E=f.1B(\'3d\');$("#15").C();3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4></4><U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\' > </U>")}n{$("#B").N();$("#8").q("<U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\'> </U>")}}n{3($("#8").r("Y")!="T"){3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\'>1l</a> 1k 1j 1s</4></4><4 5=\'F\' J=\'z:"+W+"p;A:"+V+"p\'></4>")}n{$("#B").N();$("#8").q("<4 5=\'F\' 3c=\'3b\' J=\'z:"+W+"p;A:"+V+"p;\'></4>")}}n{$("#F")[0].J.z=W+"p";$("#F")[0].J.A=V+"p";$("#F")[0].3a=0;$("#1H").11(d)}}$("#Z").s(G);3(f.O(\'37\')!=-1){$("#F").q($(\'#\'+m[\'26\']).1T());$("#8").24(9(){$(\'#\'+m[\'26\']).q($("#F").1T())});16();$("#K").C();$("#8").r({Y:"T"})}n 3(f.O(\'2j\')!=-1){16();3($.1q.35){$("#K").C();$("#8").r({Y:"T"})}}n{$("#F").34(f+="&1y="+(1p 33().32()),9(){16();$("#K").C();1u("#F a.18");$("#8").r({Y:"T"})})}}3(!m[\'1A\']){o.21=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}}}}31(e){}}9 1m(){$("#K").C();$("#8").r({Y:"T"})}9 G(){$("#2Y").N("s");$("#Z").N("s");$("#8").2X("2W",9(){$(\'#8,#B,#1F\').2V("24").N().C()});$("#K").C();3(2t o.v.J.2i=="2g"){$("v","11").r({A:"1Z",z:"1Z"});$("11").r("22","")}o.1h="";o.21="";H P}9 16(){$("#8").r({2U:\'-\'+20((13/2),10)+\'p\',z:13+\'p\'});3(!(1V.1q.2Q&&1V.1q.2P<7)){$("#8").r({38:\'-\'+20((1a/2),10)+\'p\'})}}9 2p(a){6 b={};3(!a){H b}6 c=a.1B(/[;&]/);25(6 i=0;i<c.1c;i++){6 d=c[i].1B(\'=\');3(!d||d.1c!=2){39}6 e=2a(d[0]);6 f=2a(d[1]);f=f.2r(/\\+/g,\' \');b[e]=f}H b}9 2x(){6 a=o.2M;6 w=1S.2o||1R.2o||(a&&a.1Q)||o.v.1Q;6 h=1S.1P||1R.1P||(a&&a.2n)||o.v.2n;1O=[w,h];H 1O}9 1K(){6 a=2K.2J.1C();3(a.O(\'2I\')!=-1&&a.O(\'3o\')!=-1){H 1b}}', 62, 211, '|||if|div|id|var||TB_window|function||||||||||||||else|document|px|append|css|click||href|body||||width|height|TB_overlay|remove|TB_Counter|TB_TempArray|TB_ajaxContent|tb_remove|return|keycode|style|TB_load|src|null|unbind|indexOf|false|title|TB_NextHTML|imgPreloader|block|iframe|ajaxContentH|ajaxContentW|this|display|TB_closeWindowButton||html|goPrev|TB_WIDTH|TB_PrevHTML|TB_iframeContent|tb_position||thickbox|tb_show|TB_HEIGHT|true|length|nbsp|span|Math|onload|onkeydown|goNext|Esc|or|close|tb_showIframe|TB_imageCount|Close|new|browser|TB_FoundURL|Key|Image|tb_init|name|imgLoader|TB_NextURL|random|TB_NextCaption|modal|split|toLowerCase|TB_PrevCaption|urlNoQuery|TB_HideSelect|TB_PrevURL|TB_ajaxWindowTitle|img|addClass|tb_detectMacXFF|TB_ImageOff|150|rel|arrayPageSize|innerHeight|clientWidth|self|window|children|TB_prev|jQuery|frameborder|TB_next|getElementById|auto|parseInt|onkeyup|overflow|alt|unload|for|inlineId||100||unescape|1000|round|hspace|TB_closeAjaxWindow|TB_title|undefined|match|maxHeight|TB_iframe|bmp|gif|png|clientHeight|innerWidth|tb_parseQuery|jpeg|replace|jpg|typeof|which|keyCode|event|tb_getPageSize|show|TB_overlayBG|TB_closeWindow|TB_overlayMacFFBGHack|TB_secondLine|TB_caption|blur|TB_Image|60|tb_pathToImage|mac|userAgent|navigator|of|documentElement|Prev|lt|version|msie|gt|ready|Next|marginLeft|trigger|fast|fadeOut|TB_imageOff|hidden||catch|getTime|Date|load|safari|get|TB_inline|marginTop|continue|scrollTop|TB_modal|class|TB_|45|440|40|630|input|188|190|substr|try|area|firefox'.split('|'), 0, {}))

function findLinebreaks(str) {
    var re = '/\r\n|\n|\r\|\f/g';
    var i = 0;
    while (re.match(str)) {
        i++;
    }
    return i;
}

/*
 ### jQuery Star Rating Plugin v3.10 - 2009-03-23 ###
 * Home: http://www.fyneworks.com/jquery/star-rating/
 * Code: http://code.google.com/p/jquery-star-rating-plugin/
 *
	* Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 ###
*/

/*# AVOID COLLISIONS #*/
;
if (window.jQuery)(function($) {
    /*# AVOID COLLISIONS #*/

    // IE6 Background Image Fix
    if ($.browser.msie) try {
        document.execCommand("BackgroundImageCache", false, true)
    } catch(e) {}
    // Thanks to http://www.visualjquery.com/rating/rating_redux.html
    // plugin initialization
    $.fn.rating = function(options) {
        if (this.length == 0) return this; // quick fail
        // Handle API methods
        if (typeof arguments[0] == 'string') {
            // Perform API methods on individual elements
            if (this.length > 1) {
                var args = arguments;
                return this.each(function() {
                    $.fn.rating.apply($(this), args);
                });
            };
            // Invoke API method handler
            $.fn.rating[arguments[0]].apply(this, $.makeArray(arguments).slice(1) || []);
            // Quick exit...
            return this;
        };

        // Initialize options for this call
        var options = $.extend({}
        /* new object */
        , $.fn.rating.options
        /* default options */
        , options || {}
        /* just-in-time options */
        );

        // loop through each matched element
        this.not('.star-rating-applied').addClass('star-rating-applied').each(function() {

            // Load control parameters / find context / etc
            var eid = (this.name || 'unnamed-rating').replace(/\[|\]+/g, "_");
            var context = $(this.form || document.body);
            var input = $(this);
            var raters = context.data('rating') || {
                count: 0
            };
            var rater = raters[eid];
            var control;

            // if rater is available, verify that the control still exists
            if (rater) control = rater.data('rating');

            if (rater && control) {
                // add star to control if rater is available and the same control still exists
                control.count++;

            }
            else {
                // create new control if first star or control element was removed/replaced
                // Initialize options for this raters
                control = $.extend({}
                /* new object */
                , options || {}
                /* current call options */
                , ($.metadata ? input.metadata() : ($.meta ? input.data() : null)) || {},
                /* metadata options */
                {
                    count: 0,
                    stars: [],
                    inputs: []
                });

                // increment number of rating controls
                control.serial = raters.count++;

                // create rating element
                rater = $('<span class="star-rating-control"/>');
                input.before(rater);

                // Mark element for initialization (once all stars are ready)
                rater.addClass('rating-to-be-drawn');

                // Accept readOnly setting from 'disabled' property
                if (input.attr('disabled')) control.readOnly = true;

                // Create 'cancel' button
                rater.append(
                control.cancel = $('<div class="rating-cancel"><a title="' + control.cancel + '">' + control.cancelValue + '</a></div>').mouseover(function() {
                    $(this).rating('drain');
                    $(this).addClass('star-rating-hover');
                    //$(this).rating('focus');
                }).mouseout(function() {
                    $(this).rating('draw');
                    $(this).removeClass('star-rating-hover');
                    //$(this).rating('blur');
                }).click(function() {
                    $(this).rating('select');
                }).data('rating', control));

            }; // first element of group
            // insert rating star
            var star = $('<div class="star-rating rater-' + control.serial + '"><a title="' + (this.title || this.value) + '">' + this.value + '</a></div>');
            rater.append(star);

            // inherit attributes from input element
            if (this.id) star.attr('id', this.id);
            if (this.className) star.addClass(this.className);

            // Half-stars?
            if (control.half) control.split = 2;

            // Prepare division control
            if (typeof control.split == 'number' && control.split > 0) {
                var stw = ($.fn.width ? star.width() : 0) || control.starWidth;
                var spi = (control.count % control.split),
                spw = Math.floor(stw / control.split);
                star
                // restrict star's width and hide overflow (already in CSS)
                .width(spw)
                // move the star left by using a negative margin
                // this is work-around to IE's stupid box model (position:relative doesn't work)
                .find('a').css({
                    'margin-left': '-' + (spi * spw) + 'px'
                })
            };

            // readOnly?
            if (control.readOnly) //{ //save a byte!
            // Mark star as readOnly so user can customize display
            star.addClass('star-rating-readonly');
            //}  //save a byte!
            else //{ //save a byte!
            // Enable hover css effects
            star.addClass('star-rating-live')
            // Attach mouse events
            .mouseover(function() {
                $(this).rating('fill');
                $(this).rating('focus');
            }).mouseout(function() {
                $(this).rating('draw');
                $(this).rating('blur');
            }).click(function() {
                $(this).addClass('test123');
                $(this).rating('select');
            });
            //}; //save a byte!
            // set current selection
            if (this.checked) control.current = star;

            // hide input element
            input.hide();

            // backward compatibility, form element to plugin
            input.change(function() {
                $(this).rating('select');
            });

            // attach reference to star to input element and vice-versa
            star.data('rating.input', input.data('rating.star', star));

            // store control information in form (or body when form not available)
            control.stars[control.stars.length] = star[0];
            control.inputs[control.inputs.length] = input[0];
            control.rater = raters[eid] = rater;
            control.context = context;

            input.data('rating', control);
            rater.data('rating', control);
            star.data('rating', control);
            context.data('rating', raters);
        }); // each element
        // Initialize ratings (first draw)
        $('.rating-to-be-drawn').rating('draw').removeClass('rating-to-be-drawn');

        return this; // don't break the chain...
    };

    /*--------------------------------------------------------*/

    /*
		### Core functionality and API ###
	*/
    $.extend($.fn.rating, {

        focus: function() {
            var control = this.data('rating');
            if (!control) return this;
            if (!control.focus) return this; // quick fail if not required
            // find data for event
            var input = $(this).data('rating.input') || $(this.tagName == 'INPUT' ? this: null);
            // focus handler, as requested by focusdigital.co.uk
            if (control.focus) control.focus.apply(input[0], [input.val(), $('a', input.data('rating.star'))[0]]);
        },
        // $.fn.rating.focus
        blur: function() {
            var control = this.data('rating');
            if (!control) return this;
            if (!control.blur) return this; // quick fail if not required
            // find data for event
            var input = $(this).data('rating.input') || $(this.tagName == 'INPUT' ? this: null);
            // blur handler, as requested by focusdigital.co.uk
            if (control.blur) control.blur.apply(input[0], [input.val(), $('a', input.data('rating.star'))[0]]);
        },
        // $.fn.rating.blur
        fill: function() { // fill to the current mouse position.
            var control = this.data('rating');
            if (!control) return this;
            // do not execute when control is in read-only mode
            if (control.readOnly) return;
            // Reset all stars and highlight them up to this element
            this.rating('drain');
            this.prevAll().andSelf().filter('.rater-' + control.serial).addClass('star-rating-hover');
        },
        // $.fn.rating.fill
        drain: function() { // drain all the stars.
            var control = this.data('rating');
            if (!control) return this;
            // do not execute when control is in read-only mode
            if (control.readOnly) return;
            // Reset all stars
            control.rater.children().filter('.rater-' + control.serial).removeClass('star-rating-on').removeClass('star-rating-hover');
        },
        // $.fn.rating.drain
        draw: function() { // set value and stars to reflect current selection
            var control = this.data('rating');
            if (!control) return this;
            // Clear all stars
            this.rating('drain');
            // Set control value
            if (control.current) {
                control.current.data('rating.input').attr('checked', 'checked');
                control.current.prevAll().andSelf().filter('.rater-' + control.serial).addClass('star-rating-on');
            }
            else $(control.inputs).removeAttr('checked');
            // Show/hide 'cancel' button
            control.cancel[control.readOnly || control.required ? 'hide': 'show']();
            // Add/remove read-only classes to remove hand pointer
            this.siblings()[control.readOnly ? 'addClass': 'removeClass']('star-rating-readonly');
        },
        // $.fn.rating.draw
        select: function(value) { // select a value
            var control = this.data('rating');
            if (!control) return this;
            // do not execute when control is in read-only mode
            if (control.readOnly) return;
            // clear selection
            control.current = null;
            // programmatically (based on user input)
            if (typeof value != 'undefined') {
                // select by index (0 based)
                if (typeof value == 'number') return $(control.stars[value]).rating('select');
                // select by literal value (must be passed as a string
                if (typeof value == 'string')
                //return 
                $.each(control.stars,
                function() {
                    if ($(this).data('rating.input').val() == value) $(this).rating('select');
                });
            }
            else control.current = this[0].tagName == 'INPUT' ? this.data('rating.star') : (this.is('.rater-' + control.serial) ? this: null);

            // Update rating control state
            this.data('rating', control);
            // Update display
            this.rating('draw');
            // find data for event
            var input = $(control.current ? control.current.data('rating.input') : null);
            // click callback, as requested here: http://plugins.jquery.com/node/1655
            if (control.callback) control.callback.apply(input[0], [input.val(), $('a', control.current)[0]]); // callback event
        },
        // $.fn.rating.select
        readOnly: function(toggle, disable) { // make the control read-only (still submits value)
            var control = this.data('rating');
            if (!control) return this;
            // setread-only status
            control.readOnly = toggle || toggle == undefined ? true: false;
            // enable/disable control value submission
            if (disable) $(control.inputs).attr("disabled", "disabled");
            else $(control.inputs).removeAttr("disabled");
            // Update rating control state
            this.data('rating', control);
            // Update display
            this.rating('draw');
        },
        // $.fn.rating.readOnly
        disable: function() { // make read-only and never submit value
            this.rating('readOnly', true, true);
        },
        // $.fn.rating.disable
        enable: function() { // make read/write and submit value
            this.rating('readOnly', false, false);
        } // $.fn.rating.select
    });

    /*--------------------------------------------------------*/

    /*
		### Default Settings ###
		eg.: You can override default control like this:
		$.fn.rating.options.cancel = 'Clear';
	*/
    $.fn.rating.options = { //$.extend($.fn.rating, { options: {
        cancel: 'Cancel Rating',
        // advisory title for the 'cancel' link
        cancelValue: '',
        // value to submit when user click the 'cancel' link
        split: 0,
        // split the star into how many parts?
        // Width of star image in case the plugin can't work it out. This can happen if
        // the jQuery.dimensions plugin is not available OR the image is hidden at installation
        starWidth: 16 //,
        //NB.: These don't need to be pre-defined (can be undefined/null) so let's save some code!
        //half:     false,         // just a shortcut to control.split = 2
        //required: false,         // disables the 'cancel' button so user can only select one of the specified values
        //readOnly: false,         // disable rating plugin interaction/ values cannot be changed
        //focus:    function(){},  // executed when stars are focused
        //blur:     function(){},  // executed when stars are focused
        //callback: function(){},  // executed when a star is clicked
    }; //} });
    /*--------------------------------------------------------*/

    /*
		### Default implementation ###
		The plugin will attach itself to file inputs
		with the class 'multi' when the page loads
	*/
    $(function() {
        $('input[type=radio].star').rating();
    });

    /*# AVOID COLLISIONS #*/
})(jQuery);
/*# AVOID COLLISIONS #*/

function submitform() {
    var bgcolor = $("div#signup").css('background-color');
    $("div#signup > #containment").fadeOut(300,
    function() {
        $("div#signup").css('background', bgcolor + ' url(/images/loader.gif) center center no-repeat');
        var data = $("#signup :input").serialize();
        //$('div#main').append(data);
        //Post it
        $.post('/orangecms/ajaxprocedures.php', data,
        function(txt) {
            $("div#signup > #containment").html(txt);
            $("div#signup").css('background-image', 'none');
            $("div#signup > #containment").fadeIn(500);
        });
    });
}

jQuery.fn.highlight = function(pat) {

    function innerHighlight(node, pat) {
        var skip = 0;
        if (node.nodeType == 3) {
            var pos = node.data.toUpperCase().indexOf(pat);
            if (pos >= 0) {
                var spannode = document.createElement('span');
                spannode.className = 'highlight';
                var middlebit = node.splitText(pos);
                var endbit = middlebit.splitText(pat.length);
                var middleclone = middlebit.cloneNode(true);
                spannode.appendChild(middleclone);
                middlebit.parentNode.replaceChild(spannode, middlebit);
                skip = 1;
            }
        }
        else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
            for (var i = 0; i < node.childNodes.length; ++i) {
                i += innerHighlight(node.childNodes[i], pat);
            }
        }
        return skip;
    }
    return this.each(function() {
        innerHighlight(this, pat.toUpperCase());
    });
};

jQuery.fn.removeHighlight = function() {
    return this.find("span.highlight").each(function() {
        this.parentNode.firstChild.nodeName;
        with(this.parentNode) {
            replaceChild(this.firstChild, this);
            normalize();
        }
    }).end();
};


$(document).ready(function(){
   $("#maincontent").prepend('<div id="storypagestop"><a href="/woodstockstories/all">All Stories</a> | <a href="/poststory.html">Submit a Story</a> | <a href="/myprofile.html">My Account</a></div>');

});

