﻿/*
 * jQuery JSON Plugin
 * version: 2.1 (2009-08-14)
 *
 * This document is licensed as free software under the terms of the
 * MIT License: http://www.opensource.org/licenses/mit-license.php
 *
 * Brantley Harris wrote this plugin. It is based somewhat on the JSON.org 
 * website's http://www.json.org/json2.js, which proclaims:
 * "NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.", a sentiment that
 * I uphold.
 *
 * It is also influenced heavily by MochiKit's serializeJSON, which is 
 * copyrighted 2005 by Bob Ippolito.
 */
;(function(e){e.toJSON=function(a){if(typeof JSON=="object"&&JSON.stringify)return JSON.stringify(a);var b=typeof a;if(a===null)return"null";if(b!="undefined"){if(b=="number"||b=="boolean")return a+"";if(b=="string")return e.quoteString(a);if(b=="object"){if(typeof a.toJSON=="function")return e.toJSON(a.toJSON());if(a.constructor===Date){var c=a.getUTCMonth()+1;if(c<10)c="0"+c;var d=a.getUTCDate();if(d<10)d="0"+d;b=a.getUTCFullYear();var f=a.getUTCHours();if(f<10)f="0"+f;var g=a.getUTCMinutes();if(g< 10)g="0"+g;var h=a.getUTCSeconds();if(h<10)h="0"+h;a=a.getUTCMilliseconds();if(a<100)a="0"+a;if(a<10)a="0"+a;return'"'+b+"-"+c+"-"+d+"T"+f+":"+g+":"+h+"."+a+'Z"'}if(a.constructor===Array){c=[];for(d=0;d<a.length;d++)c.push(e.toJSON(a[d])||"null");return"["+c.join(",")+"]"}c=[];for(d in a){b=typeof d;if(b=="number")b='"'+d+'"';else if(b=="string")b=e.quoteString(d);else continue;if(typeof a[d]!="function"){f=e.toJSON(a[d]);c.push(b+":"+f)}}return"{"+c.join(", ")+"}"}}};e.evalJSON=function(a){if(typeof JSON== "object"&&JSON.parse)return JSON.parse(a);return eval("("+a+")")};e.secureEvalJSON=function(a){if(typeof JSON=="object"&&JSON.parse)return JSON.parse(a);var b=a;b=b.replace(/\\["\\\/bfnrtu]/g,"@");b=b.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");b=b.replace(/(?:^|:|,)(?:\s*\[)+/g,"");if(/^[\],:{}\s]*$/.test(b))return eval("("+a+")");else throw new SyntaxError("Error parsing JSON, source is not valid.");};e.quoteString=function(a){if(a.match(i))return'"'+a.replace(i, function(b){var c=j[b];if(typeof c==="string")return c;c=b.charCodeAt();return"\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16)})+'"';return'"'+a+'"'};var i=/["\\\x00-\x1f\x7f-\x9f]/g,j={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"}})(jQuery);


/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 *
*/
// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing.jswing=jQuery.easing.swing; jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,a,c,b,d){return jQuery.easing[jQuery.easing.def](e,a,c,b,d)},easeInQuad:function(e,a,c,b,d){return b*(a/=d)*a+c},easeOutQuad:function(e,a,c,b,d){return-b*(a/=d)*(a-2)+c},easeInOutQuad:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a+c;return-b/2*(--a*(a-2)-1)+c},easeInCubic:function(e,a,c,b,d){return b*(a/=d)*a*a+c},easeOutCubic:function(e,a,c,b,d){return b*((a=a/d-1)*a*a+1)+c},easeInOutCubic:function(e,a,c,b,d){if((a/=d/2)<1)return b/ 2*a*a*a+c;return b/2*((a-=2)*a*a+2)+c},easeInQuart:function(e,a,c,b,d){return b*(a/=d)*a*a*a+c},easeOutQuart:function(e,a,c,b,d){return-b*((a=a/d-1)*a*a*a-1)+c},easeInOutQuart:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a*a*a+c;return-b/2*((a-=2)*a*a*a-2)+c},easeInQuint:function(e,a,c,b,d){return b*(a/=d)*a*a*a*a+c},easeOutQuint:function(e,a,c,b,d){return b*((a=a/d-1)*a*a*a*a+1)+c},easeInOutQuint:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a*a*a*a+c;return b/2*((a-=2)*a*a*a*a+2)+c},easeInSine:function(e, a,c,b,d){return-b*Math.cos(a/d*(Math.PI/2))+b+c},easeOutSine:function(e,a,c,b,d){return b*Math.sin(a/d*(Math.PI/2))+c},easeInOutSine:function(e,a,c,b,d){return-b/2*(Math.cos(Math.PI*a/d)-1)+c},easeInExpo:function(e,a,c,b,d){return a==0?c:b*Math.pow(2,10*(a/d-1))+c},easeOutExpo:function(e,a,c,b,d){return a==d?c+b:b*(-Math.pow(2,-10*a/d)+1)+c},easeInOutExpo:function(e,a,c,b,d){if(a==0)return c;if(a==d)return c+b;if((a/=d/2)<1)return b/2*Math.pow(2,10*(a-1))+c;return b/2*(-Math.pow(2,-10*--a)+2)+c}, easeInCirc:function(e,a,c,b,d){return-b*(Math.sqrt(1-(a/=d)*a)-1)+c},easeOutCirc:function(e,a,c,b,d){return b*Math.sqrt(1-(a=a/d-1)*a)+c},easeInOutCirc:function(e,a,c,b,d){if((a/=d/2)<1)return-b/2*(Math.sqrt(1-a*a)-1)+c;return b/2*(Math.sqrt(1-(a-=2)*a)+1)+c},easeInElastic:function(e,a,c,b,d){e=1.70158;var f=0,g=b;if(a==0)return c;if((a/=d)==1)return c+b;f||(f=d*0.3);if(g<Math.abs(b)){g=b;e=f/4}else e=f/(2*Math.PI)*Math.asin(b/g);return-(g*Math.pow(2,10*(a-=1))*Math.sin((a*d-e)*2*Math.PI/f))+c},easeOutElastic:function(e, a,c,b,d){e=1.70158;var f=0,g=b;if(a==0)return c;if((a/=d)==1)return c+b;f||(f=d*0.3);if(g<Math.abs(b)){g=b;e=f/4}else e=f/(2*Math.PI)*Math.asin(b/g);return g*Math.pow(2,-10*a)*Math.sin((a*d-e)*2*Math.PI/f)+b+c},easeInOutElastic:function(e,a,c,b,d){e=1.70158;var f=0,g=b;if(a==0)return c;if((a/=d/2)==2)return c+b;f||(f=d*0.3*1.5);if(g<Math.abs(b)){g=b;e=f/4}else e=f/(2*Math.PI)*Math.asin(b/g);if(a<1)return-0.5*g*Math.pow(2,10*(a-=1))*Math.sin((a*d-e)*2*Math.PI/f)+c;return g*Math.pow(2,-10*(a-=1))*Math.sin((a* d-e)*2*Math.PI/f)*0.5+b+c},easeInBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;return b*(a/=d)*a*((f+1)*a-f)+c},easeOutBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;return b*((a=a/d-1)*a*((f+1)*a+f)+1)+c},easeInOutBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;if((a/=d/2)<1)return b/2*a*a*(((f*=1.525)+1)*a-f)+c;return b/2*((a-=2)*a*(((f*=1.525)+1)*a+f)+2)+c},easeInBounce:function(e,a,c,b,d){return b-jQuery.easing.easeOutBounce(e,d-a,0,b,d)+c},easeOutBounce:function(e,a,c,b,d){return(a/= d)<1/2.75?b*7.5625*a*a+c:a<2/2.75?b*(7.5625*(a-=1.5/2.75)*a+0.75)+c:a<2.5/2.75?b*(7.5625*(a-=2.25/2.75)*a+0.9375)+c:b*(7.5625*(a-=2.625/2.75)*a+0.984375)+c},easeInOutBounce:function(e,a,c,b,d){if(a<d/2)return jQuery.easing.easeInBounce(e,a*2,0,b,d)*0.5+c;return jQuery.easing.easeOutBounce(e,a*2-d,0,b,d)*0.5+b*0.5+c}});


/*
 * jQuery Color Animations
 * Copyright 2007 John Resig
 * Released under the MIT and GPL licenses.
 */
(function(e){function g(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1]),parseInt(a[2]),parseInt(a[3])];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1],16),parseInt(a[2], 16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];return i[e.trim(c).toLowerCase()]}e.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(c,a){e.fx.step[a]=function(b){if(b.state==0){var d;d=b.elem;var h=a,f;do{f=e.curCSS(d,h);if(f!=""&&f!="transparent"||e.nodeName(d,"body"))break;h="backgroundColor"}while(d=d.parentNode); d=g(f);b.start=d;b.end=g(b.end)}b.elem.style[a]="rgb("+[Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0]),255),0),Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1]),255),0),Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2]),255),0)].join(",")+")"}});var i={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0, 100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128, 128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);


