﻿/*
*	Site jQuery Plugins
*
*/

Function.prototype.bind = function (a) {
    var b = this;
    return function () {
        return b.apply(a, arguments)
    }
};
function EventBroadcaster() {
    this.x = {};
    this.events = [];
    this.builtinEvts = []
}
EventBroadcaster.prototype.getActionIdx = function (f, c, e, g) {
    if (f && c) {
        var b = this.events[f][c];
        if (b) {
            var a = b.length;
            for (var d = a - 1; d >= 0; d--) {
                if (b[d].action == e && b[d].binding == g) {
                    return d
                }
            }
        } else {
            return -1
        }
    }
    return -1
};
EventBroadcaster.prototype.addListener = function (b, c, d) {
    obj = this;
    if (this.events[obj]) {
        if (this.events[obj][b]) {
            if (this.getActionIdx(obj, b, c, d) == -1) {
                var a = this.events[obj][b];
                a[a.length] = {
                    action: c,
                    binding: d
                }
            }
        } else {

            this.events[obj][b] = [];
            this.events[obj][b][0] = {
                action: c,
                binding: d
            }
        }
    } else {
        this.events[obj] = [];
        this.events[obj][b] = [];
        this.events[obj][b][0] = {
            action: c,
            binding: d
        }
    }
};
EventBroadcaster.prototype.removeListener = function (d, b, c, e) {
    d = this;
    if (this.events[d]) {
        if (this.events[d][b]) {
            var a = this.actionExists(d, b, c, e);
            if (a >= 0) {
                this.events[d][b].splice(a, 1)
            }
        }
    }
};
EventBroadcaster.prototype.dispatchEvent = function (c, h, f) {
    obj = this;
    if (!h) {
        h = window.event
    }
    if (obj && this.events) {
        var d = this.events[obj];
        if (d) {
            var b = d[c];
            if (b) {
                for (var a in b) {
                    var g = b[a].action;
                    if (b[a].binding) {
                        g = g.bind(b[a].binding)
                    }
                    g(h, f)
                }
            }
        }
    }
};


