Date.prototype.setISO8601 = function(dString){
    var regexp = /(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)(:)?(\d\d)(\.\d+)?(Z|([+-])(\d\d)(:)?(\d\d))/;
    if (dString.toString().match(new RegExp(regexp))) {
        var d = dString.match(new RegExp(regexp));
        var offset = 0;
        this.setUTCDate(1);
        this.setUTCFullYear(parseInt(d[1], 10));
        this.setUTCMonth(parseInt(d[3], 10) - 1);
        this.setUTCDate(parseInt(d[5], 10));
        this.setUTCHours(parseInt(d[7], 10));
        this.setUTCMinutes(parseInt(d[9], 10));
        this.setUTCSeconds(parseInt(d[11], 10));
        if (d[12]) 
            this.setUTCMilliseconds(parseFloat(d[12]) * 1000);
        else 
            this.setUTCMilliseconds(0);
        if (d[13] != 'Z') {
            offset = (d[15] * 60) + parseInt(d[17], 10);
            offset *= ((d[14] == '-') ? -1 : 1);
            this.setTime(this.getTime() - offset * 60 * 1000);
        }
    }
    else {
        this.setTime(Date.parse(dString));
    }
    return this;
};




/*
 * Date Format 1.2.3
 * (c) 2007-2009 Steven Levithan <stevenlevithan.com>
 * MIT license
 *
 * Includes enhancements by Scott Trenda <scott.trenda.net>
 * and Kris Kowal <cixar.com/~kris.kowal/>
 *
 * Accepts a date, a mask, or a date and a mask.
 * Returns a formatted version of the given date.
 * The date defaults to the current date/time.
 * The mask defaults to dateFormat.masks.default.
 */

/*
 * Documentations: http://blog.stevenlevithan.com/archives/date-time-format
 */
var dateFormat = function () {
	var	token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
		timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
		timezoneClip = /[^-+\dA-Z]/g,
		pad = function (val, len) {
			val = String(val);
			len = len || 2;
			while (val.length < len) val = "0" + val;
			return val;
		};

	// Regexes and supporting functions are cached through closure
	return function (date, mask, utc) {
		var dF = dateFormat;

		// You can't provide utc if you skip other args (use the "UTC:" mask prefix)
		if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) {
			mask = date;
			date = undefined;
		}

		// Passing date through Date applies Date.parse, if necessary
		date = date ? new Date(date) : new Date();
		if (isNaN(date)) {
			throw SyntaxError("invalid date");
		}

		mask = String(dF.masks[mask] || mask || dF.masks["default"]);

		// Allow setting the utc argument via the mask
		if (mask.slice(0, 4) == "UTC:") {
			mask = mask.slice(4);
			utc = true;
		}

		var	_ = utc ? "getUTC" : "get",
			d = date[_ + "Date"](),
			D = date[_ + "Day"](),
			m = date[_ + "Month"](),
			y = date[_ + "FullYear"](),
			H = date[_ + "Hours"](),
			M = date[_ + "Minutes"](),
			s = date[_ + "Seconds"](),
			L = date[_ + "Milliseconds"](),
			o = utc ? 0 : date.getTimezoneOffset(),
			flags = {
				d:    d,
				dd:   pad(d),
				ddd:  dF.i18n.dayNames[D],
				dddd: dF.i18n.dayNames[D + 7],
				m:    m + 1,
				mm:   pad(m + 1),
				mmm:  dF.i18n.monthNames[m],
				mmmm: dF.i18n.monthNames[m + 12],
				yy:   String(y).slice(2),
				yyyy: y,
				h:    H % 12 || 12,
				hh:   pad(H % 12 || 12),
				H:    H,
				HH:   pad(H),
				M:    M,
				MM:   pad(M),
				s:    s,
				ss:   pad(s),
				l:    pad(L, 3),
				L:    pad(L > 99 ? Math.round(L / 10) : L),
				t:    H < 12 ? "a"  : "p",
				tt:   H < 12 ? "am" : "pm",
				T:    H < 12 ? "A"  : "P",
				TT:   H < 12 ? "AM" : "PM",
				Z:    utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
				o:    (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
				S:    ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
			};

		return mask.replace(token, function ($0) {
			return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
		});
	};
}();

