/*
* @
*
*
* @version	   		 $Tu`s Query version 1.0.9	$
* @package			 Library JavaScript . $
*@author			Power By Tu	(c) 2009
* @copyright		 Copyright (C) 2009 Mr.NguyenTu [ NTvn ] . All rights reserved . $
* @website Support	 http://yeuit.com	.$		
*
* @date time		 30/09/2009 . $	
* @Last Update 	 	 02h:30 23/10/2009 . $
*
*@Fixed bug & add functions : 
[ 00h:00 08/10/2009  ] . - Fix get elements by class name ->ok . $
[ 00h:00 08/10/2009  ]  - Add new method for animation [top:->++100] . $
[ 00h:00 08/10/2009  ]  - Add new function subjects multi slide . $
[ 00h:00 08/10/2009  ]  - Fix next animation for multiSlide ->ok . $
[ 00h:00 12/10/2009  ]  - Add function $.Ajax()  -  With multi connecting  unlimited request - > So Cool . $
[ 22h:00 16/10/2009  ]  - Add function $.setTimeout() - Delay time for a Animation .$
[ 02h:30 23/10/2009  ]  - Add new method find way OBJ .$
[ 00h:00 31/10/2009  ]  - addEvent() for objects and onload for window .$
*
*
*
*/
/*  [TQuery]   */
function $T_GetBrower(){
	this.brw=navigator.appName;
	this.opacity=0;
	this.ie = function(){if(this.brw=="Microsoft Internet Explorer")return true;else return false;}
	this.ff = function(){if(this.brw=="Netscape")return true;else return false;}
	this.opera = function(){if(this.brw=="Opera")return true;else return false;}
/*	$T	*/		
	this.size = function($val,$f){
		if(!$f)$f='';
		if(($f.indexOf('padding')!=-1||$f.indexOf('margin')!=-1)&&$f.indexOf('offset')!=-1)
			$f=$f.replace('offset-','');
	
		var $TSize='0px';
		if($val=='check'){if($f=='width'||$f=='height'||$f=='top'||$f=='left')return true; else return false;}
		else{
			if($f.indexOf('-')!=-1){
				this.f=$f.split('-')[1];
				this.f=$f.split('-')[0]+this.f.substr(0,1).toUpperCase()+this.f.substr(1,this.f.length-1);
			}else this.f=$f;	
				if(this.f.indexOf('offset')!=-1)this.properties="$TSize=$val."+this.f+"+'px';";
				else this.properties="$TSize=$val.style."+this.f+"+'px';";	
				eval(this.properties);
				if($TSize=='autopx')return null;
				return eval($TSize.substr(0,$TSize.indexOf("px")));
			}	
		}
/*	$T	*/		
	this.opac = function($obj){if(!$obj)return false;
		if(this.brw!="Microsoft Internet Explorer"){
			eval(this.opacity=$obj.style.opacity);
			if(!this.opacity)return 1;
			else return this.opacity;
		}
		else{
			this.opacity=$obj.style.filter;
			this.opacity=this.opacity.toString();
			if(this.opacity==''||!this.opacity)return 1;
			this.opacity=eval(this.opacity.split('opacity=')[1].split(')')[0]);
			return this.opacity/100;
			}
	}
/*	$T	*/		
	this.sizebr = function($f){
		if($f=='height')return window.innerHeight ? window.innerHeight : document.body.offsetHeight;
		else if($f=='width')return window.innerWidth ? window.innerWidth : document.body.offsetWidth;
	}	
}
/*  [TQuery]   */
var $TQueryGetz = new $T_GetBrower();
function $TQueryGetzVia($obj){
	this.size = function($pr){
		return $TQueryGetz.size($obj,$pr);
	}
	this.opac=$TQueryGetz.opac($obj);
}
/*  [TQuery]   */
function $getPr($obj){
	return new $TQueryGetzVia($obj);
}
/*  [TQuery]   */
function $TProcessEvent($TObject,TEvents,$TFunc,$PObject,$prefix){
	if(!$PObject)$PObject=document.getElementsByTagName("body")[0];
	if(!$TFunc)$TFunc=function(){};
	switch (TEvents)
		{
		case 'onmouseMove':$TObject.onmousemove=$TFunc;break;
		case 'style':$TFunc($TObject.style);break;
		case 'run':{var $slide=new $TQueryControlAnimation($TObject,$PObject,$prefix);$TFunc($slide);}break;
		case 'load':{var $slide=new $TQueryControlAnimation($TObject,$PObject,$prefix);$TFunc($slide);}break;
		default:
		this.properties="$TObject."+TEvents+"=function(){var $slide=new $TQueryControlAnimation($TObject,$PObject,$prefix);$TFunc($slide);};";
		eval(this.properties);	
		break;
		}
}
/* ********@@@@BEGIN Intermediate Function@@@@****** */
/*  [TQuery]   */
function $findWayOBJIntermediate($val,$func,$parentObjs,$prefix){
		this.val=$val;
		if(this.val.indexOf(':')!=-1){
			this.event_FindWayOBJ=this.val.split(':')[1];
			this.val=this.val.split(':')[0];
		}else this.event_FindWayOBJ=false;
		this.cache = new Array();
		this.cacheReturn = new Array();
		if(this.val.indexOf('->')==-1)return;
		this.val=this.val.split('->');
		this.cache[0]=$TQueryFunctionsGlobal(this.val[0]);

		if(this.cache[0].length){
			for(this.k=1;this.k<this.cache[0].length;this.k++)
				this.cache[this.cache.length]=this.cache[0][this.k];
				this.cache[0]=this.cache[0][0];	
			}
		for(this.i=1;this.i<this.val.length;this.i++){
			this.lenCache=this.cache.length;
			for(this.j=0;this.j<this.lenCache;this.j++){
				if(this.cache[this.j]){
					if(this.val[this.i].indexOf('#')==-1){
						 this.cache[this.j]=$TQueryFunctionsGlobal(this.val[this.i],null,this.cache[this.j]);
						if(this.cache[this.j]==undefined)this.cache[this.j]=false;
						if(this.cache[this.j].length){
							for(this.k=1;this.k<this.cache[this.j].length;this.k++)
								if(this.cache[this.j][this.k])this.cache[this.cache.length]=this.cache[this.j][this.k];
							this.cache[this.j]=this.cache[this.j][0];	
							}				
					}else this.cache[this.j]=$TQueryFunctionsGlobal(this.val[this.i]);			
				}
			}
		}
		for(this.i=0;this.i<this.cache.length;this.i++)
			if(this.cache[this.i]&&this.cache[this.i]!='')
				this.cacheReturn[this.cacheReturn.length]=this.cache[this.i];

		if(!this.event_FindWayOBJ){
				if(this.cacheReturn.length==1)return this.cacheReturn[0];	
				return this.cacheReturn;
			}	
		if(this.cacheReturn.length==1)
			new $TProcessEvent(this.cacheReturn[0],this.event_FindWayOBJ,$func,$parentObjs,$prefix);	
		else for(this.i=0;this.i<this.cacheReturn.length;this.i++)
			new $TProcessEvent(this.cacheReturn[this.i],this.event_FindWayOBJ,$func,$parentObjs,$prefix);
}
/*  [TQuery]   */
	function $setOffsetPageIntermediate($obj){
		this.obj=$obj;
		this.cobj=$obj;
		this.top=0;
		this.left=0;
		if(!this.obj.length){
			while(this.cobj.tagName!='BODY'){
				this.top+=this.cobj.offsetTop;
				this.left+=this.cobj.offsetLeft;
				this.cobj=this.cobj.parentNode;
			}
			this.obj.pageTop=this.top;
			this.obj.pageLeft=this.left;
		}
		else for(this.i=0;this.i<=this.obj.length;this.i++){
			if(this.obj[this.i]){
				this.cobj=this.obj[this.i];
				this.top=0;
				this.left=0;
				while(this.cobj.tagName!='BODY'){
					this.top+=this.cobj.offsetTop;
					this.left+=this.cobj.offsetLeft;
					this.cobj=this.cobj.parentNode;
				}
				this.obj[this.i].pageTop=this.top;
				this.obj[this.i].pageLeft=this.left;
			}
		}
	}
