/**
 * jQuery Templates
 *
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Written by: Stan Lemon <stanlemon@mac.com>
 *
 * Based off of the Ext.Template library, available at:
 * http://www.extjs.com
 *
 * This library provides basic templating functionality, allowing for macro-based
 * templates within jQuery.
 *
 * Basic Usage:
 *
 * var t = $.template('<div id="foo">Hello ${name}, how are you ${question}? I am ${me:substr(0,10)}</div>');
 *
 * $(selector).append( t , {
 * name: 'Stan',
 * question: 'feeling',
 * me: 'doing quite well myself, thank you very much!'
 * });
 *
 * Requires: jQuery 1.2+
 *
 *
 * @todo Add callbacks to the DOM manipulation methods, so that events can be bound
 * to template nodes after creation.
 */
(function($j){

 /**
 * Create a New Template
 */
 $j.template = function(html, options) {
 return new $j.template.instance(html, options);
 };

 /**
 * Template constructor - Creates a new template instance.
 *
 * @param html The string of HTML to be used for the template.
 * @param options An object of configurable options. Currently
 * you can toggle compile as a boolean value and set a custom
 * template regular expression on the property regx by
 * specifying the key of the regx to use from the regx object.
 */
 $j.template.instance = function(html, options) {
 // If a custom regular expression has been set, grab it from the regx object
 if ( options && options['regx'] ) options.regx = this.regx[ options.regx ];

 this.options = $j.extend({
 compile: false,
 regx: this.regx.standard
 }, options || {});

 this.html = html;

 if (this.options.compile) {
 this.compile();
 }
 this.isTemplate = true;
 };

 /**
 * Regular Expression for Finding Variables
 *
 * The default pattern looks for variables in JSP style, the form of: ${variable}
 * There are also regular expressions available for ext-style variables and
 * jTemplate style variables.
 *
 * You can add your own regular expressions for variable ussage by doing.
 * $.extend({ $.template.re , {
 * myvartype: /...../g
 * }
 *
 * Then when creating a template do:
 * var t = $.template("<div>...</div>", { regx: 'myvartype' });
 */
 $j.template.regx = $j.template.instance.prototype.regx = {
 jsp: /\$\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
 ext: /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
 jtemplates: /\{\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}\}/g
 };

 /**
 * Set the standard regular expression to be used.
 */
 $j.template.regx.standard = $j.template.regx.jsp;

 /**
 * Variable Helper Methods
 *
 * This is a collection of methods which can be used within the variable syntax, ie:
 * ${variable:substr(0,30)} Which would only print a substring, 30 characters in length
 * begining at the first character for the variable named "variable".
 *
 * A basic substring helper is provided as an example of how you can define helpers.
 * To add more helpers simply do:
 * $.extend( $.template.helpers , {
 * sampleHelper: function() { ... }
 * });
 */
 $j.template.helpers = $j.template.instance.prototype.helpers = {
 substr : function(value, start, length){
 return String(value).substr(start, length);
 }
 };


 /**
 * Template Instance Methods
 */
 $j.extend( $j.template.instance.prototype, {

 /**
 * Apply Values to a Template
 *
 * This is the macro-work horse of the library, it receives an object
 * and the properties of that objects are assigned to the template, where
 * the variables in the template represent keys within the object itself.
 *
 * @param values An object of properties mapped to template variables
 */
 apply: function(values) {
 if (this.options.compile) {
 return this.compiled(values);
 } else {
 var tpl = this;
 var fm = this.helpers;

 var fn = function(m, name, format, args) {
 if (format) {
 if (format.substr(0, 5) == "this."){
 return tpl.call(format.substr(5), values[name], values);
 } else {
 if (args) {
 // quoted values are required for strings in compiled templates,
 // but for non compiled we need to strip them
 // quoted reversed for jsmin
 var re = /^\s*['"](.*)["']\s*$/;
 args = args.split(',');

 for(var i = 0, len = args.length; i < len; i++) {
 args[i] = args[i].replace(re, "$1");
 }
 args = [values[name]].concat(args);
 } else {
 args = [values[name]];
 }

 return fm[format].apply(fm, args);
 }
 } else {
 return values[name] !== undefined ? values[name] : "";
 }
 };

 return this.html.replace(this.options.regx, fn);
 }
 },

 /**
 * Compile a template for speedier usage
 */
 compile: function() {
 var sep = $j.browser.mozilla ? "+" : ",";
 var fm = this.helpers;

 var fn = function(m, name, format, args){
 if (format) {
 args = args ? ',' + args : "";

 if (format.substr(0, 5) != "this.") {
 format = "fm." + format + '(';
 } else {
 format = 'this.call("'+ format.substr(5) + '", ';
 args = ", values";
 }
 } else {
 args= ''; format = "(values['" + name + "'] == undefined ? '' : ";
 }
 return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'";
 };

 var body;

 if ($j.browser.mozilla) {
 body = "this.compiled = function(values){ return '" +
 this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.options.regx, fn) +
 "';};";
 } else {
 body = ["this.compiled = function(values){ return ['"];
 body.push(this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.options.regx, fn));
 body.push("'].join('');};");
 body = body.join('');
 }
 eval(body);
 return this;
 }
 });


 /**
 * Save a reference in this local scope to the original methods which we're
 * going to overload.
 **/
 var $_old = {
 domManip: $j.fn.domManip,
 text: $j.fn.text,
 html: $j.fn.html
 };

 /**
 * Overwrite the domManip method so that we can use things like append() by passing a
 * template object and macro parameters.
 */
 $j.fn.domManip = function( args, table, reverse, callback ) {
 if (args[0].isTemplate) {
 // Apply the template and it's arguments...
 args[0] = args[0].apply( args[1] );
 // Get rid of the arguements, we don't want to pass them on
 delete args[1];
 }

 // Call the original method
 var r = $_old.domManip.apply(this, arguments);

 return r;
 };

 /**
 * Overwrite the html() method
 */
 $j.fn.html = function( value , o ) {
 if (value && value.isTemplate) var value = value.apply( o );

 var r = $_old.html.apply(this, [value]);

 return r;
 };

 /**
 * Overwrite the text() method
 */
 $j.fn.text = function( value , o ) {
 if (value && value.isTemplate) var value = value.apply( o );

 var r = $_old.text.apply(this, [value]);

 return r;
 };

})(jQuery);

