/*
	=== jqModal-Drag ===
*/
/*
 * jqDnR - Minimalistic Drag'n'Resize for jQuery.
 *
 * Copyright (c) 2007 Brice Burgess <bhb@iceburg.net>, http://www.iceburg.net
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * $Version: 2007.08.19 +r2
 */

(function($){
$.fn.jqDrag=function(h){return i(this,h,'d');};
$.fn.jqResize=function(h){return i(this,h,'r');};
$.jqDnR={dnr:{},e:0,
drag:function(v){
 if(M.k == 'd')E.css({left:M.X+v.pageX-M.pX,top:M.Y+v.pageY-M.pY});
 else E.css({width:Math.max(v.pageX-M.pX+M.W,0),height:Math.max(v.pageY-M.pY+M.H,0)});
  return false;},
stop:function(){E.css('opacity',M.o);$().unbind('mousemove',J.drag).unbind('mouseup',J.stop);}
};
var J=$.jqDnR,M=J.dnr,E=J.e,
i=function(e,h,k){return e.each(function(){h=(h)?$(h,e):e;
 h.bind('mousedown',{e:e,k:k},function(v){var d=v.data,p={};E=d.e;
 // attempt utilization of dimensions plugin to fix IE issues
 if(E.css('position') != 'relative'){try{E.position(p);}catch(e){}}
 M={X:p.left||f('left')||0,Y:p.top||f('top')||0,W:f('width')||E[0].scrollWidth||0,H:f('height')||E[0].scrollHeight||0,pX:v.pageX,pY:v.pageY,k:d.k,o:E.css('opacity')};
 E.css({opacity:0.8});$().mousemove($.jqDnR.drag).mouseup($.jqDnR.stop);
 return false;
 });
});},
f=function(k){return parseInt(E.css(k))||false;};
})(jQuery);;

/*
	=== jquery.newsTicker ===
*/
/*
News ticker plugin (BBC news style)
Bryan Gullan,2007
version 1.1.1
http://www.makemineatriple.com/jquery
Use and distrubute freely with this header

Options (defaults shown):
newsList: "#news" 	// assumes unordered list; specify the ul holding the news items
tickerRate: 80 		// time gap between display of each letter (ms)
startDelay: 100 	// delay before first run of the ticker (ms)
loopDelay: 3000 	// time for which full text of each item is shown at end of print-out (ms)
placeHolder1: " |"	// character placeholder shown on even loops
placeHolder2: "_"	// character placeholder shown on odd loops

Sample usage:
$(document).ready(function() {
	var options = {
  		newsList: "#news",
 		startDelay: 10,
 		placeHolder1: " []"
	}
	$().newsTicker(options);
});

for markup as follows:

<ul id="news">
<li><a href="http://www.makemineatriple.com">MakeMineATriple.com</a></li>
<li><a href="http://www.jquery.com">jQuery</a></li>
</ul>

Underline text decoration on the link is not recommended! :-)



(function($) {
	
	function runTicker(settings) {
		if(settings.firstRun == 1){
			currentLength = settings.currentLength;
			currentItem = settings.currentItem;
			settings.firstRun = 0;
		}
		if(currentItem == settings.newsItemCounter + 1){
			currentItem = 0;
		}
		
		if( currentLength % 2 == 0) {
				placeHolder = settings.placeHolder1;
		}
		else {
			placeHolder = settings.placeHolder2;
		}
		
		if( currentLength <= settings.newsItems[currentItem].length + 1) {
			var tickerText = settings.newsItems[currentItem].substring(0,currentLength);
			$(settings.newsList).text(tickerText + placeHolder);
			currentLength ++;
			setTimeout(function(){runTicker(settings); settings = null;},settings.tickerRate);
		}
		else {
			$(settings.newsList).text(settings.newsItems[currentItem]);
			currentLength = 0;
			currentItem ++;
			setTimeout(function(){runTicker(settings); settings = null;},settings.loopDelay);	
		}	
	}
	
	$.fn.extend({
		newsTicker: function(settings) {
			settings = jQuery.extend({
		 	  	newsList: "#news",
		   		tickerRate: 80,
		    	startDelay: 100,
		    	loopDelay: 3000,
		    	placeHolder1: " |",
		    	placeHolder2: "_"
			}, settings);
			
			var newsItems = new Array();
			var newsLinks = new Array();
			var newsItemCounter = 0;
			
			$(settings.newsList + '').each(function(){
				newsItems[newsItemCounter] = $(this).text();
				newsItemCounter ++;
			});
			
			settings = jQuery.extend(settings,{
				newsItems: newsItems,
				newsLinks: newsLinks,
				newsItemCounter: newsItemCounter - 1,
				currentItem: 0,
				currentLength: 0,
				firstRun:1
			});
			
			setTimeout(function(){runTicker(settings); settings = null;},settings.startDelay);
		}
	
	});
	

})(jQuery);
*/;

/*
	=== jquery.dimensions ===
*/
/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-08-17 13:14:11 -0500 (Fri, 17 Aug 2007) $
 * $Rev: 2759 $
 *
 * Version: 1.1.2
 *
 * Requires: jQuery 1.1.3+
 */