// Some common format strings
dateFormat.masks = {
	"default":      "ddd mmm dd yyyy HH:MM:ss",
	shortDate:      "m/d/yy",
	mediumDate:     "mmm d, yyyy",
	longDate:       "mmmm d, yyyy",
	fullDate:       "dddd, mmmm d, yyyy",
	shortTime:      "h:MM TT",
	mediumTime:     "h:MM:ss TT",
	longTime:       "h:MM:ss TT Z",
	isoDate:        "yyyy-mm-dd",
	isoTime:        "HH:MM:ss",
	isoDateTime:    "yyyy-mm-dd'T'HH:MM:ss",
	isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
};

// Internationalization strings
dateFormat.i18n = {
	dayNames: [
		"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
		"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
	],
	monthNames: [
		"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
		"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
	]
};

// For convenience...
Date.prototype.format = function (mask, utc) {
	return dateFormat(this, mask, utc);
};





// VERTICALLY ALIGN FUNCTION
//if there are problems padding-top can be margin-top
$j = jQuery;
jQuery.fn.vAlign = function(options) {
	var opts = jQuery.extend({},jQuery.fn.vAlign.defaults, options);
	return this.each(function(i){
	var ah = jQuery(this).height();
	var ph = jQuery(this).parent().height();
	var mh = (ph - ah) / 2;
	mh = mh + opt.offset;
	jQuery(this).css('padding-top', mh);
	});
};
jQuery.fn.vAlign.defaults = {
	"offset":0
};

jQuery.fn.homePage = function(options){
	var opts = jQuery.extend({},jQuery.fn.homePage.defaults, options);
	var $thisHomePage;
	var $parent;
	var	$prev;
	var $children;
	var panelIndex;
	var $child;
	var panelStyle;
	var panels = [];
	var i;
	return this.each(function(){
		$thisHomePage = jQuery(this);
		$sourceMarkup = $thisHomePage.clone();
		$parent = $thisHomePage.parent();
		$prev = $thisHomePage.prev();
		$children = $thisHomePage.children().detach();
		panelIndex = 0;
		$children.each(function(index,value){
			$child = jQuery(this);
			if($child.is("h1") || $child.is("h2")){
				panelIndex = panelIndex + 1;
				panelStyle = $child.attr('class');
				panels[panelIndex] = jQuery(document.createElement("div")).attr({'class':'hp-panel hp-panel-'+panelIndex+' '+panelStyle});
				$child.removeAttr('class').appendTo(panels[panelIndex]);
			} else {
				$child.appendTo(panels[panelIndex]);
			}
		});
		for (i = 0; i <= panels.length; i++){
			jQuery(panels[i]).wrapInner("<div class='inner-panel'></div>");
			$thisHomePage.addClass('hp-wrap').append(panels[i]);
		}
		if($prev.length){
			$thisHomePage.insertAfter($prev);
		} else {
			$thisHomePage.prependTo($parent);
		}
			return $sourceMarkup;
	});
};
jQuery.fn.homePage.defaults = {
	"option":null
};