/**
 * jQuery.PTui - PT96 UI for jQuery
 * Written by Highmore Hill (h DOT highmore AT gmail DOT com)
 * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
 * Date: 2010/12/28
 *
 * @author Highmore
 * @version 1.0
 *
 **/
;(function($) {

	var $el, $tempDiv, $tempButton, divHeight = 0;

	$.fn.ptMiddleBoxButton = function(text, url) {
		return this.hover(
			function(e) {
				$el = $(this).css("border-color", "white");
				divHeight = $el.height() + parseInt($el.css("padding-top")) + parseInt($el.css("padding-bottom"));

				$tempDiv = $("<div />", {
					"class": "overlay rounded"
				});

				$tempButton = $("<a />", {
					"href"	: url,
					"text"	: text,
					"class"	: "widget-button rounded",
					"css"	: {
						top	: (divHeight / 2) - 7 + "px"
					}
				}).appendTo($tempDiv);

				$tempDiv.appendTo($el);
			},

			function(e) {
				$el = $(this).css("border-color", "#999");
				$(".overlay").fadeOut("fast", function() {$(this).remove();});
			}
		);
	}

})(jQuery);

/*
 * jQuery.PTui - PT96 UI for jQuery
 * 
 * 
 * @depends: jquery.js
 * @version 0.1
 * @license Dual licensed under the MIT and GPL licenses.
 * @author  Highmore Hill
 * @website http://pt96.com
 */