(function($) { 

	//	jQuery Logging Function
	$.fn.log = function (msg) {
		if(window.console) window.console.log("%s: %o", msg, this);
		return this;
	};

	//	add a spinner to element / $('element').spin()
	$.fn.spin = function(append) {
		if (append)
			$(this).append('<img src="/static/default/site/images/spinner.gif" class="spinner" alt="" />')
		else
			$(this).after('<img src="/static/default/site/images/spinner.gif" class="spinner" alt="" />')
	};


	//	$('element').scrollTo(speed)
	$.fn.scrollTo = function(speed) {
		var offset = $(this).offset().top - 30
		$('html,body').animate({scrollTop: offset}, speed || 1000)
		return this
	};

	$.fn.idle = function(time) { 
		var time = time || 1000;
		var o = $(this); 
		o.queue(function() { 
			setTimeout(function() { o.dequeue(); }, time);
		});
		return this;
	};

	
	//	Block slider
	$.fn.slider = function(mode, speed, time, callback) {
	
		var mode = mode || 'up'; // if mode is undefined, use 'up' as default
		var speed = speed || 'slow'; // if speed is undefined, use 'slow' as default
		var $this = this;
		switch(mode) {
			case 'up':
				setTimeout(function() { $this.slideUp(speed, function() { $(this).remove(); if($.isFunction(callback)) { callback.call(this, $) } }) }, (time * 1000));
				break;
			case 'down':
				setTimeout(function() { $this.slideDown(speed, function() { $(this).remove(); if($.isFunction(callback)) { callback.call(this, $) } }) }, (time * 1000));
				break;
		}
	};

	//	replace an element plugin
	$.fn.replaceWith = function(o)
	{ 
		return this.after(o).remove(); 
	};
	
	//	Resets the form data.  Causes all form elements to be reset to their original value.
	$.fn.reset_form = function() {
		return this.each(function() {
			// guard against an input with the name of 'reset'
			// note that IE reports the reset function as an 'object'
			if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
				this.reset();
		});
	};
	
	//	Changing articles font size
	$.fn.changeTextSize = function(content){
		var obj = this;
		var whichLink = $('a', obj);
		$('.sml').addClass('active');

		return whichLink.each(function() {
			$(this).click(function(){
				var className = $(this).attr('class');
				var whichLinkClass = 'a.'+(className).substring(0,3);
				$(content).removeClass('sml').removeClass('med').removeClass('lrg').addClass(className);
				$(whichLink).removeClass('active');
				$(whichLinkClass).addClass('active');
				return false;
			})
		})
	};

	//	Field Helper
	$.fn.helper = function(class_name, options) {
		var $this = this;

		//	Define default options
		$.fn.helper.defaults = {
			xOffset: 15,
			yOffset: -15
		}

		//	Roll options into a usable variable
		var opts = $.extend({}, $.fn.helper.defaults, options);

		//	Positioning function
		var setPosition = function(e){
			var border_top = $(window).scrollTop()
			var border_right = $(window).width()
			var left_pos
			var top_pos
			
			if( border_right >= $('div.tipper').width() + e.pageX + (opts.xOffset * 2) )
				left_pos = e.pageX + opts.xOffset
			else
				left_pos = border_right - $('div.tipper').width() - opts.xOffset
			if( border_top >= e.pageY - $('div.tipper').height() - (opts.xOffset * 2) )
				top_pos = border_top + opts.yOffset
			else
				top_pos = e.pageY - $('div.tipper').height() - opts.yOffset
			
			$('div.tipper').css({left: left_pos, top: top_pos})
		}

		//	Do the actual thing, yeah?
		return this.each(function() {
			$this = $(this);
			$(this).mouseover(function(e){
				this.t = this.title
				this.title = ''
				var i = this.t.indexOf(":")
				$('body').append('<div class="tipper"><span><strong>' + this.t.substring(0, i + 1) + '</strong> ' + this.t.substring(i + 1) + '</span></div>')
				
				setPosition(e)
				$('div.tipper').addClass(class_name)
				$('div.tipper').css({left: (e.pageX + 100)})
				$('div.tipper').show()
				$('div.tipper').animate({
					left: (e.pageX + opts.xOffset),
					opacity: 1
				}, 250, 'swing' );
			}).mouseout(function() {
				this.title = this.t
				$('div.tipper').remove()
			}).mousemove(function(e){
				setPosition(e)
			})
		});
	};
	

	/**
	 * jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget.
	 * @requires jQuery v1.2 or above
	 *
	 * http://gmarwaha.com/jquery/jcarousellite/
	 *
	 * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
	 * Dual licensed under the MIT and GPL licenses:
	 * http://www.opensource.org/licenses/mit-license.php
	 * http://www.gnu.org/licenses/gpl.html
	 *
	 * Version: 1.0.1
	 * Note: Requires jquery 1.2 or above from version 1.0.1
	 */
	
	/**
	 * Creates a carousel-style navigation widget for images/any-content from a simple HTML markup.
	 *
	 * The HTML markup that is used to build the carousel can be as simple as...
	 *
	 *  <div class="carousel">
	 *      <ul>
	 *          <li><img src="image/1.jpg" alt="1"></li>
	 *          <li><img src="image/2.jpg" alt="2"></li>
	 *          <li><img src="image/3.jpg" alt="3"></li>
	 *      </ul>
	 *  </div>
	 *
	 * As you can see, this snippet is nothing but a simple div containing an unordered list of images.
	 * You don't need any special "class" attribute, or a special "css" file for this plugin.
	 * I am using a class attribute just for the sake of explanation here.
	 *
	 * To navigate the elements of the carousel, you need some kind of navigation buttons.
	 * For example, you will need a "previous" button to go backward, and a "next" button to go forward.
	 * This need not be part of the carousel "div" itself. It can be any element in your page.
	 * Lets assume that the following elements in your document can be used as next, and prev buttons...
	 *
	 * <button class="prev">&lt;&lt;</button>
	 * <button class="next">&gt;&gt;</button>
	 *
	 * Now, all you need to do is call the carousel component on the div element that represents it, and pass in the
	 * navigation buttons as options.
	 *
	 * $(".carousel").jCarouselLite({
	 *      btnNext: ".next",
	 *      btnPrev: ".prev"
	 * });
	 *
	 * That's it, you would have now converted your raw div, into a magnificient carousel.
	 *
	 * There are quite a few other options that you can use to customize it though.
	 * Each will be explained with an example below.
	 *
	 * @param an options object - You can specify all the options shown below as an options object param.
	 *
	 * @option btnPrev, btnNext : string - no defaults
	 * @example
	 * $(".carousel").jCarouselLite({
	 *      btnNext: ".next",
	 *      btnPrev: ".prev"
	 * });
	 * @desc Creates a basic carousel. Clicking "btnPrev" navigates backwards and "btnNext" navigates forward.
	 *
	 * @option btnGo - array - no defaults
	 * @example
	 * $(".carousel").jCarouselLite({
	 *      btnNext: ".next",
	 *      btnPrev: ".prev",
	 *      btnGo: [".0", ".1", ".2"]
	 * });
	 * @desc If you don't want next and previous buttons for navigation, instead you prefer custom navigation based on
	 * the item number within the carousel, you can use this option. Just supply an array of selectors for each element
	 * in the carousel. The index of the array represents the index of the element. What i mean is, if the
	 * first element in the array is ".0", it means that when the element represented by ".0" is clicked, the carousel
	 * will slide to the first element and so on and so forth. This feature is very powerful. For example, i made a tabbed
	 * interface out of it by making my navigation elements styled like tabs in css. As the carousel is capable of holding
	 * any content, not just images, you can have a very simple tabbed navigation in minutes without using any other plugin.
	 * The best part is that, the tab will "slide" based on the provided effect. :-)
	 *
	 * @option mouseWheel : boolean - default is false
	 * @example
	 * $(".carousel").jCarouselLite({
	 *      mouseWheel: true
	 * });
	 * @desc The carousel can also be navigated using the mouse wheel interface of a scroll mouse instead of using buttons.
	 * To get this feature working, you have to do 2 things. First, you have to include the mouse-wheel plugin from brandon.
	 * Second, you will have to set the option "mouseWheel" to true. That's it, now you will be able to navigate your carousel
	 * using the mouse wheel. Using buttons and mouseWheel or not mutually exclusive. You can still have buttons for navigation
	 * as well. They complement each other. To use both together, just supply the options required for both as shown below.
	 * @example
	 * $(".carousel").jCarouselLite({
	 *      btnNext: ".next",
	 *      btnPrev: ".prev",
	 *      mouseWheel: true
	 * });
	 *
	 * @option auto : number - default is null, meaning autoscroll is disabled by default
	 * @example
	 * $(".carousel").jCarouselLite({
	 *      auto: 800,
	 *      speed: 500
	 * });
	 * @desc You can make your carousel auto-navigate itself by specfying a millisecond value in this option.
	 * The value you specify is the amount of time between 2 slides. The default is null, and that disables auto scrolling.
	 * Specify this value and magically your carousel will start auto scrolling.
	 *
	 * @option speed : number - 200 is default
	 * @example
	 * $(".carousel").jCarouselLite({
	 *      btnNext: ".next",
	 *      btnPrev: ".prev",
	 *      speed: 800
	 * });
	 * @desc Specifying a speed will slow-down or speed-up the sliding speed of your carousel. Try it out with
	 * different speeds like 800, 600, 1500 etc. Providing 0, will remove the slide effect.
	 *
	 * @option easing : string - no easing effects by default.
	 * @example
	 * $(".carousel").jCarouselLite({
	 *      btnNext: ".next",
	 *      btnPrev: ".prev",
	 *      easing: "bounceout"
	 * });
	 * @desc You can specify any easing effect. Note: You need easing plugin for that. Once specified,
	 * the carousel will slide based on the provided easing effect.
	 *
	 * @option vertical : boolean - default is false
	 * @example
	 * $(".carousel").jCarouselLite({
	 *      btnNext: ".next",
	 *      btnPrev: ".prev",
	 *      vertical: true
	 * });
	 * @desc Determines the direction of the carousel. true, means the carousel will display vertically. The next and
	 * prev buttons will slide the items vertically as well. The default is false, which means that the carousel will
	 * display horizontally. The next and prev items will slide the items from left-right in this case.
	 *
	 * @option circular : boolean - default is true
	 * @example
	 * $(".carousel").jCarouselLite({
	 *      btnNext: ".next",
	 *      btnPrev: ".prev",
	 *      circular: false
	 * });
	 * @desc Setting it to true enables circular navigation. This means, if you click "next" after you reach the last
	 * element, you will automatically slide to the first element and vice versa. If you set circular to false, then
	 * if you click on the "next" button after you reach the last element, you will stay in the last element itself
	 * and similarly for "previous" button and first element.
	 *
	 * @option visible : number - default is 3
	 * @example
	 * $(".carousel").jCarouselLite({
	 *      btnNext: ".next",
	 *      btnPrev: ".prev",
	 *      visible: 4
	 * });
	 * @desc This specifies the number of items visible at all times within the carousel. The default is 3.
	 * You are even free to experiment with real numbers. Eg: "3.5" will have 3 items fully visible and the
	 * last item half visible. This gives you the effect of showing the user that there are more images to the right.
	 *
	 * @option start : number - default is 0
	 * @example
	 * $(".carousel").jCarouselLite({
	 *      btnNext: ".next",
	 *      btnPrev: ".prev",
	 *      start: 2
	 * });
	 * @desc You can specify from which item the carousel should start. Remember, the first item in the carousel
	 * has a start of 0, and so on.
	 *
	 * @option scrool : number - default is 1
	 * @example
	 * $(".carousel").jCarouselLite({
	 *      btnNext: ".next",
	 *      btnPrev: ".prev",
	 *      scroll: 2
	 * });
	 * @desc The number of items that should scroll/slide when you click the next/prev navigation buttons. By
	 * default, only one item is scrolled, but you may set it to any number. Eg: setting it to "2" will scroll
	 * 2 items when you click the next or previous buttons.
	 *
	 * @option beforeStart, afterEnd : function - callbacks
	 * @example
	 * $(".carousel").jCarouselLite({
	 *      btnNext: ".next",
	 *      btnPrev: ".prev",
	 *      beforeStart: function(a) {
	 *          alert("Before animation starts:" + a);
	 *      },
	 *      afterEnd: function(a) {
	 *          alert("After animation ends:" + a);
	 *      }
	 * });
	 * @desc If you wanted to do some logic in your page before the slide starts and after the slide ends, you can
	 * register these 2 callbacks. The functions will be passed an argument that represents an array of elements that
	 * are visible at the time of callback.
	 *
	 *
	 * @cat Plugins/Image Gallery
	 * @author Ganeshji Marwaha/ganeshread@gmail.com
	 */
	
	(function($) {                                          // Compliant with jquery.noConflict()
	$.fn.jCarouselLite = function(o) {
		o = $.extend({
			btnPrev: null,
			btnNext: null,
			btnGo: null,
			mouseWheel: false,
			auto: null,
	
			speed: 200,
			easing: null,
	
			vertical: false,
			circular: true,
			visible: 3,
			start: 0,
			scroll: 1,
	
			beforeStart: null,
			afterEnd: null
		}, o || {});
	
		return this.each(function() {                           // Returns the element collection. Chainable.
	
			var running = false, animCss=o.vertical?"top":"left", sizeCss=o.vertical?"height":"width";
			var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible;
	
			if(o.circular) {
				ul.prepend(tLi.slice(tl-v-1+1).clone())
				  .append(tLi.slice(0,v).clone());
				o.start += v;
			}
	
			var li = $("li", ul), itemLength = li.size(), curr = o.start;
			div.css("visibility", "visible");
	
			li.css({overflow: "hidden", float: o.vertical ? "none" : "left"});
			ul.css({margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"});
			div.css({overflow: "hidden", position: "relative", "z-index": "2", left: "0px"});
	
			var liSize = o.vertical ? height(li) : width(li);   // Full li size(incl margin)-Used for animation
			var ulSize = liSize * itemLength;                   // size of full ul(total length, not just for the visible items)
			var divSize = liSize * v;                           // size of entire div(total length for just the visible items)
	
			li.css({width: li.width(), height: li.height()});
			ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));
	
			div.css(sizeCss, divSize+"px");                     // Width of the DIV. length of visible images
	
			if(o.btnPrev)
				$(o.btnPrev).click(function() {
					return go(curr-o.scroll);
				});
	
			if(o.btnNext)
				$(o.btnNext).click(function() {
					return go(curr+o.scroll);
				});
	
			if(o.btnGo)
				$.each(o.btnGo, function(i, val) {
					$(val).click(function() {
						return go(o.circular ? o.visible+i : i);
					});
				});
	
			if(o.mouseWheel && div.mousewheel)
				div.mousewheel(function(e, d) {
					return d>0 ? go(curr-o.scroll) : go(curr+o.scroll);
				});
	
			if(o.auto)
				setInterval(function() {
					go(curr+o.scroll);
				}, o.auto+o.speed);
	
			function vis() {
				return li.slice(curr).slice(0,v);
			};
	
			function go(to) {
				if(!running) {
	
					if(o.beforeStart)
						o.beforeStart.call(this, vis());
	
					if(o.circular) {            // If circular we are in first or last, then goto the other end
						if(to<=o.start-v-1) {           // If first, then goto last
							ul.css(animCss, -((itemLength-(v*2))*liSize)+"px");
							// If "scroll" > 1, then the "to" might not be equal to the condition; it can be lesser depending on the number of elements.
							curr = to==o.start-v-1 ? itemLength-(v*2)-1 : itemLength-(v*2)-o.scroll;
						} else if(to>=itemLength-v+1) { // If last, then goto first
							ul.css(animCss, -( (v) * liSize ) + "px" );
							// If "scroll" > 1, then the "to" might not be equal to the condition; it can be greater depending on the number of elements.
							curr = to==itemLength-v+1 ? v+1 : v+o.scroll;
						} else curr = to;
					} else {                    // If non-circular and to points to first or last, we just return.
						if(to<0 || to>itemLength-v) return;
						else curr = to;
					}                           // If neither overrides it, the curr will still be "to" and we can proceed.
	
					running = true;
	
					ul.animate(
						animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing,
						function() {
							if(o.afterEnd)
								o.afterEnd.call(this, vis());
							running = false;
						}
					);
					// Disable buttons when the carousel reaches the last/first, and enable when not
					if(!o.circular) {
						$(o.btnPrev + "," + o.btnNext).removeClass("disabled");
						$( (curr-o.scroll<0 && o.btnPrev)
							||
						   (curr+o.scroll > itemLength-v && o.btnNext)
							||
						   []
						 ).addClass("disabled");
					}
	
				}
				return false;
			};
		});
	};
	
	function css(el, prop) {
		return parseInt($.css(el[0], prop)) || 0;
	};
	function width(el) {
		return  el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
	};
	function height(el) {
		return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
	};
	
	})(jQuery);
	
	
	/**
	 * jCarousel - Riding carousels with jQuery
	 *   http://sorgalla.com/jcarousel/
	 *
	 * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
	 * Dual licensed under the MIT (MIT-LICENSE.txt)
	 * and GPL (GPL-LICENSE.txt) licenses.
	 *
	 * Built on top of the jQuery library
	 *   http://jquery.com
	 *
	 * Inspired by the "Carousel Component" by Bill Scott
	 *   http://billwscott.com/carousel/
	 */
    $.fn.jcarousel = function(o) {
        return this.each(function() {
            new $jc(this, o);
        });
    };

    // Default configuration properties.
    var defaults = {
        vertical: false,
        start: 1,
        offset: 1,
        size: null,
        scroll: 3,
        visible: null,
        animation: 'normal',
        easing: 'swing',
        auto: 0,
        wrap: null,
        initCallback: null,
        reloadCallback: null,
        itemLoadCallback: null,
        itemFirstInCallback: null,
        itemFirstOutCallback: null,
        itemLastInCallback: null,
        itemLastOutCallback: null,
        itemVisibleInCallback: null,
        itemVisibleOutCallback: null,
        buttonNextHTML: '<div></div>',
        buttonPrevHTML: '<div></div>',
        buttonNextEvent: 'click',
        buttonPrevEvent: 'click',
        buttonNextCallback: null,
        buttonPrevCallback: null
    };

    /**
     * The jCarousel object.
     *
     * @constructor
     * @name $.jcarousel
     * @param Object e The element to create the carousel for.
     * @param Hash o A set of key/value pairs to set as configuration properties.
     * @cat Plugins/jCarousel
     */
    $.jcarousel = function(e, o) {
        this.options    = $.extend({}, defaults, o || {});

        this.locked     = false;

        this.container  = null;
        this.clip       = null;
        this.list       = null;
        this.buttonNext = null;
        this.buttonPrev = null;

        this.wh = !this.options.vertical ? 'width' : 'height';
        this.lt = !this.options.vertical ? 'left' : 'top';

        // Extract skin class
        var skin = '', split = e.className.split(' ');

        for (var i = 0; i < split.length; i++) {
            if (split[i].indexOf('jcarousel-skin') != -1) {
                $(e).removeClass(split[i]);
                var skin = split[i];
                break;
            }
        }

        if (e.nodeName == 'UL' || e.nodeName == 'OL') {
            this.list = $(e);
            this.container = this.list.parent();

            if (this.container.hasClass('jcarousel-clip')) {
                if (!this.container.parent().hasClass('jcarousel-container'))
                    this.container = this.container.wrap('<div></div>');

                this.container = this.container.parent();
            } else if (!this.container.hasClass('jcarousel-container'))
                this.container = this.list.wrap('<div></div>').parent();
        } else {
            this.container = $(e);
            this.list = $(e).find('>ul,>ol,div>ul,div>ol');
        }

        if (skin != '' && this.container.parent()[0].className.indexOf('jcarousel-skin') == -1)
        	this.container.wrap('<div class=" '+ skin + '"></div>');

        this.clip = this.list.parent();

        if (!this.clip.length || !this.clip.hasClass('jcarousel-clip'))
            this.clip = this.list.wrap('<div></div>').parent();

        this.buttonPrev = $('.jcarousel-prev', this.container);

        if (this.buttonPrev.size() == 0 && this.options.buttonPrevHTML != null)
            this.buttonPrev = this.clip.before(this.options.buttonPrevHTML).prev();

        this.buttonPrev.addClass(this.className('jcarousel-prev'));

        this.buttonNext = $('.jcarousel-next', this.container);

        if (this.buttonNext.size() == 0 && this.options.buttonNextHTML != null)
            this.buttonNext = this.clip.before(this.options.buttonNextHTML).prev();

        this.buttonNext.addClass(this.className('jcarousel-next'));

        this.clip.addClass(this.className('jcarousel-clip'));
        this.list.addClass(this.className('jcarousel-list'));
        this.container.addClass(this.className('jcarousel-container'));

        var di = this.options.visible != null ? Math.ceil(this.clipping() / this.options.visible) : null;
        var li = this.list.children('li');

        var self = this;

        if (li.size() > 0) {
            var wh = 0, i = this.options.offset;
            li.each(function() {
                self.format(this, i++);
                wh += self.dimension(this, di);
            });

            this.list.css(this.wh, wh + 'px');

            // Only set if not explicitly passed as option
            if (!o || o.size === undefined)
                this.options.size = li.size();
        }

        // For whatever reason, .show() does not work in Safari...
        this.container.css('display', 'block');
        this.buttonNext.css('display', 'block');
        this.buttonPrev.css('display', 'block');

        this.funcNext   = function() { self.next(); };
        this.funcPrev   = function() { self.prev(); };
        this.funcResize = function() { self.reload(); };

        if (this.options.initCallback != null)
            this.options.initCallback(this, 'init');

        if ($.browser.safari) {
            this.buttons(false, false);
            $(window).bind('load', function() { self.setup(); });
        } else
            this.setup();
    };

    // Create shortcut for internal use
    var $jc = $.jcarousel;

    $jc.fn = $jc.prototype = {
        jcarousel: '0.2.3'
    };

    $jc.fn.extend = $jc.extend = $.extend;

    $jc.fn.extend({
        /**
         * Setups the carousel.
         *
         * @name setup
         * @type undefined
         * @cat Plugins/jCarousel
         */
        setup: function() {
            this.first     = null;
            this.last      = null;
            this.prevFirst = null;
            this.prevLast  = null;
            this.animating = false;
            this.timer     = null;
            this.tail      = null;
            this.inTail    = false;

            if (this.locked)
                return;

            this.list.css(this.lt, this.pos(this.options.offset) + 'px');
            var p = this.pos(this.options.start);
            this.prevFirst = this.prevLast = null;
            this.animate(p, false);

            $(window).unbind('resize', this.funcResize).bind('resize', this.funcResize);
        },

        /**
         * Clears the list and resets the carousel.
         *
         * @name reset
         * @type undefined
         * @cat Plugins/jCarousel
         */
        reset: function() {
            this.list.empty();

            this.list.css(this.lt, '0px');
            this.list.css(this.wh, '10px');

            if (this.options.initCallback != null)
                this.options.initCallback(this, 'reset');

            this.setup();
        },

        /**
         * Reloads the carousel and adjusts positions.
         *
         * @name reload
         * @type undefined
         * @cat Plugins/jCarousel
         */
        reload: function() {
            if (this.tail != null && this.inTail)
                this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + this.tail);

            this.tail   = null;
            this.inTail = false;

            if (this.options.reloadCallback != null)
                this.options.reloadCallback(this);

            if (this.options.visible != null) {
                var self = this;
                var di = Math.ceil(this.clipping() / this.options.visible), wh = 0, lt = 0;
                $('li', this.list).each(function(i) {
                    wh += self.dimension(this, di);
                    if (i + 1 < self.first)
                        lt = wh;
                });

                this.list.css(this.wh, wh + 'px');
                this.list.css(this.lt, -lt + 'px');
            }

            this.scroll(this.first, false);
        },

        /**
         * Locks the carousel.
         *
         * @name lock
         * @type undefined
         * @cat Plugins/jCarousel
         */
        lock: function() {
            this.locked = true;
            this.buttons();
        },

        /**
         * Unlocks the carousel.
         *
         * @name unlock
         * @type undefined
         * @cat Plugins/jCarousel
         */
        unlock: function() {
            this.locked = false;
            this.buttons();
        },

        /**
         * Sets the size of the carousel.
         *
         * @name size
         * @type undefined
         * @param Number s The size of the carousel.
         * @cat Plugins/jCarousel
         */
        size: function(s) {
            if (s != undefined) {
                this.options.size = s;
                if (!this.locked)
                    this.buttons();
            }

            return this.options.size;
        },

        /**
         * Checks whether a list element exists for the given index (or index range).
         *
         * @name get
         * @type bool
         * @param Number i The index of the (first) element.
         * @param Number i2 The index of the last element.
         * @cat Plugins/jCarousel
         */
        has: function(i, i2) {
            if (i2 == undefined || !i2)
                i2 = i;

            if (this.options.size !== null && i2 > this.options.size)
            	i2 = this.options.size;

            for (var j = i; j <= i2; j++) {
                var e = this.get(j);
                if (!e.length || e.hasClass('jcarousel-item-placeholder'))
                    return false;
            }

            return true;
        },

        /**
         * Returns a jQuery object with list element for the given index.
         *
         * @name get
         * @type jQuery
         * @param Number i The index of the element.
         * @cat Plugins/jCarousel
         */
        get: function(i) {
            return $('.jcarousel-item-' + i, this.list);
        },

        /**
         * Adds an element for the given index to the list.
         * If the element already exists, it updates the inner html.
         * Returns the created element as jQuery object.
         *
         * @name add
         * @type jQuery
         * @param Number i The index of the element.
         * @param String s The innerHTML of the element.
         * @cat Plugins/jCarousel
         */
        add: function(i, s) {
            var e = this.get(i), old = 0, add = 0;

            if (e.length == 0) {
                var c, e = this.create(i), j = $jc.intval(i);
                while (c = this.get(--j)) {
                    if (j <= 0 || c.length) {
                        j <= 0 ? this.list.prepend(e) : c.after(e);
                        break;
                    }
                }
            } else
                old = this.dimension(e);

            e.removeClass(this.className('jcarousel-item-placeholder'));
            typeof s == 'string' ? e.html(s) : e.empty().append(s);

            var di = this.options.visible != null ? Math.ceil(this.clipping() / this.options.visible) : null;
            var wh = this.dimension(e, di) - old;

            if (i > 0 && i < this.first)
                this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - wh + 'px');

            this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) + wh + 'px');

            return e;
        },

        /**
         * Removes an element for the given index from the list.
         *
         * @name remove
         * @type undefined
         * @param Number i The index of the element.
         * @cat Plugins/jCarousel
         */
        remove: function(i) {
            var e = this.get(i);

            // Check if item exists and is not currently visible
            if (!e.length || (i >= this.first && i <= this.last))
                return;

            var d = this.dimension(e);

            if (i < this.first)
                this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + d + 'px');

            e.remove();

            this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) - d + 'px');
        },

        /**
         * Moves the carousel forwards.
         *
         * @name next
         * @type undefined
         * @cat Plugins/jCarousel
         */
        next: function() {
            this.stopAuto();

            if (this.tail != null && !this.inTail)
                this.scrollTail(false);
            else
                this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'last') && this.options.size != null && this.last == this.options.size) ? 1 : this.first + this.options.scroll);
        },

        /**
         * Moves the carousel backwards.
         *
         * @name prev
         * @type undefined
         * @cat Plugins/jCarousel
         */
        prev: function() {
            this.stopAuto();

            if (this.tail != null && this.inTail)
                this.scrollTail(true);
            else
                this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'first') && this.options.size != null && this.first == 1) ? this.options.size : this.first - this.options.scroll);
        },

        /**
         * Scrolls the tail of the carousel.
         *
         * @name scrollTail
         * @type undefined
         * @param Bool b Whether scroll the tail back or forward.
         * @cat Plugins/jCarousel
         */
        scrollTail: function(b) {
            if (this.locked || this.animating || !this.tail)
                return;

            var pos  = $jc.intval(this.list.css(this.lt));

            !b ? pos -= this.tail : pos += this.tail;
            this.inTail = !b;

            // Save for callbacks
            this.prevFirst = this.first;
            this.prevLast  = this.last;

            this.animate(pos);
        },

        /**
         * Scrolls the carousel to a certain position.
         *
         * @name scroll
         * @type undefined
         * @param Number i The index of the element to scoll to.
         * @param Bool a Flag indicating whether to perform animation.
         * @cat Plugins/jCarousel
         */
        scroll: function(i, a) {
            if (this.locked || this.animating)
                return;

            this.animate(this.pos(i), a);
        },

        /**
         * Prepares the carousel and return the position for a certian index.
         *
         * @name pos
         * @type Number
         * @param Number i The index of the element to scoll to.
         * @cat Plugins/jCarousel
         */
        pos: function(i) {
            if (this.locked || this.animating)
                return;

            i = $jc.intval(i);
            if (this.options.wrap != 'circular')
                i = i < 1 ? 1 : (this.options.size && i > this.options.size ? this.options.size : i);

            var back = this.first > i;
            var pos  = $jc.intval(this.list.css(this.lt));

            // Create placeholders, new list width/height
            // and new list position
            var f = this.options.wrap != 'circular' && this.first <= 1 ? 1 : this.first;
            var c = back ? this.get(f) : this.get(this.last);
            var j = back ? f : f - 1;
            var e = null, l = 0, p = false, d = 0;

            while (back ? --j >= i : ++j < i) {
                e = this.get(j);
                p = !e.length;
                if (e.length == 0) {
                    e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
                    c[back ? 'before' : 'after' ](e);
                }

                c = e;
                d = this.dimension(e);

                if (p)
                    l += d;

                if (this.first != null && (this.options.wrap == 'circular' || (j >= 1 && (this.options.size == null || j <= this.options.size))))
                    pos = back ? pos + d : pos - d;
            }

            // Calculate visible items
            var clipping = this.clipping();
            var cache = [];
            var visible = 0, j = i, v = 0;
            var c = this.get(i - 1);

            while (++visible) {
                e = this.get(j);
                p = !e.length;
                if (e.length == 0) {
                    e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
                    // This should only happen on a next scroll
                    c.length == 0 ? this.list.prepend(e) : c[back ? 'before' : 'after' ](e);
                }

                c = e;
                var d = this.dimension(e);
                if (d == 0) {
//                    alert('jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...');
                    return 0;
                }

                if (this.options.wrap != 'circular' && this.options.size !== null && j > this.options.size)
                    cache.push(e);
                else if (p)
                    l += d;

                v += d;

                if (v >= clipping)
                    break;

                j++;
            }

             // Remove out-of-range placeholders
            for (var x = 0; x < cache.length; x++)
                cache[x].remove();

            // Resize list
            if (l > 0) {
                this.list.css(this.wh, this.dimension(this.list) + l + 'px');

                if (back) {
                    pos -= l;
                    this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - l + 'px');
                }
            }

            // Calculate first and last item
            var last = i + visible - 1;
            if (this.options.wrap != 'circular' && this.options.size && last > this.options.size)
                last = this.options.size;

            if (j > last) {
                visible = 0, j = last, v = 0;
                while (++visible) {
                    var e = this.get(j--);
                    if (!e.length)
                        break;
                    v += this.dimension(e);
                    if (v >= clipping)
                        break;
                }
            }

            var first = last - visible + 1;
            if (this.options.wrap != 'circular' && first < 1)
                first = 1;

            if (this.inTail && back) {
                pos += this.tail;
                this.inTail = false;
            }

            this.tail = null;
            if (this.options.wrap != 'circular' && last == this.options.size && (last - visible + 1) >= 1) {
                var m = $jc.margin(this.get(last), !this.options.vertical ? 'marginRight' : 'marginBottom');
                if ((v - m) > clipping)
                    this.tail = v - clipping - m;
            }

            // Adjust position
            while (i-- > first)
                pos += this.dimension(this.get(i));

            // Save visible item range
            this.prevFirst = this.first;
            this.prevLast  = this.last;
            this.first     = first;
            this.last      = last;

            return pos;
        },

        /**
         * Animates the carousel to a certain position.
         *
         * @name animate
         * @type undefined
         * @param mixed p Position to scroll to.
         * @param Bool a Flag indicating whether to perform animation.
         * @cat Plugins/jCarousel
         */
        animate: function(p, a) {
            if (this.locked || this.animating)
                return;

            this.animating = true;

            var self = this;
            var scrolled = function() {
                self.animating = false;

                if (p == 0)
                    self.list.css(self.lt,  0);

                if (self.options.wrap == 'both' || self.options.wrap == 'last' || self.options.size == null || self.last < self.options.size)
                    self.startAuto();

                self.buttons();
                self.notify('onAfterAnimation');
            };

            this.notify('onBeforeAnimation');

            // Animate
            if (!this.options.animation || a == false) {
                this.list.css(this.lt, p + 'px');
                scrolled();
            } else {
                var o = !this.options.vertical ? {'left': p} : {'top': p};
                this.list.animate(o, this.options.animation, this.options.easing, scrolled);
            }
        },

        /**
         * Starts autoscrolling.
         *
         * @name auto
         * @type undefined
         * @param Number s Seconds to periodically autoscroll the content.
         * @cat Plugins/jCarousel
         */
        startAuto: function(s) {
            if (s != undefined)
                this.options.auto = s;

            if (this.options.auto == 0)
                return this.stopAuto();

            if (this.timer != null)
                return;

            var self = this;
            this.timer = setTimeout(function() { self.next(); }, this.options.auto * 1000);
        },

        /**
         * Stops autoscrolling.
         *
         * @name stopAuto
         * @type undefined
         * @cat Plugins/jCarousel
         */
        stopAuto: function() {
            if (this.timer == null)
                return;

            clearTimeout(this.timer);
            this.timer = null;
        },

        /**
         * Sets the states of the prev/next buttons.
         *
         * @name buttons
         * @type undefined
         * @cat Plugins/jCarousel
         */
        buttons: function(n, p) {
            if (n == undefined || n == null) {
                var n = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'first') || this.options.size == null || this.last < this.options.size);
                if (!this.locked && (!this.options.wrap || this.options.wrap == 'first') && this.options.size != null && this.last >= this.options.size)
                    n = this.tail != null && !this.inTail;
            }

            if (p == undefined || p == null) {
                var p = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'last') || this.first > 1);
                if (!this.locked && (!this.options.wrap || this.options.wrap == 'last') && this.options.size != null && this.first == 1)
                    p = this.tail != null && this.inTail;
            }

            var self = this;

            this.buttonNext[n ? 'bind' : 'unbind'](this.options.buttonNextEvent, this.funcNext)[n ? 'removeClass' : 'addClass'](this.className('jcarousel-next-disabled')).attr('disabled', n ? false : true);
            this.buttonPrev[p ? 'bind' : 'unbind'](this.options.buttonPrevEvent, this.funcPrev)[p ? 'removeClass' : 'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled', p ? false : true);

            if (this.buttonNext.length > 0 && (this.buttonNext[0].jcarouselstate == undefined || this.buttonNext[0].jcarouselstate != n) && this.options.buttonNextCallback != null) {
                this.buttonNext.each(function() { self.options.buttonNextCallback(self, this, n); });
                this.buttonNext[0].jcarouselstate = n;
            }

            if (this.buttonPrev.length > 0 && (this.buttonPrev[0].jcarouselstate == undefined || this.buttonPrev[0].jcarouselstate != p) && this.options.buttonPrevCallback != null) {
                this.buttonPrev.each(function() { self.options.buttonPrevCallback(self, this, p); });
                this.buttonPrev[0].jcarouselstate = p;
            }
        },

        notify: function(evt) {
            var state = this.prevFirst == null ? 'init' : (this.prevFirst < this.first ? 'next' : 'prev');

            // Load items
            this.callback('itemLoadCallback', evt, state);

            if (this.prevFirst !== this.first) {
                this.callback('itemFirstInCallback', evt, state, this.first);
                this.callback('itemFirstOutCallback', evt, state, this.prevFirst);
            }

            if (this.prevLast !== this.last) {
                this.callback('itemLastInCallback', evt, state, this.last);
                this.callback('itemLastOutCallback', evt, state, this.prevLast);
            }

            this.callback('itemVisibleInCallback', evt, state, this.first, this.last, this.prevFirst, this.prevLast);
            this.callback('itemVisibleOutCallback', evt, state, this.prevFirst, this.prevLast, this.first, this.last);
        },

        callback: function(cb, evt, state, i1, i2, i3, i4) {
            if (this.options[cb] == undefined || (typeof this.options[cb] != 'object' && evt != 'onAfterAnimation'))
                return;

            var callback = typeof this.options[cb] == 'object' ? this.options[cb][evt] : this.options[cb];

            if (!$.isFunction(callback))
                return;

            var self = this;

            if (i1 === undefined)
                callback(self, state, evt);
            else if (i2 === undefined)
                this.get(i1).each(function() { callback(self, this, i1, state, evt); });
            else {
                for (var i = i1; i <= i2; i++)
                    if (i !== null && !(i >= i3 && i <= i4))
                        this.get(i).each(function() { callback(self, this, i, state, evt); });
            }
        },

        create: function(i) {
            return this.format('<li></li>', i);
        },

        format: function(e, i) {
            var $e = $(e).addClass(this.className('jcarousel-item')).addClass(this.className('jcarousel-item-' + i));
            $e.attr('jcarouselindex', i);
            return $e;
        },

        className: function(c) {
            return c + ' ' + c + (!this.options.vertical ? '-horizontal' : '-vertical');
        },

        dimension: function(e, d) {
            var el = e.jquery != undefined ? e[0] : e;

            var old = !this.options.vertical ?
                el.offsetWidth + $jc.margin(el, 'marginLeft') + $jc.margin(el, 'marginRight') :
                el.offsetHeight + $jc.margin(el, 'marginTop') + $jc.margin(el, 'marginBottom');

            if (d == undefined || old == d)
                return old;

            var w = !this.options.vertical ?
                d - $jc.margin(el, 'marginLeft') - $jc.margin(el, 'marginRight') :
                d - $jc.margin(el, 'marginTop') - $jc.margin(el, 'marginBottom');

            $(el).css(this.wh, w + 'px');

            return this.dimension(el);
        },

        clipping: function() {
            return !this.options.vertical ?
                this.clip[0].offsetWidth - $jc.intval(this.clip.css('borderLeftWidth')) - $jc.intval(this.clip.css('borderRightWidth')) :
                this.clip[0].offsetHeight - $jc.intval(this.clip.css('borderTopWidth')) - $jc.intval(this.clip.css('borderBottomWidth'));
        },

        index: function(i, s) {
            if (s == undefined)
                s = this.options.size;

            return Math.round((((i-1) / s) - Math.floor((i-1) / s)) * s) + 1;
        }
    });

    $jc.extend({
        /**
         * Gets/Sets the global default configuration properties.
         *
         * @name defaults
         * @descr Gets/Sets the global default configuration properties.
         * @type Hash
         * @param Hash d A set of key/value pairs to set as configuration properties.
         * @cat Plugins/jCarousel
         */
        defaults: function(d) {
            return $.extend(defaults, d || {});
        },

        margin: function(e, p) {
            if (!e)
                return 0;

            var el = e.jquery != undefined ? e[0] : e;

            if (p == 'marginRight' && $.browser.safari) {
                var old = {'display': 'block', 'float': 'none', 'width': 'auto'}, oWidth, oWidth2;

                $.swap(el, old, function() { oWidth = el.offsetWidth; });

                old['marginRight'] = 0;
                $.swap(el, old, function() { oWidth2 = el.offsetWidth; });

                return oWidth2 - oWidth;
            }

            return $jc.intval($.css(el, p));
        },

        intval: function(v) {
            v = parseInt(v);
            return isNaN(v) ? 0 : v;
        }
    });


})(jQuery);