(function($){

// store a copy of the core height and width methods
var height = $.fn.height,
    width  = $.fn.width;

$.fn.extend({
    /**
     * If used on document, returns the document's height (innerHeight).
     * If used on window, returns the viewport's (window) height.
     * See core docs on height() to see what happens when used on an element.
     *
     * @example $("#testdiv").height()
     * @result 200
     *
     * @example $(document).height()
     * @result 800
     *
     * @example $(window).height()
     * @result 400
     *
     * @name height
     * @type Number
     * @cat Plugins/Dimensions
     */
    height: function() {
        if ( !this[0] ) error();
        if ( this[0] == window )
            if ( $.browser.opera || ($.browser.safari && parseInt($.browser.version) > 520) )
                return self.innerHeight - (($(document).height() > self.innerHeight) ? getScrollbarWidth() : 0);
            else if ( $.browser.safari )
                return self.innerHeight;
            else
                return $.boxModel && document.documentElement.clientHeight || document.body.clientHeight;
        
        if ( this[0] == document ) 
            return Math.max( ($.boxModel && document.documentElement.scrollHeight || document.body.scrollHeight), document.body.offsetHeight );
        
        return height.apply(this, arguments);
    },
    
    /**
     * If used on document, returns the document's width (innerWidth).
     * If used on window, returns the viewport's (window) width.
     * See core docs on width() to see what happens when used on an element.
     *
     * @example $("#testdiv").width()
     * @result 200
     *
     * @example $(document).width()
     * @result 800
     *
     * @example $(window).width()
     * @result 400
     *
     * @name width
     * @type Number
     * @cat Plugins/Dimensions
     */
    width: function() {
        if (!this[0]) error();
        if ( this[0] == window )
            if ( $.browser.opera || ($.browser.safari && parseInt($.browser.version) > 520) )
                return self.innerWidth - (($(document).width() > self.innerWidth) ? getScrollbarWidth() : 0);
            else if ( $.browser.safari )
                return self.innerWidth;
            else
                return $.boxModel && document.documentElement.clientWidth || document.body.clientWidth;

        if ( this[0] == document )
            if ($.browser.mozilla) {
                // mozilla reports scrollWidth and offsetWidth as the same
                var scrollLeft = self.pageXOffset;
                self.scrollTo(99999999, self.pageYOffset);
                var scrollWidth = self.pageXOffset;
                self.scrollTo(scrollLeft, self.pageYOffset);
                return document.body.offsetWidth + scrollWidth;
            }
            else 
                return Math.max( (($.boxModel && !$.browser.safari) && document.documentElement.scrollWidth || document.body.scrollWidth), document.body.offsetWidth );

        return width.apply(this, arguments);
    },
    
    /**
     * Gets the inner height (excludes the border and includes the padding) for the first matched element.
     * If used on document, returns the document's height (innerHeight).
     * If used on window, returns the viewport's (window) height.
     *
     * @example $("#testdiv").innerHeight()
     * @result 210
     *
     * @name innerHeight
     * @type Number
     * @cat Plugins/Dimensions
     */
    innerHeight: function() {
        if (!this[0]) error();
        return this[0] == window || this[0] == document ?
            this.height() :
            this.is(':visible') ?
                this[0].offsetHeight - num(this, 'borderTopWidth') - num(this, 'borderBottomWidth') :
                this.height() + num(this, 'paddingTop') + num(this, 'paddingBottom');
    },
    
    /**
     * Gets the inner width (excludes the border and includes the padding) for the first matched element.
     * If used on document, returns the document's width (innerWidth).
     * If used on window, returns the viewport's (window) width.
     *
     * @example $("#testdiv").innerWidth()
     * @result 210
     *
     * @name innerWidth
     * @type Number
     * @cat Plugins/Dimensions
     */
    innerWidth: function() {
        if (!this[0]) error();
        return this[0] == window || this[0] == document ?
            this.width() :
            this.is(':visible') ?
                this[0].offsetWidth - num(this, 'borderLeftWidth') - num(this, 'borderRightWidth') :
                this.width() + num(this, 'paddingLeft') + num(this, 'paddingRight');
    },
    
    /**
     * Gets the outer height (includes the border and padding) for the first matched element.
     * If used on document, returns the document's height (innerHeight).
     * If used on window, returns the viewport's (window) height.
     *
     * The margin can be included in the calculation by passing an options map with margin
     * set to true.
     *
     * @example $("#testdiv").outerHeight()
     * @result 220
     *
     * @example $("#testdiv").outerHeight({ margin: true })
     * @result 240
     *
     * @name outerHeight
     * @type Number
     * @param Map options Optional settings to configure the way the outer height is calculated.
     * @cat Plugins/Dimensions
     */
    outerHeight: function(options) {
        if (!this[0]) error();
        options = $.extend({ margin: false }, options || {});
        return this[0] == window || this[0] == document ?
            this.height() :
            this.is(':visible') ?
                this[0].offsetHeight + (options.margin ? (num(this, 'marginTop') + num(this, 'marginBottom')) : 0) :
                this.height() 
                    + num(this,'borderTopWidth') + num(this, 'borderBottomWidth') 
                    + num(this, 'paddingTop') + num(this, 'paddingBottom')
                    + (options.margin ? (num(this, 'marginTop') + num(this, 'marginBottom')) : 0);
    },
    
    /**
     * Gets the outer width (including the border and padding) for the first matched element.
     * If used on document, returns the document's width (innerWidth).
     * If used on window, returns the viewport's (window) width.
     *
     * The margin can be included in the calculation by passing an options map with margin
     * set to true.
     *
     * @example $("#testdiv").outerWidth()
     * @result 1000
     *
     * @example $("#testdiv").outerWidth({ margin: true })
     * @result 1020
     * 
     * @name outerHeight
     * @type Number
     * @param Map options Optional settings to configure the way the outer width is calculated.
     * @cat Plugins/Dimensions
     */
    outerWidth: function(options) {
        if (!this[0]) error();
        options = $.extend({ margin: false }, options || {});
        return this[0] == window || this[0] == document ?
            this.width() :
            this.is(':visible') ?
                this[0].offsetWidth + (options.margin ? (num(this, 'marginLeft') + num(this, 'marginRight')) : 0) :
                this.width() 
                    + num(this, 'borderLeftWidth') + num(this, 'borderRightWidth') 
                    + num(this, 'paddingLeft') + num(this, 'paddingRight')
                    + (options.margin ? (num(this, 'marginLeft') + num(this, 'marginRight')) : 0);
    },
    
    /**
     * Gets how many pixels the user has scrolled to the right (scrollLeft).
     * Works on containers with overflow: auto and window/document.
     *
     * @example $(window).scrollLeft()
     * @result 100
     *
     * @example $(document).scrollLeft()
     * @result 100
     * 
     * @example $("#testdiv").scrollLeft()
     * @result 100
     *
     * @name scrollLeft
     * @type Number
     * @cat Plugins/Dimensions
     */
    /**
     * Sets the scrollLeft property for each element and continues the chain.
     * Works on containers with overflow: auto and window/document.
     *
     * @example $(window).scrollLeft(100).scrollLeft()
     * @result 100
     * 
     * @example $(document).scrollLeft(100).scrollLeft()
     * @result 100
     *
     * @example $("#testdiv").scrollLeft(100).scrollLeft()
     * @result 100
     *
     * @name scrollLeft
     * @param Number value A positive number representing the desired scrollLeft.
     * @type jQuery
     * @cat Plugins/Dimensions
     */
    scrollLeft: function(val) {
        if (!this[0]) error();
        if ( val != undefined )
            // set the scroll left
            return this.each(function() {
                if (this == window || this == document)
                    window.scrollTo( val, $(window).scrollTop() );
                else
                    this.scrollLeft = val;
            });
        
        // return the scroll left offest in pixels
        if ( this[0] == window || this[0] == document )
            return self.pageXOffset ||
                $.boxModel && document.documentElement.scrollLeft ||
                document.body.scrollLeft;
                
        return this[0].scrollLeft;
    },
    
    /**
     * Gets how many pixels the user has scrolled to the bottom (scrollTop).
     * Works on containers with overflow: auto and window/document.
     *
     * @example $(window).scrollTop()
     * @result 100
     *
     * @example $(document).scrollTop()
     * @result 100
     * 
     * @example $("#testdiv").scrollTop()
     * @result 100
     *
     * @name scrollTop
     * @type Number
     * @cat Plugins/Dimensions
     */
    /**
     * Sets the scrollTop property for each element and continues the chain.
     * Works on containers with overflow: auto and window/document.
     *
     * @example $(window).scrollTop(100).scrollTop()
     * @result 100
     * 
     * @example $(document).scrollTop(100).scrollTop()
     * @result 100
     *
     * @example $("#testdiv").scrollTop(100).scrollTop()
     * @result 100
     *
     * @name scrollTop
     * @param Number value A positive number representing the desired scrollTop.
     * @type jQuery
     * @cat Plugins/Dimensions
     */
    scrollTop: function(val) {
        if (!this[0]) error();
        if ( val != undefined )
            // set the scroll top
            return this.each(function() {
                if (this == window || this == document)
                    window.scrollTo( $(window).scrollLeft(), val );
                else
                    this.scrollTop = val;
            });
        
        // return the scroll top offset in pixels
        if ( this[0] == window || this[0] == document )
            return self.pageYOffset ||
                $.boxModel && document.documentElement.scrollTop ||
                document.body.scrollTop;

        return this[0].scrollTop;
    },
    
    /** 
     * Gets the top and left positioned offset in pixels.
     * The positioned offset is the offset between a positioned
     * parent and the element itself.
     *
     * For accurate calculations make sure to use pixel values for margins, borders and padding.
     *
     * @example $("#testdiv").position()
     * @result { top: 100, left: 100 }
     *
     * @example var position = {};
     * $("#testdiv").position(position)
     * @result position = { top: 100, left: 100 }
     * 
     * @name position
     * @param Object returnObject Optional An object to store the return value in, so as not to break the chain. If passed in the
     *                            chain will not be broken and the result will be assigned to this object.
     * @type Object
     * @cat Plugins/Dimensions
     */
    position: function(returnObject) {
        return this.offset({ margin: false, scroll: false, relativeTo: this.offsetParent() }, returnObject);
    },
    
    /**
     * Gets the location of the element in pixels from the top left corner of the viewport.
     * The offset method takes an optional map of key value pairs to configure the way
     * the offset is calculated. Here are the different options.
     *
     * (Boolean) margin - Should the margin of the element be included in the calculations? True by default.
     * (Boolean) border - Should the border of the element be included in the calculations? False by default. 
     * (Boolean) padding - Should the padding of the element be included in the calculations? False by default. 
     * (Boolean) scroll - Should the scroll offsets of the parent elements be included in the calculations? True by default.
     *                    When true it adds the total scroll offsets of all parents to the total offset and also adds two
     *                    properties to the returned object, scrollTop and scrollLeft.
     * (Boolean) lite - When true it will use the offsetLite method instead of the full-blown, slower offset method. False by default.
     *                  Only use this when margins, borders and padding calculations don't matter.
     * (HTML Element) relativeTo - This should be a parent of the element and should have position (like absolute or relative).
     *                             It will retreive the offset relative to this parent element. By default it is the body element.
     *
     * Also an object can be passed as the second paramater to
     * catch the value of the return and continue the chain.
     *
     * For accurate calculations make sure to use pixel values for margins, borders and padding.
     * 
     * Known issues:
     *  - Issue: A div positioned relative or static without any content before it and its parent will report an offsetTop of 0 in Safari
     *    Workaround: Place content before the relative div ... and set height and width to 0 and overflow to hidden
     *
     * @example $("#testdiv").offset()
     * @result { top: 100, left: 100, scrollTop: 10, scrollLeft: 10 }
     *
     * @example $("#testdiv").offset({ scroll: false })
     * @result { top: 90, left: 90 }
     *
     * @example var offset = {}
     * $("#testdiv").offset({ scroll: false }, offset)
     * @result offset = { top: 90, left: 90 }
     *
     * @name offset
     * @param Map options Optional settings to configure the way the offset is calculated.
     * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the
     *                            chain will not be broken and the result will be assigned to this object.
     * @type Object
     * @cat Plugins/Dimensions
     */
    offset: function(options, returnObject) {
        if (!this[0]) error();
        var x = 0, y = 0, sl = 0, st = 0,
            elem = this[0], parent = this[0], op, parPos, elemPos = $.css(elem, 'position'),
            mo = $.browser.mozilla, ie = $.browser.msie, oa = $.browser.opera,
            sf = $.browser.safari, sf3 = $.browser.safari && parseInt($.browser.version) > 520,
            absparent = false, relparent = false, 
            options = $.extend({ margin: true, border: false, padding: false, scroll: true, lite: false, relativeTo: document.body }, options || {});
        
        // Use offsetLite if lite option is true
        if (options.lite) return this.offsetLite(options, returnObject);
        // Get the HTMLElement if relativeTo is a jquery collection
        if (options.relativeTo.jquery) options.relativeTo = options.relativeTo[0];
        
        if (elem.tagName == 'BODY') {
            // Safari 2 is the only one to get offsetLeft and offsetTop properties of the body "correct"
            // Except they all mess up when the body is positioned absolute or relative
            x = elem.offsetLeft;
            y = elem.offsetTop;
            // Mozilla ignores margin and subtracts border from body element
            if (mo) {
                x += num(elem, 'marginLeft') + (num(elem, 'borderLeftWidth')*2);
                y += num(elem, 'marginTop')  + (num(elem, 'borderTopWidth') *2);
            } else
            // Opera ignores margin
            if (oa) {
                x += num(elem, 'marginLeft');
                y += num(elem, 'marginTop');
            } else
            // IE does not add the border in Standards Mode
            if ((ie && jQuery.boxModel)) {
                x += num(elem, 'borderLeftWidth');
                y += num(elem, 'borderTopWidth');
            } else
            // Safari 3 doesn't not include border or margin
            if (sf3) {
                x += num(elem, 'marginLeft') + num(elem, 'borderLeftWidth');
                y += num(elem, 'marginTop')  + num(elem, 'borderTopWidth');
            }
        } else {
            do {
                parPos = $.css(parent, 'position');
            
                x += parent.offsetLeft;
                y += parent.offsetTop;

                // Mozilla and IE do not add the border
                // Mozilla adds the border for table cells
                if ((mo && !parent.tagName.match(/^t[d|h]$/i)) || ie || sf3) {
                    // add borders to offset
                    x += num(parent, 'borderLeftWidth');
                    y += num(parent, 'borderTopWidth');

                    // Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent
                    if (mo && parPos == 'absolute') absparent = true;
                    // IE does not include the border on the body if an element is position static and without an absolute or relative parent
                    if (ie && parPos == 'relative') relparent = true;
                }

                op = parent.offsetParent || document.body;
                if (options.scroll || mo) {
                    do {
                        if (options.scroll) {
                            // get scroll offsets
                            sl += parent.scrollLeft;
                            st += parent.scrollTop;
                        }
                        
                        // Opera sometimes incorrectly reports scroll offset for elements with display set to table-row or inline
                        if (oa && ($.css(parent, 'display') || '').match(/table-row|inline/)) {
                            sl = sl - ((parent.scrollLeft == parent.offsetLeft) ? parent.scrollLeft : 0);
                            st = st - ((parent.scrollTop == parent.offsetTop) ? parent.scrollTop : 0);
                        }
                
                        // Mozilla does not add the border for a parent that has overflow set to anything but visible
                        if (mo && parent != elem && $.css(parent, 'overflow') != 'visible') {
                            x += num(parent, 'borderLeftWidth');
                            y += num(parent, 'borderTopWidth');
                        }
                
                        parent = parent.parentNode;
                    } while (parent != op);
                }
                parent = op;
                
                // exit the loop if we are at the relativeTo option but not if it is the body or html tag
                if (parent == options.relativeTo && !(parent.tagName == 'BODY' || parent.tagName == 'HTML'))  {
                    // Mozilla does not add the border for a parent that has overflow set to anything but visible
                    if (mo && parent != elem && $.css(parent, 'overflow') != 'visible') {
                        x += num(parent, 'borderLeftWidth');
                        y += num(parent, 'borderTopWidth');
                    }
                    // Safari 2 and opera includes border on positioned parents
                    if ( ((sf && !sf3) || oa) && parPos != 'static' ) {
                        x -= num(op, 'borderLeftWidth');
                        y -= num(op, 'borderTopWidth');
                    }
                    break;
                }
                if (parent.tagName == 'BODY' || parent.tagName == 'HTML') {
                    // Safari 2 and IE Standards Mode doesn't add the body margin for elments positioned with static or relative
                    if (((sf && !sf3) || (ie && $.boxModel)) && elemPos != 'absolute' && elemPos != 'fixed') {
                        x += num(parent, 'marginLeft');
                        y += num(parent, 'marginTop');
                    }
                    // Safari 3 does not include the border on body
                    // Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent
                    // IE does not include the border on the body if an element is positioned static and without an absolute or relative parent
                    if ( sf3 || (mo && !absparent && elemPos != 'fixed') || 
                         (ie && elemPos == 'static' && !relparent) ) {
                        x += num(parent, 'borderLeftWidth');
                        y += num(parent, 'borderTopWidth');
                    }
                    break; // Exit the loop
                }
            } while (parent);
        }

        var returnValue = handleOffsetReturn(elem, options, x, y, sl, st);

        if (returnObject) { $.extend(returnObject, returnValue); return this; }
        else              { return returnValue; }
    },
    
    /**
     * Gets the location of the element in pixels from the top left corner of the viewport.
     * This method is much faster than offset but not as accurate when borders and margins are
     * on the element and/or its parents. This method can be invoked
     * by setting the lite option to true in the offset method.
     * The offsetLite method takes an optional map of key value pairs to configure the way
     * the offset is calculated. Here are the different options.
     *
     * (Boolean) margin - Should the margin of the element be included in the calculations? True by default.
     * (Boolean) border - Should the border of the element be included in the calculations? False by default. 
     * (Boolean) padding - Should the padding of the element be included in the calcuations? False by default. 
     * (Boolean) scroll - Sould the scroll offsets of the parent elements be included int he calculations? True by default.
     *                    When true it adds the total scroll offsets of all parents to the total offset and also adds two
     *                    properties to the returned object, scrollTop and scrollLeft.
     * (HTML Element) relativeTo - This should be a parent of the element and should have position (like absolute or relative).
     *                             It will retreive the offset relative to this parent element. By default it is the body element.
     *
     * @name offsetLite
     * @param Map options Optional settings to configure the way the offset is calculated.
     * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the
     *                            chain will not be broken and the result will be assigned to this object.
     * @type Object
     * @cat Plugins/Dimensions
     */
    offsetLite: function(options, returnObject) {
        if (!this[0]) error();
        var x = 0, y = 0, sl = 0, st = 0, parent = this[0], offsetParent, 
            options = $.extend({ margin: true, border: false, padding: false, scroll: true, relativeTo: document.body }, options || {});
                
        // Get the HTMLElement if relativeTo is a jquery collection
        if (options.relativeTo.jquery) options.relativeTo = options.relativeTo[0];
        
        do {
            x += parent.offsetLeft;
            y += parent.offsetTop;

            offsetParent = parent.offsetParent || document.body;
            if (options.scroll) {
                // get scroll offsets
                do {
                    sl += parent.scrollLeft;
                    st += parent.scrollTop;
                    parent = parent.parentNode;
                } while(parent != offsetParent);
            }
            parent = offsetParent;
        } while (parent && parent.tagName != 'BODY' && parent.tagName != 'HTML' && parent != options.relativeTo);

        var returnValue = handleOffsetReturn(this[0], options, x, y, sl, st);

        if (returnObject) { $.extend(returnObject, returnValue); return this; }
        else              { return returnValue; }
    },
    
    /**
     * Returns a jQuery collection with the positioned parent of 
     * the first matched element. This is the first parent of 
     * the element that has position (as in relative or absolute).
     *
     * @name offsetParent
     * @type jQuery
     * @cat Plugins/Dimensions
     */
    offsetParent: function() {
        if (!this[0]) error();
        var offsetParent = this[0].offsetParent;
        while ( offsetParent && (offsetParent.tagName != 'BODY' && $.css(offsetParent, 'position') == 'static') )
            offsetParent = offsetParent.offsetParent;
        return $(offsetParent);
    }
});

/**
 * Throws an error message when no elements are in the jQuery collection
 * @private
 */
var error = function() {
    throw "Dimensions: jQuery collection is empty";
};

/**
 * Handles converting a CSS Style into an Integer.
 * @private
 */
var num = function(el, prop) {
    return parseInt($.css(el.jquery?el[0]:el,prop))||0;
};

/**
 * Handles the return value of the offset and offsetLite methods.
 * @private
 */
var handleOffsetReturn = function(elem, options, x, y, sl, st) {
    if ( !options.margin ) {
        x -= num(elem, 'marginLeft');
        y -= num(elem, 'marginTop');
    }

    // Safari and Opera do not add the border for the element
    if ( options.border && (($.browser.safari && parseInt($.browser.version) < 520) || $.browser.opera) ) {
        x += num(elem, 'borderLeftWidth');
        y += num(elem, 'borderTopWidth');
    } else if ( !options.border && !(($.browser.safari && parseInt($.browser.version) < 520) || $.browser.opera) ) {
        x -= num(elem, 'borderLeftWidth');
        y -= num(elem, 'borderTopWidth');
    }

    if ( options.padding ) {
        x += num(elem, 'paddingLeft');
        y += num(elem, 'paddingTop');
    }
    
    // do not include scroll offset on the element ... opera sometimes reports scroll offset as actual offset
    if ( options.scroll && (!$.browser.opera || elem.offsetLeft != elem.scrollLeft && elem.offsetTop != elem.scrollLeft) ) {
        sl -= elem.scrollLeft;
        st -= elem.scrollTop;
    }

    return options.scroll ? { top: y - st, left: x - sl, scrollTop:  st, scrollLeft: sl }
                          : { top: y, left: x };
};

/**
 * Gets the width of the OS scrollbar
 * @private
 */
var scrollbarWidth = 0;
var getScrollbarWidth = function() {
    if (!scrollbarWidth) {
        var testEl = $('<div>')
                .css({
                    width: 100,
                    height: 100,
                    overflow: 'auto',
                    position: 'absolute',
                    top: -1000,
                    left: -1000
                })
                .appendTo('body');
        scrollbarWidth = 100 - testEl
            .append('<div>')
            .find('div')
                .css({
                    width: '100%',
                    height: 200
                })
                .width();
        testEl.remove();
    }
    return scrollbarWidth;
};

})(jQuery);
;

