Array.prototype.indexAt= function(what){
	var L= this.length;
	var i= 0;
	while(i< L){
		if(this[i]=== what) return i;
		++i;
	}
	return -1;
}

String.prototype.pformat = function(){
    var argv = String.prototype.pformat.arguments;
    var val = this.replace(/\(%[\d]+\)/g , function(mch){
        var indx = mch.match(/\d+/g );
        if( indx && indx.length >= 1 ){
            var argIndx = parseInt( indx[0] );
            if (argIndx <= argv.length && argIndx > 0 )
                return argv[argIndx-1];
        }
        return "";
    });
    return val;
}

Date.prototype.add = function(day){
    var value = this.valueOf();
    value += day*24*60*60*1000.0;
    return new Date( value );
}

Date.fromISOString = function(strDate){
    var datetimeParts = (strDate+"").split("T");
    if (datetimeParts.length == 2 ){
        var dateParts = datetimeParts[0].split("-");
        var timeParts = datetimeParts[1].split(":");
        if ( dateParts.length == 3 && timeParts.length == 3 )
            return new Date(dateParts[0], dateParts[1]-1,dateParts[2], timeParts[0], timeParts[1], timeParts[2]);
    }
    
    return null;
}


Date.prototype.toUTCISOString = function(){
    function _zero( x , num){
        return ( x < 10 ? '0'+x : x);
    }
    function _4_zero( x , num){
        return ( x < 10 ? '000'+x : ( x < 100 ? '00'+x :  ( x < 1000 ? '0'+x : x) )  );
    }
    return _4_zero( this.getUTCFullYear() ) + '-'+ _zero( this.getUTCMonth() + 1) + '-' +
        _zero( this.getUTCDate() ) + 'T'+ _zero( this.getUTCHours() ) + ':' + _zero( this.getUTCMinutes() )+
        ':'+_zero( this.getUTCSeconds() )
}

Date.prototype.toISOString = function(){
    function _zero( x , num){
        return ( x < 10 ? '0'+x : x);
    }
    function _4_zero( x , num){
        return ( x < 10 ? '000'+x : ( x < 100 ? '00'+x :  ( x < 1000 ? '0'+x : x) )  );
    }
    return _4_zero( this.getFullYear() ) + '-'+ _zero( this.getMonth() + 1 ) + '-' +
        _zero( this.getDate() ) + 'T'+ _zero( this.getHours() ) + ':' + _zero( this.getMinutes() )+
        ':'+_zero( this.getSeconds() )
}

Date.prototype.zeroTime = function(){
    this.setMilliseconds( 0 );
    this.setSeconds( 0 );
    this.setMinutes( 0 );
    this.setHours( 0 );
    return this;
}

function isIntegerKey(evt)
{
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57))
    return false;

    return true;
}


$(document).ready(function(){
   $('.zeednax_elem').each(function(i,elem){
    eval($(elem).attr('zeednax'));
    })
});



$(document).ready(function(){

$("#loading").bind("ajaxSend", function(){
   $('#loading').show();
 }).bind("ajaxComplete", function(){
   $('#loading').hide();
 });
});


/*
Evaluate the comment inside the element specified by elem_selector paramater to parsed HTML code 
*/
function removeCommentTag(elem_selector){
    comment_nodes=$(elem_selector).contents().filter(
        function() {
            return this.nodeType == 8;
        });
    try{ /* IE comment element has innerHTML property, but firefox comment element has textContent property instead */
        var temp_str = comment_nodes[0].innerHTML;
        temp_str = temp_str.replace('<!--', '').replace('-->', '');
        $(elem_selector).html(temp_str);
    }catch(e){
        $(elem_selector).html(comment_nodes[0].textContent);
    }
}