var rt100 = new(function ($) {
	var ie = $.browser.msie;
	var ie6 = ie && parseInt($.browser.version) == 6;
	var rt = this;
	rt.debug;
	rt.logging = false;
	rt.useDebug = false;
	rt.forceDebug = (window.location.href.indexOf("debug=true") >= 0) ? true : false;
	rt.debugOdd = true;
	rt.lastUrl = window.location;
	rt.currentUrl = (window.location.hash.length > 0) ? (window.location.href.substr(0, window.location.href.indexOf("#"))) : (window.location.href);
	rt.nextUrl = rt.currentUrl;
	rt.cacheBust = false;
	rt.properties;
	rt.section = "index";
	rt.broadcaster = new EventBroadcaster();
	rt.time = (new Date()).getTime();

	rt.createDebug = function () {
		rt.debug = window.open("about:blank", "debug", "resizable=yes,scrollbars=yes,width=650,height=600");
		var debug = rt.debug
	}
	rt.error = function (msg, suppressAlert) {
		rt.log("ERROR: " + msg);
		if (!suppressAlert) {
			rt100.modal.show("<div class='error-modal'><h4>Error</h4>" + msg + "</div>", true)
		}
	};
	rt.info = function (msg) {
		rt.log((typeof(msg) == "string") ? ("INFO: " + msg) : (msg))
	}
	rt.log = function (msg) {
		if (rt.logging === false) {
			return
		}

		if (($.browser.msie && rt.useDebug) || rt.forceDebug) {
			rt.debugOdd = !rt.debugOdd;
			var style = (rt.debugOdd) ? ("") : ("background-color: #efefef;");
			if (rt.debug) {
				var div = "<div style='" + style + "font-size:10px;'><pre style='margin:0 2px 0 2px;font-family:arial,sans-serif;font-size:12px;'>" + msg + "</pre></div>";
				$(rt.debug.document).find("body").append(div)
			}
		} else {
			console.log(msg)
		}
	}
	rt.logObject = function (obj, spaces) {
		spaces = spaces ? spaces : "..";
		for (var prop in obj) {
			if (typeof obj[prop] == "string") {
				rt.log(spaces + prop + " = " + obj[prop])
			} else { if (typeof obj[prop] == "array") {
					rt.log(spaces + prop + " = " + obj[prop])
				} else {
					rt.log(spaces + prop + ":");
					rt.logObject(obj[prop], spaces + "..")
				}
			}
		}
	}
	rt.onHashChanged = function (hash) {
		rt100.info("rt100.onHashChanged(" + hash + ")");
		rt.load(hash)
	};
	rt.articlesCarousel = function () {
		if( $('#items-carousel').length > 0 ) {
//			$('#articles-carousel').jcarousel({ auto: 3, wrap: 'last'});
//			$('#carousel').jCarouselLite({auto: 3000, speed: 1000, visible: 5 });
			$("#scroll-container").jCarouselLite({
				btnNext: "#items-carousel .next",
				btnPrev: "#items-carousel .prev",
				scroll: 1,
				/*auto: 3000,*/
				visible: 4,
				circular: false,
				speed: 600,
				start: 0
			})
		}
	};
	rt.setupPage = function () {
		rt100.info("rt100.setupPage()");
		rt.hideLoadingScreen();
		rt.hijackLinks();
        if (rt.nextUrl.indexOf("#") >= 0) {
            rt.nextUrl = window.location.protocol + "//" + window.location.host + "/" + rt.nextUrl.substr(rt.nextUrl.indexOf("#") + 1)
        }
        rt.lastUrl = rt.currentUrl;
        rt.currentUrl = rt.nextUrl;

		//	articles carousel
		rt100.articlesCarousel();
		
		//	events lignthbox
		if( $(".lightbox").length > 0 ) { $(".lightbox").lightbox({fitToScreen: true, imageClickClose: true }); }
		
		//	comments formating
		if( $(".comments_list").length > 0 ) {
			$(".comments_list").formatComments();
		}
		
		//	top tabs
		rt100.initTabs();
	
		//	go2top button
		rt.initGo2Top();
	};
	rt.hijackLinks = function (root) {
		root = (root) ? (root) : ("#site-wrapper");
		var selection = $(root).find("a:not(.no-ajax)");
		$(selection).click(function () {
			rt.cacheBust = false;
			rt.cacheBust = $(this).hasClass("cache-bust") ? true : false;
			var hash = $(this).attr("href");
			var before = hash;
			var after = "";
			if (hash.indexOf("?") >= 0) {
				before = (hash.substr(0, hash.indexOf("?"))).toLowerCase();
				after = hash.substr(hash.indexOf("?"))
			}
			hash = before + after;
			if (hash.indexOf(location.host) >= 0) {
				hash = hash.substr(hash.indexOf(location.host) + (location.host.length))
			}
			if (hash && hash.length > 0 && hash.indexOf("javascript") == -1 && hash.indexOf("http") == -1) {
				rt100.info("hijacked link clicked: " + hash);
				rt100.navigateToUrl(hash);
				return false
			}
			rt100.info("not hijacked: [" + hash + "]");
			return true
		})
	}
    rt.hideLoadingScreen = function () {
        $("#content-container").css("visibility", "visible");
        $("#loading-screen").fadeOut("fast", function() {
			$('.content', '#content-container').removeClass('loader');
		})
    };
	rt.showLoadingScreen = function (url) {
		$('.content', '#content-container').addClass('loader');
        var h = $("#content-container");
        var docSize = {
            width: (h.width() > 0) ? (h.width()) : 969,
            height: h.height()
        };
		$("#loading-screen").css({
            width: docSize.width - 30,
            height: docSize.height - 30
        });
        $("#loading-screen").fadeIn("fast", function () {
            if (url) {
                rt.loadPage(url)
            }
        })
    };
	rt.load = function (url) {
		url = url.replace(/.html|.htm|.php/gi, '')
		rt100.info("rt100.load(" + url + ")");
		//rt.loadPage(url)
		rt.showLoadingScreen(url)
    };
	rt.loadDefaultError404 = function(url){
		var qs = url.indexOf("?") > -1 ? "&" : "?";
		var loadUrl = url + qs + "ajax=true" + (rt.cacheBust ? "&cachebust=" + (new Date()).getTime() : "");
		try {
			$.ajax({
				type: "GET",
				url: loadUrl,
				contentType: "text/html; charset=utf-8",
				error: function (XMLHttpRequest, textStatus, errorThrown) {
					rt100.info("Page load 'error'");
				},
				success: function (response, textStatus) {
					if (textStatus == "success") {
						document.title = $('#page-title', response).text();
//						alert($('#page-title', response).text());
						$("#content-container")[0].innerHTML = $(response).find('#content-container').html();
						if (url.indexOf("#") > -1 || url.indexOf("/HASH/") > -1) {
							setTimeout(function () {
								var jump = $(scrollTo).offset().top;
								rt100.info("jump to " + scrollTo + " position = " + jump);
								$("html,body").animate({
									scrollTop: jump
								},
								1000)
							},
							1000)
						} else {
							$("html,body").animate({
								scrollTop: 0
							},
							1000)
						}
						rt.setupPage()
					}
				}
			})
		} catch(er) {
			rt100.error("Page Loading Error")
		}
	};
	rt.loadPage = function (url) {
        rt100.info("rt100.loadPage(" + url + ")");
		
        if (url) {
            var qs = url.indexOf("?") > -1 ? "&" : "?";
            var cleanUrl = url;
            var scrollTo = "#content";
            if (url.indexOf("#") > -1) {
                cleanUrl = url.substring(0, url.indexOf("#"));
                scrollTo = url.substring(url.indexOf("#"))
            } else { if (url.indexOf("/HASH/") > -1) {
                    cleanUrl = url.substring(0, url.indexOf("/HASH/"));
                    scrollTo = "#" + url.substring(url.indexOf("/HASH/") + 6)
                }
            }
            rt.nextUrl = location.protocol + "//" + location.host + url;
            var loadUrl = cleanUrl + qs + "ajax=true" + (rt.cacheBust ? "&cachebust=" + (new Date()).getTime() : "");
            rt100.info("url: " + loadUrl);
            try {
                $.ajax({
                    type: "GET",
                    url: loadUrl,
                    contentType: "text/html; charset=utf-8",
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        rt100.info("Page load 'error'");
                      //  rt100.error("Page Loading Error", true)
						rt100.loadDefaultError404('/notfound');
                    },
                    success: function (response, textStatus) {
                        rt100.info("Page load complete: " + textStatus);
                        if (textStatus == "success") {
                            rt100.info(url + ":" + rt100.history.hash);
                            if (url == rt100.history.hash) {
								document.title = $(response).filter('title').html();
								$("#content-container")[0].innerHTML = $(response).find('#content-container').html();
                                if (url.indexOf("#") > -1 || url.indexOf("/HASH/") > -1) {
                                    setTimeout(function () {
                                        var jump = $(scrollTo).offset().top;
                                        rt100.info("jump to " + scrollTo + " position = " + jump);
                                        $("html,body").animate({
                                            scrollTop: jump
                                        },
                                        1000)
                                    },
                                    1000)
                                } else {
                                    $("html,body").animate({
                                        scrollTop: 0
                                    },
                                    1000)
                                }
                                rt.setupPage()
                            }
                        }
                    }
                })
            } catch(er) {
                rt100.error("Page Loading Error")
            }
        }
    };
	rt.navigateToUrl = function (url) {
		rt100.history.setHash(url)
	}
	rt.initTabs = function () {
		$('div.rt_tabs').each(function(){
			var t = $(this);
			$('a.is-tab', t).bind('click', function(){
				$('.captcha', t).attr('src', '/captcha?c=' + (new Date()).getTime());
				$('a.is-tab').removeClass('active')
				var tabIndex = $('a.is-tab', t)
					.removeClass('active')
					.index(this);
				$(this)
					.addClass('active')
					.blur();
				$('div.tab').hide()
				$('div.tab', t)
					.hide()
					.eq(tabIndex)
					.show();
				var $target = $(this);
				var targetOffset = $target.offset().top;
				$('html, body').animate({scrollTop: targetOffset - 3}, 1000);
				
				return false;
			})
		})
		if($('.captcha-validation').length > 0 ) {
			$('.captcha-validation').each(function(){
				var c = $(this)
				$('.reload', c).bind('click', function(){	
					$('.captcha', c).attr('src', '/captcha?&c=' + (new Date()).getTime());
				})
			})
		}
		if( $('.comments').length ) {
			$('.comments').each(function(){
				var comm = $(this);
				$('form', comm).validate({
								meta: 'validate',
								errorElement: "span",
								messages: { c_captcha: "Codul de siguranta este incorect scris." },
								submitHandler: function(form) {
									$('input[type="submit"]', comm).addClass('waiting').val('Asteapta ...').spin();
									$(form).ajaxSubmit({
										target: ".ajax-results",
										parent: comm,
										success: function(responseText, statusText){
											var res = $('.ajax-results', comm);
											var message = $('blockquote:first', res);
											$('.spinner', comm).css({'visibility': 'hidden'})
											if($(message).hasClass('error')) {
												$(message).removeClass('puff');
												$(message).slider('up', 'slow', 30);
											} else {
												$('input[type="submit"]', comm).val('Mesaj trimis');
												$('form', comm).resetForm();
												if( $('.comments_list', comm).length > 0 ) {
													if( $('.empty', comm).length > 0 ) { $('.empty', comm).hide(); }
													var comment_body = $('div.puff', res).html();
													$('.captcha', comm).attr('src', '/captcha?&c=' + (new Date()).getTime());
													$(comment_body).prependTo('.comments_list', comm); 
													$('input[type="submit"]', comm).removeClass('waiting').val('Trimite');
												}
											}
										}
									});
								}
				});
			})
		}
	}
	rt.resizeNav = function () {
		var browser_width = $(window).width();
		var site_width = $('#site-content').width();
		var nav_width = $('#floating-nav').width();
		var minim_width = (browser_width - site_width + 45) / 2 - 55;
		
		if(nav_width >= minim_width ) {
			var cloned_menu = $('#floating-nav ul').clone();
			$("#fixed-nav").append(cloned_menu).addClass('second-menu');    
			$('ul', '#floating-nav').remove();
		} else {
			var cloned_menu = $('#fixed-nav ul').clone();
			$("#floating-nav").append(cloned_menu);
			$('#fixed-nav').removeClass('second-menu');
			$('ul', '#fixed-nav').remove();
		}
		/*rt.broadcaster.addListener("hashChanged", function (hash) {
			rt.onHashChanged(hash)
		});
		rt100.history.init();
		rt100.info(rt100.history.hash + " ?= " + rt100.history.defaultHash);
		if (rt100.history.hash != rt100.history.defaultHash) {
			rt100.info("=== clearing existing content ===");
			$("#content-container").empty()
			rt.load(rt100.history.hash)
        } else {
            rt.setupPage()
        }*/
	}
	rt.initGo2Top = function () {
		$("#go2top").css({'opacity':0});
		var browser_height = $(window).height() + 10;
		var scroll_top = $("#go2top").offset().top;
		rt.go2top(scroll_top, browser_height);	
		$(window).scroll(function () {
			rt.go2top($("#go2top").offset().top, browser_height);
		});
	}
	rt.go2top = function (a, h) {
		if( a > h )
			$("#go2top").stop().animate({opacity: 1}, 300);
		else
			$("#go2top").stop().animate({opacity: 0}, 300);
	}
	rt.init = function () {
		//	site succesfully loaded ...
		$('body').addClass('site');
		
		//	articles carousel
		rt100.articlesCarousel();

		//	top tabs
		rt100.initTabs();

		//	go2top button
		rt.initGo2Top();
		
		//	navigation menu / change on resize
		rt.resizeNav();
		$(window).bind('resize', rt.resizeNav);
		
		//	create debug
		if (($.browser.msie && rt.useDebug) || rt.forceDebug) {
			rt100.createDebug()
		}
		rt.broadcaster.addListener("hashChanged", function (hash) {
			rt.onHashChanged(hash)
		});
		rt100.history.init();
		rt100.info(rt100.history.hash + " ?= " + rt100.history.defaultHash);
		if (rt100.history.hash != rt100.history.defaultHash) {
			rt100.info("=== clearing existing content ===");
			$("#content-container").empty()
			rt.load(rt100.history.hash)
        } else {
            rt.setupPage()
        }
		
		rt100.playerAudio.init();
	}
	$(function () {
		rt100.init();
		rt100.info("rt100.init()");
	});
	
})(jQuery);