/**
 * Copyright (c) 2009 Sergiy Kovalchuk (serg472@gmail.com)
 * 
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * 
 * Following code is based on Element.mask() implementation from ExtJS framework (http://extjs.com/)
 *
 */
 var $j = jQuery.noConflict();
;(function($j){
 
 /**
 * Displays loading mask over selected element.
 *
 * @param label Text message that will be displayed on the top of a mask besides a spinner (optional). 
 * If not provided only mask will be displayed without a label or a spinner. 
 */
 $j.fn.mask = function(label){
 
 this.unmask();
 
 if(this.css("position") == "static") {
 this.addClass("masked-relative");
 }
 
 this.addClass("masked");
 
 var maskDiv = $j('<div class="loadmask"></div>');
 
 //auto height fix for IE
 if(navigator.userAgent.toLowerCase().indexOf("msie") > -1){
 maskDiv.height(this.height() + parseInt(this.css("padding-top")) + parseInt(this.css("padding-bottom")));
 maskDiv.width(this.width() + parseInt(this.css("padding-left")) + parseInt(this.css("padding-right")));
 }
 
 //fix for z-index bug with selects in IE6
 if(navigator.userAgent.toLowerCase().indexOf("msie 6") > -1){
 this.find("select").addClass("masked-hidden");
 }
 
 this.append(maskDiv);
 
 if(typeof label == "string") {
 var maskMsgDiv = $j('<div class="loadmask-msg" style="display:none;"></div>');
 maskMsgDiv.append('<div>' + label + '</div>');
 this.append(maskMsgDiv);
 
 //calculate center position
 maskMsgDiv.css("top", Math.round(this.height() / 2 - (maskMsgDiv.height() - parseInt(maskMsgDiv.css("padding-top")) - parseInt(maskMsgDiv.css("padding-bottom"))) / 2)+"px");
 maskMsgDiv.css("left", Math.round(this.width() / 2 - (maskMsgDiv.width() - parseInt(maskMsgDiv.css("padding-left")) - parseInt(maskMsgDiv.css("padding-right"))) / 2)+"px");
 
 maskMsgDiv.show();
 }
 
 };
 
 /**
 * Removes mask from the element.
 */
 $j.fn.unmask = function(label){
 this.find(".loadmask-msg,.loadmask").remove();
 this.removeClass("masked");
 this.removeClass("masked-relative");
 this.find("select").removeClass("masked-hidden");
 };
 
})(jQuery);
/**
 * jQuery.Preload
 * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com
 * Dual licensed under MIT and GPL.
 * Date: 3/25/2009
 *
 * @projectDescription Multifunctional preloader
 * @author Ariel Flesler
 * @version 1.0.8
 *
 * @id jQuery.preload
 * @param {String, jQuery, Array< String, <a>, <link>, <img> >} original Collection of sources to preload
 * @param {Object} settings Hash of settings.
 *
 * @id jQuery.fn.preload
 * @param {Object} settings Hash of settings.
 * @return {jQuery} Returns the same jQuery object, for chaining.
 *
 * @example Link Mode:
 * $j.preload( '#images a' );
 *
 * @example Rollover Mode:
 * $j.preload( '#images img', {
 * find:/\.(gif|jpg)/,
 * replace:'_over.$1'
 * });
 *
 * @example Src Mode:
 * $j.preload( [ 'red', 'blue', 'yellow' ], {
 * base:'images/colors/',
 * ext:'.jpg'
 * });
 *
 * @example Placeholder Mode:
 * $j.preload( '#images img', {
 * placeholder:'placeholder.jpg',
 * notFound:'notfound.jpg'
 * });
 *
 * @example Placeholder+Rollover Mode(High res):
 * $j.preload( '#images img', {
 * placeholder:true,
 * find:/\.(gif|jpg)/,
 * replace:'_high.$1'
 * });
 */