/*
This function is used to show any DOM element as a dialog with animation during showing/hiding
e.g. We have <div id="dialog">Hello Word</div>
We can invoke: showDialog('dialog') to show the dialog
and showDialog('dialog', false) to hide it
*/
function showDialog(name,show, conf){
    if(show ==  undefined)
        show=true
    if (conf== undefined)
        conf = { modal: true, resizable: false }
        
    /* Disable scrolls in the body when the dialog open and enable them when it closes to prevent annoying body overflow */ 
    conf.open = function(event, ui) { /*$('body').addClass('zc_hidebodyscroll');*/ };
    conf.close = function(event, ui) {$(this).dialog('destroy')};

    if(show){
        $('#'+name).dialog(conf);
        $('#'+name).dialog('open').fadeIn('slow');
    }
    else{
        $('#'+name).dialog().fadeOut('normal', function(){$('#'+name).dialog('close'); });
    }
}

/* Show informative message */
function showInfoMessageBox(msg, timeout ,conf, callback){
    /* conf example: {modal:true, title:'Info', width:'auto', height:'auto', resizable: false}*/
    nodeText = '<div id="z_info_temp_dialog_box" class="hidden">' + '</div>';
    elem = $(nodeText);
    elem.html(msg);
    $('body').append(elem);
    
    $('body #z_info_temp_dialog_box').html()
    if (conf === undefined)
        conf = { modal: true, resizable: false }
        
    conf.open = function(event, ui) {  };
    conf.close = function(event, ui) {$('body #z_info_temp_dialog_box').remove();
                                            if (!(callback === undefined))
                                                callback.call(this);
                                            };
    $('#z_info_temp_dialog_box').dialog(conf);
    $('#z_info_temp_dialog_box').dialog('open').fadeIn('slow');
    
    if(timeout > 0){
        var funcText= "$('#z_info_temp_dialog_box').dialog().fadeOut('normal', function(){$('#z_info_temp_dialog_box').dialog('close'); $('#z_info_temp_dialog_box').dialog('destroy'); })";
        
        var t=setTimeout(funcText, timeout);
    }
}



function showModalOverlay(selector, opts){

    int_opts = {
    	mask: {
    		// you might also consider a "transparent" color for the mask
    		color: '#D9D9D9',
    		// load mask a little faster
    		loadSpeed: 200,
    		// very transparent
    		opacity: 0.5
    	},
    	// disable this for modal dialog-type of overlays
    	closeOnClick: false,
    	// load it immediately after the construction
    	load: true
    };    
    if(!(opts === undefined))
        $.extend(true, int_opts, opts)
    $.xLazyLoader({
        
        js: ['/zmedia/js/jquerytools/jquery.tools.min.js'],
        /*css: ['/zmedia/design/css/jquerytools/style.css'],*/
    
        name: 'z_overlay_files',
        success: function(){
            if(!$(selector).data("overlay"))
                $(selector).overlay(int_opts);
            else
                $(selector).data("overlay").load();
        },
        error: function(){
        }
    });
}

function showMessage(title, body, opts, callback){
    /* level is:  1 for info, 2 for warning, 3 for error 
    opts is a dictionary has value in  http://flowplayer.org/tools/overlay/index.html  in addition to timeout, className, level
    */
    int_opts = {timeout: 4000, className:'', level:1};
    timeout = 0;
    className = '';
    level = 1
    
    if(!(opts===undefined)){
        $.extend(true, int_opts, opts);
    }
    
    if(!(callback === undefined))
        int_opts['onClose'] = callback;
        
    timeout = int_opts.timeout;
    className = int_opts.className;
    level = int_opts.level;
    
    closebtn = '<span class="close z_close"></span>';
    hdr = '<h1 class="z_title">' + title + '</h1>'+ closebtn;
    cont = hdr + '<div class="z_message z_content">' + body + '</div>';
    if (level == 2)
        cont = hdr + '<div class="z_warning">' + body + '</div>'
    if(level==3)
        cont = hdr + '<div class="z_error">' + body + '</div>'
          
    if($('.z_overlay#z_overlay_message').length < 1){
        elem = '<div class="z_overlay '+className+'" id="z_overlay_message">' + cont + '</div>';
        $('body').append(elem);
    }
    else{
       $('.z_overlay#z_overlay_message').remove();
        elem = '<div class="hidden z_overlay '+className+'" id="z_overlay_message">' + cont + '</div>';
        $('body').append(elem);
    }

    showModalOverlay('.z_overlay#z_overlay_message', int_opts);
    if (timeout > 0){
        setTimeout( function(){$(".z_overlay#z_overlay_message").data("overlay").close();
        if(!(callback === undefined))
            callback();
        }, timeout );
    }
}