/*	History Class*/
rt100.history = new(function (b) {
	var a = this;
	a.links = [];
	a.intervalId = null;
	a.interval = 200;
	a.defaultHash = "";
	a.hash = "";
	a.newhash = "";
	a.inited = false;
	a.frameLoaded = false;
	a.managed = true;
	a.init = function () {
		rt100.info("History.init()");
		var c = window.location.href;
		a.defaultHash = window.location.pathname + window.location.search;
		rt100.info("-> defaultHash: " + a.defaultHash);
		rt100.info("-> hash: " + window.location.hash);
		rt100.info("=====");
		if (c.indexOf("#") >= 0 && window.location.hash.length > 1) {
			rt100.info(" HASH EXISTS: " + window.location.hash);
			a.hash = c.substr(c.indexOf("#") + 1)
		} else {
			rt100.info(" NO HASH EXISTS");
			a.hash = a.defaultHash;
			if (a.defaultHash.charAt(a.defaultHash.length - 1) == "#") {
				a.defaultHash = a.defaultHash.substr(0, a.defaultHash.length - 1)
			}
			if (a.hash.charAt(a.hash.length - 1) == "#") {
				a.hash = a.hash.substr(0, a.hash.length - 1)
			}
			window.location.hash = a.defaultHash
		}
		rt100.info("-> defaultHash: " + a.defaultHash);
		rt100.info("-> hash: " + a.hash);
		if (b.browser.safari == true && (b.browser.version.indexOf("418") != -1 || b.browser.version.indexOf("419") != -1)) {
			a.managed = false
		}
		var d = self.location.search;
		if (d.indexOf("unmanaged=") > -1) {
			a.managed = false
		}
		a.inited = true;
		a.intervalId = setInterval("rt100.history.checkHash()", a.interval)
	};
	a.checkHash = function () {
		var d = window.location.href;
		var c;
		if (d.indexOf("#") != -1) {
			c = (d.substr(d.indexOf("#")).substr(1))
		}
		c = (c) ? (c) : (a.defaultHash);
		if (c.toLowerCase() != a.hash.toLowerCase()) {
			a.hash = c;
			a.links.push(c);
			rt100.broadcaster.dispatchEvent("hashChanged", a.hash)
		}
	};
	a.onFrameLoaded = function (c) {
		rt100.info("onFrameLoaded = " + c);
		if (rt100.history.inited && b.browser.msie == true && b.browser.version >= 7) {
			if (c.indexOf("/HASH/") > -1) {
				c = c.replace("/HASH/", "#")
			}
			window.location.hash = c
		} else {}
	};
	a.clearHash = function () {
		a.setHash("")
	};
	a.setHash = function (c) {
		rt100.info("History.setHash(" + c + ")");
		if (c.charAt(0) != "/") {
			c = "/" + c
		}
		if (a.managed) {
			var d = window.location.href;
			if (d.indexOf("#") != -1) {
				d = d.substr(0, d.indexOf("#"))
			}
			d = d + "#" + c;
			rt100.info(" applying hash: [" + c + "]");
			if ((b.browser.msie == true && b.browser.version >= 7) || b.browser.safari == true) {
				if (c.indexOf("#") > -1) {
					c = c.replace("#", "/HASH/")
				}
				rt100.info("Stripped # and replaced with /HASH/: " + c);
				if (b.browser.msie == true && b.browser.version >= 7) {
					rt100.info("setting IE history frame with: " + c);
					b("#historyFrame").attr("src", "/history.html?" + c)
				} else {
					window.location.hash = c
				}
			} else {
				window.location.hash = c
			}
		} else {
			a.hash = c;
			rt100.broadcaster.dispatchEvent("hashChanged", a.hash)
		}
	};
	a.getHash = function () {
		return a.hash
	};
	a.hasBack = function () {
		if (a.links.length > 1) {
			return true
		}
		return false
	};
	a.back = function () {
		if (a.hasBack()) {
			a.links.pop();
			var c = a.links.pop();
			a.setHash(c)
		}
	}
})(jQuery);