/*  [TQuery]   */	
function $setDragIntermediate($obj,$pst,$func,$funcEnd){
		if(!$obj)return;
		if($obj.length)return;
		$T().plugin('unSelect').disable();
		this.obj=$obj;
		if(this.obj.inerHTML=='')this.obj.inerHTML='&nbsp;';
		document.ODFx= this.obj;
		document.ODFx.drag= 'pending';
		if($pst=='fix')document.ODFx.parentNode.style.position='relative';
		if(!$pst)$pst='absolute';	document.pstDrag=$pst;
		if(!$func)$func= function(){};	document.ODFx.func=$func;
		if(!$funcEnd)$funcEnd= function(){};	document.ODFx.funcEnd=$funcEnd;
		if($pst=='absolute'||$pst=='relative'||$pst=='inherit'||$pst=='fixed'||$pst=='static')
				this.obj.style.position= $pst;
		else this.obj.style.position= 'absolute';
		if($pst=='fix'){
			document.ODFx.ow=document.ODFx.offsetWidth;
			document.ODFx.oh=document.ODFx.offsetHeight;
			document.ODFx.pw=document.ODFx.parentNode.offsetWidth;	
			document.ODFx.ph=document.ODFx.parentNode.offsetHeight;	
		}
		document.top=this.obj.offsetTop;
		document.left=this.obj.offsetLeft;
		document.title=document.top+' | '+document.left;
		$T(this.obj).style('z-index:'+($zIndexForDrag++)+';top:'+document.top+'px;left:'+document.left+'px');
		this.obj.style.marginTop= '0px';
		this.obj.style.marginLeft= '0px';
	document.onmouseup= function(){
				$T().plugin('unSelect').enable();
				document.onmousemove=null;
				document.onmouseup=null;
				document.ODFx.funcEnd();
				if(!document.ODFx)document.ODFx=null;
				};
	document.onmousemove= function(e){
		this.top=!document.all ? e.clientY: event.clientY;
		this.left=!document.all ? e.clientX: event.clientX;
	if (document.documentElement && (document.documentElement.scrollTop||document.documentElement.scrollLeft))
	{this.top +=  document.documentElement.scrollTop;this.left +=  document.documentElement.scrollLeft;}	
	else if (document.body){this.top +=  document.body.scrollTop;this.left +=  document.body.scrollLeft;}
		if(document.ODFx.drag=='pending'){
			this.curtop=this.top-$TQueryGetz.size(document.ODFx,'top');
			this.curleft=this.left-$TQueryGetz.size(document.ODFx,'left');
			document.ODFx.drag='moving';}		
		if(document.pstDrag=='fix'){
			if((this.left-this.curleft)+document.ODFx.ow>document.ODFx.pw)
				this.left=this.curleft-document.ODFx.ow+document.ODFx.pw;
			if((this.top-this.curtop)+document.ODFx.oh>document.ODFx.ph)
				this.top=this.curtop-document.ODFx.oh+document.ODFx.ph;					
			if(this.top-this.curtop<0)this.top=this.curtop;	
			if(this.left-this.curleft<0)this.left=this.curleft;
		}
		document.ODFx.style.top=(this.top-this.curtop)+'px';
		document.ODFx.style.left=(this.left-this.curleft)+'px';
		document.ODFx.top=(this.top-this.curtop);
		document.ODFx.left=(this.left-this.curleft);
		document.ODFx.cTop=this.top;
		document.ODFx.cLeft=this.left;
		document.ODFx.func();
	}
}	
/*  [TQuery]   */
function $insertHTMLIntermediate($obj,$HTML,$method){
	if(!$obj)return; else this.obj=$obj;
	if(!this.obj.length){
				if($TQueryGetz.ie()){
					this.HTML=document.createElement('div');
					this.HTML.innerHTML=$HTML;
					if($method=='inner')while(this.obj.hasChildNodes()){
						this.obj.removeChild(this.obj.lastChild);
					}
					this.obj.appendChild(this.HTML);
				}
				else{
					if($method=='inner')this.obj.innerHTML=$HTML;
					else this.obj.innerHTML+=$HTML;
				}	
			}
		else for(this.i=0;this.i<this.obj.length;this.i++){
				if($TQueryGetz.ie()){
					this.HTML=document.createElement('div');
					this.HTML.innerHTML=$HTML;
					if($method=='inner')while(this.obj[this.i].hasChildNodes()){
						this.obj[this.i].removeChild(this.obj[this.i].lastChild);
					}
					this.obj[this.i].appendChild(this.HTML);
				}
				else{
					if($method=='inner')this.obj[this.i].innerHTML=$HTML;
					else this.obj[this.i].innerHTML+=$HTML;
				}
		}	
}		
/* ********@@@@END Intermediate Function@@@@****** */
/*  [TQuery]   */
function $TQueryFunctionsGlobal($val,$func,$parentObj,$prefix){
	this.val=$val;
	this.func=$func;
	if(typeof this.val!='string')return false;
	if(this.val.indexOf('->')!=-1){return new $findWayOBJIntermediate(this.val,this.func,$parentObj,$prefix);}
	if(!$parentObj)this.parentObj=document.getElementsByTagName("body")[0];
	else this.parentObj=$parentObj;
	if(this.val.indexOf(':')!=-1){
			this.T_events=this.val.split(':')[1];
			this.val=this.val.split(':')[0];
		}
	else this.T_events=false; 	 	
	/*  : Begin Set Event for object(s) : */		
	if(this.val.indexOf('#')!=-1){				/*		ID   	*/
		this.val=this.val.split('#')[1];
		if(!this.T_events){
			if($TQueryGetz.size('check',this.func))
				return $TQueryGetz.size(document.getElementById(this.val),this.func);
			else if(document.getElementById(this.val)) return document.getElementById(this.val);
			else {return false;/*alert('ID  " '+this.val+' "  is not defined ');*/}
			}
		else if(document.getElementById(this.val)) new $TProcessEvent(document.getElementById(this.val),this.T_events,this.func,$parentObj,$prefix);
			else {return false;/*alert('ID  " '+this.val+' "  is not defined ');*/}
		}
		
	else{			/*		Class	or 	Tag		*/
	
			if(this.val.indexOf('.')==-1)this.val+='.'; //$T('div')
			this.val=this.val.split('.');			
			this.Tij=0;
			this.TPer=null;
			if(this.val[1].indexOf('[')!=-1){
				this.ClassName=this.val[1].split('[')[0];
				this.TPer=this.val[1].split('[')[1].split(']')[0];
				}
			else this.ClassName=this.val[1];
			if(this.val[0].indexOf('[')!=-1){
				this.TPer = this.val[0].split('[')[1].split(']')[0];
				this.val[0] = this.val[0].split('[')[0];
			}	
			if(!this.ClassName)this.ClassName='';

			 if(this.val[0]=='')this.val[0]='*';
			this.cacheTogle = new Array();
			this.togle = new Array();
			var re = new RegExp('\\b' + this.ClassName + '\\b');
			if(this.parentObj.length){
				this.cacheTogle=this.parentObj[0].getElementsByTagName(this.val[0]);
				for(this.i=0;this.i<this.cacheTogle.length;this.i++)
					this.togle.push(this.cacheTogle[this.i]);
				for(this.i=1;this.i<this.parentObj.length-1;this.i++)
					if(this.parentObj[this.i].getElementsByTagName(this.val[0]).length>0)	/*kiem tra co get dc cai nao ko*/
						this.togle.push(this.parentObj[this.i].getElementsByTagName(this.val[0]));
				}	
			else this.togle = this.parentObj.getElementsByTagName(this.val[0]);

			this.cacheTogle = null;
			this.cacheTogle = new Array();
			for(this.i=0;this.i<this.togle.length;this.i++)
				if(re.test(this.togle[this.i].className)||this.ClassName=='')
					this.cacheTogle.push(this.togle[this.i]);
			if(this.TPer=='last')this.TPer=this.cacheTogle.length-1;
			if(!this.T_events){
				if(!this.cacheTogle||this.cacheTogle==''){return false;};
				if(this.TPer)return this.cacheTogle[this.TPer];	
				else{ if(this.cacheTogle.length==1)return this.cacheTogle[0];
						else return this.cacheTogle;
				}
			}
			else{
				if(!this.cacheTogle||this.cacheTogle==''){return false;};
				if(this.TPer)
				   new $TProcessEvent(this.cacheTogle[this.TPer],this.T_events,this.func,this.parentObj,$prefix);
				else for(this.i=0;this.i<this.cacheTogle.length;this.i++)
					new $TProcessEvent(this.cacheTogle[this.i],this.T_events,this.func,this.parentObj,$prefix);
			}	
	}
/*  : End Set Event for object(s) : */		
}
/*  [TQuery]   */
function $TIntermediateCoreFunction($obj,$probj,$objType){
	if(!$probj)$probj=document.getElementsByTagName("body")[0];
/*	$T	*/	
	this.cmd = function($func,$prefix){ 
		if($objType=='isObject')
			return new $TProcessEvent($obj,'run',$func,$probj,$prefix);
		else if($objType=='noneObject'){
			if($obj.indexOf(':')==-1)$obj+=':load';
			return new $TQueryFunctionsGlobal($obj,$func,$probj,$prefix);}
	}
/*	$T	*/
	this.event = function($event,$func,$prefix){
		if($objType=='isObject')
			return new $TProcessEvent($obj,$event,$func,$probj,$prefix);
		else if($objType=='noneObject'){
			$func=$event;
			return new $TQueryFunctionsGlobal($obj,$func,$probj,$prefix);
			}
	}
/*	$T	*/
	this.getz = function($pr){
		if($objType=='isObject'){
			if(!$pr||$pr=='')return false;
			else if($pr=='opacity')return $getPr($obj).opac;
			else return $getPr($obj).size($pr);			
			}
		else if($objType=='noneObject'){
			if(!$pr||$pr=='')return false;
			this.obj=$TQueryFunctionsGlobal($obj,null,$probj);
			if(this.obj.length)this.obj=this.obj[0];
			else if($pr=='opacity')return $getPr(this.obj).opac;
			else return $getPr(this.obj).size($pr);			
			}
	};
/*	$T	*/	
	this.opac = function(){
		if($objType=='isObject')
			return $getPr($obj).opac;
		else if($objType=='noneObject')
			return $getPr($TQueryFunctionsGlobal($obj,null,$probj)).opac;
	};
/*	$T	*/	
	this.obj = function(){
		if($objType=='isObject')
			return $obj;
		else if($objType=='noneObject')
			return new $TQueryFunctionsGlobal($obj,null,$probj);
	}
/*	$T	*/	
	this.onload = function($funct){
		return new $onloadWhenDocumentReady($funct,$obj,'onload');
	};
/*	$T	*/		
	this.addEvent = function($event,$funct){
		if($objType=='isObject')
			this.obj=$obj;
		else if($objType=='noneObject')
			this.obj=$TQueryFunctionsGlobal($obj,null,$probj);
		if($obj==window)this.obj=window;	
		return new $onloadWhenDocumentReady($funct,this.obj,$event);
	}
/*	$T	*/	
	this.style = function($val_Set,$prefix){
		if($objType=='isObject'){
			this.newstyle = new $TQueryControlAnimation($obj,document,$prefix);
			return this.newstyle.style($val_Set);
		}	
		else if($objType=='noneObject'){
			this.obj=$TQueryFunctionsGlobal($obj,null,$probj);
			if(!this.obj||this.obj==''){return false;/*alert('ID  " '+$obj+' "  is not defined ');*/}
			else if(this.obj.length)
				for(this.i=0;this.i<this.obj.length;this.i++){						
					this.newstyle = new $TQueryControlAnimation(this.obj[this.i],document,$prefix);
					this.newstyle.style($val_Set);
				}
			else{
				this.newstyle = new $TQueryControlAnimation(this.obj,document,$prefix);
				return this.newstyle.style($val_Set);	
			}	
		}
	}
	/*	$T	*/		
	this.getParent = function(){
		if($objType=='isObject'){
			if($obj.length)return $obj[0].parentNode;	
			return $obj.parentNode;
			}	
		else if($objType=='noneObject')
			this.obj=$TQueryFunctionsGlobal($obj,null,$probj);
			if(this.obj.length)for(this.i=0;this.i<this.obj.length;this.i++)
				this.obj[this.i]=this.obj[this.i].parentNode;
		return this.obj;
	}
	/*	$T	*/		
	this.drag = function($pst,$func,$funcEnd){	
		if($objType=='isObject')$setDragIntermediate($obj,$pst,$func,$funcEnd);	
		else if($objType=='noneObject')
				$setDragIntermediate($TQueryFunctionsGlobal($obj,null,$probj),$pst,$func,$funcEnd);
	}
	/*	$T Getz Value Attribute of an Object	*/		
	this.getAttribute = function($attName){
		if(!$attName||$attName=='')return false;
		if($objType=='isObject')
			return $obj.getAttributeNode($attName).value;
		else if($objType=='noneObject')
			this.obj=new $TQueryFunctionsGlobal($obj,null,$probj);
		if(this.obj.length)
			for(this.i=0;this.i<this.obj.length;this.i++){
				if(this.obj[this.i].getAttributeNode($attName))	
					this.obj[this.i]=this.obj[this.i].getAttributeNode($attName).value;
				else this.obj[this.i]='';	
				}
		else{ this.obj=this.obj.getAttributeNode($attName).value;	}		
		return this.obj;	
	}
/*	$T	*/	
	this.innerHTML = function($HTML){
		if($objType=='isObject')
			this.obj=$obj;
		else if($objType=='noneObject')
			this.obj=new $TQueryFunctionsGlobal($obj,null,$probj);
		new $insertHTMLIntermediate(this.obj,$HTML,'inner');	
	}
/*	$T	*/	
	this.addHTML = function($HTML){
		if($objType=='isObject')
			this.obj=$obj;
		else if($objType=='noneObject')
			this.obj=new $TQueryFunctionsGlobal($obj,null,$probj);
		new $insertHTMLIntermediate(this.obj,$HTML,'add');	
	}
/*	$T	*/		
	this.createChild=function($tagName,$func){	
		if($objType=='isObject')
			this.obj=$obj;
		else if($objType=='noneObject')
			this.obj=new $TQueryFunctionsGlobal($obj,null,$probj);
		if(!$func)$func=function(){};
		this.HTML=document.createElement($tagName);
		if(!$obj||$obj=='',this.obj==document)this.obj=document.getElementsByTagName("body")[0];
		if(!this.obj.length){			
			this.obj.appendChild(this.HTML);
			$func(this.HTML);
		}	
		else for(this.i=0;this.i<this.obj.length;this.i++){
			this.HTML=document.createElement($tagName);
			this.obj[this.i].appendChild(this.HTML);
			$func(this.HTML);
		}
	}
/*	$T	*/	
	this.plugin = function($pluginName){
		if($objType=='isObject')
			this.obj=$obj;
		else if($objType=='noneObject')
			this.obj=new $TQueryFunctionsGlobal($obj,null,$probj);
		if(!$infoPluginConnected[$pluginName]){
				alert('T`s Query REPORT : \n \n Not Found Plugin  " '+$pluginName+' "\nThis plugin have not been connected with core function');
				return false;
			}
		this.cmdRun='this.cmdRun=function(obj){return new '+$infoPluginConnected[$pluginName].mainFunction+'(obj);}';	
		eval(this.cmdRun);
		return this.cmdRun(this.obj);
	}
/*	$T	*/	
	this.setOffsetPage = function(){
		if($objType=='isObject')
			new $setOffsetPageIntermediate($obj);
		else if($objType=='noneObject')
			new $setOffsetPageIntermediate($TQueryFunctionsGlobal($obj,null,$probj));
		}
/*	$T	*/	
	this.connect = function(){$infoPluginConnected[$obj.name]=$obj;}	
}
/*  [TQuery]   */
var $infoPluginConnected=new Array();
var $zIndexForDrag=68686868;
function $T($obj,$prObj){
	if(!$obj)$obj=document.getElementsByTagName("body")[0];
	this.prObj=$prObj;
	if(!$prObj)this.prObj=document.getElementsByTagName("body")[0];
	if($obj.tagName||$obj==document||$obj==window){
		return new $TIntermediateCoreFunction($obj,this.prObj,'isObject');
	}
	else {
		return new $TIntermediateCoreFunction($obj,this.prObj,'noneObject');
		}
}
/*  [TQuery]   */
function $onloadWhenDocumentReady($funct,$parent,$event){
	if(!$parent)$parent=window;
	if($parent.length){
		for(this.i=0;this.i<$parent.length;this.i++){
			if (window.addEventListener)$parent[this.i].addEventListener($event.split('on')[1],$funct,true); 
			else if (window.attachEvent)$parent[this.i].attachEvent($event,$funct);
			else if (window.detachEvent)$parent[this.i].detachEvent($event,$funct);
		}	
	}
	else{
		if (window.addEventListener)$parent.addEventListener($event.split('on')[1],$funct,true); 
		else if (window.attachEvent)$parent.attachEvent($event,$funct);
		else if (window.detachEvent)$parent.detachEvent($event,$funct);
	}	
}
/*  [TQuery]   */
function $TQueryControlAnimation($object,$parentobj,$prefix){
			this.$=$object;
			this.slideCache=null;
			this.contr=null;
			this.properties=null;
			this.obj = this.$;
			this.id=$CacheIdGlobal;	
			this.parent = this.obj.parentNode;
			this.$$=$prefix;
/*	$T	*/			
	this.createChild=function($tagName,$func){	
		$T($object).createChild($tagName,$func);
	}			
/*	$T	*/			
	this.innerHTML = function($HTML){
		new $insertHTMLIntermediate(this.$,$HTML,'inner');
	}
/*	$T	*/			
	this.addHTML = function($HTML){
		new $insertHTMLIntermediate(this.$,$HTML,'add');
	}	
/*	$T	*/			
	this.getAttribute = function($attName){
		return $T($object).getAttribute($attName);
	}	
/*	$T	*/			
	this.style = function($valSet){
			if(!this.$)return false;
			this.val=$valSet+';';
			this.val=this.val.split(';');
			for(this.i=0;this.i<this.val.length-1;this.i++){
				this.pr=this.val[this.i].split(':')[0];
				if(this.pr.indexOf('-')!=-1){
				this.pr=this.pr.split('-')[1];
				this.pr=this.val[this.i].split(':')[0].split('-')[0]+this.pr.substr(0,1).toUpperCase()+this.pr.substr(1,this.pr.length-1);
				}
				if(this.pr!='')switch (this.pr){
					case 'opacity':{if($TQueryGetz.ie())this.$.style.filter = "alpha(opacity="+(this.val[this.i].split(':')[1]*100)+")";
					else this.$.style.opacity=this.val[this.i].split(':')[1];}break;	
					case 'xopacity':this.$.style.opacity=this.val[this.i].split(':')[1];break;			
					default:this.properties="this.$.style."+this.pr+"='"+this.val[this.i].split(':')[1]+"'";
						eval(this.properties);			
					break;		
					}
			}
	}
/*	$T	*/
	this.functions = function($func,$this){
			this.contr='';
			this.val='->';
			this.slideCache = new $TQueryMakeAnimation($func,'->',$this,'function,');
	}			
/*	$T	*/	
	this.slide = function($val,$speed){
			this.type=$val.split(':')[0];
			this.val=$val.split(':')[1];
			if(this.type=='xopacity'){this.type='opacity,false';}
			else this.type+=',true';
				this.val=$val.split(':')[1];
				this.slideCache = new $TQueryMakeAnimation(this.$,this.val,$speed,this.type);			
	}
/*	$T	*/
	this.multi = function($val,$speed){
			switch($speed){
				case 'veryslow':$speed='70:45';break;
				case 'slow':$speed='50:30';break;
				case 'medium':$speed='40:20';break;
				case 'fast':$speed='30:10';break;
				case 'veryfast':$speed='20:1';break;
				}
			this.slideCache = new $TQueryMakeAnimation(this.$,$val,'','multi,'+$speed);	
	}
/*	$T	*/	
	this.ajax = function($URI,$cache){
			return new $TQueryIntermediateRequest(this.$,$URI,$cache)
	}
/*	$T	*/	
	this.ready = function($amout,$next){
			if($next==null)this.next=$amout;
			else this.next=$next;	
			if($aniFXC[$CacheIdGlobal-$amout])$TQueryReader($CacheIdGlobal-$amout,this.next);
		}		
/*	$T	*/	
	this.setTimeout = function($timeOut){
			if($aniFXC[$CacheIdGlobal-1])$aniFXC[$CacheIdGlobal-1].timeOut=$timeOut;
		}	
/*	$T	*/	
	this.getz = function($pr){
			if(!this.$)return false;
			if($pr=='opacity')
				return new $getPr(this.$).opac;
			else if($pr&&$pr!='')
				return new $getPr(this.$).size($pr);
		}			
}
/*  [TQuery]   */
function $ClearCache(){
		this.check=0;
		for(this.i=0;this.i<$CacheIdGlobal;this.i++)
			if($aniFXC[this.i]){
				if($aniFXC[this.i].status=='working'||$aniFXC[this.i].status=='pending')this.check++;
				if($aniFXC[this.i].status=='finish')$aniFXC[this.i]=null;
			}
		if(this.check==0){$aniFXC=null;$aniFXC=new Array();$CacheIdGlobal=0;}	
	}
