// ====================================================
// Mail Encrypt
// ====================================================

function UnCryptMailto(s) {	
	var n=0;
	var r="";
	for(var i=0; i < s.length; i++) {
		n=s.charCodeAt(i);
		if (n>=8364) {n = 128;}
		r += String.fromCharCode(n-(1));
	}
	return r;
}

function linkTo_UnCryptMailto(s)	{
	location.href=UnCryptMailto(s);
}

// ====================================================
// script: Gerard Ferrandez - Ge-1-doot - JANUARY 2K5
// http://www.dhteumeuleu.com/
// ====================================================

document.onselectstart = new Function("return false");
document.onmousedown   = new Function("return false");
C   = ["feel", "see","hear","burn", "on fire"];
obj = new Array();
xm  = 0;
ym  = 0;
K   = 0;
zI  = 0;
///////////
M   = 300;    // anim steps
N   = 10;    // number of dots
mx  = 5;     // max fires
siz = 100;   // dots size
mT  = false; // mouse trail
///////////
S   = 1 / M;

function Fire(xm, ym){
	this.O  = 0;
	this.xm = xm;
	this.ym = ym;
	for(x=0;x<N;x++)this.O = new CObj(this, this.O);
}

function GetWidth() {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && document.documentElement.clientWidth ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && document.body.clientWidth ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  if (myWidth < 754) myWidth = 754;
  return myWidth;
}

function CObj(parent, next){
	this.o = document.createElement("bubble");
	//this.o.MozOpacity = .5;
	//if (filters) filters.alpha.opacity = 50;
	//this.o2  = document.createElement("bubble");
  	this.o2 = document.createElement("bubble");
  	this.o2.innerHTML = "<img src='wp-content/themes/unblu/images/screen-1.png'>";
	this.o2.style.borderStyle = "none";
	this.o.appendChild(this.o2);
	document.body.appendChild(this.o);
	this.k  = Math.floor(Math.random() * M) * S;
	this.vx = 0;
	this.vy = 0;
	this.x  = -1000;
	this.y  = 0;
	this.del = function del() {
		document.body.removeChild(this.o);
		if(next)next.del();
	}
	this.anim = function anim() {
		with(this){
			if ((k+=S) > 1) {
				k  = 0;
				x  = mT?xm:parent.xm;
				y  = mT?ym:parent.ym;
				vx = (Math.random() * 10 - 5) * (40 / M);
				vy = (Math.random() * 4 + 5) * (40 / M);
				o.style.zIndex = zI++;
			}
			x += vx * (siz * .01) - .5;
			y -= vy * (siz * .01);
			c = Math.round(k * 512);
			with(o.style){
				left    = x - k * siz;
				top     = y - k * siz;
				width   = 200; //k * 2 * siz;
				height  = 200; //k * 2 * siz;
			}
			if(next)next.anim();
		}
	}
}

document.onmousemove = function(e){
	if (window.event) e = window.event;
	xm = (e.x || e.clientX);
	ym = (e.y || e.clientY);
}

function cs(x){
	siz = x;
	event.cancelBubble=true;
	return false;
}
function run(){
	for(i in obj)obj[i].O.anim();
	setTimeout(run, 16);
}

//onload = run;

function starter() {
	run();
	obj[0] = new Fire(-200,-200);
}

function steam(x,y) {
	obj[0].xm = x;
	obj[0].ym = y;
}

function hilite(button) {
	button.style.backgroundImage = "url('wp-content/themes/unblu/images/nav-1-h.gif')";
	document.body.style.cursor = "pointer";
	steam(510 + (GetWidth() - 754)/2,200);
}
function lowlite(button) {
	button.style.backgroundImage = "url('wp-content/themes/unblu/images/nav-1-u.gif')";
	document.body.style.cursor = "default";
	steam(-200,-200);
}
function opn(uri) {
	window.open(uri, '_self');
}