/*
	=== jquery.blockUI ===
*/
/*
 * jQuery blockUI plugin
 * Version 1.33  (09/14/2007)
 * @requires jQuery v1.1.1
 *
 * $Id$
 *
 * Examples at: http://malsup.com/jquery/block/
 * Copyright (c) 2007 M. Alsup
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
 (function($) {
/**
 * blockUI provides a mechanism for blocking user interaction with a page (or parts of a page).
 * This can be an effective way to simulate synchronous behavior during ajax operations without
 * locking the browser.  It will prevent user operations for the current page while it is
 * active ane will return the page to normal when it is deactivate.  blockUI accepts the following
 * two optional arguments:
 *
 *   message (String|Element|jQuery): The message to be displayed while the UI is blocked. The message
 *              argument can be a plain text string like "Processing...", an HTML string like
 *              "<h1><img src="busy.gif" /> Please wait...</h1>", a DOM element, or a jQuery object.
 *              The default message is "<h1>Please wait...</h1>"
 *
 *   css (Object):  Object which contains css property/values to override the default styles of
 *              the message.  Use this argument if you wish to override the default
 *              styles.  The css Object should be in a format suitable for the jQuery.css
 *              function.  For example:
 *              $.blockUI({
 *                    backgroundColor: '#ff8',
 *                    border: '5px solid #f00,
 *                    fontWeight: 'bold'
 *              });
 *
 * The default blocking message used when blocking the entire page is "<h1>Please wait...</h1>"
 * but this can be overridden by assigning a value to $.blockUI.defaults.pageMessage in your
 * own code.  For example:
 *
 *      $.blockUI.defaults.pageMessage = "<h1>Bitte Wartezeit</h1>";
 *
 * The default message styling can also be overridden.  For example:
 *
 *      $.extend($.blockUI.defaults.pageMessageCSS, { color: '#00a', backgroundColor: '#0f0' });
 *
 * The default styles work well for simple messages like "Please wait", but for longer messages
 * style overrides may be necessary.
 *
 * @example  $.blockUI();
 * @desc prevent user interaction with the page (and show the default message of 'Please wait...')
 *
 * @example  $.blockUI( { backgroundColor: '#f00', color: '#fff'} );
 * @desc prevent user interaction and override the default styles of the message to use a white on red color scheme
 *
 * @example  $.blockUI('Processing...');
 * @desc prevent user interaction and display the message "Processing..." instead of the default message
 *
 * @name blockUI
 * @param String|jQuery|Element message Message to display while the UI is blocked
 * @param Object css Style object to control look of the message
 * @cat Plugins/blockUI
 */