/*  [TQuery]   */
function $TQueryMakeNewRequest($object,$ID_Global,$URI,$paramate,$functLoad,$functEnd){
	//this.checker=true;
//	for(this.i=0;this.i<$GlobalCacheAjax.length;this.i++)
	//	if($GlobalCacheAjax[this.i]){
		//	if($GlobalCacheAjax[this.i].obj==$object){
			//	$GlobalCacheAjax[this.i]=null;
			//	this.rq='T_HttpRequest_'+this.i+'=null;$T_AjaxResult_'+this.i+'=null';
			//	eval(this.rq);
			//	}
		//	if($GlobalCacheAjax[this.i])this.checker=false;
		//	}	
		//	if(this.checker){
			//	$GlobalCacheAjax = null;
			//	$GlobalCacheAjax = new Array();
		//	};
	$GlobalCacheAjax[$GlobalCacheAjax.length] = new function(){
				this.URI = $URI;
				this.param = $paramate;
				this.obj = $object;	
				this.loading=$functLoad;	
				this.finish = $functEnd;
				this.idGlobal = $ID_Global;
				this.id = $GlobalCacheAjax.length;
				this.result = null;
				this.status = 'pending';
				this.request = 'new function(){var $T_HttpRequest_'+this.id+' = false;		  		  function  makePOSTRequest(url_'+this.id+',parameters_'+this.id+') {			  $T_HttpRequest_'+this.id+' = false;				$GlobalCacheAjax['+this.id+'].status="working";			 $aniFXC['+this.idGlobal+'].status="working"; 		 $GlobalCacheAjax['+this.id+'].loading();		  if (window.XMLHttpRequest) { /* Mozilla, Safari,...*/				 $T_HttpRequest_'+this.id+' = new XMLHttpRequest();				 if ($T_HttpRequest_'+this.id+'.overrideMimeType) {					$T_HttpRequest_'+this.id+'.overrideMimeType("text/html");				 }			  } else if (window.ActiveXObject) { /* IE */				 try {					$T_HttpRequest_'+this.id+' = new ActiveXObject("Msxml2.XMLHTTP");				 } catch (e) {					try {					   $T_HttpRequest_'+this.id+' = new ActiveXObject("Microsoft.XMLHTTP");					} catch (e) {}				 }			  }			  if (!$T_HttpRequest_'+this.id+') {				 alert("Cannot create XMLHTTP instance");				 return false;			  }    			  $T_HttpRequest_'+this.id+'.onreadystatechange = $T_AjaxResult_'+this.id+';			  $T_HttpRequest_'+this.id+'.open("POST", url_'+this.id+', true);			  $T_HttpRequest_'+this.id+'.setRequestHeader("Content-type", "application/x-www-form-urlencoded");			  $T_HttpRequest_'+this.id+'.setRequestHeader("Content-length", parameters_'+this.id+'.length);			  $T_HttpRequest_'+this.id+'.setRequestHeader("Connection", "close");			  $T_HttpRequest_'+this.id+'.send(parameters_'+this.id+');		   }		   function $T_AjaxResult_'+this.id+'() {			  if ($T_HttpRequest_'+this.id+'.readyState == 4) {				 if ($T_HttpRequest_'+this.id+'.status == 200) {		$GlobalCacheAjax['+this.id+'].result=$T_HttpRequest_'+this.id+'.responseText;						if(!$GlobalCacheAjax['+this.id+'].finish)$insertHTMLIntermediate($GlobalCacheAjax['+this.id+'].obj,$T_HttpRequest_'+this.id+'.responseText,"inner");				$aniFXC['+this.idGlobal+'].status="finish";	 					 if($GlobalCacheAjax['+this.id+'].finish)$GlobalCacheAjax['+this.id+'].finish();		$GlobalCacheAjax['+this.id+'].status="complete";		  $GlobalCacheAjax['+this.id+']=null; $T_HttpRequest_'+this.id+' = null;   $T_AjaxResult_'+this.id+' = null;	$TQueryReader($aniFXC['+this.idGlobal+'].nextTo,$aniFXC['+this.idGlobal+'].next);		 } else {		$GlobalCacheAjax['+this.id+']=null;		/*	alert("There was a problem with the request.");	*/			 }}}			   			   return makePOSTRequest("'+this.URI+'","'+this.param+'");}';};$GlobalCacheAjax[$GlobalCacheAjax.length-1].request = eval($GlobalCacheAjax[$GlobalCacheAjax.length-1].request);
}	
/*  [TQuery]   */
var $aniFXC = new Array();
var $GlobalCacheAjax = new Array();	
var $CacheIdGlobal=0;
function $TQueryReader($id,$next){
		this.next=$next;
		if(this.next==0)return false;
		if($aniFXC[$id]){
	
			if($aniFXC[$id].timeOut)if($aniFXC[$id].timeOut>0){
					setTimeout("$TQueryReader("+$id+","+this.next+")",$aniFXC[$id].timeOut);
					$aniFXC[$id].timeOut=null;
					return false;
					}
				
			if(this.next!=null)$aniFXC[$id].next=this.next-1;
			if($aniFXC[$id].contr==null&&$aniFXC[$id].type!='multi'&&$aniFXC[$id].type!='ajax'){
				for(i=0;i<=$CacheIdGlobal;i++)	/* Tranh xung dot : neu da ton tai thi xoa cache  */
					if($aniFXC[i]){
						if($aniFXC[i].obj==$aniFXC[$id].obj&&$aniFXC[i].type==$aniFXC[$id].type&&$aniFXC[i].status=='working'&&i!=$id)$aniFXC[i].status='finish';}					
					$aniFXC[$id].beg=$aniFXC[$id].beg.split('->');
					$aniFXC[$id].end=$aniFXC[$id].beg[1];
					$aniFXC[$id].beg=$aniFXC[$id].beg[0];
					if($aniFXC[$id].beg==''){
						if($aniFXC[$id].type=='opacity')$aniFXC[$id].beg=$TQueryGetz.opac($aniFXC[$id].obj);
						else if($aniFXC[$id].type!='function'){
							if($aniFXC[$id].beg=='')$aniFXC[$id].beg=$T($aniFXC[$id].obj).getz($aniFXC[$id].type);				
							if($aniFXC[$id].beg==null)$aniFXC[$id].beg=$T($aniFXC[$id].obj).getz('offset-'+$aniFXC[$id].type);	
							if($aniFXC[$id].beg==null)$aniFXC[$id].beg=0;
							}
						}	
					if($aniFXC[$id].end.substr(0,2)=='++')$aniFXC[$id].end=eval($aniFXC[$id].beg)+eval($aniFXC[$id].end.split('++')[1]);
					else if($aniFXC[$id].end.substr(0,2)=='--')$aniFXC[$id].end=eval($aniFXC[$id].beg)-eval($aniFXC[$id].end.split('--')[1]);
					
					if(eval($aniFXC[$id].beg)>eval($aniFXC[$id].end))$aniFXC[$id].contr='Down';
					else $aniFXC[$id].contr='Up';
					if(eval($aniFXC[$id].beg)==eval($aniFXC[$id].end)&&$aniFXC[$id].type!='function'){
						$aniFXC[$id].status='finish';
						if($aniFXC[$id]!=0)$TQueryReader(eval($aniFXC[$id].id)+1,$aniFXC[$id].next);
					}
			}		
		
			if($aniFXC[$id].status!='finish'){
					if($aniFXC[$id].type=='function'){$aniFXC[$id].functions();}
					else if($aniFXC[$id].type=='opacity') $aniFXC[$id].opacity();
					else if($aniFXC[$id].type=='multi') $aniFXC[$id].multi();
					else if($aniFXC[$id].type=='ajax') $aniFXC[$id].ajax();
					else $aniFXC[$id].slide();
				}
			}else return false;			
}	
/*  [TQuery]   */
/* $TQueryMakeAnimation($obj,'0->100','[fast] || [30,2]','type,true'); */	
/*			[ BEGIN CORE FUNCTION  ]			*/						
function $TQueryMakeAnimation($obj,$val,$speed,$more){
		this.id=$CacheIdGlobal++;
		this.obj=$obj;
		this.animation = new $TQueryControlAnimation($obj);
		this.counter=1;
		this.ct=1;
		this.next=1;
		this.nextTo=$CacheIdGlobal;
		this.beg=$val;
		this.end=null;
		this.contr=null;
		this.forIE=$more.split(',')[1];
		this.type=$more.split(',')[0];
		this.status='pending';
		this.timeOut=0;
		this.extr1=$speed;
		this.extr2=$more;
		if($speed&&this.type!='function'&&this.type!='ajax')
			if($speed.indexOf(':')!=-1){
				this.ct=eval($speed.split(':')[0]);
				this.timer=eval($speed.split(':')[1]);
			}
	if(this.type=='opacity'){
		switch ($speed){
				case 'fast':this.timer=30;this.ct=3;break;	
				case 'medium':this.timer=40;this.ct=2;break;
				case 'slow':this.timer=50;this.ct=1;break;
				case undefined :this.timer=30;break;
				//default : this.timer=$speed;break;			
			}
		}
	else{
			switch ($speed){
				case 'veryfast':this.timer=1;this.ct=10;break;	
				case 'fast':this.timer=10;this.ct=3;break;				
				case 'medium':this.timer=20;this.ct=2;break;
				case 'slow':this.timer=30;this.ct=1;break;
				case undefined :this.timer=20;this.ct=2;break;
				//default : this.timer=$speed;break;			
			}
		}	
		
				  /* *//* */		 /* *//* */
				/* 	Save this to cache global 	*/			
				/* */$aniFXC[this.id]=this; /*
				/* 	Day la linh hon cua TQuery  	*/
				   /* *//* *//* *//* *//* *//* */
					   /*  *//*     *//*  */
					     /*    /*/  /*/
					     	          /* */ 
/*	$T	*/		
	this.functions = function(){
			this.obj(this.extr1);
			this.status='finish';
			$TQueryReader(this.nextTo,this.next);
			$ClearCache();
	}	
/*	$T	*/	
	/* 	Fader Animation	 */
	this.opacity = function(){
		if(!$TQueryGetz.ie()){
				if(this.contr=='Down'){this.beg=eval(this.beg)-eval(0.01*this.counter);}
				else this.beg=eval(this.beg)+eval(0.01*this.counter);
				if(eval(this.beg)>=0.001&&eval(this.beg)<=1)this.obj.style.opacity=this.beg;
				}
			else if(this.forIE!='false'){
				if(this.contr=='Down')this.beg=eval(this.beg)-eval(0.01*this.counter);
				else this.beg=eval(this.beg)+eval(0.01*this.counter);
				this.obj.style.filter="alpha(opacity="+(eval(this.beg*100)+this.counter)+")";		
				}
			this.counter+=this.ct;				
		if((this.contr=='Up'&&this.beg<this.end)||(this.contr=='Down'&&this.beg>this.end)){
				if(this.status!='fisnish'){this.status='working';setTimeout("$TQueryReader("+this.id+")",this.timer);}
			}	
		else{
				if(!$TQueryGetz.ie())this.obj.style.opacity=this.end;
				else this.obj.style.filter="alpha(opacity="+(eval(this.end)*100)+")";
				this.status='finish';
				if(this.next!=0)$TQueryReader(this.nextTo,this.next);
				else $ClearCache();
			}
	}
/*	$T	*/	
	/* 	Slide Animation 	*/
	this.slide = function(){
		if(this.contr=='Down')this.beg=eval(this.beg)-eval(this.counter);
		else this.beg=eval(this.beg)+eval(this.counter);
				this.counter+=this.ct;				
		if((this.contr=='Up'&&this.beg<this.end)||(this.contr=='Down'&&this.beg>this.end)){
				if(this.status!='fisnish'){
				this.status='working';
				this.animation.style(this.type+':'+Math.round(this.beg)+'px');
				setTimeout("$TQueryReader("+this.id+")",this.timer);}
				}	
		else{
				this.animation.style(this.type+':'+Math.round(this.end)+'px');
				this.status='finish';
				if(this.next!=0)$TQueryReader(this.nextTo,this.next);
				else $ClearCache();
			}
	}
/*	$T	*/	
	/*	Move Object Animation	*/
	this.multi = function(){
			this.beg=this.beg.split(';');
			if(this.forIE=='undefined'||!this.forIE){this.forIE='35:1';}
			if(this.forIE.indexOf(':')==-1){this.timer=1;this.forIE=eval(this.forIE);}
			else {this.timer=eval(this.forIE.split(':')[1]);this.forIE=eval(this.forIE.split(':')[0]);}
			for(this.end=0;this.end<this.beg.length;this.end++){
				this.counter=this.beg[this.end].split(':')[1];
				this.counter=this.counter.split('->');
				if(this.beg[this.end].split(':')[0]=='opacity'||this.beg[this.end].split(':')[0]=='xopacity')
					{
						if(this.beg[this.end].split(':')[0]=='xopacity'){this.type='opacity,false';}
						else this.type='opacity,true';
						if(this.counter[0]=='')this.counter[0]=$TQueryGetz.opac(this.obj,this.beg[this.end].split(':')[0]);
						if(this.counter[0]==''||this.counter[0]==null||!this.counter[0])this.counter[0]=1;	
						if(this.counter[1].indexOf('+')==0)this.counter[1]=this.counter[0]+eval(this.counter[1].split('+')[1]);
						else if(this.counter[1].indexOf('-')==0)this.counter[1]=this.counter[0]-eval(this.counter[1].split('-')[1]);							
		this.slideCache = new $TQueryMakeAnimation(this.obj,this.beg[this.end].split(':')[1],'0:'+this.timer,this.type);
						$aniFXC[$CacheIdGlobal-1].counter=(Math.abs(this.counter[1]-this.counter[0])/this.forIE)*100;
					}
				else{
						if(this.counter[0]=='')this.counter[0]=$T(this.obj).getz(this.beg[this.end].split(':')[0]);		
						if(this.counter[0]==null)this.counter[0]=$T(this.obj).getz('offset-'+this.beg[this.end].split(':')[0]);	
						if(this.counter[0]==null)this.counter[0]=0;
						if(this.counter[1].indexOf('++')==0)this.counter[1]=this.counter[0]+eval(this.counter[1].split('++')[1]);
						else if(this.counter[1].indexOf('--')==0)this.counter[1]=this.counter[0]-eval(this.counter[1].split('--')[1]);
		this.slideCache = new $TQueryMakeAnimation(this.obj,this.beg[this.end].split(':')[1],'0:'+this.timer,this.beg[this.end].split(':')[0]+',true');	
						$aniFXC[$CacheIdGlobal-1].counter=Math.abs(this.counter[1]-this.counter[0])/this.forIE;
						}	
					//$aniFXC[$CacheIdGlobal-1].timer=this.timer;
					//$aniFXC[$CacheIdGlobal-1].ct=0;					
					if(this.end==0)$aniFXC[$CacheIdGlobal-1].nextTo=eval(this.id)+1;
					if(this.end==0)$TQueryReader($CacheIdGlobal-1,this.next+1);
					else $TQueryReader($CacheIdGlobal-1,1); // Next Animation
			}
			this.status='finish';
			$ClearCache();
		}	
	/*	Multi connecting Ajax Animation width Unlimited Request	*/		
	this.ajax = function(){
		new $TQueryMakeNewRequest(this.obj,this.id,this.extr1.split('###')[0],this.extr1.split('###')[1],this.beg,this.end);
	}
}
/*  [TQuery]   */
function $TQueryIntermediateRequest($obj,$URI,$cache){
	this.obj=$obj;
	this.URI=$URI;
	if($cache)this.cache=$cache;
	else this.cache=false;
	
	this.post = function($funcLoading,$funcFinish){
		if(!$funcLoading)$funcLoading=function(){};
		if(this.URI.indexOf('?')==-1)this.URI+="?checker=TQuery";
		if(this.cache!='cache')this.URI+="&RandomIdRequest="+Math.round(Math.random()*6868);
		this.URI=this.URI.split('?');
		this.URI=this.URI[0]+'###'+this.URI[1];
	new $TQueryMakeAnimation(this.obj,'',this.URI,'ajax,');
		$aniFXC[$aniFXC.length-1].beg=$funcLoading;
		$aniFXC[$aniFXC.length-1].end=$funcFinish;
	}
	this.get = function($funcLoading,$funcFinish){
		if(!$funcLoading)$funcLoading=function(){};	
		if(this.cache!='cache'){
			if(this.URI.indexOf('?')==-1)this.URI+="?IdLoad="+Math.round(Math.random()*6868);
			else this.URI+="&RandomIdRequest="+Math.round(Math.random()*6868);
		}else if(this.URI.indexOf('?')==-1)this.URI+="?checker=TQuery";
		this.URI=this.URI.split('?');
		this.URI[0]+='?'+this.URI[1];this.URI[1]='MakeRequest=TQuery';
		this.URI=this.URI[0]+'###'+this.URI[1];		
	new $TQueryMakeAnimation(this.obj,'',this.URI,'ajax,');
		$aniFXC[$aniFXC.length-1].beg=$funcLoading;
		$aniFXC[$aniFXC.length-1].end=$funcFinish;
	}
}
/*		@  END CORE FUNCTION  @	
*@
*@		Thu vien TQuery duoc xay dung boi Nguyen Tu		 
*@		Cac  thuat toan thuoc quyen so huu cua TQuery                 
*@		Vui long de lai ban quyen khi su dung lai .                            	
*@		Website ho tro  http://yeuit.com  .                                       
* @
*/
/* ### Extra Plugin ### */
	var info=new Array();
	info.name='unSelect';
	info.mainFunction='$TQueryPluginDisableSelection';
	$T(info).connect();	/*	connection with core function	*/
	
function $TQueryPluginDisableSelection($obj){
	this.disable=function(){
		if (typeof document.body.onselectstart!="undefined") //IE route
			document.body.onselectstart=function(){return false}
		else if (typeof document.body.style.MozUserSelect!="undefined") //Firefox route
			document.body.style.MozUserSelect="none";
		else //All other route (ie: Opera)
			document.body.onmousedown=function(){return false}
	}
	this.enable=function(){
		if (typeof document.body.onselectstart!="undefined") //IE route
			document.body.onselectstart=function(){return true}
		else if (typeof document.body.style.MozUserSelect!="undefined") //Firefox route
			document.body.style.MozUserSelect=null;
		else //All other route (ie: Opera)
			document.body.onmousedown=function(){return true}
	}	
}
/* ### Driver Functions ### 

function getProperties(obj) {
  var i, v;
  var count = 0;
  var props = [];
  if (typeof(obj) === 'object') {
    for (i in obj) {
      v = obj[i];
      if (v !== undefined && typeof(v) !== 'function') {
        props[count] = i+' ';
        count++;
      }
    }
  }
  return props;
} 
*/