/*
scrollWin is used to scroll the window top to a certain DOM element.
*/
function scrollWin(node){
    $('html, body').animate({
        scrollTop: node.offset().top
    }, 1000);
}

/*
Used internally by flex
*/
function getBaseUrl(){
    return document.location.host;
}





/*
jQuery plugin to upload many js files dynamically
refer to: http://code.google.com/p/jquery-loadscript/  for examples
*/

(function($) {

var scripts = [];

function loadScript(url, callback, context) {

	var script = scripts[url] || (scripts[url] = {
		loaded    : false,
		callbacks : []
	});

	if(script.loaded) {
		return callback.apply(context);
	}

	script.callbacks.push({
		fn      : callback,
		context : context
	});

	if(script.callbacks.length == 1) {
		$.ajax({
			type     : 'GET',
			url      : url,
			dataType : 'script',
			cache    : true,
			success  : function() {
				script.loaded = true;
				$.each(script.callbacks, function() {
					this.fn.apply(this.context);
				});
				script.callbacks.length = 0;
			}
		});
	}

}

$.requireScript = function(url, callback, context, options) {

	if(typeof options === 'undefined' && context && context.hasOwnProperty('parallel')) {
		options = context;
		context = window;
	}

	options = $.extend({ parallel : true }, options);

	if(!$.isArray(url)) {
		return loadScript(url, callback, context);
	}

	var counter = 0;

	// parallel loading
	if(options.parallel) {
		return $.each(url, function() {
			loadScript(this, function() {
				if(++counter == url.length) {
					callback.apply(context);
				}
			});
		});
	}

	// sequential loading
	(function() {
		if(counter == url.length) {
			return callback.apply(context);
		}
		loadScript(url[counter++], arguments.callee);
	})();

};

$.requireScript.registerLoaded = function(url) {
	$.each($.makeArray(url), function() {
		(scripts[url] || (scripts[url] = {})).loaded = true;
	});
};

})(jQuery);





(function($){
/*
 * includeMany 1.2.1
 *
 * Copyright (c) 2009 Arash Karimzadeh (arashkarimzadeh.com)
 * Licensed under the MIT (MIT-LICENSE.txt)
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Date: Nov 11 2009
 */
$.chainclude = function(urls,finaly){
	var onload = function(callback,data){
						if(typeof urls.length!='undefined'){
							if(urls.length==0)
								return $.isFunction(finaly)
											?finaly(data)
											:null;
							urls.shift();
							return $.chainclude.load(urls,onload);
						}
						for(var item in urls){
							urls[item](data);
							delete urls[item];
							var count = 0;
							for(var i in urls)
								count++;
							return (count==0)
										?$.isFunction(finaly)?finaly(data):null
										:$.chainclude.load(urls,onload);
						}
					}
	$.chainclude.load(urls,onload);
};
$.chainclude.load = function(urls,onload){
	if(typeof urls=='object' && typeof urls.length=='undefined')
		for(var item in urls)
			return $.include.load(item,onload,urls[item].callback);
	urls = $.makeArray(urls);
	$.include.load(urls[0],onload,null);
};
$.include = function(urls,finaly){
	var luid = $.include.luid++;
	var onload = function(callback,data){
						if($.isFunction(callback))
							callback(data);
						if(--$.include.counter[luid]==0&&$.isFunction(finaly))
							finaly();
					}
	if(typeof urls=='object' && typeof urls.length=='undefined'){
		$.include.counter[luid] = 0;
		for(var item in urls)
			$.include.counter[luid]++;
		return $.each(urls,function(url,callback){$.include.load(url,onload,callback);});
	}
	urls = $.makeArray(urls);
	$.include.counter[luid] = urls.length;
	$.each(urls,function(){$.include.load(this,onload,null);});
}
$.extend(
	$.include,
	{
		luid: 0,
		counter: [],
		load: function(url,onload,callback){
			if($.include.exist(url))
				return onload(callback);
			if(/.css$/.test(url))
				$.include.loadCSS(url,onload,callback);
			else if(/.js$/.test(url))
				$.include.loadJS(url,onload,callback);
			else
				$.get(url,function(data){onload(callback,data)});
		},
		loadCSS: function(url,onload,callback){
			var css=document.createElement('link');
			css.setAttribute('type','text/css');
			css.setAttribute('rel','stylesheet');
			css.setAttribute('href',''+url);
			$('head').get(0).appendChild(css);
			$.browser.msie
				?$.include.IEonload(css,onload,callback)
				:onload(callback);//other browsers do not support it
		},
		loadJS: function(url,onload,callback){
			var js=document.createElement('script');
			js.setAttribute('type','text/javascript');
			js.setAttribute('src',''+url);
			$.browser.msie
				?$.include.IEonload(js,onload,callback)
				:js.onload = function(){onload(callback)};
			$('head').get(0).appendChild(js);
		},
		IEonload: function(elm,onload,callback){
			elm.onreadystatechange = 
					function(){
						if(this.readyState=='loaded'||this.readyState=='complete')
							onload(callback);
					}
		},
		exist: function(url){
			var fresh = false;
			$('head script').each(
								function(){
									if(/.css$/.test(url)&&this.href==url)
											return fresh=true;
									else if(/.js$/.test(url)&&this.src==url)
											return fresh=true;
								}
							);
			return fresh;
		}
	}
);
//
})(jQuery);