$.blockUI = function(msg, css, opts) {
    $.blockUI.impl.install(window, msg, css, opts);
};

// expose version number so other plugins can interogate
$.blockUI.version = 1.33;

/**
 * unblockUI removes the UI block that was put in place by blockUI
 *
 * @example  $.unblockUI();
 * @desc unblocks the page
 *
 * @name unblockUI
 * @cat Plugins/blockUI
 */
$.unblockUI = function(opts) {
    $.blockUI.impl.remove(window, opts);
};

/**
 * Blocks user interaction with the selected elements.  (Hat tip: Much of
 * this logic comes from Brandon Aaron's bgiframe plugin.  Thanks, Brandon!)
 * By default, no message is displayed when blocking elements.
 *
 * @example  $('div.special').block();
 * @desc prevent user interaction with all div elements with the 'special' class.
 *
 * @example  $('div.special').block('Please wait');
 * @desc prevent user interaction with all div elements with the 'special' class
 * and show a message over the blocked content.
 *
 * @name block
 * @type jQuery
 * @param String|jQuery|Element message Message to display while the element is blocked
 * @param Object css Style object to control look of the message
 * @cat Plugins/blockUI
 */
$.fn.block = function(msg, css, opts) {
    return this.each(function() {
        if (!this.$pos_checked) {
            if ($.css(this,"position") == 'static')
                this.style.position = 'relative';
            if ($.browser.msie) this.style.zoom = 1; // force 'hasLayout' in IE
            this.$pos_checked = 1;
        }
        $.blockUI.impl.install(this, msg, css, opts);
    });
};

