/*========
 * Flying's JavaScript Library
 * flying-w.net/js/Fjl.js
 *
 * (c) Copyright 1998-2011 (v5.5s) Flying @ Flying's World
 * 吴颖晖 Freddie
 *
 *#req	jQuery
 *#opt	Firebug
 ========*/
F={error:function(a,b){var c=window["console"];if(c&&("function"==typeof c.log))c.log(a);else alert(a+"\n\n"+"Please help report this error to Flying with following information:\n"+"\t+ Browser name and version\n"+"\t+ Operating system name and version\n"+"\t+ Any special configuration in your system\n"+"\n"+"Your help is greatly appreciated!");if(!b&&("function"==typeof window["Error"]))throw new Error(a);return false},assert:function(a,b,c){b=b||"Assertion error";if("function"==typeof b)b=b();return a?true:F.error(b,!c)},quote:function(a){var b=".[]?*+{}|^$()\\";return a.replace(new RegExp("(\\"+b.split('').join("|\\")+")","g"),"\\$1")}};if("function"!=typeof window["jQuery"])F.error("Missing prerequisite: jQuery");$.extend($.fn,{lang:function(a){var b=$(this);return(undefined===a)?(b.attr("xml:lang")||b.attr("lang")):b.attr({"xml:lang":a,lang:a})}});$.extend($.expr[':'],{lang:function(a,i,m){var b=$(a).lang();return m[3]&&b&&new RegExp('^'+m[3]+"($|-.*)").test(b)}});F.URI=function(c,d){c=c||location.href;var e=this;var f=d?/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;var g="URI,PROTOCOL,AUTHORITY,USER_INFO,USER,PASSWORD,HOST,PORT,RELATIVE,PATH,DIRECTORY,FILE,QUERY,ANCHOR".split(',');var h=f.exec(c);if(!h)return F.error("Invalid URI: "+c);$.each(g,function(i,a){e[a]=h[i]||''});e.QUERY_VARS={};e.QUERY.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(_,a,b){if(a)e.QUERY_VARS[decodeURIComponent(a)]=decodeURIComponent(b)});return e};F.URI.prototype.updQuery=function(a){a=a||'';var b=$.param(this.QUERY_VARS);if(this.QUERY.length>0){this.URI=this.URI.replace(this.QUERY,b);this.RELATIVE=this.RELATIVE.replace(this.QUERY,b)}else{this.URI+='?'+b;this.RELATIVE+='?'+b}this.QUERY=b;return b};F.URI.prototype.toString=function(a){this.updQuery(a);return this.URI};F.cookie=function(a,b,c){c=c||{};return(undefined===b)?F.cookie._get(a):F.cookie._set(a,b,c)};F.cookie._get=function(b){if(!document.cookie)return null;var c={};$.each(document.cookie.split(';'),function(){var a=/^([^=]+)=(.*)$/.exec($.trim(this));if(a)c[decodeURIComponent(a[1])]=decodeURIComponent(a[2])});return c[b]};F.cookie._set=function(a,b,c){if(null==b){b='';c.expires=-1}if(c.expires){var d=new Date();if("number"==$.type(c.expires))d.setTime(d.getTime()+(c.expires*(60*1000)));else if("function"==$.type(c.expires["toUTCString"]))d=c.expires;c.expires=d.toUTCString()}var e=[encodeURIComponent(a)+'='+encodeURIComponent(b)];$.each("expires,path,domain".split(','),function(){if(c[this])e.push(this+'='+c[this])});if(c.secure)e.push("secure");return document.cookie=e.join("; ")};F.Lang=function(){return this};F.Lang.prototype.iso639={en:/^en(-.*)?/,"zh-Hant":/^zh-(TW|HK|MO)/,"zh-Hans":/^zh(-(CN|SG|.*))?/};F.Lang.prototype.get=function(b,c,d){b=b||"lang";c=c||"lang";if(!d){var e=new F.URI().QUERY_VARS[c];if(e&&this.iso639[e]){return e}}e=F.cookie(b);if(e&&this.iso639[e])return e;e=$.grep([navigator.language,navigator.userLanguage,navigator.browserLanguage,navigator.systemLanguage],function(l){return!!l});if(e.length>0){var f=e[0].replace(/_/g,'-');e=null;$.each(this.iso639,function(l,a){if(!e&&a.test(f))e=l});if(e)return e}return this.getDefault()};F.Lang.prototype.getDefault=function(){var a=$("html").lang();F.assert(a&&this.iso639[a],"Attribute html[xml|lang] does not exist or contains unsupported value");return a};F.Base64={tr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};F.assert(0x40+1==F.Base64.tr.length,"Invalid Base64 code table size");F.Base64.enc=function(a){a=F.UTF8.enc(a);var b=[],char=[],code=[];for(var i=0;i<a.length;){for(var j=0;j<3;++j)char[j]=a.charCodeAt(i++);code[0]=char[0]>>2;code[1]=((char[0]&0x03)<<4)|(char[1]>>4);code[2]=((char[1]&0x0F)<<2)|(char[2]>>6);code[3]=char[2]&0x3F;if(isNaN(char[1]))code[2]=code[3]=0x40;else if(isNaN(char[2]))code[3]=0x40;$.merge(b,$.map(code,function(i){return F.Base64.tr.charAt(i)}))}return b.join('')};F.Base64.dec=function(a){a=a.replace(new RegExp("[^"+F.quote(F.Base64.tr)+']',"g"),"");var b=[],char=[],code=[];for(var i=0;i<a.length;){for(var j=0;j<4;++j)code[j]=F.Base64.tr.indexOf(a.charAt(i++));char[0]=(code[0]<<2)|(code[1]>>4);char[1]=((code[1]&0x0F)<<4)|(code[2]>>2);char[2]=((code[2]&0x03)<<6)|code[3];b.push(String.fromCharCode(char[0]));if(0x40!=code[2])b.push(String.fromCharCode(char[1]));if(0x40!=code[3])b.push(String.fromCharCode(char[2]))}return F.UTF8.dec(b.join(''))};F.UTF8={};F.UTF8.enc=function(a){a=a.replace(/\r\n/g,"\n");var b=[];for(var i=0;i<a.length;++i){var c=a.charCodeAt(i);if(c<=0x00007F)b.push(String.fromCharCode(c));else if(c<=0x0007FF)b.push(String.fromCharCode((c>>6)|0xC0),String.fromCharCode((c&0x3F)|0x80));else if(c<=0x00FFFF)b.push(String.fromCharCode((c>>12)|0xE0),String.fromCharCode(((c>>6)&0x3F)|0x80),String.fromCharCode((c&0x3F)|0x80));else if(c<=0x10FFFF)b.push(String.fromCharCode((c>>18)|0xF0),String.fromCharCode(((c>>12)&0x3F)|0x80),String.fromCharCode(((c>>6)&0x3F)|0x80),String.fromCharCode((c&0x3F)|0x80));else b.push("\xEF\xBF\xBD")}return b.join('')};F.UTF8.dec=function(a){var b=[],code=[];for(var i=0;i<a.length;){code[0]=a.charCodeAt(i++);if(code[0]<=0x7F){b.push(String.fromCharCode(code[0]));continue}if(code[0]<0xC2){b.push('\uFFFD');continue}code[1]=a.charCodeAt(i++);if(code[0]<0xE0){b.push(String.fromCharCode(((code[0]&0x1F)<<6)|(code[1]&0x3F)));continue}code[2]=a.charCodeAt(i++);if(code[0]<0xF0){b.push(String.fromCharCode(((code[0]&0x0F)<<12)|((code[1]&0x3F)<<6)|(code[2]&0x3F)));continue}code[3]=a.charCodeAt(i++);if(code[0]<0xF4){b.push(String.fromCharCode(((code[0]&0x07)<<18)|((code[1]&0x3F)<<12)|((code[2]&0x3F)<<6)|(code[3]&0x3F)));continue}b.push('\uFFFD')}return b.join('')};F.UUID={};F.UUID.next=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=('x'==c)?r:(r&0x03|0x08);return v.toString(16)})};F.Math={gcd:function(a,b){while(b!=0){var t=a%b;a=b;b=t}return a},lcm:function(a,b){return(a*b)/F.Math.gcd(a,b)}};F.FX={ScrollTo:function(o,a){if($(o).size()<=0)return;$("html,body").animate({scrollTop:$(o).first().offset().top},a||'slow')}};F.FX.TableGuide={init:function(b,c){var d=$("link[rel='canonical']").attr("href");F.assert(d,'Unexpected missing <link rel="canonical" ... /> element in page header');$.getScript(d+"/js/jQuery/jquery.tablehover-0.1.4.pack.js",function(a){$(b).tableHover(c)})}};F.Quirks={};F.Quirks.XHTML1=function(){var b={replace:function(a){a.target="_top"},external:function(a){a.target=F.Base64.enc(a.href).replace(/[^A-Za-z0-9_]/g,'-')}};b["nofollow"]=b["external"];$("a[rel]").each(function(){var a=$(this).attr("rel");if(b[a])b[a](this)})};F.Quirks.XHTML11=function(){/*@cc_on@if(@_jscript&&(@_jscript_version>5.6)&&(@_jscript_version<=5.7))@else@*/$("[xml\\:lang]").each(function(){var o=$(this);o.lang(o.attr("xml:lang"))});/*@end@*/};