;(function($, window) {

	$.fn.ptHumanMsg = function(message, options) {
		return this.each(function() {
			var container = (this == window || this == document) ? document.body : this;
			!$.data(container, "ptHumanMsg") && $.data(container, "ptHumanMsg", new $.ptHumanMsg(container, message, options));
		});
	}

	$.ptHumanMsg = function(container, message, options) {
		if (typeof message == "object") {
			options = message;
			message = null;
		}

		var s = $.extend({}, $.ptHumanMsg.defaults, options);
		var sizeContainer = (container == document.body) ? window : container;

		var $m = $('<div class="humanized-message ' + s.addClass + '"/>')
			.html(message || s.message)
			.click(remove)
			.appendTo(container);
		
		install();

		function install() {
			$m.css({
				display		: "none",
				visibility	: "visible",
				top			: ($(sizeContainer).height()-$m.innerHeight())/2,
				left		: ($(sizeContainer).width()-$m.innerWidth())/2
			})
			.fadeIn(s.speed);
			if (s.autoHide) setTimeout(remove, s.autoHide);
		}

		function remove() {
			$m.fadeOut(s.speed, function() {
				$m.remove();
				$.removeData(container, "ptHumanMsg");
			});
		}
	}

	$.ptHumanMsg.defaults = {
		message		: "没有设定任何消息",
		autoHide	: 0,
		addClass	: "",
		speed		: 300
	}

})(jQuery, this);