/**
 * Unblocks content that was blocked by "block()"
 *
 * @example  $('div.special').unblock();
 * @desc unblocks all div elements with the 'special' class.
 *
 * @name unblock
 * @type jQuery
 * @cat Plugins/blockUI
 */
$.fn.unblock = function(opts) {
    return this.each(function() {
        $.blockUI.impl.remove(this, opts);
    });
};

/**
 * displays the first matched element in a "display box" above a page overlay.
 *
 * @example  $('#myImage').displayBox();
 * @desc displays "myImage" element in a box
 *
 * @name displayBox
 * @type jQuery
 * @cat Plugins/blockUI
 */
$.fn.displayBox = function(css, fn, isFlash) {
    var msg = this[0];
    if (!msg) return;
    var $msg = $(msg);
    css = css || {};

    var w = $msg.width()  || $msg.attr('width')  || css.width  || $.blockUI.defaults.displayBoxCSS.width;
    var h = $msg.height() || $msg.attr('height') || css.height || $.blockUI.defaults.displayBoxCSS.height ;
    if (w[w.length-1] == '%') {
        var ww = document.documentElement.clientWidth || document.body.clientWidth;
        w = parseInt(w) || 100;
        w = (w * ww) / 100;
    }
    if (h[h.length-1] == '%') {
        var hh = document.documentElement.clientHeight || document.body.clientHeight;
        h = parseInt(h) || 100;
        h = (h * hh) / 100;
    }

    var ml = '-' + parseInt(w)/2 + 'px';
    var mt = '-' + parseInt(h)/2 + 'px';

    // supress opacity on overlay if displaying flash content on mac/ff platform
    var ua = navigator.userAgent.toLowerCase();
    var opts = {
        displayMode: fn || 1,
        noalpha: isFlash && /mac/.test(ua) && /firefox/.test(ua)
    };

    $.blockUI.impl.install(window, msg, { width: w, height: h, marginTop: mt, marginLeft: ml }, opts);
};


// override these in your code to change the default messages and styles
$.blockUI.defaults = {
    // the message displayed when blocking the entire page
    pageMessage:    '<h1>Please wait...</h1>',
    // the message displayed when blocking an element
    elementMessage: '', // none
    // styles for the overlay iframe
    overlayCSS:  { backgroundColor: '#fff', opacity: '0.5' },
    // styles for the message when blocking the entire page
    pageMessageCSS:    { width:'250px', margin:'-50px 0 0 -125px', top:'50%', left:'50%', textAlign:'center', color:'#000', backgroundColor:'#fff', border:'3px solid #aaa' },
    // styles for the message when blocking an element
    elementMessageCSS: { width:'250px', padding:'10px', textAlign:'center', backgroundColor:'#fff'},
    // styles for the displayBox
    displayBoxCSS: { width: '400px', height: '400px', top:'50%', left:'50%' },
    // allow body element to be stetched in ie6
    ie6Stretch: 1,
    // supress tab nav from leaving blocking content?
    allowTabToLeave: 0,
    // Title attribute for overlay when using displayBox
    closeMessage: 'Click to close',
    // use fadeOut effect when unblocking (can be overridden on unblock call)
    fadeOut:  1,
    // fadeOut transition time in millis
    fadeTime: 400
};