function onFrameLoaded(a) {
	if ($.browser.msie == true) {
	rt100.history.onFrameLoaded(a)
	}
}

rt100.playerAudio = new(function (b) {
    var c = 5;
    var mp = this;
    mp.isOpen = false;
    mp.widgetId = "floating-mplayer";
    mp.isPlayerLoaded = false;
    mp.autoPlay = false;
    mp.init = function () {
		
		rt100.info("playerAudio.init()");
		
		if( $('#'+mp.widgetId).length > 0 ) {
			var mp_height = $('.mp-object', '#'+mp.widgetId).height() + 4;
			$('#mp-close').css({'height': mp_height+'px'})
			$('#mp-closed').bind('click', function(){ mp.toggle(); });
			$('#mp-close').bind('click', function(){ mp.toggle(); });
		}
	};
	mp.play = function (s) {
		if(s == '')
			return false;
			
		if (!mp.isOpen){
            mp.open();
		} else {
			mp.close();
			mp.open();
		}
		$('#mp-content', '#'+mp.widgetId).html(s);
	};
	mp.toggle = function () {
        if (!mp.isOpen) {
            mp.open()
        } else {
            mp.close()
        }
    };
	mp.open = function () {
		$('#'+mp.widgetId).animate({'left': -279}, 150, 'linear', function(){
			var t = this;
			$(t).removeClass('closed').addClass('opened');
			$('#mp-closed', t).hide(10, function(){
				var mp_height = $('.mp-object', t).height() + 4;
				$('#mp-close').css({'height': mp_height+'px'})
				$(t).animate({'left': 0}, 550, 'linear')
				mp.isOpen = true
			});
		});
	};
	mp.close = function () {
		$('#'+mp.widgetId).animate({'left': -279}, 550, 'linear', function(){
			var t = this;
			$(t).removeClass('opened').addClass('closed'); 
			$('#mp-closed', t).show(10, function(){
				var mp_height = $('.mp-object', t).height() + 4;
				$('#mp-close').css({'height': mp_height+'px'})
				$(t).animate({'left': -211}, 150, 'linear')
//				$('#mp-content', '#'+mp.widgetId).html('Nothing to play ... please choose an audio.');
				mp.isOpen = false
			})
		})
	};
	
})(jQuery);

