//bootstrap $Id: fly.js 232 2010-03-06 13:24:59Z h058 $

var oFly = { 

	//动作处理页面
	url: function(d, t) {
		return '/d.html' + (t == '' ? '' : '?task=' + t) + (d == '' ? '' : '&do=' + d);
	},
	
	//静态文件存放
	staticPath: 'http://static.kiz.cn/',

	//网站路径
	sitePath: 'http://www.kiz.cn/',

	//变量
	v: {}, 

	//初始执行的js
	i: '', 

	//获取执行的静态页面
	curl: '',
	
	isFlyUrl: function(u) {
		return this.reg('\\.html$').test(u);
	},
	
	//去除数组中重复的元素
	arrUnique: function(a) {
		var k, r = {};
		for (k in a) {
			r[a[k]] = '';
		}
		a = [];
		for (k in r) {
			a.push(k);
		}
		return a;
	},
	//用于转义作用的\必须使用\\
	reg: function(a, b) {
		return new RegExp(a, b);
	},

	//判断时候为空
	empty: function(m) {
		var r = true, k, t = typeof(m);
		if (t == 'undefined') {
		} else if (t == 'number') {
			r = m == 0;
		} else if (t == 'string') {
			r = m == '';
		} else if (t == 'object' || t == 'array') {
			for (k in m) {
				r = !r;
				break;
			}
		} else if (t == 'boolean') {
			r = m;
		} else if (t == 'function') {
			r = !r;
		}
		return r;
	},

	//常用的随机数
	rand: function (a, b) {
		return a + parseInt((b - a) * Math.random());
	},

	//将全角变为半角
	fullChar2halfChar:function (str)  
	{  
		var r = '',c;  
		   
		for (i=0 ; i<str.length; i++)  
		{   
			c = str.charCodeAt(i);//获取当前字符的unicode编码  
			if (c >= 65281 && c <= 65373)//在这个unicode编码范围中的是所有的英文字母已经各种字符  
			{  
				r += String.fromCharCode(str.charCodeAt(i) - 65248);//把全角字符的unicode编码转换为对应半角字符的unicode码  
			}else if (c == 12288)//空格  
			{  
				r += String.fromCharCode(str.charCodeAt(i) - 12288 + 32);  
			}else{  
				r += str.charAt(i);  
			}  
		}  
		return r;  
	},
	//鼠标划过的炫彩效果
	hover: function(o) {
		var r = this.rand;
		o.hover(
		  function () {
			o.css({background:'rgb('+r(210,245)+','+r(210,245)+','+r(210,245)+')'});
		  },
		  function () {
			o.css({background:''});
		  }
		); 
	},
	
	//一个超链接的按钮，很多地方用到的, 超链接有很多好处的
	abtn: function(s, d, c) {
		return '<a href="javascript:void(0)"' + (oFly.empty(d) ? '' : ' onclick="' + d + '"') + (oFly.empty(c) ? '' : ' class="' + c + '"') + '>' + s + '</a>';
	},
	abutton: function(s, d, c) {
		return this.abtn(s,d,c);
	},

	//载入css
	css: function(c) {
		$.each(typeof(c) == 'string' ? [c] : c, function(i, n) {
			$(document.body).append('<link href="' + n + '" rel="stylesheet" type="text/css" />');
		});
	 },

	//载入js ck回调函数
	js: function(j, ck) {
		function _(j, ck) {
			var a;
			if (a = j.pop()) {
				$.getScript(a, function() {
					_(j, ck);
				});
			} else {
				ck();
			}
		}
		_(typeof(j) == 'string' ? [j] : j.reverse(), ck);
	},

	//代码高亮显示
	highlighter: function() {
		var c = $('pre[name="code"]'), k, u = [], p = this.staticPath + 'js/highlighter/', g = $.getScript;
		if (c.length > 0) {
			c.each(function() {
				u.push($(this).attr('class'));
			});
			u = this.arrUnique(u);
			function s() {
				var a;
				if (a = u.pop()) {
					if (a == 'javascript') {
						a = 'Jscript';
					}
					g(p + 'shBrush' + a.substring(1, 0).toUpperCase() + a.substring(1) + '.js', s); 
				} else {
					a = dp.SyntaxHighlighter;
					a.ClipboardSwf = p + 'clipboard.swf';
					a.HighlightAll('code');
					$('div.dp-highlighter li').each(function() {
						oFly.hover($(this));
					});
				}
			}
			g(p + 'css.js');
			g(p + 'shCore.js', s);
		}
	},
	
	myjs: function(r) {
		document.write('<script type="text/javascript" src="'+this.staticPath+r+'"><\/script>');
	},
	
	tip: {
		clear: function(z) {
			$('.fly-tip[n="' + $(z).attr('tipn') + '"]').remove();
			$(z).attr('tipn', '');
		},
		n: 0,
		clearAll: function(o) {
			o.find('[tipn!=""]').each(function() {
				oFly.tip.clear(this);	
			});
		},
		one: function(o, i, t) {
			var z = this;
			z.n++;
			var o = $(o), r = ['<dl class="fly-tip" n="' + z.n +'">'];
			if (!oFly.empty(o.attr('tipn'))) {
				z.clear(o);
			}
			o.attr('tipn', z.n);
			if (!oFly.empty(t)) {
				r.push('<dt>' + t + '</dt>');
			}
			r.push('<dd>' + i + '</dd></dl>');
			var _o = $(document.body).append(r.join('')).find('.fly-tip:last-child').click(function() {
				z.clear(o);
			});
			function place(_o, o) {
				var f = o.offset();
				return _o.css({top: f.top - _o.height() -2, left: f.left})
			}
			function p() {
				place(_o, o);
			}
			$(window).scroll(p);
			//拖动	
			$(document).mousedown(p).mouseup(p);
			return place(_o, o);
			
		},
		all: function(o) {
			var z = this;
			$('[tip]', oFly.empty(o) ? $(document) : o).focus(function() {
				z.one(this, $(this).attr('tip'));
			}).blur(function() {
				z.clear(this);
			});
		}
	},
	
	//清除json数据中的字符串两边的空格
	trim: function(o) {
		for (var k in o) {
			if (typeof(o[k]) == 'string') {
				o[k] = $.trim(o[k]);
			}
		}
		return o;
	},

	lightbox: {
		fp: 0,
		n: 0,
		auto: 0,
		all: function(o) {
			$('img', oFly.empty(o) ? $(document) : o).each(function() {
				oFly.lightbox.one($(this));
			});
		},
		one: function(o) {
			var z = this, s = o.attr('src'), reg = oFly.reg('_s\\.(jpg|jpeg|png|gif)$', 'i');
			if (reg.test(s)) {
				var big = function(s) {
						return s.replace(reg, ".$1");
					},
					_change = function(n) {
						var _n = z.fp + n, a = z.n;
						if (_n >= a) {
							_n = 0;
						} else if(_n < 0) {
							_n = a -1;
						}
						z.fp = _n;
						var i = $('dl.fly-dialog > dd > table');
						i.find('img').replaceWith('<img src="'+big($('img[lightbox=' + _n + ']').attr('src'))+'"/>');
						i = i.find('img').css({opacity: 0}).load(function() {
							size(i);
							i.animate({opacity: 1}, 1000);
						});
					},
					next = function() {
						_change(1);
					},
					prev = function() {
						_change(-1);
					},
					auto = function() {
						var os = 'dl.fly-dialog > dd > ul > li:nth-child(2)', o = $(os);
						if (o.html() == '自动') {
							o.html('暂停');
							z.auto = function() {
								setTimeout(function() {
									if ($(os).html() == '暂停') {
										_change(1);
										z.auto();
									}
								}, 2000);
							};
							z.auto();
						} else {
							o.html('自动');
						}
					},
					close = function() {
						oFly._dialog_close();
					},
					size = function(z) {
						z.css({opacity: 0, width: '100%'});
									var h = z.height(), w = z.width();
									if (h / w > 433 / 650) {
										
											w = 433 * w/h;
											h = 433;
										
									}
									else {
										h = 650 * h/w;
										w = 650;
									}
									z.css({
										height: h + 'px',
										width: w + 'px'
									});
					};
				o.css('cursor', 'pointer').click(function() {
					z.fp = parseInt(o.attr('lightbox'));
					oFly.dialog({
						z: o,
						content: '<table style="width:650px; height:433px;"><tr><td valign="middle" align="center"><img src="' + big(o.attr('src')) +  '" width=0 onerror="this.src=\'' + oFly.staticPath + 'js/fly/sorry.gif\'" /></td></tr></table>',
						width: 660,
						height: 450,
						bar: false,
						load: function(dd) {
							var i = dd.find('img');
							i.ready(function() {
								
								function l (x, y, k, z) {
									return '<li style="background-position:' + x + 'px ' + y + 'px;" title="快捷键：' + k + '">' + z + '</li>';
								}
									
								size(i);
								i.animate({opacity: 1}, 500, function() {
									setTimeout(function() {
										dd.parent().animate({height: 470}, function() {
											dd.append('<ul class="fly-lightbox-cplan" style="display:none;">' + l(0, 3, '←', '上一张') + l(0, -18, 'Enter', '自动') + l(0, -36, 'Esc', '关闭') + l(0, -55, '→', '下一张')).find('ul').css({display: '', opacity: 0}).animate({opacity: 1})
											.find('li:first-child').click(prev)
											.next().click(auto)
											.next().click(close)
											.next().click(next);
										})
									;}, 500);
								});
							});
						},
						keyfnc: {
							'27': close,//esc
							'13': auto,//enter
							'37': prev,//上一张
							'39': next//下一张
						}
					}).css({background: 'url(' + oFly.staticPath +  'fly/images/loading.gif) no-repeat center center'});
				}).attr('lightbox', z.n++).parent().filter('a').click(function() {
					return false;	
				});
			}
			
		}
		
	}, 
	

	//插件调用
	_plugin_load: {}, _plugin_o: {},
	plugin: function(pname, o, p) {
		var cl = this._plugin_load[pname], co = this._plugin_o[pname], d = function(o, p) {o[pname](p);}, js = {
			lightBox: this.staticPath + 'js/jquery/lightbox/jquery.lightbox-0.5.js',
			corner: this.staticPath + 'js/jquery/jquery.corner.js'//http://www.methvin.com/jquery/jq-corner.html
		};
		if (typeof(cl) == 'undefined') {
			cl = 0;
		}
		if (typeof(co) == 'undefined') {
			co = [];
		}
		if (cl == 0) {
			cl = 1;
			$.getScript(js[pname], function() {
				var k;
				while (k = co.pop()) {
					d(k.o, k.p);
				}
				d(o, p);
				cl = 2;
			});
		} else if (cl == 1) {
			co.push({o: o, p: p});
		} else if (cl == 2) {
			d(o, p);
		}
	},
	
	//登陆认证
	auth: {
		_identity: '',
		clearIdentity: function() {
			this._identity = '';
		},
		hasIdentity: function() {
			if (this._identity == '') {
				var d = $.cookie('Fly_data');
				if (!oFly.empty(d)) {
					this._identity = (new Function('return ' + d))();
				} else {
					return false;
				}
			}
			return true;
		},
		getIdentity: function() {
			return this._identity;
		},
		forceLogin: function() {
			if (!this.hasIdentity()) {
				//setTimeout(function() {window.location.href = oFly.url('author', 'login') + '&goback=' + escape(window.location.href);}, 1);
				flyphp.d('login');
				return false;
			} else {
				return true;
			}
		}
	},

	init: function() {
		if (this.i != '') {
			$(document).ready(
				function() {
					if (oFly.i != '') {
						eval(oFly.i + (oFly.i.indexOf('(') > -1 ? '' : '();'));
						oFly.i = '';
					}
				}
			);
		}
	},
	
	go: function(u) {
		setTimeout(function() {window.location.href = u;}, 10);
	},
	
	//重新加载网页有利于缓存
	reload: function() {
		oFly.go(window.location.href.replace(oFly.reg('#.*'), ''));
	},
	
	//取得浏览器传递数据
	$_GET: function(k) {
		var u = unescape(window.location.href),
			m = u.match(oFly.reg("[\?&]+" + k + "=[^&]*", 'g'));
		if (m != null) {
			m =  m[m.length-1].match(oFly.reg("[\?&]+" + k + "=([^&]*)"));
			return m[1];
		}
		return '';
	},
	//将数字hash成array
	hashById: function(id) {
		var id = id.toString(), ids = [], l = id.length;
		while (l >= 0) {
			if (id.length <= 2) {
				ids.push(id);
				break;
			} else {
				ids.push(id.substr(l -2, 2));
				id = id.substr(0, l -2);
				l = id.length;
			}
		}
		return ids.reverse();
	},

	//获取已存在的ico
	ico: function(fext) {
		var ext = ['vsd', 'xls', 'xml', ['zip', 'rar'], 'ai', 'avi', 'bmp', 'cs', 'dll', 'doc', 'exe', 'fla', 'gif', 'htm', 'html', ['jpg', 'jpeg'], 'js', 'mdb', ['mp3', 'rm', 'rmvb', 'wma', 'wav'], 'pdf', 'png', 'ppt', 'rdp', 'swf', 'swt', 'txt'], k, ico = 'default.icon';
		if (-1 != ext.toString().indexOf(fext)) {
			if (-1 != $.inArray(fext, ext)) {
				ico = fext;
			} else {
				for (k in ext) {
					if (typeof(ext[k]) == 'object') {
						if (-1 != $.inArray(fext, ext[k])) {
							ico = ext[k][0];
							break;
						}
					}
				}
			}
		}
		return ico;
	},
	
	//根据hash路径获取id
	idByHash: function(p) {
		return p.match(oFly.reg('([\\/0-9]+)_?[a-z]?\\.[a-z0-9]{2,4}$', 'i'))[1].split('/').join('');
	},

	//根据 id hash 散列 便于分布到不同的文件夹 100个文件一个文件夹 5/32/19
	hashFileById: function (arr) {
		return arr.dir + oFly.hashById(arr.id).join('/') + arr.ext;
	},
	
	//根据文件名获取后缀
	fileExt: function(p) {
		return p.match(oFly.reg('\\.([a-z0-9]{2,4})$', 'i'))[1];
	},

	//获取fck数据
	getText: function(n) {
		try {var o = FCKeditorAPI.GetInstance(n);}catch(e) {}
		return (typeof(o) == 'undefined') ? $("textarea[name='" + n + "']").val() : o.GetXHTML(true);
	},

	//载入编辑器
	editor:function(n, p) {
		var c = $('textarea[name="' + n + '"]');
		c.val(c.val().replace(oFly.reg('fly_textarea', 'gi'), 'textarea'));
		
		if (c.val() == '') {
			oFly.fck(n, p);
		} else {
			this._editor(n, p);
		}
	},
	_editor: function (n, p) {     
		var ie = $.browser.msie, 
			h = p.height ? p.height : 200, 
			w = p.width, 
			t = $('textarea[name="' + n + '"]').css({display: 'none'}),
			cls = {
				height: h -13 - 20,
				width: w,
				padding: 0,
				margin: 0
			},
			bcls = {border: '1px solid #B1DAEF'},
			o = t.after('<div><a href="javascript:void(0)" title="展开工具栏" style="background: #F7F8FD;display: block; overflow: hidden; height: 8px; border: 1px outset #F7F8FD;width:' + ((p.width == '100%') ? '100%;margin-right:-2px;' : (ie ? w -2 : w) + 'px') + '"><img src="' + this.staticPath + 'js/fckeditor/editor/skins/default/images/toolbar.expand.gif" style="vertical-align:top;margin:2px 0 2px 2px;" /></a><iframe id="editor_' + n + '" frameborder="0"></iframe><textarea style="display:none"></textarea><div style="text-align:right;"><input type="checkbox"> 源代码</div></div>').next().css({width: w, display: 'inline'}).find('a').click(function() {
				oFly.fck(n, p);
				t.next().remove();
			}).next().css(cls), ot = o.next().css(cls);
			ot.next().find(':checkbox').click(function() {
				ot.val(t.val());
				var c = $(this).attr('checked');
				o.css('display', c ? 'none' : '');
				ot.css('display', c ? '' : 'none');
			});
			ot.change(function() {
				t.val(ot.val());
				f.body.innerHTML = toEditor(t.val());
			});
		if (!ie) {
			o.css(bcls);
			ot.css(bcls);
		}
		var f = o[0].contentWindow.document;
		f.designMode = "on";
		f.contentEditable = "true";
		f.open();
		f.write('<html><head><style type="text/css">body {' + (ie ? 'border:1px solid #B1DAEF;' : '') + 'padding: 5px;margin: 0px;background:#fff}*{font-size: 12px;}.fly-page-break {background-image:url(' + oFly.staticPath + 'js/fckeditor/editor/css/images/fck_pagebreak.gif);background-position:center center;background-repeat:no-repeat;border-color:#999999;border-style:dotted none;border-width:1px 0;clear:both;display:block;float:none;height:5px;width:100%;}.codes  {border:1px #0033FF solid; border-left:3px #0033FF solid; padding:2px; background:#D0E8FF; }</style></head><body topmargin=0 leftmargin=0></body></html>');
		f.close();

		//处理分页
		function toEditor(r) {
			var reg = oFly.reg('<div[^>]*style[^>]*page-break-after[^>]*always[^>]*>[^>]*<span[^>]*style[^>]*display[^>]*none[^>]*>[^<]*<\/span>[^<]*<\\/div>', 'i');
			while (reg.test(r)) {
			  r = r.replace(reg, '<img class="fly-page-break" src="' + oFly.staticPath + 'js/fckeditor/editor/images/spacer.gif" />')
			}
			 return r;
		}
		function toText(r) {
			var reg = oFly.reg('<img[^>]*class[^>]*fly-page-break[^>]*src=[^>]*>', 'i');
			while (reg.test(r)) {
			  r = r.replace(reg, '<div style="page-break-after: always;"><span style="display: none;">&nbsp;</span></div>')
			}
			 return r;
		}
		function _(){
			var r = toText(f.body.innerHTML);
			if (t.val() != r) {
				t.val(r);
			}
		 }
	    
		f.body.innerHTML = toEditor(t.val());
		
		$(f).keypress(function (e){
			switch (e.which) {
				case 13://回车
				  if($.browser.msie){
					 f.selection.createRange().pasteHTML('<br />');  
					  return false;
				  }
				break;
			}
			  
		  }).mouseover(_).mouseup(_).keyup(_);
	},
	alert: {
		n: 1,//只能说保证每个弹出对话框有一个不同的标记
		z: 1000,//z-index层级
		close: function(o) {
			var o = $(o).closest('dl'),f = o.data('f1');
			oFly.tip.clearAll(o);
			o.data('f2').remove();
			o.animate(o.data('c1'), function() {o.remove();});
			f.animate({opacity: 0}, function() {f.remove();});
		},
		init: function(j) {
			var z = this, 
			j = $.extend({//配置信息
				z: 'body',
				bar: true,
				title: '',
				content: '',
				width: 0,
				height: 0,
				load: '',
				keyfnc: {},
				bg: true
			}, j),
			n = this.n++, //标记
			fm = '<iframe scrolling="no" border="0" frameborder="0" n="' + n + '"></iframe>', //框架
			b = $('body'), //body
			o,//弹窗容器
			fs = $(j.z).offset(),
			c1 = {height: 0, width: 0, opacity: 0, left: fs.left, top: fs.top},
			w = $(window), d= $(document),
			c2 = function () {return {height: j.height, width: j.width, opacity: 1, left: (w.width() - j.width)/2 + w.scrollLeft(), top: (w.height() - j.height)/2 + w.scrollTop()}},
			ihtm = function (f, s) {
				f = f[0].contentWindow.document;
				f.open();
				f.write(s);
				f.close();
			},
			f1, f2, dd,
			x = function() {
				z.close(dd);
			},
			fd = '<html><head><title></title></head><body style="background:#000;overflow:hidden" onclick="parent.oFly.alert.close(\'.fly-dialog[n='+n+'] dd\')"></body></html>';
			b.append(fm + fm + '<dl class="fly-dialog" n="' + n + '">' + 
			(j.bar ? '<dt onselectstart="return false"><a class="fly-dialog-close" href="javascript:" title="关闭">关闭</a>' + 
			j.title + '</dt>' : '') + '<dd>' + j.content + '</dd></dl>');
			o = $('.fly-dialog[n='+n+']');
			dd = o.find('dd');
			f1 = $($('iframe[n="'+n+'"]')[0]);
			f2 = f1.next();
			f1.css({position:'absolute', opacity: 0, left:0, top:0, display: j.bg ? '' : 'none', width: b.width(), height:b.height()}).animate({opacity: 0.8});
			ihtm(f1, fd);
		
			//为了修复ie下fck的工具栏透明bug
			ihtm(f2.css({position:'absolute',display: 'none'}), fd.replace('#000', '#F7F8FD'));
			//居中
			o.css(c1).animate(c2(), function() {
				var s = o.offset();
				f2.css({display: ''}).css(c2());
				if ($.isFunction(j.load)) {
					j.load(dd);
				}
			}).data('c1', c1).data('f1', f1).data('f2', f2).click(function() {
				$('dl[n="'+n+'"]').css({zIndex: ++z.z});
			});
			//滚动
			w.scroll(function() {
				var c = c2();
				o.css(c);
				f2.css(c);
			});
			//拖动	
			dd.prev().mousedown(function(e) {
				var ex = e.pageX, ey = e.pageY, of = o.offset();
				d.mousemove(function(e) {
					var c = {left: of.left + e.pageX - ex, top: of.top + e.pageY - ey};
					o.css(c);
					f2.css(c);
				}).mouseup(function() {
					d.unbind('mousemove');
				});
			}).find('a').click(x);
			
			d.keydown(function (e){
				var y = j.keyfnc[e.keyCode];
				if ($.isFunction(y)) {
					try{y(dd);}catch (e){}
				}
			});
			return dd;
		},
		words: function(o, s) {
			$(o).closest('dl').find('dd').prepend('<table width="100%" height="100%"><tr><td align="center" valign="middle">' + s + '<br /><br /><br /><br /></td></tr></table>');	
		}
	},

	//fck编辑器
	fck: function(n, p) {//所见所得
		if (typeof(p) == 'undefined'){p = {};}
		try{if (typeof(FCKeditor) == 'undefined'){FCKeditor = false;}}catch (e){}
		if (!FCKeditor){
			$.getScript(this.staticPath + "js/fckeditor/fckeditor.js",function(){oFly.fck(n, p);}); 
		} else {
			var o = new FCKeditor(n) ;
			o.BasePath	= '/plugins/fckeditor/' ;
			o.ToolbarSet = p.bar ? p.bar : 'Default';//o.ToolbarSet = 'Default' 
			o.Width = p.width ? p.width : '100%';
			o.Height = p.height ? p.height : '200'; 
			o.ReplaceTextarea() ;
			if($.browser.msie) 
			setTimeout(new Function("var a = document.frames['"+n+"___Frame'];if (a.document.body.innerHTML == '')a.location.href = a.location.href;"), 100);
		}
	},
	//设为首页
	setHomepage: function (){
		var u = window.location.href;
		if ($.browser.msie){
				document.body.style.behavior='url(#default#homepage)';
				document.body.setHomePage(u);
		}else if(window.sidebar){
			if(window.netscape){
				try{
					netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
				}catch (e){
					alert( "亲爱的用户你好：\n你使用的不是IE浏览器，此操作被浏览器阻挡了，你可以选择手动设置为首页！\n给你带来的不便，本站深表歉意。" );
				}
				var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
                prefs.setCharPref('browser.startup.homepage',u);
			}
		}
	},
	//本地收藏
	addLocal: function() {
		var url = window.location.href, title = window.document.title;
		if(window.sidebar){
			window.sidebar.addPanel(title,url,"");
		} else if(document.all){
			window.external.AddFavorite(url,title);
		} else if(window.external && ("AddSearchProvider" in window.external)) {
			window.external.AddSearchProvider(url);
		}else if(window.opera&&window.print){
			return true;
		}
	},

	load: function() {
		var s = document.getElementsByTagName("script"), n = s.length, i = 0, f, k, 
		w = window.location.href, p, html = [], sp = this.staticPath;
		//获取路径
		p = s[i].getAttribute('p');
		p = p ? p + '/' : '/';

		this.sitePath = w.match(oFly.reg('http:\\/\\/[^\\/]*','i'))[0] + '/';
		function wri(j) {
			html.push('<script type="text/javascript" src="' + j + '"><\/scr' + 'ipt>');
		}
		if (typeof(jQuery) == 'undefined') {
			var jq = ['1.3.2.min', 'cookie'].reverse();
			while (k = jq.pop()) {
				wri(sp + 'js/jquery/jquery.' + k + '.js');
			}
		}
		//wri('http://static.kiz.cn/js/firebug/firebug.js');

		for (i; i < n; i++) {
			if (oFly.reg('\\/fly\\.js$', 'i').test(s[i].getAttribute('src'))) {
				//传递变量
				f = s[i].getAttribute('v');
				f = f ? (new Function("return " + f))() : [];
				for (k in f) {
					this.v[k] = f[k];
				}
				//获取初始化的函数
				f = s[i].getAttribute('i');
				if (f) {
					this.i = f;
				}
				//载入js
				f = s[i].getAttribute('j');
				f = f ? f.split('|') : [];
				for (k in f) {
					wri(sp + p + 'js/' + f[k] + '.js');
				}
				//载入css
				f = s[i].getAttribute('c');
				s = oFly.$_GET('style');
				
				f = f ? f.split('|') : [];
				html.push('<link rel="stylesheet" type="text/css" href="'+sp + 'style/global.css'+'" />');
				for (k in f) {
					if (!oFly.reg('^http:').test(f[k])) {
						if (oFly.reg('^\\d+$').test(f[k])) {
							//临时模版预览
							f[k] = sp + 'style/' + (s == '' ? f[k] : s) + '/my.css';
						} else {
							f[k] = sp + p + 'css/' + f[k] + '.css';
						}
					}
					html.push('<link rel="stylesheet" type="text/css" href="' + f[k]+'" />');
				}
			}
		}
		wri(sp + 'fly/js/flyphp.js');
		document.write(html.join(''));
	},

	
	page: function(o, url, max) {
		//采用f属性进行锁定，杜绝两次绑定事件
		if (oFly.empty($(o).attr('tip'))) {
			$(o).attr('tip', '请输入页码: 1 ~ ' + max + ' 数字，按回车键(Enter)确定跳转').keydown(function(e) {
				if (e.keyCode == 13) {
					var a = o.value, b;
					if (oFly.reg('^\\d+$').test(a) && a > 0 && a <= max) {
						if (url == '') {
							b = window.location.href;
							if (oFly.reg('page=', 'i').test(b)) {
								b = b.replace(oFly.reg('page=\\d+'), 'page=' + a)
							} else {
								b = b + (oFly.reg('\\?').test(b) ? '&' : '?') + 'page=' + a;
							}
						} else {
							b = this.curl + '?&fly=' + url +  '-' + a + '.html';
						}
						window.location.href = b;
					} else {
						setTimeout(function(){
							alert('请填写1~' + max + ' 范围的页面！');
							$(o).select();
						}, 10);
					}
					return false;
				}
			});
			oFly.tip.all($(o).parent());
			$(o).focus();
		}
	},
	goback: function(t) {
		setTimeout(function() {
			oFly.go(document.referrer);
		}, t ? t : 0);
	},
	
	_upload_o: 0,
	upload: function(j) {
		var _ = 0;
		try {_ = SWFUpload;} catch(e) {}
		function d() {
			oFly._upload_o = new SWFUpload(j);
		}
		if (_ == 0) {
			var p = oFly.staticPath + 'js/swfupload/';
			oFly.css(p + 'default.css?a=' + oFly.rand(1,1000));
			$.getScript(p + 'upload.js', d);
		} else {
			d();
		}
	}
};
oFly.load();