jQuery.fn.sameHeight = function(options){
	var opts = jQuery.extend({},jQuery.fn.homePage.defaults, options);
	var $this;
	var $firstChild;
	var $thisChild;
	var $children;
	var $totalHeight;
	var height;
	var totalSiblingHeight;
	return this.each(function(){
		$this = jQuery(this);

		$panelOne = $this.find(".hp-panel-1");
		panelOneHeight = $panelOne.outerHeight();
		$siblingPanels = $this.find(".hp-panel").not(".hp-panel-1, :hidden");
		$(".panel-one-log").find("span").text(panelOneHeight);
//		if($siblingPanels.length){
//			return;
//		}
		totalSiblingHeight = 0;
		$siblingPanels.each(function(i){
			$thisSibling = $(this);
			thisSiblingHeight = $thisSibling.outerHeight();
			totalSiblingHeight = totalSiblingHeight + thisSiblingHeight;
		});
		$lastSibling = $siblingPanels.last();
		lastSiblingHeight = $lastSibling.outerHeight();
		$(".right-panels-log").find("span").text(totalSiblingHeight);
		if(panelOneHeight > totalSiblingHeight){
			finalHeight = (panelOneHeight - totalSiblingHeight) + lastSiblingHeight;
			$lastSibling.height(finalHeight)
		} else if(panelOneHeight < totalSiblingHeight){
			$panelOne.height(totalSiblingHeight);
		} else {
			return;
		}
	});
};
jQuery.fn.sameHeight.defaults = {
	"option":null
};
//Flickr Query String Parameters
//http://www.flickr.com/services/feeds/docs/photos_public/
function flickrFeed(tags){
	$j(function(){
		var url = 'http://api.flickr.com/services/feeds/photos_public.gne?id=47791066@N07&jsoncallback=?&lang=en-us';
		var params = {
			'format': 'json',
			'tags': tags
		};
		$j.getJSON(url, params, function(json){
			if (json.items) {
				var $itemList = $j("<ul id='item-list'></ul>");
				$j("ul#item-list").remove();
				/*Create UL container*/

				/*Travse through Each item in feed*/
				$j.each(json.items, function(i){
					var oItem = json.items[i],
						$item = $j('<li id="item' + i + '"></li>'),
						itemTags = oItem.tags.replace(/ /gi,", "),
						itemLink;
						
					$item.append("<div class='inner-item'></div>");
					$item.html(oItem.description).append('<p class="tags"><span class="label">Tags: </span><span class="value">' + itemTags + '</span></p>');
					itemLink = $item.find("a[rel=nofollow]").attr("href");
					$item.find("a").attr("href",itemLink);
					$itemList.append($item);
				});
				$itemList.appendTo("#inner-gallery");
				$j("#item-list li p:nth-child(1)").addClass("hide");
				$j("#item-list li p:nth-child(2)").addClass("image");
				$j("#item-list li p:nth-child(3)").addClass("description");
			}
		});
	});
}