(function($) { 
	$.fn.formatComments = function() {
		return this.each(function() {
			var t = $(this);
			var settings = $('.commentsSettings', t);
			var pageUrl = $(settings).attr('pageUrl');
			var totalComments = parseInt($(settings).attr('totalComments'));
			var perpageComments = parseInt($(settings).attr('commentsPerPage'));
			var pageId = parseInt($(settings).attr('pageId'));
			
			$('.showmeMore', t).bind('click', function(e){
				var a = $(this);
				var pageComments = parseInt($(settings).attr('pageComments'));
				var nrofComments = parseInt($(a).prev().find('font').text());
				e.preventDefault();
				e.stopPropagation();
				$(a).hide().spin();
				
				if(nrofComments >= totalComments) {
					$('.spinner', t).css({'visibility': 'hidden'});
					$(a).hide();
				} else {
					try {
						$.ajax({
							type: "GET",
							url: pageUrl+'?comments='+pageId+'&page='+(pageComments+1),
							contentType: "text/html; charset=utf-8",
							error: function (XMLHttpRequest, textStatus, errorThrown) {
								alert("Page load error. Try again later");
							},
							success: function (response, textStatus) {
								$('.spinner', t).css({'visibility': 'hidden'})
								if (textStatus == "success") {
									//$(t).append(response);
									//$(response).insertBefore('.toolbar', t);
									$('.toolbar', t).before(response);
									$(settings).attr('pageComments', pageComments+1);
									$(a).show();
									if( (perpageComments * $(settings).attr('pageComments')) <= totalComments )
										$(a).prev().find('font').text(perpageComments * $(settings).attr('pageComments'));
									else {
										$(a).prev().find('font').text(totalComments);
										$(a).hide();
									}
								}
							}
						})
						} catch(err) {
						alert("Page Loading Error")
					}
				}
			})
		});
	};
})(jQuery);


/*
 * jQuery Form Plugin
 * version: 2.31 (09-SEP-2009)
 * @requires jQuery v1.2.2 or later
 *
 * Examples and documentation at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
(function(b){b.fn.ajaxSubmit=function(s){if(!this.length){a("ajaxSubmit: skipping submit process - no element selected");return this}if(typeof s=="function"){s={success:s}}var e=b.trim(this.attr("action"));if(e){e=(e.match(/^([^#]+)/)||[])[1]}e=e||window.location.href||"";s=b.extend({url:e,type:this.attr("method")||"GET"},s||{});var u={};this.trigger("form-pre-serialize",[this,s,u]);if(u.veto){a("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(s.beforeSerialize&&s.beforeSerialize(this,s)===false){a("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var m=this.formToArray(s.semantic);if(s.data){s.extraData=s.data;for(var f in s.data){if(s.data[f] instanceof Array){for(var g in s.data[f]){m.push({name:f,value:s.data[f][g]})}}else{m.push({name:f,value:s.data[f]})}}}if(s.beforeSubmit&&s.beforeSubmit(m,this,s)===false){a("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[m,this,s,u]);if(u.veto){a("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var d=b.param(m);if(s.type.toUpperCase()=="GET"){s.url+=(s.url.indexOf("?")>=0?"&":"?")+d;s.data=null}else{s.data=d}var t=this,l=[];if(s.resetForm){l.push(function(){t.resetForm()})}if(s.clearForm){l.push(function(){t.clearForm()})}if(!s.dataType&&s.target){var p=s.success||function(){};l.push(function(j){b(s.target,s.parent).html(j).each(p,arguments)})}else{if(s.success){l.push(s.success)}}s.success=function(q,k){for(var n=0,j=l.length;n<j;n++){l[n].apply(s,[q,k,t])}};var c=b("input:file",this).fieldValue();var r=false;for(var i=0;i<c.length;i++){if(c[i]){r=true}}var h=false;if(s.iframe||r||h){if(s.closeKeepAlive){b.get(s.closeKeepAlive,o)}else{o()}}else{b.ajax(s)}this.trigger("form-submit-notify",[this,s]);return this;function o(){var w=t[0];if(b(":input[name=submit]",w).length){alert('Error: Form elements must not be named "submit".');return}var q=b.extend({},b.ajaxSettings,s);var G=b.extend(true,{},b.extend(true,{},b.ajaxSettings),q);var v="jqFormIO"+(new Date().getTime());var C=b('<iframe id="'+v+'" name="'+v+'" src="about:blank" />');var E=C[0];C.css({position:"absolute",top:"-1000px",left:"-1000px"});var F={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;C.attr("src","about:blank")}};var D=q.global;if(D&&!b.active++){b.event.trigger("ajaxStart")}if(D){b.event.trigger("ajaxSend",[F,q])}if(G.beforeSend&&G.beforeSend(F,G)===false){G.global&&b.active--;return}if(F.aborted){return}var k=0;var z=0;var j=w.clk;if(j){var x=j.name;if(x&&!j.disabled){s.extraData=s.extraData||{};s.extraData[x]=j.value;if(j.type=="image"){s.extraData[name+".x"]=w.clk_x;s.extraData[name+".y"]=w.clk_y}}}setTimeout(function(){var J=t.attr("target"),H=t.attr("action");w.setAttribute("target",v);if(w.getAttribute("method")!="POST"){w.setAttribute("method","POST")}if(w.getAttribute("action")!=q.url){w.setAttribute("action",q.url)}if(!s.skipEncodingOverride){t.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})}if(q.timeout){setTimeout(function(){z=true;A()},q.timeout)}var I=[];try{if(s.extraData){for(var K in s.extraData){I.push(b('<input type="hidden" name="'+K+'" value="'+s.extraData[K]+'" />').appendTo(w)[0])}}C.appendTo("body");E.attachEvent?E.attachEvent("onload",A):E.addEventListener("load",A,false);w.submit()}finally{w.setAttribute("action",H);J?w.setAttribute("target",J):t.removeAttr("target");b(I).remove()}},10);var y=50;function A(){if(k++){return}E.detachEvent?E.detachEvent("onload",A):E.removeEventListener("load",A,false);var H=true;try{if(z){throw"timeout"}var I,K;K=E.contentWindow?E.contentWindow.document:E.contentDocument?E.contentDocument:E.document;if(K.body==null||K.body.innerHTML==""){if(--y){k=0;setTimeout(A,100);return}a("Could not access iframe DOM after 50 tries.");return}F.responseText=K.body?K.body.innerHTML:null;F.responseXML=K.XMLDocument?K.XMLDocument:K;F.getResponseHeader=function(M){var L={"content-type":q.dataType};return L[M]};if(q.dataType=="json"||q.dataType=="script"){var n=K.getElementsByTagName("textarea")[0];F.responseText=n?n.value:F.responseText}else{if(q.dataType=="xml"&&!F.responseXML&&F.responseText!=null){F.responseXML=B(F.responseText)}}I=b.httpData(F,q.dataType)}catch(J){H=false;b.handleError(q,F,"error",J)}if(H){q.success(I,"success");if(D){b.event.trigger("ajaxSuccess",[F,q])}}if(D){b.event.trigger("ajaxComplete",[F,q])}if(D&&!--b.active){b.event.trigger("ajaxStop")}if(q.complete){q.complete(F,H?"success":"error")}setTimeout(function(){C.remove();F.responseXML=null},100)}function B(n,H){if(window.ActiveXObject){H=new ActiveXObject("Microsoft.XMLDOM");H.async="false";H.loadXML(n)}else{H=(new DOMParser()).parseFromString(n,"text/xml")}return(H&&H.documentElement&&H.documentElement.tagName!="parsererror")?H:null}}};b.fn.ajaxForm=function(c){return this.ajaxFormUnbind().bind("submit.form-plugin",function(){b(this).ajaxSubmit(c);return false}).each(function(){b(":submit,input:image",this).bind("click.form-plugin",function(f){var d=this.form;d.clk=this;if(this.type=="image"){if(f.offsetX!=undefined){d.clk_x=f.offsetX;d.clk_y=f.offsetY}else{if(typeof b.fn.offset=="function"){var g=b(this).offset();d.clk_x=f.pageX-g.left;d.clk_y=f.pageY-g.top}else{d.clk_x=f.pageX-this.offsetLeft;d.clk_y=f.pageY-this.offsetTop}}}setTimeout(function(){d.clk=d.clk_x=d.clk_y=null},10)})})};b.fn.ajaxFormUnbind=function(){this.unbind("submit.form-plugin");return this.each(function(){b(":submit,input:image",this).unbind("click.form-plugin")})};b.fn.formToArray=function(q){var p=[];if(this.length==0){return p}var d=this[0];var h=q?d.getElementsByTagName("*"):d.elements;if(!h){return p}for(var k=0,m=h.length;k<m;k++){var e=h[k];var f=e.name;if(!f){continue}if(q&&d.clk&&e.type=="image"){if(!e.disabled&&d.clk==e){p.push({name:f,value:b(e).val()});p.push({name:f+".x",value:d.clk_x},{name:f+".y",value:d.clk_y})}continue}var r=b.fieldValue(e,true);if(r&&r.constructor==Array){for(var g=0,c=r.length;g<c;g++){p.push({name:f,value:r[g]})}}else{if(r!==null&&typeof r!="undefined"){p.push({name:f,value:r})}}}if(!q&&d.clk){var l=b(d.clk),o=l[0],f=o.name;if(f&&!o.disabled&&o.type=="image"){p.push({name:f,value:l.val()});p.push({name:f+".x",value:d.clk_x},{name:f+".y",value:d.clk_y})}}return p};b.fn.formSerialize=function(c){return b.param(this.formToArray(c))};b.fn.fieldSerialize=function(d){var c=[];this.each(function(){var h=this.name;if(!h){return}var f=b.fieldValue(this,d);if(f&&f.constructor==Array){for(var g=0,e=f.length;g<e;g++){c.push({name:h,value:f[g]})}}else{if(f!==null&&typeof f!="undefined"){c.push({name:this.name,value:f})}}});return b.param(c)};b.fn.fieldValue=function(h){for(var g=[],e=0,c=this.length;e<c;e++){var f=this[e];var d=b.fieldValue(f,h);if(d===null||typeof d=="undefined"||(d.constructor==Array&&!d.length)){continue}d.constructor==Array?b.merge(g,d):g.push(d)}return g};b.fieldValue=function(c,j){var e=c.name,p=c.type,q=c.tagName.toLowerCase();if(typeof j=="undefined"){j=true}if(j&&(!e||c.disabled||p=="reset"||p=="button"||(p=="checkbox"||p=="radio")&&!c.checked||(p=="submit"||p=="image")&&c.form&&c.form.clk!=c||q=="select"&&c.selectedIndex==-1)){return null}if(q=="select"){var k=c.selectedIndex;if(k<0){return null}var m=[],d=c.options;var g=(p=="select-one");var l=(g?k+1:d.length);for(var f=(g?k:0);f<l;f++){var h=d[f];if(h.selected){var o=h.value;if(!o){o=(h.attributes&&h.attributes.value&&!(h.attributes.value.specified))?h.text:h.value}if(g){return o}m.push(o)}}return m}return c.value};b.fn.clearForm=function(){return this.each(function(){b("input,select,textarea",this).clearFields()})};b.fn.clearFields=b.fn.clearInputs=function(){return this.each(function(){var d=this.type,c=this.tagName.toLowerCase();if(d=="text"||d=="password"||c=="textarea"){this.value=""}else{if(d=="checkbox"||d=="radio"){this.checked=false}else{if(c=="select"){this.selectedIndex=-1}}}})};b.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};b.fn.enable=function(c){if(c==undefined){c=true}return this.each(function(){this.disabled=!c})};b.fn.selected=function(c){if(c==undefined){c=true}return this.each(function(){var d=this.type;if(d=="checkbox"||d=="radio"){this.checked=c}else{if(this.tagName.toLowerCase()=="option"){var e=b(this).parent("select");if(c&&e[0]&&e[0].type=="select-one"){e.find("option").selected(false)}this.selected=c}}})};function a(){if(b.fn.ajaxSubmit.debug&&window.console&&window.console.log){window.console.log("[jquery.form] "+Array.prototype.join.call(arguments,""))}}})(jQuery);


/*
 * Metadata - jQuery plugin for parsing metadata from elements
 *
 * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.metadata.js 4187 2007-12-16 17:15:27Z joern.zaefferer $
 *
 */