// the gory details
$.blockUI.impl = {

    box: null,
    boxCallback: null,
    pageBlock: null,
    pageBlockEls: [],
    op8: window.opera && window.opera.version() < 9,
    ie6: $.browser.msie && /MSIE 6.0/.test(navigator.userAgent),
    install: function(el, msg, css, opts) {
        opts = opts || {};
        this.boxCallback = typeof opts.displayMode == 'function' ? opts.displayMode : null;
        this.box = opts.displayMode ? msg : null;
        var full = (el == window);

        // use logical settings for opacity support based on browser but allow overrides via opts arg
        var noalpha = this.op8 || $.browser.mozilla && /Linux/.test(navigator.platform);
        if (typeof opts.alphaOverride != 'undefined')
            noalpha = opts.alphaOverride == 0 ? 1 : 0;

        if (full && this.pageBlock) this.remove(window, {fadeOut:0});
        // check to see if we were only passed the css object (a literal)
        if (msg && typeof msg == 'object' && !msg.jquery && !msg.nodeType) {
            css = msg;
            msg = null;
        }
        msg = msg ? (msg.nodeType ? $(msg) : msg) : full ? $.blockUI.defaults.pageMessage : $.blockUI.defaults.elementMessage;
        if (opts.displayMode)
            var basecss = jQuery.extend({}, $.blockUI.defaults.displayBoxCSS);
        else
            var basecss = jQuery.extend({}, full ? $.blockUI.defaults.pageMessageCSS : $.blockUI.defaults.elementMessageCSS);
        css = jQuery.extend(basecss, css || {});

        var f = ($.browser.msie) ? $('<iframe class="blockUI" style="z-index:1000;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="javascript:false;"></iframe>')
                                 : $('<div class="blockUI" style="display:none"></div>');
        var w = $('<div class="blockUI" style="z-index:1001;cursor:wait;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
        var m = full ? $("<div class='blockUI blockMsg' style='z-index:1002;cursor:wait;padding:0;position:fixed'></div>") : 
                       $("<div class='blockUI' style='display:none;z-index:1002;cursor:wait;position:absolute'></div>");

        w.css('position', full ? 'fixed' : 'absolute');

        //if (msg) m.css(css);

        if (!noalpha) w.css($.blockUI.defaults.overlayCSS);

        if (this.op8) w.css({ width:''+el.clientWidth,height:''+el.clientHeight }); // lame
        if ($.browser.msie) f.css('opacity','0.0');

        $([f[0],w[0],m[0]]).appendTo(full ? 'body' : el);

        // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
        var expr = $.browser.msie && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
        if (this.ie6 || expr) {
            // stretch content area if it's short
            if (full && $.blockUI.defaults.ie6Stretch && $.boxModel)
                $('html,body').css('height','100%');

            // fix ie6 problem when blocked element has a border width
            if ((this.ie6 || !$.boxModel) && !full) {
                var t = this.sz(el,'borderTopWidth'), l = this.sz(el,'borderLeftWidth');
                var fixT = t ? '(0 - '+t+')' : 0;
                var fixL = l ? '(0 - '+l+')' : 0;
            }

            // simulate fixed position
            $.each([f,w,m], function(i,o) {
                var s = o[0].style;
                s.position = 'absolute';
                if (i < 2) {
                    full ? s.setExpression('height','document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + "px"')
                         : s.setExpression('height','this.parentNode.offsetHeight + "px"');
                    full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
                         : s.setExpression('width','this.parentNode.offsetWidth + "px"');
                    if (fixL) s.setExpression('left', fixL);
                    if (fixT) s.setExpression('top', fixT);
                }
                else {
                    if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
                    s.marginTop = 0;
                }
            });
        }
        
        if (opts.displayMode) {
            w.css('cursor','default').attr('title', $.blockUI.defaults.closeMessage);
            m.css('cursor','default');
            $([f[0],w[0],m[0]]).removeClass('blockUI').addClass('displayBox');
            $().click($.blockUI.impl.boxHandler).bind('keypress', $.blockUI.impl.boxHandler);
        }
        else
            this.bind(1, el);
        m.append(msg).show();
        if (msg.jquery) msg.show();
        if (opts.displayMode) return;
        if (full) {
            this.pageBlock = m[0];
            this.pageBlockEls = $(':input:enabled:visible',this.pageBlock);
            setTimeout(this.focus, 20);
        }
        else this.center(m[0]);
        
    },
    
    remove: function(el, opts) {
        var o = $.extend({}, $.blockUI.defaults, opts);
        this.bind(0, el);
        var full = el == window;
        var els = full ? $('body').children().filter('.blockUI') : $('.blockUI', el);
        if (full) this.pageBlock = this.pageBlockEls = null;

        if (o.fadeOut) {
            els.fadeOut(o.fadeTime, function() {
                if (this.parentNode) this.parentNode.removeChild(this);
            });
        }
        else els.remove();
    },
    boxRemove: function(el) {
        $().unbind('click',$.blockUI.impl.boxHandler).unbind('keypress', $.blockUI.impl.boxHandler);
        if (this.boxCallback)
            this.boxCallback(this.box);
        $('body .displayBox').hide().remove();
    },
    // event handler to suppress keyboard/mouse events when blocking
    handler: function(e) {
        if (e.keyCode && e.keyCode == 9) {
            if ($.blockUI.impl.pageBlock && !$.blockUI.defaults.allowTabToLeave) {
                var els = $.blockUI.impl.pageBlockEls;
                var fwd = !e.shiftKey && e.target == els[els.length-1];
                var back = e.shiftKey && e.target == els[0];
                if (fwd || back) {
                    setTimeout(function(){$.blockUI.impl.focus(back)},10);
                    return false;
                }
            }
        }
        if ($(e.target).parents('div.blockMsg').length > 0)
            return true;
        return $(e.target).parents().children().filter('div.blockUI').length == 0;
    },
    boxHandler: function(e) {
        if ((e.keyCode && e.keyCode == 27) || (e.type == 'click' && $(e.target).parents('div.blockMsg').length == 0))
            $.blockUI.impl.boxRemove();
        return true;
    },
    // bind/unbind the handler
    bind: function(b, el) {
        var full = el == window;
        // don't bother unbinding if there is nothing to unbind
        if (!b && (full && !this.pageBlock || !full && !el.$blocked)) return;
        if (!full) el.$blocked = b;
        var $e = $(el).find('a,:input');
        $.each(['mousedown','mouseup','keydown','keypress','click'], function(i,o) {
            $e[b?'bind':'unbind'](o, $.blockUI.impl.handler);
        });
    },
    focus: function(back) {
        if (!$.blockUI.impl.pageBlockEls) return;
        var e = $.blockUI.impl.pageBlockEls[back===true ? $.blockUI.impl.pageBlockEls.length-1 : 0];
        if (e) e.focus();
    },
    center: function(el) {
        var p = el.parentNode, s = el.style;
        var l = ((p.offsetWidth - el.offsetWidth)/2) - this.sz(p,'borderLeftWidth');
        var t = ((p.offsetHeight - el.offsetHeight)/2) - this.sz(p,'borderTopWidth');
        s.left = l > 0 ? (l+'px') : '0';
        s.top  = t > 0 ? (t+'px') : '0';
    },
    sz: function(el, p) { return parseInt($.css(el,p))||0; }
    
};

})(jQuery);

;

/*
	=== mortgageloan ===
*/
var MortgageLoan = 
{
	init: function()
	{
	
		$('body').addClass('javascript-enabled').removeClass('javascript-disabled');

		//MortgageLoan.inputDefaultValue();
		//MortgageLoan.toolTips();
		MortgageLoan.layout();
		MortgageLoan.makeStuffEqualHeight();
        MortgageLoan.hideFormFields();
        if ( $("#news-flash").size() )
            MortgageLoan.flashNewsFlash();
		// Auto-submit some forms
		$('#article-listing input[type="submit"]').remove();
		$('#article-listing select, #calculator-listing select').change(function()
		{
	       		window.location = $(this).val();
		});
		
		
		$('#guide-button').click(  function() { goToGuide() });
	}, 

	flashNewsFlash: function()
	{
    	$("#news-flash").fadeOut(400).fadeIn(400);
	},
	hideFormFields: function()
	{
	   $("#hidden-form-fields").hide();
	},
	
	makeStuffEqualHeight: function()
	{
		// We need to wait for images to load before..
		try {
		window.onload = function()
		{
			// ...making stuff equal height
			if(document.getElementById('sub-content'))
			{
				$('#content div.container:first, #sub-content').equalHeight();
			}
			if(document.getElementById('mortgage-tools'))
			{
				$('#mortgage-tools div.container-b').equalHeight();
			}
			if(document.getElementById('tools-body'))
			{
				$('#tools-body div.container-b').equalHeight();
			}
		}
		}
		catch( e )
		{
		
		}
	}, 

	toolTips: function()
	{
		$('img[title]').Tooltip(
		{
			delay: 0,
			track: true, 
			showURL: false 
		}).css({cursor: 'help'});
	}, 

	inputDefaultValue: function()
	{
		$('input[alt]').each(function()
		{
			$(this).val($(this).attr('alt'));
		}).focus(function()
		{
			if($(this).val() == $(this).attr('alt'))
			{
				$(this).val('');
			}
		}).blur(function()
		{
			if($(this).val() == '')
			{
				$(this).val($(this).attr('alt'));
			}
		});
	}, 

	toggleTel: function()
	{
		// Turn phone numbers into links and only display them onclick
		$('<a href="#" class="tel">Phone Number &gt;</a>').insertBefore('span.tel');
		$('span.tel').hide();
		$('a.tel').click(function()
		{
			$(this).hide().next('span.tel').show();
			return false;
		});
		
	}, 

	layout: function()
	{
		// Change form-selects with fonts
		$('#tt-get-tool select:not(.colour-picker) option').each(function()
		{
			$(this).css({fontFamily: $(this).text()});
		});

		// Add a div used only for styling
		//if(document.getElementById('form'))
		//{
//			$('<div id="form-arrow"></div>').appendTo('#form > div.container-a');
//		}
			
		// Add first-child classes to first children
		$('div[class^="container"] > *:first-child').addClass('first-child');
		$('div[class^="container"] > *:last-child').addClass('last-child');
	
		// IE-stuff	
		
		if($.browser.msie)
		{
			$('body').addClass('is-ie');
	
			// Nav for IE
			$('#navigation li.has-children').mouseover(function()
			{
				$(this).addClass('hover');
			}).mouseout(function()
			{
				$(this).removeClass('hover');
			});
			// Add wrapper-divs to containers in ie
			// Container
			
   			$('div.container').wrap('<div class="container-body"><div class="container-tl"><div class="container-tr"><div class="container-br"><div class="container-bl"></div></div></div></div></div>');

			// Container A
			$('div.container-a').wrap('<div class="container-a-body"><div class="container-a-tl"><div class="container-a-tr"><div class="container-a-br"><div class="container-a-bl"></div></div></div></div></div>');
	
			// Container B
			$('div.container-b').wrap('<div class="container-b-body"><div class="container-b-tl"><div class="container-b-tr"><div class="container-b-br"><div class="container-b-bl"></div></div></div></div></div>');
	
			// Container C
			$('div.container-c').wrap('<div class="container-c-body"><div class="container-c-tl"><div class="container-c-tr"><div class="container-c-br"><div class="container-c-bl"></div></div></div></div></div>');
	
			// Container D
			$('div.container-d').wrap('<div class="container-d-body"><div class="container-d-tl"><div class="container-d-tr"><div class="container-d-br"><div class="container-d-bl"></div></div></div></div></div>');
			
     		// Add id's to all outer wrappers
			$('div.container-body, div.container-a-body, div.container-b-body, div.container-c-body, div.container-d-body').each(function()
			{
				var id = $(this).find('div.container, div.container-a, div.container-b, div.container-c, div.container-d').attr('id');
				if(id) $(this).attr('id', id +'-wrapper');
			});
		}
	}
};
    $().ready(function(){
        MortgageLoan.init();
    });;