/***********************
    Humanize Date
************************/

(function($) {
	$.fn.cuteTime = function(options) {
        var settings = $.extend(
            {many_seconds:'seconds ago',one_minute:'a minute ago',many_minutes:' minutes ago',one_hour:'one hour ago',many_hours:'hours ago',yesterday:'yesterday at',many_days:'days ago at'}
	        ,options);
        var self = this;
		humanizeDate();
		return this;

		function humanizeDate(){
    	   self.each(function(){
    	        var other_time = parseDate( parseInt( $(this).attr('date_value') ) );
    			if (other_time == undefined || other_time==null || isNaN( other_time ) )
    			 other_time = parseDate($(this).html());
    			var right_now = new Date().getTime();
    			if ( !( other_time==null || other_time==undefined || isNaN(other_time.valueOf()) ) ){
    			     $(this).attr('date_value',other_time.getTime());
    			     interval = right_now -other_time;
    			     humanized_time = other_time.toLocaleString();
    			     if( interval>0){
    			         if (interval < 1000*60) /*less than one minute */
    			             humanized_time=settings.many_seconds.pformat( Math.floor(interval/1000) );
    		             else if (interval < 1000*60*2) /*one minute */
    			             humanized_time=settings.one_minute.pformat();
    		             else if (interval < 1000*60*60) /* many hours */
    			             humanized_time=settings.many_minutes.pformat( Math.floor(interval/1000/60) );
    		             else if (interval < 1000*60*60*2)/* one hour ago */
    			             humanized_time=settings.one_hour.pformat();
    		             else if (interval < 1000*60*60*24)/* many hour ago */
    			             humanized_time=settings.many_hours.pformat( Math.floor(interval/1000/60/60) );
    		              else if (interval < 1000*60*60*24*2)/* yesterday */
    			             humanized_time=settings.yesterday.pformat( other_time.toLocaleTimeString() );
    		             else if (interval < 1000*60*60*24*30)/* in month */
    			             humanized_time=settings.many_days.pformat(Math.floor(interval/1000/60/60/24) , other_time.toLocaleTimeString() );
    			     }
    			     $(this).html( humanized_time );
    			 }
    		});
    	}
	};

	function parseDate(the_date){
        var val = new Date(the_date);
        return isNaN(val.valueOf())?Date.fromISOString( the_date) :val
	}



})(jQuery);





/***********************
    xLazyLoader
************************/

/*
 * xLazyLoader 1.3 - Plugin for jQuery
 * 
 * Load js, css and images asynchron and get different callbacks
 *
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Depends:
 *   jquery.js
 *
 *  Copyright (c) 2008 Oleg Slobodskoi (ajaxsoft.de)
 */