var $j = jQuery.noConflict(); 
;(function( $j ){

 var $preload = $j.preload = function( original, settings ){
 if( original.split ) // selector
 original = $j(original);

 settings = $j.extend( {}, $preload.defaults, settings );
 var sources = $j.map( original, function( source ){
 if( !source ) 
 return; // skip
 if( source.split ) // URL Mode
 return settings.base + source + settings.ext;
 var url = source.src || source.href; // save the original source
 if( typeof settings.placeholder == 'string' && source.src ) // Placeholder Mode, if it's an image, set it.
 source.src = settings.placeholder;
 if( url && settings.find ) // Rollover mode
 url = url.replace( settings.find, settings.replace );
 return url || null; // skip if empty string
 });

 var data = {
 loaded:0, // how many were loaded successfully
 failed:0, // how many urls failed
 next:0, // which one's the next image to load (index)
 done:0, // how many urls were tried
 /*
 index:0, // index of the related image 
 found:false, // whether the last one was successful
 */
 total:sources.length // how many images are being preloaded overall
 };
 
 if( !data.total ) // nothing to preload
 return finish();
 
 var imgs = $j(Array(settings.threshold+1).join('<img/>'))
 .load(handler).error(handler).bind('abort',handler).each(fetch);
 
 function handler( e ){
 data.element = this;
 data.found = e.type == 'load';
 data.image = this.src;
 data.index = this.index;
 var orig = data.original = original[this.index];
 data[data.found?'loaded':'failed']++;
 data.done++;

 // This will ensure that the images aren't "un-cached" after a while
 if( settings.enforceCache )
 $preload.cache.push( 
 $j('<img/>').attr('src',data.image)[0]
 );

 if( settings.placeholder && orig.src ) // special case when on placeholder mode
 orig.src = data.found ? data.image : settings.notFound || orig.src;
 if( settings.onComplete )
 settings.onComplete( data );
 if( data.done < data.total ) // let's continue
 fetch( 0, this );
 else{ // we are finished
 if( imgs && imgs.unbind )
 imgs.unbind('load').unbind('error').unbind('abort'); // cleanup
 imgs = null;
 finish();
 }
 };
 function fetch( i, img, retry ){
 // IE problem, can't preload more than 15
 if( img.attachEvent /* msie */ && data.next && data.next % $preload.gap == 0 && !retry ){
 setTimeout(function(){ fetch( i, img, true ); }, 0);
 return false;
 }
 if( data.next == data.total ) return false; // no more to fetch
 img.index = data.next; // save it, we'll need it.
 img.src = sources[data.next++];
 if( settings.onRequest ){
 data.index = img.index;
 data.element = img;
 data.image = img.src;
 data.original = original[data.next-1];
 settings.onRequest( data );
 }
 };
 function finish(){
 if( settings.onFinish )
 settings.onFinish( data );
 };
 };

 // each time we load this amount and it's IE, we must rest for a while, make it lower if you get stack overflow.
 $preload.gap = 14; 
 $preload.cache = [];
 
 $preload.defaults = {
 threshold:2, // how many images to load simultaneously
 base:'', // URL mode: a base url can be specified, it is prepended to all string urls
 ext:'', // URL mode:same as base, but it's appended after the original url.
 replace:'' // Rollover mode: replacement (can be left empty)
 /*
 enforceCache: false, // If true, the plugin will save a copy of the images in $.preload.cache
 find:null, // Rollover mode: a string or regex for the replacement
 notFound:'' // Placeholder Mode: Optional url of an image to use when the original wasn't found
 placeholder:'', // Placeholder Mode: url of an image to set while loading
 onRequest:function( data ){ ... }, // callback called every time a new url is requested
 onComplete:function( data ){ ... }, // callback called every time a response is received(successful or not)
 onFinish:function( data ){ ... } // callback called after all the images were loaded(or failed)
 */
 };

 $j.fn.preload = function( settings ){
 $preload( this, settings );
 return this;
 };

})( jQuery );
/*
 * jQuery HoverPulse Plugin by M. Alsup
 * Examples and docs at: http://malsup.com/jquery/hoverpulse/
 * Dual licensed under the MIT and GPL
 * Requires: jQuery v1.2.6 or later
 * @version: 1.01 26-FEB-2009
 */