/*
	=== jquery.equalHeight ===
*/
/*
 * EqualHeight 1.0
 *
 * Requires the dimensions plug-in
 *
 * Copyright (c) 2007 Andreas Lagerkvist (exscale.se)
 */
jQuery.fn.equalHeight = function()
{
	var maxHeight = 0;

	// Store the tallest element's height
	this.each(function()
	{
		var height = jQuery(this).outerHeight();
		maxHeight = (height > maxHeight) ? height : maxHeight;
	});

	// Always return each...
	return this.each(function()
	{
		// Adjust all elements' bottom padding to make them equal height
		var pb = maxHeight - jQuery(this).outerHeight() + parseInt(jQuery(this).css('paddingBottom'));
		jQuery(this).css({paddingBottom: pb +'px'});
	});
	
};;

/*
	=== jquery.tooltip ===
*/
/*
 * Tooltip - jQuery plugin  for styled tooltips
 *
 * Copyright (c) 2006 Jörn Zaefferer, Stefan Petre
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * $Id$
 *
 */
eval(function(p,a,c,k,e,d){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--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[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}('(7($){6 4,G,9,C,u,Q,r;$.1s.1b=7(8){8=$.23({},U.24.Y,8);3(!4){4=$(\'<1t 25="26"><L></L><p 1c="k"></p><p 1c="V"></p></1t>\').c().l({28:\'1G\',1x:"1y"}).1z(\'k\');G=$(\'L\',4);9=$(\'p.k\',4);C=$(\'p.V\',4)}$(1).S(\'[@d]\').O(7(){1.f=8}).J("1h",1v).J(8.a,1r);A 1};7 1r(a){3(1.f.R)r=1A(m,1.f.R);D m();3(1.f.1m)$(\'k\').J(\'1f\',B);B(a);$(1).J(\'X\',c)}7 1v(){3(1==u||!1.d)A;u=1;6 q=$(1),8=1.f;6 d=Q=q.z(\'d\');q.z(\'d\',\'\');3(8.M){6 T=d.1B(8.M);G.E(T.1C());9.1D();19(6 i=0,K;K=T[i];i++){3(i>0)9.10("<1E/>");9.10(K)}3(9.E())9.m();D 9.c()}D{G.E(d);9.c()}6 F=(q.z(\'F\')||q.z(\'1e\'));3(8.1p&&F)C.E(F.1R(\'1H://\',\'\')).m();D C.c();3(8.o){4.1J(8.o)}3(8.N&&$.1d.14){4.O(7(){3(1.13.H!=\'17\'){6 s=1.13.H;s=s.1K(5,s.1q-2);$(1).l({\'H\':\'17\',\'S\':"1M:1N.1O.1Q(1S=Z, 1T=1U, 1e=\'"+s+"\')"})}})}}7 m(){r=t;4.m();B()}7 B(a){3(u==t){$(\'k\').W(\'1f\',B);A}6 j=4[0].1j;6 g=4[0].1l;3(a){j=a.1V+15;g=a.1W+15;4.l({j:j+\'I\',g:g+\'I\'})}6 v=1o(),h=4[0];3(v.x+v.16<h.1j+h.1k){j-=h.1k+20;4.l({j:j+\'I\'})}3(v.y+v.1a<h.1l+h.1n){g-=h.1n+20;4.l({g:g+\'I\'})}}7 1o(){6 e=1u.22||{},b=1u.k||{},w=27;7 P(){6 v=1w;19(6 i=0;i<U.1q;i++){6 n=U[i];3(n&&n<v)v=n}A v}A{x:w.1F||e.11||b.11||0,y:w.1I||e.12||b.12||0,16:P(e.18,b.18,w.1P),1a:P(e.1g,b.1g,w.1X)}}7 c(){3(r)1Z(r);u=t;4.c();3(1.f.o){4.21(1.f.o)}$(1).z(\'d\',Q).W(\'X\',c);3(1.f.N&&$.1d.14){4.O(7(){$(1).l({\'S\':\'\',H:\'\'})})}}$.1s.1b.Y={R:1L,a:"1h",1m:1i,1p:Z,M:t,o:t,N:1i}})(1Y);',62,133,'|this||if|helper||var|function|settings|tBody|event||hide|title||tSettings|top|||left|body|css|show||extraClass||source|tID|image|null|current|||||attr|return|update|tUrl|else|html|href|tTitle|backgroundImage|px|bind|part|h3|showBody|fixPNG|each|min|oldTitle|delay|filter|parts|arguments|url|unbind|mouseout|defaults|true|append|scrollLeft|scrollTop|currentStyle|msie||cx|none|clientWidth|for|cy|Tooltip|class|browser|src|mousemove|clientHeight|mouseover|false|offsetLeft|offsetWidth|offsetTop|track|offsetHeight|viewport|showURL|length|handle|fn|div|document|save|Infinity|zIndex|3000|appendTo|setTimeout|split|shift|empty|br|pageXOffset|absolute|http|pageYOffset|addClass|substring|250|progid|DXImageTransform|Microsoft|innerWidth|AlphaImageLoader|replace|enabled|sizingMethod|crop|pageX|pageY|innerHeight|jQuery|clearTimeout||removeClass|documentElement|extend|callee|id|tooltip|window|position'.split('|'),0,{}));

/*
	=== jquery.center ===
*/
/*
 * Center 1.0
 *
 * Requires the dimensions plug-in
 *
 * Copyright (c) 2007 Andreas Lagerkvist (exscale.se)
 */
jQuery.fn.center = function(fixed)
{
	// Always return each...
	return this.each(function()
	{
		// Set position to absolute (so element shrink-wraps) so that width/height is calculated properly
		jQuery(this).css({position: 'absolute'});

		// If user wants to use fixed centering (only supported in browsers that support position: fixed; (no IE))
		if(fixed)
		{
			var leftMargin = jQuery(this).outerWidth() / 2, 
				topMargin = jQuery(this).outerHeight() / 2;

			jQuery(this).css({position: 'fixed', left: '50%', top: '50%', marginLeft: '-' +leftMargin +'px', marginTop: '-' +topMargin +'px', zIndex: '1000'});
		}
		// Else, use normal centering
		else
		{
			// Calculate left and top pos values
			var leftPos = (jQuery(window).width() - jQuery(this).outerWidth()) / 2 + jQuery(window).scrollLeft(), 
				topPos = (jQuery(window).height() - jQuery(this).outerHeight()) / 2 + jQuery(window).scrollTop();

			// Make sure element is not out of bounds
			leftPos = (leftPos < 0) ? 0 : leftPos;
			topPos = (topPos < 0) ? 0 : topPos;

			jQuery(this).css({left: leftPos +'px', top: topPos +'px', zIndex: '1000'});
		}
	});
};;

/*
	=== jquery.colourPicker ===
*/
var FOO = {};
/*
 * ColourPicker 1.0
 *
 * Copyright (c) 2007 Andreas Lagerkvist (exscale.se)
 */
jQuery.fn.colourPicker = function(c)
{

	// Returns inverted hex-value (well, _should_ do that)
	function niceColour(hex)
	{
		var r = hex.substr(0, 2), 
			g = hex.substr(2, 2), 
			b = hex.substr(4, 2);

		// Todo...
		return 'ffffff';
	}

	// Config for plug-in
	var config =
	{
		ico: 'ico.gif',			// Icon user clicks to open dialog
		title: 'Pick a Colour',	// Heading in dialog
		inputBG: true 			// Whether to change the input's background
	};

	// Check for user config
	// Todo: use $.extend instead!
	if(typeof(c) === 'object')
	{
		config.ico = (c.ico !== undefined) ? c.ico : config.ico;
		config.title = (c.title !== undefined) ? c.title : config.title;
		config.inputBG = (c.inputBG !== undefined) ? c.inputBG : config.inputBG;
	}

	// Create colour-picker container
	if(!$('#colour-picker').length)
	{
		$('<div id="colour-picker"></div>').appendTo('body').hide();
	}

	// Always return each...
	return this.each(function(i)
	{
		var select = jQuery(this);

		// Create colour-picker input
		var cpInput = '<input type="text" name="' +select.attr('name') +'" class="colour-picker-input" size="7" maxlength="7" id="' + this.id +'"/>';

		// Create colour-picker icon
		var cpIco = '<a href="#" class="colour-picker-open"><img src="' + config.ico +'" alt="Open Colour-Picker" /></a>';

		// Create list of colours
		
        var rand = Math.ceil((Math.random() * 100) % 10);
        
        var cpLoc = '<ul class="colour-picker-list" id="ulid_' + rand + '"></ul>';
        jQuery(cpLoc).insertAfter(select).hide();

		// Go through every option in select and store hex and title
		
		jQuery('option', select).each(function()
		{
			var hex = jQuery(this).val(), 
			title = jQuery(this).text();
			// What could you use instead of rel-attribute to store the hex-value? class mustn't start wiv a digit and href fooks wiv IE...
			cpLoc = '<li><a href="#" title="' +title +'" rel="' +hex +'" style="background-color: ' +hex +'; colour: ' +niceColour(hex) +';">' +title +'</a></li>';
		    $("#ulid_" + rand).append(cpLoc);
		});
		

		jQuery(cpIco).insertAfter(select);
		jQuery(cpInput).insertAfter(select);
        select.remove();
		// If user clicks an icon
		jQuery('a.colour-picker-open').click(function()
		{
			// Get list of colours
			var loc = jQuery(this).next('ul.colour-picker-list').html(), 
				input = jQuery(this).prev('input.colour-picker-input');

			// Fill colour picker wiv colours and fade it in
			var close = "<img src='/css/gfx/icons/close.png' onclick='$(\"#colour-picker\").hide();return false;' id='close_colorpicker'/>";
			
			jQuery('#colour-picker').html(close + '<h2>' +config.title +'</h2><ul>' +loc +'</ul>').center().show();

			// If user clicks link inside colour picker
			jQuery('#colour-picker a').click(function(e)
			{
				var hex = jQuery(this).attr('rel');
	
				// Set the input's value to clicked colour's hex
				input.val(hex);
	
				// Also change its background and colour
				if(config.inputBG)
				{
					input.css({background: '#' +hex, color: '#' +niceColour(hex)});
				}
	
				// Hide the container
				jQuery('#colour-picker').hide();

				return false;
			});

			return false;
		});
	});
};;

/*
	=== jqModal ===
*/
/*
 * jqModal - Minimalist Modaling with jQuery
 *
 * Copyright (c) 2007 Brice Burgess <bhb@iceburg.net>, http://www.iceburg.net
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * $Version: 2007.08.17 +r11
 * 
 */
(function($) {
$.fn.jqm=function(o){
var _o = {
zIndex: 3000,
overlay: 50,
overlayClass: 'jqmOverlay',
closeClass: 'jqmClose',
trigger: '.jqModal',
ajax: false,
target: false,
modal: false,
toTop: false,
onShow: false,
onHide: false,
onLoad: false
};
return this.each(function(){if(this._jqm)return; s++; this._jqm=s;
H[s]={c:$.extend(_o, o),a:false,w:$(this).addClass('jqmID'+s),s:s};
if(_o.trigger)$(this).jqmAddTrigger(_o.trigger);
});};

$.fn.jqmAddClose=function(e){hs(this,e,'jqmHide'); return this;};
$.fn.jqmAddTrigger=function(e){hs(this,e,'jqmShow'); return this;};
$.fn.jqmShow=function(t){return this.each(function(){if(!H[this._jqm].a)$.jqm.open(this._jqm,t)});};
$.fn.jqmHide=function(t){return this.each(function(){if(H[this._jqm].a)$.jqm.close(this._jqm,t)});};

$.jqm = {
hash:{},
open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(/^\d+$/.test(h.w.css('z-index')))?h.w.css('z-index'):c.zIndex,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});h.t=t;h.a=true;h.w.css('z-index',z);
 if(c.modal) {if(!A[0])F('bind');A.push(s);o.css('cursor','wait');}
 else if(c.overlay > 0)h.w.jqmAddClose(o);
 else o=false;

 h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):false;
 if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}

 if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
  r.load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
 else if(cc)h.w.jqmAddClose($(cc,h.w));

 if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o); 
 (c.onShow)?c.onShow(h):h.w.show();e(h);return false;
},
close:function(s){var h=H[s];h.a=false;
 if(A[0]){A.pop();if(!A[0])F('unbind');}
 if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
 if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return false;
}};
var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),
i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),
e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(e){}},
F=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
hs=function(w,e,y){var s=[];w.each(function(){s.push(this._jqm)});
 $(e).each(function(){if(this[y])$.extend(this[y],s);else{this[y]=s;$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return false;});}});};
})(jQuery);
;