/*
 * jQuery.PTui - PT96 UI for jQuery
 * 
 * 
 * @depends: jquery.js
 * @version 0.1
 * @license Dual licensed under the MIT and GPL licenses.
 * @author  Highmore Hill
 * @website http://pt96.com
 */

;(function($) {
	$.fn.ptBlocks = function(options) {
		var defaults = {
			trigger			: "click",
			direction		: "clockwise",
			duration		: 750,
			zIndex			: 10,
			widthMultiplier	: 1.2
		}

		var sets = $.extend({}, defaults, options);

		$.path = {};
		$.path.arc = function(params) {
			for (var i in params) {
				this[i] = params[i];
			}
			this.dir = this.dir || 1;
			while (this.start>this.end && this.dir>0) {
				this.start -= 360;
			}
			while (this.start<this.end && this.dir<0) {
				this.start += 360;
			}
			this.css = function(p) {
				var a = this.start*(p) + this.end*(1 - (p));
				a = a*3.1415927/180;
				var x = Math.sin(a)*this.radius + this.center[0];
				var y = Math.cos(a)*this.radius + this.center[1];
				return {
					top	: y+"px",
					left: x+"px"
				}
			}
		}
		$.fx.step.path = function(fx) {
			var css = fx.end.css(1 - fx.pos);
			for (var i in css) {
				fx.elem.style[i] = css[i];
			}
		}

		return this.each(function() {
			var $t		= $(this);
			var w		= $t.width();
			var h		= $t.height();
			var parent	= $t.find("ul");
			var list	= parent.find("li");
			var size	= list.length;
			var hov		= false;
			var dir;

			$t.css({
				position	: "relative",
				background	: "url('js/admin.gif') no-repeat",
				cursor		: "pointer"
			});
			parent.css({
				"list-style": "none",
				padding		: 0,
				margin		: 0
			});
			list.css({
				position	: "absolute",
				padding		: 0,
				margin		: 0
			});

			if (sets.direction=="clockwise") {
				dir = -1;
			} else {
				if (sets.direction=="counter") {
					dir = 1;
				}
			}

			var socials = {
				init		: function() {
					parent.css({zIndex: sets.zIndex}).hide();
					$t.addClass("trigger").css({
								display	: "block",
								position: "relative",
								zIndex	: 1
					});
					switch(sets.trigger) {
						case "click":
							socials.click();
							break;
						case "hover":
							socials.hover();
							break;
						default:
							//socials.click();
					}
				},
				click		: function() {
					var trigger = $t;
					trigger.bind("click", function() {
						if ($t.hasClass("close")) {
							$t.removeClass("close");
							parent.fadeTo(sets.duration, 0);
							socials.animation.close();
						} else {
							$t.addClass("close");
							parent.fadeTo(sets.duration, 1);
							socials.animation.open();
						}
						return false;
					});
				},
				hover		: function() {
					var trigger = $t;
					trigger.bind("mouseover", function() {
						if (hov==false) {
							$t.addClass("close");
							parent.fadeTo(sets.duration, 1);
							socials.animation.open();
						}
					});
					parent.bind("mouseleave", function() {
						$t.removeClass("close");
						parent.fadeTo(sets.duration, 0);
						socials.animation.close();
						hov = true;
						setTimeout(function() {hov = false;}, 500);
					});
				},
				animation	: {
					open	: function() {
						list.show();
						list.each(function(i) {
							var li = $(this);
							li.animate({
								path	: new $.path.arc({
									center	: [0, 0],
									radius	: w*sets.widthMultiplier,
									start	: 0,
									end		: 360/size*i,
									dir		: dir
								})
							}, sets.duration);
						});
						list.hover(function() {
							var li = $(this);
							li.css({zIndex: sets.zIndex}).siblings("li").css({zIndex: sets.zIndex-1})
						});
					},
					close	: function() {
						list.each(function(i) {
							var li = $(this);
							li.animate({
								top		:0,
								left	:0
							}, sets.duration, function() {list.hide();});
						});
					}
				}
			}
			socials.init();
		})
	}
}(jQuery));

