/*
 * author 		zhang binjue
 * blog			http://hi.baidu.com/paperstudio
 * copyright	No Rights Reserved
 * version		1.2.9
 * reference	Jquery.js
 */
(function(){var undefined,BJ=window.BJ=function(name){if(typeof name=="string"&&name.charAt(0)=="#"){return document.getElementById(name.slice(1,name.length));}return new BJ.fn(name);};BJ.fn=BJ.prototype=function(name){if(typeof name=="string"){this.name=name;this.elem=document.getElementById(name);}else{this.elem=name;}};BJ.fn.prototype={css:function(prop){var elem=this.elem;if(typeof prop=="string"){if(elem.style[prop]){return elem.style[prop];}else if(elem.currentStyle){if(prop=="float")prop="styleFloat";return elem.currentStyle[prop];}else if(document.defaultView&&document.defaultView.getComputedStyle){if(prop=="float")prop="cssFloat";if(prop!="display"&&(elem.style.display=="none"||document.defaultView.getComputedStyle(elem,null)["display"]=="none")){BJ(elem).bestDisplay();var t=document.defaultView.getComputedStyle(elem,null)[prop];elem.style.display="none";return t;}return document.defaultView.getComputedStyle(elem,null)[prop];}else{return null;}}else{BJ(elem).each(function(){for(var i in prop){if(i=="opacity")this.style.filter="alpha(opacity="+prop[i]*100+")";this.style[i]=prop[i];}});}},each:function(callback){return BJ.each(this.elem,callback);},resetCSS:function(prop){var old={};for(var i in prop){old[i]=BJ(this.elem).css(i);this.elem.style[i]=prop[i];}return old;},addClass:function(name){var elem=this.elem;BJ(elem).each(function(){var _name=name,oldClass=this.className;if(oldClass==''){this.className=name;}else{oldClass=oldClass.split(" ");_name=_name.split(" ");var namePass='';for(var i=0;i<_name.length;i++){for(var j=0;j<oldClass.length;j++){if(oldClass[j]==_name[i]){break;}if(j==oldClass.length-1&&oldClass[j]!=_name[i]){namePass=namePass+" "+_name[i];}}}this.className=oldClass.join(" ")+namePass;}});return BJ(elem);},removeClass:function(name){var elem=this.elem;if(name===undefined){BJ(elem).each(function(){this.className="";});}else{BJ(elem).each(function(){var _name=name,oldClass=this.className;if(oldClass=='')return;oldClass=oldClass.split(" ");_name=_name.split(" ");for(var i=0;i<_name.length;i++){for(var j=0;j<oldClass.length;j++){if(oldClass[j]==_name[i]){oldClass.splice(j,1);break;}}}this.className=oldClass.join(" ");});}return BJ(elem);},setOpacity:function(level){BJ(this.elem).each(function(){this.style.filter=this.filters?this.style.filter='alpha(opacity='+level+')':this.style.opacity=level/100;});},getElementPos:function(){var elem=this.elem,ua=navigator.userAgent.toLowerCase(),isOpera=(ua.indexOf('opera')!=-1),isIE=(ua.indexOf('msie')!=-1&&!isOpera),elemNone=null;if(elem.parentNode===null){return false;}if(BJ(elem).css("display")=="none"){BJ(elem).bestDisplay();elemNone=true;}var parent=null,pos=[],box;if(elem.getBoundingClientRect){box=elem.getBoundingClientRect();var scrollTop=Math.max(document.documentElement.scrollTop,document.body.scrollTop);var scrollLeft=Math.max(document.documentElement.scrollLeft,document.body.scrollLeft);if(elemNone){elem.style.display="none";}return{x:box.left+scrollLeft,y:box.top+scrollTop};}else if(document.getBoxObjectFor){box=document.getBoxObjectFor(el);var borderLeft=(elem.style.borderLeftWidth)?parseInt(elem.style.borderLeftWidth):0;var borderTop=(elem.style.borderTopWidth)?parseInt(elem.style.borderTopWidth):0;pos=[box.x-borderLeft,box.y-borderTop];}else{pos=[elem.offsetLeft,elem.offsetTop];parent=elem.offsetParent;if(parent!=el){while(parent){pos[0]+=parent.offsetLeft;pos[1]+=parent.offsetTop;parent=parent.offsetParent;}}if(ua.indexOf('opera')!=-1||(ua.indexOf('safari')!=-1&&elem.style.position=='absolute')){pos[0]-=document.body.offsetLeft;pos[1]-=document.body.offsetTop;}}if(elem.parentNode){parent=elem.parentNode;}else{parent=null;}while(parent&&parent.tagName!='BODY'&&parent.tagName!='HTML'){pos[0]-=parent.scrollLeft;pos[1]-=parent.scrollTop;if(parent.parentNode){parent=parent.parentNode;}else{parent=null;}}if(elemNone){elem.style.display="none";}return{x:pos[0],y:pos[1]};},getElem:function(){return this.elem;},find:function(selector){var elem=this.elem,result=[],parts=selector.split(" "),getTagName=function(paraent,tagname){var r=[];BJ(paraent).each(function(){var c=BJ(this).getElem().getElementsByTagName(tagname);if(c.length!=0)r=r.concat(BJ.realArray(c));});return r;},part=parts.shift();if(part.indexOf(".")==-1){result=getTagName(elem,part);return parts.length==0?BJ(result):BJ(result).find(parts.join(' '));}else{var p=part.split("."),partTagName=p[0]==''?'*':p[0],partClassName=p[1],r=getTagName(elem,partTagName);BJ(r).each(function(){if(this.className.indexOf(partClassName)>-1){result.push(this);}});return parts.length==0?BJ(result):BJ(result).find(parts.join(' '));}},bind:function(obj){var elem=this.elem;for(var i in obj){(function(k){var callback=obj[k],type=k;BJ(elem).each(function(){var _this=this;var fn=function(e){return callback.call(_this,window.event||e);};_this.addEventListener?_this.addEventListener(type,fn,false):_this.attachEvent?_this.attachEvent('on'+type,fn):_this['on'+type]=function(e){fn(e);};});})(i);}return BJ(elem);},prev:function(num){var num=num||1,elem=this.elem;while(num!=0){do{elem=elem.previousSibling;}while(elem&&elem.nodeType!=1);num--;}return elem?BJ(elem):null;},prevAll:function(){var nodes=[],elem=this.elem,firstNode=BJ(elem.parentNode).first().getElem();while(elem!=firstNode){elem=elem.previousSibling;if(elem&&elem.nodeType==1){nodes.push(elem);}};return nodes.length==0?null:BJ(nodes);},next:function(num){var num=num||1,elem=this.elem;while(num!=0){do{elem=elem.nextSibling;}while(elem&&elem.nodeType!=1);num--;}return elem?BJ(elem):null;},nextAll:function(){var nodes=[],elem=this.elem,lastNode=BJ(elem).parent().last().getElem();while(elem!=lastNode){elem=elem.nextSibling;if(elem&&elem.nodeType==1){nodes.push(elem);}};return nodes.length==0?null:BJ(nodes);},first:function(){var elem=this.elem,elem=elem.firstChild;return elem==null?null:(elem&&elem.nodeType!=1)?BJ(elem).next():BJ(elem);},last:function(){var elem=this.elem,elem=elem.lastChild;return elem==null?null:(elem&&elem.nodeType!=1)?BJ(elem).prev():BJ(elem);},children:function(num){var children=[],childNodes=this.elem.childNodes;for(var i=0,l=childNodes.length;i<l;i++){if(childNodes[i].nodeType==1){children.push(childNodes[i]);}}return children.length==0?null:num===undefined?BJ(children):BJ(children[num-1]);},parent:function(num){var num=num||1,elem=this.elem;while(num--){elem=elem.parentNode;}return elem?BJ(elem):null;},siblings:function(){var r1=this.prevAll(),r2=this.nextAll();if(r1!=null&&r2!=null)return BJ(r1.getElem().concat(r2.getElem()));else if(r1==null&&r2!=null)return r2;else if(r1!=null&&r2==null)return r1;else return null;},remove:function(){if(this.elem!=null)this.elem.parentNode.removeChild(this.elem);},empty:function(){var elem=this.elem;while(elem.firstChild){elem.removeChild(elem.firstChild);};return BJ(elem);},html:function(content){var elem=this.elem;if(content===undefined){return BJ.trim(elem.innerHTML.toString());}else{elem.innerHTML=content.toString();return BJ(elem);}},text:function(obj){var r=[],elem=this.elem,tempText=this.forText(r,elem);if(obj===undefined){return tempText.join('')==''?null:tempText.join('');}else if(obj.getArray===true){return tempText.length==0?null:tempText;}},forText:function(r,node){var nodeChildren=node.childNodes,len=nodeChildren.length;for(var i=0;i<len;i++){if(nodeChildren[i].nodeType==1){this.forText(r,nodeChildren[i]);}if(nodeChildren[i].nodeType==3){var nodeChildrenValue=BJ.trim(nodeChildren[i].nodeValue);if(nodeChildrenValue!=""){r.push(nodeChildrenValue);}}}return r;},attr:function(name,value){if(name===undefined||typeof name!="string")return'';var elem=this.elem,name={'for':'htmlFor','class':'className'}[name]||name;if(value!==undefined){if(typeof value=="string"){value=[value];}BJ(elem).each(function(i){this[name]=value[i];if(this.setAttribute){value[i]==undefined?this.setAttribute(name,value[value.length-1]):this.setAttribute(name,value[i]);}});return BJ(elem);}else{return elem[name]||elem.getAttribute(name)||'';}},stringToElem:function(content){if(/^<\w+>/.test(content)){var nodeName=content.match(/\w+/g,'<$1>')[0].toLowerCase(),node=document.createElement(nodeName);node.innerHTML=content.substr(nodeName.length+2,content.length-((nodeName.length+2)*2+1));return node;}else{return document.createTextNode(content);}},append:function(content){var elem=this.elem;typeof content=="string"?elem.innerHTML+=content:elem.appendChild(content);return BJ(elem);},prepend:function(content){var elem=this.elem,fChild=elem.firstChild;typeof content=="string"?elem.insertBefore(this.stringToElem(content),fChild):elem.insertBefore(content,fChild);return BJ(elem);},after:function(content){var elem=this.elem,parent=elem.parentNode;content=typeof content=="string"?this.stringToElem(content):content;parent.firstChild==elem?parent.appendChild(content):parent.insertBefore(content,elem.nextSibling);return BJ(elem);},before:function(content){var elem=this.elem,parent=elem.parentNode;content=typeof content=="string"?this.stringToElem(content):content;parent.insertBefore(content,elem);return BJ(elem);},bestDisplay:function(){var elem=this.elem,tagname=elem.tagName,node=document.createElement(tagname);document.body.appendChild(node);var tempDisplay=BJ(node).css("display");BJ(node).remove();if(elem.currentStyle){var outDisplay=elem.currentStyle["display"];}else{var outDisplay=document.defaultView.getComputedStyle(elem,null)["display"];}if(elem.style.display=="none"){elem.style.display="";if(outDisplay=="none"){elem.style.display=tempDisplay;}}else{if(outDisplay=="none"){elem.style.display=tempDisplay;}}return BJ(elem);},hide:function(speed,callback){var elem=this.elem;if(speed===undefined){BJ(elem).each(function(){this.$oldDisplay=BJ(this).css("display");if(this.$oldDisplay!=='none'){this.style.display="none";}});}else{if(typeof speed==="string"){if(speed=="fast")speed=2;if(speed=="normal")speed=5;if(speed=="slow")speed=10;}speed=speed<100?speed:5;BJ(elem).each(function(){var self=this;if(BJ(self).css("display")=='none')return;var h=BJ(self).getElemContentHeightWidth().height,w=BJ(self).getElemContentHeightWidth().width,oldCSSTest=self.style.cssText;self.style.overflow="hidden";for(var i=100;i>=0;i-=1){(function(pos){setTimeout(function(){BJ(self).css({height:(pos/100)*h+"px",width:(pos/100)*w+"px"});BJ(self).setOpacity(pos);if(pos==0){self.style.cssText=oldCSSTest;self.curDisplay=BJ(self).css("display");if(self.curDisplay!='none')self.$oldDisplay=self.curDisplay;self.style.display="none";if(callback)callback.call(self);}},(-pos+101)*(speed+1));})(i);}});}return BJ(elem);},show:function(speed,callback){var elem=this.elem;if(speed===undefined){BJ(elem).each(function(){if(this.$oldDisplay===undefined){BJ(this).bestDisplay();}else{this.style.display=this.$oldDisplay;}});}else{if(typeof speed==="string"){if(speed=="fast")speed=2;if(speed=="normal")speed=5;if(speed=="slow")speed=10;}speed=speed<100?speed:5;BJ(elem).each(function(){var self=this;if(BJ(self).css("display")=='block'||BJ(self).css("display")=='inline')return;var oldCSSTest=self.style.cssText;h=BJ(self).getElemContentHeightWidth().height,w=BJ(self).getElemContentHeightWidth().width;BJ(self).css({height:"0",overflow:"hidden",opacity:"0"});BJ(self).show();for(var i=0;i<=100;i+=1){(function(pos){setTimeout(function(){BJ(self).css({height:(pos/100)*h+"px",width:(pos/100)*w+"px"});BJ(self).setOpacity(pos);if(pos==100){self.style.cssText=oldCSSTest;self.style.display=self.$oldDisplay||'';if(callback)callback.call(self);}},(pos+1)*(speed+1));})(i);}});}return BJ(elem);},sDown:function(speed,callback){var elem=this.elem;if(speed===undefined){var speed=5;}else{if(typeof speed==="string"){if(speed=="fast")speed=1;else if(speed=="normal")speed=5;else if(speed=="slow")speed=10;}var speed=speed<100?speed:3;}BJ(elem).each(function(){if(BJ(this).css("display")!="none")return;var self=this,h=BJ(self).getElemContentHeightWidth().height,paddingTop=parseInt(BJ(self).css("paddingTop"))||0,paddingBottom=parseInt(BJ(self).css("paddingBottom"))||0;borderTop=parseInt(BJ(self).css("borderTopWidth"))||0,borderBottom=parseInt(BJ(self).css("borderBottomWidth"))||0,oldCSSTest=self.style.cssText;BJ(self).css({height:'0',paddingTop:"0",paddingBottom:"0",borderTopWidth:"0",borderBottomWidth:"0",overflow:"hidden"});if(!BJ.isIE())BJ(self).setOpacity(0);BJ(self).show();for(var i=0;i<=100;i+=1){(function(pos){setTimeout(function(){BJ(self).css({height:(pos/100)*h+"px",paddingTop:(pos/100)*paddingTop+"px",paddingBottom:(pos/100)*paddingBottom+"px",borderTopWidth:(pos/100)*borderTop+"px",borderBottomWidth:(pos/100)*borderBottom+"px"});if(!BJ.isIE())BJ(self).setOpacity(pos);if(pos==100){self.style.cssText=oldCSSTest;BJ(self).show();if(callback)callback,call(self);}},(pos+1)*(speed+1));})(i);}});return BJ(elem);},sUp:function(speed,callback){var elem=this.elem;if(speed===undefined){var speed=5;}else{if(typeof speed==="string"){if(speed=="fast")speed=1;else if(speed=="normal")speed=5;else if(speed=="slow")speed=10;}var speed=speed<100?speed:3;}BJ(elem).each(function(){if(BJ(this).css("display")=="none")return;var self=this,h=BJ(self).getElemContentHeightWidth().height,paddingTop=parseInt(BJ(self).css("paddingTop"))||0,paddingBottom=parseInt(BJ(self).css("paddingBottom"))||0,borderTop=parseInt(BJ(self).css("borderTopWidth"))||0,borderBottom=parseInt(BJ(self).css("borderBottomWidth"))||0,oldCSSTest=self.style.cssText;self.style.overflow="hidden";for(var i=100;i>=0;i-=1){(function(pos){setTimeout(function(){BJ(self).css({height:(pos/100)*h+"px",paddingTop:(pos/100)*paddingTop+"px",paddingBottom:(pos/100)*paddingBottom+"px",borderTopWidth:(pos/100)*borderTop+"px",borderBottomWidth:(pos/100)*borderBottom+"px"});if(!BJ.isIE())BJ(self).setOpacity(pos);if(pos==0){self.style.cssText=oldCSSTest;BJ(self).hide();if(callback)callback.call(self);}},(-pos+101)*(speed+1));})(i);}});return BJ(elem);},fIn:function(speed,callback){var elem=this.elem;if(typeof speed=="string"){switch(speed){case"fast":speed=20;break;case"normal":speed=10;break;case"slow":speed=5;break;}}var speed=speed===undefined?10:speed<100?speed:10;BJ(elem).each(function(){var self=this;if(self.fOutTime||self.fInTime||BJ(self).css("display")!="none")return;BJ(self).show();var pos=0,endPos=BJ(self).css("opacity")*100||100,oldCSSText=self.style.cssText;BJ(self).setOpacity(pos);self.style.zoom=1;self.fInTime=setInterval(function(){pos=pos+speed/5;if(pos>=endPos){clearInterval(self.fInTime);self.fInTime=null;self.style.cssText=oldCSSText;if(callback)callback.call(self);}else{BJ(self).setOpacity(pos);}},1);});return BJ(elem);},fOut:function(speed,callback){var elem=this.elem;if(typeof speed=="string"){switch(speed){case"fast":speed=20;break;case"normal":speed=10;break;case"slow":speed=5;break;}}var speed=speed===undefined?10:speed<100?speed:10;BJ(elem).each(function(){var self=this;if(self.fOutTime||self.fInTime||BJ(self).css("display")=="none")return;var pos=BJ(self).css("opacity")*100||100,endPos=0,oldCSSText=self.style.cssText;BJ(self).setOpacity(pos);self.style.zoom=1;self.fOutTime=setInterval(function(){pos=pos-speed/5;if(pos<=endPos){clearInterval(self.fOutTime);self.fOutTime=null;self.style.cssText=oldCSSText;BJ(self).hide();if(callback)callback.call(self);}else{BJ(self).setOpacity(pos);}},1);});return BJ(elem);}};BJ.each=function(r,callback){var tr=[];r.length===undefined?tr.push(r):tr=r;var i=0,length=tr.length;for(var value=tr[0];i<length&&callback.call(value,i)!==false;value=tr[++i]){}};BJ.trim=function(s){if(typeof s=="string")return s.replace(/^\s+|\s+$/g,"");};BJ.setCookie=function(name,value,days){var Days=days||30;var exp=new Date();exp.setTime(exp.getTime()+Days*24*60*60*1000);document.cookie=name+"="+escape(value)+";expires="+exp.toGMTString();};BJ.getCookie=function(name){var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));if(arr!=null)return unescape(arr[2]);return null;};BJ.delCookie=function(name){var exp=new Date();exp.setTime(exp.getTime()-1);var cval=BJ.getCookie(name);if(cval!=null)document.cookie=name+"="+cval+";expires="+exp.toGMTString();};BJ.isIE=function(v){var msg=navigator.userAgent;if(v===undefined){return msg.indexOf("MSIE")>-1?true:false;}if(+v==6){return msg.indexOf("MSIE 6.0")>-1?true:false;}if(+v==7){return msg.indexOf("MSIE 7.0")>-1?true:false;}};BJ.isOpera=function(){return navigator.userAgent.indexOf("Opera")>-1?true:false;};BJ.isFirefox=function(){return navigator.userAgent.indexOf("Firefox")>-1?true:false;};BJ.ieImage=function(){try{document.execCommand("BackgroundImageCache",false,true);}catch(e){}};BJ.getMouse=function(e){e=e||window.event;if(e.pageX||e.pageY){return{x:e.pageX,y:e.pageY};}var dd=document.documentElement;return{x:e.clientX+dd.scrollLeft-dd.clientLeft,y:e.clientY+dd.scrollTop-dd.clientTop};};BJ.getBody=function(){return{height:document.body.clientHeight,width:document.body.clientWidth}};BJ.getArea=function(){return{height:document.documentElement.clientHeight,width:document.documentElement.clientWidth}};BJ.getScroll=function(){return{top:document.documentElement.scrollTop,left:document.body.scrollLeft}};BJ.getMax=function(){var dd=document.documentElement;return{height:Math.max(dd.scrollHeight,dd.clientHeight),width:Math.max(dd.scrollWidth,dd.clientWidth)}};BJ.lightbox=function(obj){BJ.lightboxCheck=true;var ob=obj===undefined?{}:obj,op=ob.opacity||0.4,z=ob.z||1000,c=ob.color||"#000",html='<div style=\" filter:alpha(opacity='+op*100+'); height:'+BJ.getMax().height+'px;width:'+BJ.getMax().width+'px;z-index:'+z+';background-color:'+c+';opacity:'+op+';left:0;top:0;position:absolute;\"><\/div>',div=document.createElement("div");div.setAttribute("id","BJ-lightbox");div.innerHTML=html;document.body.appendChild(div);window.onresize=function(){if(BJ.lightboxCheck){BJ("BJ-lightbox").first().css({height:BJ.getMax().height+"px",width:BJ.getMax().width+"px"});}};};BJ.removeLightbox=function(){BJ.lightboxCheck=false;if(document.getElementById("BJ-lightbox")){BJ("BJ-lightbox").remove();}};BJ.stopBubble=function(e){if(e&&e.stopPropagation){e.stopPropagation();}else{window.event.cancelBubble=true;}};BJ.stopDefault=function(e){if(e&&e.preventDefault){e.preventDefault();}else{window.event.returnValue=false;}return false;};BJ.realArray=function(c){try{return Array.prototype.slice.call(c);}catch(e){var r=[],len=c.length;for(var i=0;i<len;i++){r[i]=c[i];}return r;}};BJ.getVersion=function(){return"1.2.9";};BJ.extend=function(obj){for(var i in obj){for(var k in BJ.fn.prototype){if(i==k){alert("扩展中的函数名已经存在，请修改!");return false;}}BJ.fn.prototype[i]=obj[i];}};BJ.extend({hold:function(obj){var elem=this.elem;BJ(elem).each(function(){var node=this;obj.timeOn=obj.timeOn||1;obj.timeOut=obj.timeOut||1;node.onmouseover=function(){var _this=this;clearTimeout(_this.timeOut);_this.timeOn=setTimeout(function(){if(obj.on!==undefined)obj.on.call(_this);},obj.timeOn);};node.onmouseout=function(){var _this=this;clearTimeout(_this.timeOn);_this.timeOut=setTimeout(function(){if(obj.out!==undefined)obj.out.call(_this);},obj.timeOut);};});},getElemHeightWidth:function(){var elem=this.elem;if(BJ(elem).css("display")!='none'){return{height:elem.offsetHeight||parseInt(BJ(elem).css("height")),width:elem.offsetWidth||parseInt(BJ(elem).css("width"))}}var old=BJ(elem).resetCSS({display:'',visibility:'hidden'});var hw={height:elem.offsetHeight||parseInt(BJ(elem).css("height")),width:elem.offsetWidth||parseInt(BJ(elem).css("width"))};BJ(elem).css(old);return hw;},getElemContentHeightWidth:function(){var elem=this.elem,fourWay=["Left","Right","Top","Bottom"],opadding=[],oborder=[];if(BJ(elem).css("display")!='none'){for(var i=0;i<fourWay.length;i++){opadding[i]=parseInt(BJ(elem).css("padding"+fourWay[i]))||0;oborder[i]=parseInt(BJ(elem).css("border"+fourWay[i]+"Width"))||0;}return{width:BJ(elem).getElemHeightWidth().width-opadding[0]-opadding[1]-oborder[0]-oborder[1],height:BJ(elem).getElemHeightWidth().height-opadding[2]-opadding[3]-oborder[2]-oborder[3]}}var old=BJ(elem).resetCSS({display:'',visibility:'hidden'});for(var i=0;i<fourWay.length;i++){opadding[i]=parseInt(BJ(elem).css("padding"+fourWay[i]))||0;oborder[i]=parseInt(BJ(elem).css("border"+fourWay[i]+"Width"))||0;}var hw={width:BJ(elem).getElemHeightWidth().width-opadding[0]-opadding[1]-oborder[0]-oborder[1],height:BJ(elem).getElemHeightWidth().height-opadding[2]-opadding[3]-oborder[2]-oborder[3]};BJ(elem).css(old);return hw;}});BJ.ajax=function(obj){if(!obj.url)return;var xmlhttp=(function(){try{return new XMLHttpRequest();}catch(e){if(window.ActiveXObject){var ActiveXName=['MSXML2.XMLHttp.5.0','MSXML2.XMLHttp.4.0','MSXML2.XMLHttp.3.0','MSXML2.XMLHttp','Microsoft.XMLHttp'];for(var i=0;i<ActiveXName.length;i++){try{return new ActiveXObject(ActiveXName[i]);}catch(e){return false;}}}else{return false;}}})();var type=obj.type||"get",asyn=obj.asyn||true;if(xmlhttp){xmlhttp.open(type,obj.url,asyn);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState!=4){if(obj.before){obj.before();}}else{if(xmlhttp.status==200){obj.xml===true?obj.success(xmlhttp):obj.success(BJ.trim(xmlhttp.responseText));}else{alert("Error: status code is "+xmlhttp.status);}}};if(obj.stop!==undefined){var time=obj.time||10000;setTimeout(function(){if(xmlhttp.readyState!=4){xmlhttp.abort();obj.stop();return;}},time);}xmlhttp.setRequestHeader("If-Modified-Since","0");xmlhttp.send(null);}else{if(obj.error){obj.error();}}};BJ.parseXML=function(xmlhttp){var xmlDoc=xmlhttp.responseXML.documentElement,result=[];return{stringToArray:function(s){return s.split(" ");},findChild:function(root,nodes){var self=this,tempRoot=root.getElementsByTagName(nodes[0]);if(nodes.length==1){result.push(tempRoot[0]);}else{for(var i=0,len=tempRoot.length;i<len;i++){var tempNodes=nodes.concat();tempNodes.shift();self.findChild(tempRoot[i],tempNodes);}}},find:function(xmlNode){var nodes=this.stringToArray(xmlNode);if(nodes.length==1){return xmlDoc.getElementsByTagName(xmlNode);}else{this.findChild(xmlDoc,nodes);return result;}},findValue:function(xmlNode){var value=[],nodes=this.stringToArray(xmlNode);if(nodes.length==1){var xmlNodes=xmlDoc.getElementsByTagName(xmlNode);BJ(xmlNodes).each(function(){value.push(BJ(this).text());});}else{BJ(this.find(xmlNode)).each(function(){value.push(BJ.trim(BJ(this).text()));});}return value;}}};BJ.drag=function(obj){return new BJ.drag.fn(obj);};BJ.drag.fn=BJ.drag.prototype=function(obj){var key=false,elem,hand,parentnode=null;elem=typeof obj.node=="string"?document.getElementById(obj.node):obj.node;if(obj.hand){hand=typeof obj.hand=="string"?document.getElementById(obj.hand):obj.hand;}else{hand=elem;}elem.style.zoom=1;var el=elem;while(BJ(el).parent()){if(BJ(el).parent().css("position")=="relative"||BJ(el).parent().css("position")=="absolute"){parentnode=BJ(el).parent().getElem();break;}else{el=BJ(el).parent().getElem();}}var oldOpacity=BJ(elem).css("opacity"),oldOpacity=oldOpacity<=1?oldOpacity*100:oldOpacity,oldCursor=BJ(hand).css("cursor");hand.onmousedown=function(event){try{hand.setCapture();}catch(e){}if(obj.mousedownCallback){obj.mousedownCallback(elem);}key=true;hand.style.cursor="move";if(obj.opacity){BJ(elem).setOpacity(obj.opacity);}var x=BJ.getMouse(event).x,y=BJ.getMouse(event).y;if(parentnode){var px=BJ(parentnode).getElementPos().x,py=BJ(parentnode).getElementPos().y;elem.style.left=BJ(elem).getElementPos().x-px+"px";elem.style.top=BJ(elem).getElementPos().y-py+"px";}else{elem.style.left=BJ(elem).getElementPos().x+"px";elem.style.top=BJ(elem).getElementPos().y+"px";}elem.style.position="absolute";document.onmousemove=function(e){if(!key)return;var event=window.event||e,xCurrent=BJ.getMouse(event).x,yCurrent=BJ.getMouse(event).y;if(obj.onlyX===true){elem.style.left=parseInt(elem.style.left,10)+xCurrent-x+"px";}else if(obj.onlyY===true){elem.style.top=parseInt(elem.style.top,10)+yCurrent-y+"px";}else{elem.style.left=parseInt(elem.style.left,10)+xCurrent-x+"px";elem.style.top=parseInt(elem.style.top,10)+yCurrent-y+"px";}x=xCurrent;y=yCurrent;if(obj.mousemoveCallback){obj.mousemoveCallback(elem);}};document.onmouseup=function(){try{hand.releaseCapture();}catch(e){}if(obj.mouseupCallback)obj.mouseupCallback(elem);if(obj.opacity){BJ(elem).setOpacity(oldOpacity);}key=false;hand.style.cursor=oldCursor;};};};})();
