var QSoft=QSoft||{};QSoft.Lib=QSoft.Lib||{};QSoft.Lib.Dom={};QSoft.Lib.Dom.ELEMENT_NODE=1;QSoft.Lib.Dom.ATTRIBUTE_NODE=2;QSoft.Lib.Dom.TEXT_NODE=3;QSoft.Lib.Dom.CDATA_SECTION_NODE=4;QSoft.Lib.Dom.ENTITY_REFERENCE_NODE=5;QSoft.Lib.Dom.ENTITY_NODE=6;QSoft.Lib.Dom.PROCESSING_INSTRUCTION_NODE=7;QSoft.Lib.Dom.COMMENT_NODE=8;QSoft.Lib.Dom.DOCUMENT_NODE=9;QSoft.Lib.Dom.DOCUMENT_TYPE_NODE=10;QSoft.Lib.Dom.DOCUMENT_FRAGMENT_NODE=11;QSoft.Lib.Dom.NOTATION_NODE=12;QSoft.Lib.Dom.importNode=function(c,a,e){if(a==null)return null;var b=null;if(c.importNode)b=c.importNode(a,e);else switch(a.nodeType){case QSoft.Lib.Dom.ELEMENT_NODE:b=c.createElement(a.nodeName);if(a.attributes&&a.attributes.length>0)for(var g=0;g<a.attributes.length;g++){var h=a.attributes[g].nodeName,j=a.getAttribute(h);b.setAttribute(h,j)}if(e&&a.childNodes&&a.childNodes.length>0)for(var d=0;d<a.childNodes.length;d++){var i=a.childNodes[d],f=QSoft.Lib.Dom.importNode(c,i,e);f&&b.appendChild(f)}break;case QSoft.Lib.Dom.DOCUMENT_NODE:case QSoft.Lib.Dom.DOCUMENT_FRAGMENT_NODE:b=c.createDocumentFragment();if(e&&a.childNodes&&a.childNodes.length>0)for(var d=0;d<a.childNodes.length;d++){var i=a.childNodes[d],f=QSoft.Lib.Dom.importNode(c,i,e);f&&b.appendChild(f)}case QSoft.Lib.Dom.TEXT_NODE:b=c.createTextNode(a.nodeValue)}return b};QSoft.Lib.Dom.getScreenOrigin=function(a){var a=a||window,b={x:0,y:0};if(a.screen.left)b.x=a.screen.left;if(a.screen.top)b.y=a.screen.top;if(typeof a.screen.availTop=="undefined"){var c,d=a.screenLeft+a.document.documentElement.offsetWidth/2,e=a.screenTop+a.document.documentElement.offsetHeight/2;if(d>a.screen.width){c=Math.floor(d/a.screen.width);b.x=c*a.screen.width}if(e>a.screen.height){c=Math.floor(e/a.screen.height);b.y=c*a.screen.height}}return b};QSoft.Lib.Dom.isDom=function(a){return!a?false:!a.nodeType?false:typeof Node!="undefined"?a instanceof Node:true};QSoft.Lib.Dom.attach=function(a,b,c){if(a.addEventListener)a.addEventListener(b,c,false);else if(a.attachEvent)a.attachEvent("on"+b,c);else a["on"+b]=c};QSoft.Lib.Dom.cancelEvent=function(a){if(!a)a=window.event;a.preventDefault&&a.preventDefault();a.returnValue=false;a.cancelBubble=true;return false};QSoft.Lib.Dom.setText=function(a,b){while(a.firstChild)a.removeChild(a.firstChild);a.appendChild(document.createTextNode(b))};QSoft.Lib.Dom.setContent=function(a,b){while(a.firstChild)a.removeChild(a.firstChild);a.appendChild(b)};QSoft.Lib.Dom.getAncestor=function(b,c){var a=b;while(a){if(c(a))return a;a=a.parentNode}return null};QSoft.Lib.Dom.insertNode=function(a,c,b){if(!a.hasChildNodes()){a.appendChild(c);return}if(b>a.childNodes.length)b=a.childNodes.length;if(b<0)b=0;if(b==a.childNodes.length){a.appendChild(c);return}var d=a.childNodes[b];a.insertBefore(c,d)};QSoft.Lib.Dom.getCssPath=function(c){var a="",b=c,d=false;while(b){if(b.id!="undefined"){a=(a.length>0?" #":"#")+b.id+a;return a}else a=(a.length>0?" ":"")+b.nodeName.toUpperCase()+a;b=b.parentNode}return a};QSoft.Lib.Dom.positionElement=function(b,a){var c=0,d=0,e=false;if(b.offsetParent){c=b.offsetParent.clientHeight;d=b.offsetParent.clientWidth}else if(self.innerHeight){c=self.innerHeight;d=self.innerWidth}else if(document.documentElement&&document.documentElement.clientHeight){c=document.documentElement.clientHeight;d=document.documentElement.clientWidth}else if(document.body){c=document.body.clientHeight;d=document.body.clientWidth}b.style.position="absolute";if("left"in a)b.style.left=a.left+"px";else if("right"in a&&"width"in a)b.style.left=Math.max(d-a.width-a.right,0)+"px";if("width"in a)b.style.width=a.width+"px";else if("right"in a&&"left"in a)b.style.width=Math.max(d-(a.right+a.left),0)+"px";if("top"in a)b.style.top=a.top+"px";else if("bottom"in a&&"height"in a)b.style.top=Math.max(c-(a.bottom+a.height),0)+"px";if("height"in a)b.style.height=a.height+"px";else if("bottom"in a&&"top"in a)b.style.height=Math.max(c-(a.bottom+a.top),0)+"px"};QSoft.Lib.Dom.setStyle=function(c,b){for(var a in b)if(a=="cssFloat"||a=="styleFloat")c.style.cssFloat=c.style.styleFloat=b[a];else c.style[a]=b[a]};QSoft.Lib.Dom.setClassName=function(a,b){if(typeof a.className=="undefined")a.className=b;else if(!this.hasClassName(a,b))a.className+=(a.className.length>0?" ":"")+b};QSoft.Lib.Dom.clearClassName=function(a,c){var b=new RegExp("(\\s+|^)"+c+"(\\s+|$)");a.className=a.className.replace(b,"")};QSoft.Lib.Dom.hasClassName=function(a,b){return typeof a.className=="undefined"?false:a.className.match(new RegExp("(\\s+|^)"+b+"(\\s+|$)"))};QSoft.Lib.Dom.setUnselectable=function(a){a.unselectable="on";a.onselectstart=function(){return false};a.style.MozUserSelect="none";a.style.WebkitUserSelect="none"};QSoft.Lib.Dom.getFlashVersion=function(){if(QSoft.Lib.Dom._flashVersion)return QSoft.Lib.Dom._flashVersion;var a=null;if(navigator.plugins!=null&&navigator.plugins.length>0){var e=navigator.plugins["Shockwave Flash"]||navigator.plugins["Shockwave Flash 2.0"];if(e){a=e.description;var g=a.split(" ");a=g[2]}}else if(ActiveXObject){var d=[{progid:"ShockwaveFlash.ShockwaveFlash.7",v:"WIN 7,0,0,0"},{progid:"ShockwaveFlash.ShockwaveFlash.6",v:"WIN 6,0,21,0"},{progid:"ShockwaveFlash.ShockwaveFlash.3",v:"WIN 3,0,18,0"},{progid:"ShockwaveFlash.ShockwaveFlash",v:"WIN 2,0,0,11"}];a=null;for(var c=0;c<d.length;c++){var f=d[c],b=null;try{b=new ActiveXObject(f.progid)}catch(h){}if(b){a=f.v;try{b.AllowScriptAccess="always"}catch(h){}try{a=b.GetVariable("$version")}catch(h){}b=null}if(a)break}}if(a)QSoft.Lib.Dom._flashVersion=a;return a};QSoft.Lib.Dom.isFlashVersionAvailable=function(e,g){var a=QSoft.Lib.Dom.getFlashVersion();if(!a)return false;var d=a.indexOf(" ");if(d>-1)a=a.substring(d+1);var b=[0,0,0];if(a.indexOf(",")>-1)b=a.split(",");else b=a.split(".");var c=parseInt(b[0]),f=parseInt(b[1]);return c>e||c==e&&f>=g};