/*
	=== jquery.bgiframe.pack ===
*/
/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-06-19 20:23:36 -0500 (Tue, 19 Jun 2007) $
 * $Rev: 2110 $
 *
 * Version 2.1
 */
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}('(f($){$.r.H=$.r.l=f(s){j($.b.17&&k($.b.g)<=6){s=$.G({c:\'3\',7:\'3\',e:\'3\',5:\'3\',q:U,i:\'N:o;\'},s||{});J a=f(n){h n&&n.C==B?n+\'4\':n},p=\'<t 15="l"12="0"X="-1"i="\'+s.i+\'"\'+\'V="T:Q;P:O;z-M:-1;\'+(s.q!==o?\'L:K(I=\\\'0\\\');\':\'\')+\'c:\'+(s.c==\'3\'?\'9(((k(2.8.m.F)||0)*-1)+\\\'4\\\')\':a(s.c))+\';\'+\'7:\'+(s.7==\'3\'?\'9(((k(2.8.m.E)||0)*-1)+\\\'4\\\')\':a(s.7))+\';\'+\'e:\'+(s.e==\'3\'?\'9(2.8.D+\\\'4\\\')\':a(s.e))+\';\'+\'5:\'+(s.5==\'3\'?\'9(2.8.R+\\\'4\\\')\':a(s.5))+\';\'+\'"/>\';h 2.S(f(){j($(\'> t.l\',2).A==0)2.y(x.W(p),2.w)})}h 2};j(!$.b.g)$.b.g=v.u.Z().14(/.+(?:13|11|10|Y)[\\/: ]([\\d.]+)/)[1]})(16);',62,70,'||this|auto|px|height||left|parentNode|expression||browser|top||width|function|version|return|src|if|parseInt|bgiframe|currentStyle||false|html|opacity|fn||iframe|userAgent|navigator|firstChild|document|insertBefore||length|Number|constructor|offsetWidth|borderLeftWidth|borderTopWidth|extend|bgIframe|Opacity|var|Alpha|filter|index|javascript|absolute|position|block|offsetHeight|each|display|true|style|createElement|tabindex|ie|toLowerCase|ra|it|frameborder|rv|match|class|jQuery|msie'.split('|'),0,{}));