//dependencies: date.format.js
jQuery.fn.fetchBlogger = function(options){
    var opts = jQuery.extend({}, jQuery.fn.fetchBlogger.defaults, options);
    var $this;
    var feedData;
    var content;
    var $fetchedContent;
	var utcDate;
    var onSuccess = function(feedData){
        $fetchedContent = jQuery("<div></div>");
        jQuery(feedData.feed.entry).each(function(){
            thisEntry = this;
            $entryWrapper = jQuery("<div></div>").attr({
                "class": opts.prefix + "entry entry"
            });
            $entryTitle = jQuery("<h3 class='entry-title'>" + thisEntry.title.$t + "</h3>");
			
			utcDate = new Date();
			utcDate.setISO8601(thisEntry.published.$t);
			
			
            $entryPubDate = jQuery("<p class='entry-date'>" + dateFormat(utcDate,opts.dateFormat) + "</p>");
            $entryContent = jQuery("<div class='entry-content'>" + thisEntry.content.$t + "</div>");
            $entryContent.prepend($entryPubDate);
            $entryTitle.prependTo($entryContent);
            $entryWrapper.append($entryContent);
            $entryWrapper.appendTo($fetchedContent);
        })
        return $fetchedContent;
    };
    return this.each(function(){
        $this = jQuery(this);
        jQuery.ajax({
            url: opts.url,
            dataType: "jsonp",
            data: ({
                alt: "json",
                prettyprint: true
            }),
            contentType: "application/x-www-form-urlencoded",
            type: "GET",
            success: function(feedData){
//console.log(feedData);
                $fetchedContent = onSuccess(feedData);
//console.log($fetchedContent);
                $fetchedContent.attr({
                    "id": opts.prefix + "wrapper"
                });
                $this.html($fetchedContent);
            },
            error: function(xhr, textStatus, errorThrown){
//                console.log("textStatus: '%s', errorThrown: '%s'", textStatus, errorThrown);
//                console.log("xhr.status:%s", xhr.status);
            }
        });
    });
    
};
jQuery.fn.fetchBlogger.defaults = {
    "url": null,
    "prefix": "fetchBlogger-",
	"dateFormat":'dddd mmmm dd, yyyy'
};
;(function(D){var A="Lite-1.0";D.fn.cycle=function(E){return this.each(function(){E=E||{};if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;this.cyclePause=0;var I=D(this);var J=E.slideExpr?D(E.slideExpr,this):I.children();var G=J.get();if(G.length<2){if(window.console&&window.console.log){window.console.log("terminating; too few slides: "+G.length)}return }var H=D.extend({},D.fn.cycle.defaults,E||{},D.metadata?I.metadata():D.meta?I.data():{});H.before=H.before?[H.before]:[];H.after=H.after?[H.after]:[];H.after.unshift(function(){H.busy=0});var F=this.className;H.width=parseInt((F.match(/w:(\d+)/)||[])[1])||H.width;H.height=parseInt((F.match(/h:(\d+)/)||[])[1])||H.height;H.timeout=parseInt((F.match(/t:(\d+)/)||[])[1])||H.timeout;if(I.css("position")=="static"){I.css("position","relative")}if(H.width){I.width(H.width)}if(H.height&&H.height!="auto"){I.height(H.height)}var K=0;J.css({position:"absolute",top:0,left:0}).hide().each(function(M){D(this).css("z-index",G.length-M)});D(G[K]).css("opacity",1).show();if(D.browser.msie){G[K].style.removeAttribute("filter")}if(H.fit&&H.width){J.width(H.width)}if(H.fit&&H.height&&H.height!="auto"){J.height(H.height)}if(H.pause){I.hover(function(){this.cyclePause=1},function(){this.cyclePause=0})}D.fn.cycle.transitions.fade(I,J,H);J.each(function(){var M=D(this);this.cycleH=(H.fit&&H.height)?H.height:M.height();this.cycleW=(H.fit&&H.width)?H.width:M.width()});J.not(":eq("+K+")").css({opacity:0});if(H.cssFirst){D(J[K]).css(H.cssFirst)}if(H.timeout){if(H.speed.constructor==String){H.speed={slow:600,fast:200}[H.speed]||400}if(!H.sync){H.speed=H.speed/2}while((H.timeout-H.speed)<250){H.timeout+=H.speed}}H.speedIn=H.speed;H.speedOut=H.speed;H.slideCount=G.length;H.currSlide=K;H.nextSlide=1;var L=J[K];if(H.before.length){H.before[0].apply(L,[L,L,H,true])}if(H.after.length>1){H.after[1].apply(L,[L,L,H,true])}if(H.click&&!H.next){H.next=H.click}if(H.next){D(H.next).bind("click",function(){return C(G,H,H.rev?-1:1)})}if(H.prev){D(H.prev).bind("click",function(){return C(G,H,H.rev?1:-1)})}if(H.timeout){this.cycleTimeout=setTimeout(function(){B(G,H,0,!H.rev)},H.timeout+(H.delay||0))}})};function B(J,E,I,K){if(E.busy){return }var H=J[0].parentNode,M=J[E.currSlide],L=J[E.nextSlide];if(H.cycleTimeout===0&&!I){return }if(I||!H.cyclePause){if(E.before.length){D.each(E.before,function(N,O){O.apply(L,[M,L,E,K])})}var F=function(){if(D.browser.msie){this.style.removeAttribute("filter")}D.each(E.after,function(N,O){O.apply(L,[M,L,E,K])})};if(E.nextSlide!=E.currSlide){E.busy=1;D.fn.cycle.custom(M,L,E,F)}var G=(E.nextSlide+1)==J.length;E.nextSlide=G?0:E.nextSlide+1;E.currSlide=G?J.length-1:E.nextSlide-1}if(E.timeout){H.cycleTimeout=setTimeout(function(){B(J,E,0,!E.rev)},E.timeout)}}function C(E,F,I){var H=E[0].parentNode,G=H.cycleTimeout;if(G){clearTimeout(G);H.cycleTimeout=0}F.nextSlide=F.currSlide+I;if(F.nextSlide<0){F.nextSlide=E.length-1}else{if(F.nextSlide>=E.length){F.nextSlide=0}}B(E,F,1,I>=0);return false}D.fn.cycle.custom=function(K,H,I,E){var J=D(K),G=D(H);G.css({opacity:0});var F=function(){G.animate({opacity:1},I.speedIn,I.easeIn,E)};J.animate({opacity:0},I.speedOut,I.easeOut,function(){J.css({display:"none"});if(!I.sync){F()}});if(I.sync){F()}};D.fn.cycle.transitions={fade:function(F,G,E){G.not(":eq(0)").css("opacity",0);E.before.push(function(){D(this).show()})}};D.fn.cycle.ver=function(){return A};D.fn.cycle.defaults={timeout:4000,speed:1000,next:null,prev:null,before:null,after:null,height:"auto",sync:1,fit:0,pause:0,delay:0,slideExpr:null}})(jQuery)