var $j = jQuery.noConflict();
(function($j) {

$j.fn.hoverpulse = function(options) {
 // in 1.3+ we can fix mistakes with the ready state
 if (this.length == 0) {
 if (!$j.isReady && this.selector) {
 var s = this.selector, c = this.context;
 $j(function() {
 $j(s,c).hoverpulse(options);
 });
 }
 return this;
 }

 var opts = $j.extend({}, $j.fn.hoverpulse.defaults, options);

 // parent must be relatively positioned
 this.parent().css({ position: 'relative' });
 // pulsing element must be absolutely positioned
 this.css({ position: 'absolute', top: 0, left: 0 });

 this.each(function() {
 var $this = $j(this);
 var w = $this.width(), h = $this.height();

 $this.data('hoverpulse.size', { w: parseInt(w), h: parseInt(h) });
 });

 // bind hover event for behavior
 return this.hover(
 // hover over
 function() {
 var $this = $j(this);

 $this.parent().css('z-index', opts.zIndexActive);

 var size = $this.data('hoverpulse.size');
 var w = size.w, h = size.h;
 $this.stop().animate({
 top: ('-'+opts.size+'px'),
 left: ('-'+opts.size+'px'),
 height: (h+2*opts.size)+'px',
 width: (w+2*opts.size)+'px'
 }, opts.speed);
 },
 // hover out
 function() {

 var $this = $j(this);
 var size = $this.data('hoverpulse.size');
 var w = size.w, h = size.h;

 $this.stop().animate({
 top: 0,
 left: 0,
 height: (h+'px'),
 width: (w+'px')
 }, opts.speed, function() {
 $this.parent().css('z-index', opts.zIndexNormal);
 });
 }
 );
};

$j.fn.hoverpulse.defaults = {
 size: 20,
 speed: 200,
 zIndexActive: 100,
 zIndexNormal: 1
};

})(jQuery);

/*
 * jGFeed 1.0 - Google Feed API abstraction plugin for jQuery
 *
 * Copyright (c) 2009 jQuery HowTo
 *
 * Licensed under the GPL license:
 * http://www.gnu.org/licenses/gpl.html
 *
 * URL:
 * http://jquery-howto.blogspot.com
 *
 * Author URL:
 * http://me.boo.uz
 *
 */
(function($j){
 $j.extend({
 jGFeed : function(url, fnk, num, key){
 // Make sure url to get is defined
 if(url == null) return false;
 // Build Google Feed API URL
 var gurl = "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q="+url;
 if(num != null) gurl += "&num="+num;
 if(key != null) gurl += "&key="+key;
 // AJAX request the API
 $j.getJSON(gurl, function(data){
 if(typeof fnk == 'function')
 fnk.call(this, data.responseData.feed);
 else
 return false;
 });
 }
 });
})(jQuery);