/**
 * Sets the type of metadata to use. Metadata is encoded in JSON, and each property
 * in the JSON will become a property of the element itself.
 *
 * There are three supported types of metadata storage:
 *
 *   attr:  Inside an attribute. The name parameter indicates *which* attribute.
 *          
 *   class: Inside the class attribute, wrapped in curly braces: { }
 *   
 *   elem:  Inside a child element (e.g. a script tag). The
 *          name parameter indicates *which* element.
 *          
 * The metadata for an element is loaded the first time the element is accessed via jQuery.
 *
 * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
 * matched by expr, then redefine the metadata type and run another $(expr) for other elements.
 * 
 * @name $.metadata.setType
 *
 * @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
 * @before $.metadata.setType("class")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from the class attribute
 * 
 * @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
 * @before $.metadata.setType("attr", "data")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from a "data" attribute
 * 
 * @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
 * @before $.metadata.setType("elem", "script")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from a nested script element
 * 
 * @param String type The encoding type
 * @param String name The name of the attribute to be used to get metadata (optional)
 * @cat Plugins/Metadata
 * @descr Sets the type of encoding to be used when loading metadata for the first time
 * @type undefined
 * @see metadata()
 */

(function($) {

$.extend({
	metadata : {
		defaults : {
			type: 'class',
			name: 'metadata',
			cre: /({.*})/,
			single: 'metadata'
		},
		setType: function( type, name ){
			this.defaults.type = type;
			this.defaults.name = name;
		},
		get: function( elem, opts ){
			var settings = $.extend({},this.defaults,opts);
			// check for empty string in single property
			if ( !settings.single.length ) settings.single = 'metadata';
			
			var data = $.data(elem, settings.single);
			// returned cached data if it already exists
			if ( data ) return data;
			
			data = "{}";
			
			if ( settings.type == "class" ) {
				var m = settings.cre.exec( elem.className );
				if ( m )
					data = m[1];
			} else if ( settings.type == "elem" ) {
				if( !elem.getElementsByTagName )
					return undefined;
				var e = elem.getElementsByTagName(settings.name);
				if ( e.length )
					data = $.trim(e[0].innerHTML);
			} else if ( elem.getAttribute != undefined ) {
				var attr = elem.getAttribute( settings.name );
				if ( attr )
					data = attr;
			}
			
			if ( data.indexOf( '{' ) <0 )
			data = "{" + data + "}";
			
			data = eval("(" + data + ")");
			
			$.data( elem, settings.single, data );
			return data;
		}
	}
});

/**
 * Returns the metadata object for the first member of the jQuery object.
 *
 * @name metadata
 * @descr Returns element's metadata object
 * @param Object opts An object contianing settings to override the defaults
 * @type jQuery
 * @cat Plugins/Metadata
 */
$.fn.metadata = function( opts ){
	return $.metadata.get( this[0], opts );
};

})(jQuery);


/*
 * jQuery validation plug-in 1.5.5
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
 * http://docs.jquery.com/Plugins/Validation
 *
 * Copyright (c) 2006 - 2008 Jörn Zaefferer
 *
 * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("<input type='hidden'/>").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submitButton){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(a.value);},filled:function(a){return!!$.trim(a.value);},unchecked:function(a){return!a.checked;}});$.validator=function(options,form){this.settings=$.extend({},$.validator.defaults,options);this.currentForm=form;this.init();};$.validator.format=function(source,params){if(arguments.length==1)return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};if(arguments.length>2&&params.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);},highlight:function(element,errorClass,validClass){$(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,errorClass,validClass){$(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",dateDE:"Bitte geben Sie ein gültiges Datum ein.",number:"Please enter a valid number.",numberDE:"Bitte geben Sie eine Nummer ein.",digits:"Please enter only digits",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator");validator.settings["on"+event.type]&&validator.settings["on"+event.type].call(validator,this[0]);}$(this.currentForm).delegate("focusin focusout keyup",":text, :password, :file, select, textarea",delegate).delegate("click",":radio, :checkbox",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus();}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.formSubmitted=false;this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id
+", check the '"+rule.method+"' method");throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined)return arguments[i];}return undefined;},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customMetaMessage(element,method),!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method);if(typeof message=="function")message=message.call(this,rule.parameters,element);this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){return this.errors().filter("[for='"+this.idOrName(element)+"']");},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",previous={old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message||$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName.toLowerCase()){case'select':var options=$("option:selected",element);return options.length>0&&(element.type=="select-multiple"||($.browser.msie&&!(options[0].attributes['value'].specified)?options[0].text:options[0].value).length>0);case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};this.settings.messages[element.name].remote=typeof previous.message=="function"?previous.message(value):previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){var valid=response===true;if(valid){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};errors[element.name]=previous.message=response||validator.defaultMessage(element,"remote");validator.showErrors(errors);}previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},dateDE:function(value,element){return this.optional(element)||/^\d\d?\.\d\d?\.\d\d\d?\d?$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},numberDE:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:\.\d{3})+)(?:,\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,'|'):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){return value==$(param).val();}}});$.format=$.validator.format;})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){if($.browser.msie)return false;this.addEventListener(original,$.event.special[fix].handler,true);},teardown:function(){if($.browser.msie)return false;this.removeEventListener(original,$.event.special[fix].handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};});$.extend($.fn,{delegate:function(type,delegate,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});},triggerEvent:function(type,target){return this.triggerHandler(type,[$.event.fix({type:type,target:target})]);}})})(jQuery);

/*
 * Translated default messages for the jQuery validation plugin.
 * Language: RO
 * Author: Elzo Valugi - http://www.valugi.ro
 */
jQuery.extend(jQuery.validator.messages, {
  required: "Acest câmp este obligatoriu.",
  remote: "Trebuie să completezi acest câmp.",
  email: "Adresa de email nu este validă",
  url: "Trebuie să introduci o adresă URL validă.",
  date: "Te rugăm să introduci o dată corectă.",
  dateISO: "Te rugăm să introduci o dată (ISO) corectă.",
  number: "Trebuie să introduci un număr întreg valid.",
  digits: "Trebuie să introduci doar cifre.",
  creditcard: "Te rugăm să introduci un numar de carte de credit valid.",
  equalTo: "Trebuie să reintroduci valoarea.",
  accept: "Trebuie să introduci o valoare cu o extensie validă.",
  maxlength: jQuery.validator.format("Trebuie să nu introduci mai mult de {0} caractere."),
  minlength: jQuery.validator.format("Trebuie să introduci cel puțin {0} caractere."),
  rangelength: jQuery.validator.format("Te rugăm să introduci o valoare între {0} și {1} caractere."),
  range: jQuery.validator.format("Te rugăm să introduci o valoare între {0} și {1}."),
  max: jQuery.validator.format("Te rugăm să introduci o valoare egal sau mai mică decât {0}."),
  min: jQuery.validator.format("Te rugăm să introduci o valoare egal sau mai mare decât {0}.")
});


/**
 * jQuery Lightbox
 * Version 0.5 - 11/29/2007
 * @author Warren Krewenki
 *
 * This package is distributed under the BSD license.
 * For full license information, see LICENSE.TXT
 *
 * Based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
 * Originally written to make use of the Prototype framework, and Script.acalo.us, now altered to use jQuery.
 *
 *
 **/