(function($){

$.xLazyLoader =  function ( method, options ) {
    if ( typeof method == 'object' ) {
        options = method;
        method = 'init';
    };
    new xLazyLoader()[method](options);
};

$.xLazyLoader.defaults = {
    js: [], css: [], img: [],
    name: null,
    timeout: 20000,
    //success callback for all files
    success: function(){}, 
    //error callback - by load errors / timeout
    error: function(){},
    //complete callbck - by success or errors
    complete: function(){},
    //success callback for each file
    each: function(){} 
};

var head = document.getElementsByTagName("head")[0];

function xLazyLoader ()
{

    var self = this,
        s,
        loaded = [],
        errors = [],
        tTimeout,
        cssTimeout,
        toLoad,
        files = []
    ;
    
    this.init = function ( options )
    {
        if ( !options ) return;
        
        s = $.extend({}, $.xLazyLoader.defaults, options);
        toLoad = {js: s.js, css: s.css, img: s.img};
        
        $.each(toLoad, function( type, f ){
            if ( typeof f == 'string' )        
                f = f.split(',');
            files = files.concat(f);    
        });

        if ( !files.length ) {
            dispatchCallbacks('error');
            return;    
        };

        if (s.timeout) {
            tTimeout = setTimeout(function(){
                var handled = loaded.concat(errors);
                /* search for unhandled files */
                $.each(files, function(i, file){
                    $.inArray(file, handled) == -1 && errors.push(file);        
                });
                dispatchCallbacks('error');            
            }, s.timeout);
        };


        $.each(toLoad, function(type, urls){
            if ( $.isArray(urls) )
                $.each( urls, function(i, url){
                    load(type, url);
                });
            else if (typeof urls == 'string')
                load(type, urls);
        });
        


    };

    this.js = function ( src, callback, name )
    {
        var $script = $('script[src*="'+src+'"]');
        if ( $script.length ) {
            $script.attr('pending') ? $script.bind('scriptload',callback) : callback();
            return;
        };
        
        var s = document.createElement('script');
        s.setAttribute("type","text/javascript");
        s.setAttribute("src", src);
        s.setAttribute('id', name);
        s.setAttribute('pending', 1);
        // Mozilla only
        s.onerror = addError;
        
        
        $(s).bind('scriptload',function(){
            $(this).removeAttr('pending');
            callback();
             //unbind load event
             //timeout because of pending callbacks
            setTimeout(function(){
                $(s).unbind('scriptload');
            },10);
        });
        
        // jQuery doesn't handling onload event special for script tag,
        var done = false;
        s.onload = s.onreadystatechange = function() {
            if ( !done && ( !this.readyState || /loaded|complete/.test(this.readyState) ) ) {
                done = true;
                // Handle memory leak in IE
                s.onload = s.onreadystatechange = null;
                $(s).trigger('scriptload'); 
            };
        };
        head.appendChild(s);
    
    };

    this.css = function ( href, callback, name )
    {

        if ( $('link[href*="'+href+'"]').length ) {
            callback();
            return;
        };
        
        var link=document.createElement("link");
        link.setAttribute("rel", "stylesheet");
        link.setAttribute("type", "text/css");
        link.setAttribute("href", href);


        //var link = $('<link rel="stylesheet" type="text/css" media="all" href="'+href+'" id="'+name+'"></link>')[0];
        if ( $.browser.msie ) {
            link.onreadystatechange = function () {
                /loaded|complete/.test(link.readyState) && callback();
            };
        } else if ( $.browser.opera ) {
            link.onload = callback;
        } else {
            /* 
             * Mozilla, Safari, Chrome 
             * unfortunately it is inpossible to check if the stylesheet is really loaded or it is "HTTP/1.0 400 Bad Request"
             * the only way to do this is to check if some special properties  were set, so there is no error callback for stylesheets -
             * it fires alway success
             * 
             * There is also no access to sheet properties by crossdomain stylesheets, 
             * so we fire callback immediately
             */
            
            var hostname = location.hostname.replace('www.',''),
                hrefHostname = /http:/.test(href) ? /^(\w+:)?\/\/([^\/?#]+)/.exec( href )[2] : hostname;
            hostname != hrefHostname && $.browser.mozilla ?  
                callback()
                :  
                //stylesheet is from the same domain or it is not firefox
                (function(){
                    try {
                        link.sheet.cssRules;
                    } catch (e) {
                        cssTimeout = setTimeout(arguments.callee, 20);
                        return;
                    };
                    callback();
                })();
        };

                
        document.getElementsByTagName("head")[0].appendChild(link);
    };
    
    this.img = function ( src, callback )
    {
        var img = new Image();
        img.onload = callback;
        img.onerror = addError;
        img.src = src;
    };
    
    /* It works only for css */
    this.disable = function ( name )
    {    
        $('#lazy-loaded-'+name, head).attr('disabled', 'disabled');
    };

    /* It works only for css */
    this.enable = function ( name )
    {    
        $('#lazy-loaded-'+name, head).removeAttr('disabled');
    };
    
    /*
     * By removing js tag, script ist still living in browser memory,
     * css will be really destroyed
     */
    this.destroy = function ( name )
    {
        $('#lazy-loaded-'+name, head).remove();    
    };
    
    function load ( type, url ) {
        self[type](url, function(status) { 
            status == 'error' ? errors.push(url) : loaded.push(url) && s.each(url);
            checkProgress();
        }, 'lazy-loaded-'+ (s.name ? s.name : new Date().getTime()) );
    };
    
    function dispatchCallbacks ( status ) {
        s.complete(status, loaded, errors);
        s[status]( status=='error' ? errors : loaded);
        clearTimeout(tTimeout);
        clearTimeout(cssTimeout);
    };
    
    function checkProgress () {
        if (loaded.length == files.length) dispatchCallbacks('success')
        else if (loaded.length+errors.length == files.length) dispatchCallbacks('error');
    };
    
    function addError () {
        errors.push(this.src);    
        checkProgress();
    };

};

})(jQuery);









/*
 * jQuery BBQ: Back Button & Query Library - v1.3pre - 8/26/2010
 * http://benalman.com/projects/jquery-bbq-plugin/
 * 
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($,r){var h,n=Array.prototype.slice,t=decodeURIComponent,a=$.param,j,c,m,y,b=$.zs=$.zs||{},s,x,k,e=$.event.special,d="hashchange",B="querystring",F="fragment",z="elemUrlAttr",l="href",w="src",p=/^.*\?|#.*$/g,u,H,g,i,C,E={};function G(I){return typeof I==="string"}function D(J){var I=n.call(arguments,1);return function(){return J.apply(this,I.concat(n.call(arguments)))}}function o(I){return I.replace(H,"$2")}function q(I){return I.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(K,P,I,L,J){var R,O,N,Q,M;if(L!==h){N=I.match(K?H:/^([^#?]*)\??([^#]*)(#?.*)/);M=N[3]||"";if(J===2&&G(L)){O=L.replace(K?u:p,"")}else{Q=m(N[2]);L=G(L)?m[K?F:B](L):L;O=J===2?L:J===1?$.extend({},L,Q):$.extend({},Q,L);O=j(O);if(K){O=O.replace(g,t)}}R=N[1]+(K?C:O||!N[1]?"?":"")+O+M}else{R=P(I!==h?I:location.href)}return R}a[B]=D(f,0,q);a[F]=c=D(f,1,o);a.sorted=j=function(J,K){var I=[],L={};$.each(a(J,K).split("&"),function(P,M){var O=M.replace(/(?:%5B|=).*$/,""),N=L[O];if(!N){N=L[O]=[];I.push(O)}N.push(M)});return $.map(I.sort(),function(M){return L[M]}).join("&")};c.noEscape=function(J){J=J||"";var I=$.map(J.split(""),encodeURIComponent);g=new RegExp(I.join("|"),"g")};c.noEscape(",/");c.ajaxCrawlable=function(I){if(I!==h){if(I){u=/^.*(?:#!|#)/;H=/^([^#]*)(?:#!|#)?(.*)$/;C="#!"}else{u=/^.*#/;H=/^([^#]*)#?(.*)$/;C="#"}i=!!I}return i};c.ajaxCrawlable(0);$.deparam=m=function(L,I){var K={},J={"true":!0,"false":!1,"null":null};$.each(L.replace(/\+/g," ").split("&"),function(O,T){var N=T.split("="),S=t(N[0]),M,R=K,P=0,U=S.split("]["),Q=U.length-1;if(/\[/.test(U[0])&&/\]$/.test(U[Q])){U[Q]=U[Q].replace(/\]$/,"");U=U.shift().split("[").concat(U);Q=U.length-1}else{Q=0}if(N.length===2){M=t(N[1]);if(I){M=M&&!isNaN(M)?+M:M==="undefined"?h:J[M]!==h?J[M]:M}if(Q){for(;P<=Q;P++){S=U[P]===""?R.length:U[P];R=R[S]=P<Q?R[S]||(U[P+1]&&isNaN(U[P+1])?{}:[]):M}}else{if($.isArray(K[S])){K[S].push(M)}else{if(K[S]!==h){K[S]=[K[S],M]}else{K[S]=M}}}}else{if(S){K[S]=I?h:""}}});return K};function A(K,I,J){if(I===h||typeof I==="boolean"){J=I;I=a[K?F:B]()}else{I=G(I)?I.replace(K?u:p,""):I}return m(I,J)}m[B]=D(A,0);m[F]=y=D(A,1);$[z]||($[z]=function(I){return $.extend(E,I)})({a:l,base:l,iframe:w,img:w,input:w,form:"action",link:l,script:w});k=$[z];function v(L,J,K,I){if(!G(K)&&typeof K!=="object"){I=K;K=J;J=h}return this.each(function(){var O=$(this),M=J||k()[(this.nodeName||"").toLowerCase()]||"",N=M&&O.attr(M)||"";O.attr(M,a[L](N,K,I))})}$.fn[B]=D(v,B);$.fn[F]=D(v,F);b.pushState=s=function(L,I){if(G(L)&&/^#/.test(L)&&I===h){I=2}var K=L!==h,J=c(location.href,K?L:{},K?I:2);location.href=J};b.getState=x=function(I,J){return I===h||typeof I==="boolean"?y(I):y(J)[I]};b.removeState=function(I){var J={};if(I!==h){J=x();$.each($.isArray(I)?I:arguments,function(L,K){delete J[K]})}s(J,2)};e[d]=$.extend(e[d],{add:function(I){var K;function J(M){var L=M[F]=c();M.getState=function(N,O){return N===h||typeof N==="boolean"?m(L,N):m(L,O)[N]};K.apply(this,arguments)}if($.isFunction(I)){K=I;return J}else{K=I.handler;I.handler=J}}})})(jQuery,this);
/*
 * jQuery hashchange event - v1.3 - 7/21/2010
 * http://benalman.com/projects/jquery-hashchange-plugin/
 * 
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);





// implement JSON.stringify serialization
JSON.stringify = JSON.stringify || function (obj) {
	var t = typeof (obj);
	if (t != "object" || obj === null) {
		// simple data type
		if (t == "string") obj = '"'+obj+'"';
		return String(obj);
	}
	else {
		// recurse array or object
		var n, v, json = [], arr = (obj && obj.constructor == Array);
		for (n in obj) {
			v = obj[n]; t = typeof(v);
			if (t == "string") v = '"'+v+'"';
			else if (t == "object" && v !== null) v = JSON.stringify(v);
			json.push((arr ? "" : '"' + n + '":') + String(v));
		}
		return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}");
	}
};




/**
 * jQuery Cookie plugin
 *
 * Copyright (c) 2010 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
jQuery.cookie = function (key, value, options) {

    // key and at least value given, set cookie...
    if (arguments.length > 1 && String(value) !== "[object Object]") {
        options = jQuery.extend({}, options);

        if (value === null || value === undefined) {
            options.expires = -1;
        }

        if (typeof options.expires === 'number') {
            var days = options.expires, t = options.expires = new Date();
            t.setDate(t.getDate() + days);
        }

        value = String(value);

        return (document.cookie = [
            encodeURIComponent(key), '=',
            options.raw ? value : encodeURIComponent(value),
            options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
            options.path ? '; path=' + options.path : '',
            options.domain ? '; domain=' + options.domain : '',
            options.secure ? '; secure' : ''
        ].join(''));
    }

    // key and possibly options given, get cookie...
    options = value || {};
    var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};