(function($){

	$.fn.lightbox = function(options){
		// build main options
		var opts = $.extend({}, $.fn.lightbox.defaults, options);
        
		return this.each(function(){
			$(this).click(function(){
    		    // initalize the lightbox
    		    initialize();
				start(this);
				return false;
			});
		});
		
	    /**
	     * initalize()
	     *
	     * @return void
	     * @author Warren Krewenki
	     */
	     
	    function initialize() {
		    $('#overlay').remove();
		    $('#lightbox').remove();
		    opts.inprogress = false;
		    
		    // if jsonData, build the imageArray from data provided in JSON format
            if(opts.jsonData && opts.jsonData.length > 0) {
                var parser = opts.jsonDataParser ? opts.jsonDataParser : $.fn.lightbox.parseJsonData;                
                opts.imageArray = [];
                opts.imageArray = parser(opts.jsonData);
	        }
		    
		    var outerImage = '<div id="outerImageContainer"><div id="imageContainer"><iframe id="lightboxIframe" /><img id="lightboxImage"><div id="hoverNav"><a href="javascript://" title="' + opts.strings.prevLinkTitle + '" id="prevLink"></a><a href="javascript://" id="nextLink" title="' + opts.strings.nextLinkTitle + '"></a></div><div id="loading"><a href="javascript://" id="loadingLink"><img src="'+opts.fileLoadingImage+'"></a></div></div></div>';
		    var imageData = '<div id="imageDataContainer" class="clearfix"><div id="imageData"><div id="imageDetails"><span id="caption"></span><span id="numberDisplay"></span></div><div id="bottomNav">';

		    if (opts.displayHelp)
			    imageData += '<span id="helpDisplay">' + opts.strings.help + '</span>';

		    imageData += '<a href="javascript://" id="bottomNavClose" title="' + opts.strings.closeTitle + '"><img src="'+opts.fileBottomNavCloseImage+'"></a></div></div></div>';

		    var string;

		    if (opts.navbarOnTop) {
		      string = '<div id="overlay"></div><div id="lightbox">' + imageData + outerImage + '</div>';
		      $("body").append(string);
		      $("#imageDataContainer").addClass('ontop');
		    } else {
		      string = '<div id="overlay"></div><div id="lightbox">' + outerImage + imageData + '</div>';
		      $("body").append(string);
		    }

		    $("#overlay").click(function(){ end(); }).hide();
		    $("#lightbox").click(function(){ end();}).hide();
		    $("#loadingLink").click(function(){ end(); return false;});
		    $("#bottomNavClose").click(function(){ end(); return false; });
		    $('#outerImageContainer').width(opts.widthCurrent).height(opts.heightCurrent);
		    $('#imageDataContainer').width(opts.widthCurrent);
		
		    if (!opts.imageClickClose) {
        		$("#lightboxImage").click(function(){ return false; });
        		$("#hoverNav").click(function(){ return false; });
		    }
	    };
	    
	    function getPageSize() {
		    var jqueryPageSize = new Array($(document).width(),$(document).height(), $(window).width(), $(window).height());
		    return jqueryPageSize;
	    };
	    
	    function getPageScroll() {
		    var xScroll, yScroll;

		    if (self.pageYOffset) {
			    yScroll = self.pageYOffset;
			    xScroll = self.pageXOffset;
		    } else if (document.documentElement && document.documentElement.scrollTop){  // Explorer 6 Strict
			    yScroll = document.documentElement.scrollTop;
			    xScroll = document.documentElement.scrollLeft;
		    } else if (document.body) {// all other Explorers
			    yScroll = document.body.scrollTop;
			    xScroll = document.body.scrollLeft;
		    }

		    var arrayPageScroll = new Array(xScroll,yScroll);
		    return arrayPageScroll;
	    };
	    
	    function pause(ms) {
		    var date = new Date();
		    var curDate = null;
		    do{curDate = new Date();}
		    while(curDate - date < ms);
	    };
	    
	    function start(imageLink) {
		    $("select, embed, object").hide();
		    var arrayPageSize = getPageSize();
		    $("#overlay").hide().css({width: '100%', height: arrayPageSize[1]+'px', opacity : opts.overlayOpacity}).fadeIn();
		    imageNum = 0;

		    // if data is not provided by jsonData parameter
            if(!opts.jsonData) {
                opts.imageArray = [];
		        // if image is NOT part of a set..
		        if(!imageLink.rel || (imageLink.rel == '')){
			        // add single image to Lightbox.imageArray
			        opts.imageArray.push(new Array(imageLink.href, opts.displayTitle ? imageLink.title : ''));
		        } else {
		        // if image is part of a set..
			        $("a").each(function(){
				        if(this.href && (this.rel == imageLink.rel)){
					        opts.imageArray.push(new Array(this.href, opts.displayTitle ? this.title : ''));
				        }
			        });
		        }
		    }
		
		    if(opts.imageArray.length > 1) {
		        for(i = 0; i < opts.imageArray.length; i++){
				    for(j = opts.imageArray.length-1; j>i; j--){
					    if(opts.imageArray[i][0] == opts.imageArray[j][0]){
						    opts.imageArray.splice(j,1);
					    }
				    }
			    }
			    while(opts.imageArray[imageNum][0] != imageLink.href) { imageNum++;}
		    }

		    // calculate top and left offset for the lightbox
		    var arrayPageScroll = getPageScroll();
		    var lightboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 10);
		    var lightboxLeft = arrayPageScroll[0];
		    $('#lightbox').css({top: lightboxTop+'px', left: lightboxLeft+'px'}).show();


		    if (!opts.slideNavBar)
			    $('#imageData').hide();

		    changeImage(imageNum);
	    };
	    
	    function changeImage(imageNum) {
		    if(opts.inprogress == false){
			    opts.inprogress = true;
			    opts.activeImage = imageNum;	// update global var

			    // hide elements during transition
			    $('#loading').show();
			    $('#lightboxImage').hide();
			    $('#hoverNav').hide();
			    $('#prevLink').hide();
			    $('#nextLink').hide();

			    if (opts.slideNavBar) { // delay preloading image until navbar will slide up
				    // $('#imageDataContainer').slideUp(opts.navBarSlideSpeed, $.fn.doChangeImage);
				    $('#imageDataContainer').hide();
				    $('#imageData').hide();
				    doChangeImage();
			    } else {
			        doChangeImage();
			    }
		    }
	    };
	    
	    function doChangeImage() {

		    imgPreloader = new Image();

		    // once image is preloaded, resize image container
		    imgPreloader.onload=function(){
		        var newWidth = imgPreloader.width;
		        var newHeight = imgPreloader.height;


			    if (opts.fitToScreen) {
		            var arrayPageSize = getPageSize();
				    var ratio;
				    var initialPageWidth = arrayPageSize[2] - 2 * opts.borderSize;
				    var initialPageHeight = arrayPageSize[3] - 200;

				    if (imgPreloader.height > initialPageHeight)
				    {
					    newWidth = parseInt((initialPageHeight/imgPreloader.height) * imgPreloader.width);
					    newHeight = initialPageHeight;
				    }
				    else if (imgPreloader.width > initialPageWidth)
				    {
					    newHeight = parseInt((initialPageWidth/imgPreloader.width) * imgPreloader.height);
					    newWidth = initialPageWidth;
				    }
			    }

			    $('#lightboxImage').attr('src', opts.imageArray[opts.activeImage][0])
							       .width(newWidth).height(newHeight);
			    resizeImageContainer(newWidth, newHeight);
		    };

		    imgPreloader.src = opts.imageArray[opts.activeImage][0];
	    };
	    
	    function end() {
		    disableKeyboardNav();
		    $('#lightbox').hide();
		    $('#overlay').fadeOut();
		    $('select, object, embed').show();
	    };
	    
	    function preloadNeighborImages(){
		    if(opts.loopImages && opts.imageArray.length > 1) {
	            preloadNextImage = new Image();
	            preloadNextImage.src = opts.imageArray[(opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1][0]
	            
	            preloadPrevImage = new Image();
	            preloadPrevImage.src = opts.imageArray[(opts.activeImage == 0) ? (opts.imageArray.length - 1) : opts.activeImage - 1][0]
	        } else {
		        if((opts.imageArray.length - 1) > opts.activeImage){
			        preloadNextImage = new Image();
			        preloadNextImage.src = opts.imageArray[opts.activeImage + 1][0];
		        }
		        if(opts.activeImage > 0){
			        preloadPrevImage = new Image();
			        preloadPrevImage.src = opts.imageArray[opts.activeImage - 1][0];
		        }
	        }
	    };
	    
	    function resizeImageContainer(imgWidth, imgHeight) {
		    // get current width and height
		    opts.widthCurrent = $("#outerImageContainer").outerWidth();
		    opts.heightCurrent = $("#outerImageContainer").outerHeight();
            
		    // get new width and height
		    var widthNew = (imgWidth  + (opts.borderSize * 2));
		    var heightNew = (imgHeight  + (opts.borderSize * 2));

		    // scalars based on change from old to new
		    opts.xScale = ( widthNew / opts.widthCurrent) * 100;
		    opts.yScale = ( heightNew / opts.heightCurrent) * 100;

		    // calculate size difference between new and old image, and resize if necessary
		    wDiff = opts.widthCurrent - widthNew;
		    hDiff = opts.heightCurrent - heightNew;

		    $('#imageDataContainer').animate({width: widthNew},opts.resizeSpeed,'linear');
		    $('#outerImageContainer').animate({width: widthNew},opts.resizeSpeed,'linear',function(){
			    $('#outerImageContainer').animate({height: heightNew},opts.resizeSpeed,'linear',function(){
				    showImage();
			    });
		    });

		    // if new and old image are same size and no scaling transition is necessary,
		    // do a quick pause to prevent image flicker.
		    if((hDiff == 0) && (wDiff == 0)){
			    if (jQuery.browser.msie){ pause(250); } else { pause(100);}
		    }

		    $('#prevLink').height(imgHeight);
		    $('#nextLink').height(imgHeight);
	    };
	    
	    function showImage() {
		    $('#loading').hide();
		    $('#lightboxImage').fadeIn("fast");
		    updateDetails();
		    preloadNeighborImages();

		    opts.inprogress = false;
	    };
	    
	    function updateDetails() {

		    $('#numberDisplay').html('');

		    if(opts.imageArray[opts.activeImage][1]){
			    $('#caption').html(opts.imageArray[opts.activeImage][1]).show();
		    }

		    // if image is part of set display 'Image x of x'
		    if(opts.imageArray.length > 1){
			    var nav_html;

			    nav_html = opts.strings.image + (opts.activeImage + 1) + opts.strings.of + opts.imageArray.length;

			    if (!opts.disableNavbarLinks) {
                    // display previous / next text links
                    if ((opts.activeImage) > 0 || opts.loopImages) {
                      nav_html = '<a title="' + opts.strings.prevLinkTitle + '" href="#" id="prevLinkText">' + opts.strings.prevLinkText + "</a>" + nav_html;
                    }

                    if (((opts.activeImage + 1) < opts.imageArray.length) || opts.loopImages) {
                      nav_html += '<a title="' + opts.strings.nextLinkTitle + '" href="#" id="nextLinkText">' + opts.strings.nextLinkText + "</a>";
                    }
                }

			    $('#numberDisplay').html(nav_html).show();
		    }

		    if (opts.slideNavBar) {
		        $("#imageData").slideDown(opts.navBarSlideSpeed);
		    } else {
			    $("#imageData").show();
		    }

		    var arrayPageSize = getPageSize();
		    $('#overlay').height(arrayPageSize[1]);
		    updateNav();
	    };
	    
	    function updateNav() {
		    if(opts.imageArray.length > 1){
			    $('#hoverNav').show();
                
                // if loopImages is true, always show next and prev image buttons 
                if(opts.loopImages) {
		            $('#prevLink,#prevLinkText').show().click(function(){
			            changeImage((opts.activeImage == 0) ? (opts.imageArray.length - 1) : opts.activeImage - 1); return false;
		            });
		            
		            $('#nextLink,#nextLinkText').show().click(function(){
			            changeImage((opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1); return false;
		            });
		        
		        } else {
			        // if not first image in set, display prev image button
			        if(opts.activeImage != 0){
				        $('#prevLink,#prevLinkText').show().click(function(){
					        changeImage(opts.activeImage - 1); return false;
				        });
			        }

			        // if not last image in set, display next image button
			        if(opts.activeImage != (opts.imageArray.length - 1)){
				        $('#nextLink,#nextLinkText').show().click(function(){

					        changeImage(opts.activeImage +1); return false;
				        });
			        }
                }
                
			    enableKeyboardNav();
		    }
	    };
	    
	    function keyboardAction(e) {
            var o = e.data.opts
		    var keycode = e.keyCode;
		    var escapeKey = 27;
            
		    var key = String.fromCharCode(keycode).toLowerCase();
            
		    if((key == 'x') || (key == 'o') || (key == 'c') || (keycode == escapeKey)){ // close lightbox
			    end();
		    } else if((key == 'p') || (keycode == 37)){ // display previous image
		        if(o.loopImages) {
		            disableKeyboardNav();
		            changeImage((o.activeImage == 0) ? (o.imageArray.length - 1) : o.activeImage - 1);
		        } 
		        else if(o.activeImage != 0){
				    disableKeyboardNav();
				    changeImage(o.activeImage - 1);
			    }
		    } else if((key == 'n') || (keycode == 39)){ // display next image
		        if (opts.loopImages) {
		            disableKeyboardNav();
		            changeImage((o.activeImage == (o.imageArray.length - 1)) ? 0 : o.activeImage + 1);
		        }
			    else if(o.activeImage != (o.imageArray.length - 1)){
				    disableKeyboardNav();
				    changeImage(o.activeImage + 1);
			    }
		    }
	    };
	    
	    function enableKeyboardNav() {
		    $(document).bind('keydown', {opts: opts}, keyboardAction);
	    };

	    function disableKeyboardNav() {
		    $(document).unbind('keydown');
	    };
	    
	};
    
    $.fn.lightbox.parseJsonData = function(data) {
        var imageArray = [];
        
        $.each(data, function(){
            imageArray.push(new Array(this.url, this.title));
        });
        
        return imageArray;
    };

	$.fn.lightbox.defaults = {
		fileLoadingImage : 'images/loading.gif',
		fileBottomNavCloseImage : 'images/closelabel.gif',
		overlayOpacity : 0.8,
		borderSize : 10,
		imageArray : new Array,
		activeImage : null,
		inprogress : false,
		resizeSpeed : 350,
		widthCurrent: 250,
		heightCurrent: 250,
		xScale : 1,
		yScale : 1,
		displayTitle: true,
		navbarOnTop: false,
		slideNavBar: false, // slide nav bar up/down between image resizing transitions
		navBarSlideSpeed: 350,
		displayHelp: false,
		strings : {
			help: ' \u2190 / P - previous image\u00a0\u00a0\u00a0\u00a0\u2192 / N - next image\u00a0\u00a0\u00a0\u00a0ESC / X - close image gallery',
			prevLinkTitle: 'previous image',
			nextLinkTitle: 'next image',
			prevLinkText:  '&laquo; Previous',
			nextLinkText:  'Next &raquo;',
			closeTitle: 'close image gallery',
			image: 'Image ',
			of: ' of '
		},
		fitToScreen: false,		// resize images if they are bigger than window
        disableNavbarLinks: false,
        loopImages: false,
        imageClickClose: true,
        jsonData: null,
        jsonDataParser: null
	};
	
})(jQuery);
