// JavaScript Document

function emailLink () {
	coded = "lYQ4@uVIHJmkmV3U.u4M.Vn"
  key = "sfkTldBNHO10VyEwmR8nzSPIQ7pJGvgL5qhcDo6M2rYiCAZtjbxaX3KeFUuW49"
  shift=coded.length
  link=""
  for (i=0; i<coded.length; i++) {
    if (key.indexOf(coded.charAt(i))==-1) {
      ltr = coded.charAt(i)
      link += (ltr)
    }
    else {     
      ltr = (key.indexOf(coded.charAt(i))-shift+key.length) % key.length
      link += (key.charAt(ltr))
    }
  }
	document.write("<a href='mailto:"+link+"'>"+link+"</a>")
}

// OX Object 
// ==========================

var OX = {};

OX.setWindowSize = function (props) { //CALL ox.window.setSize( {width:[x],height:[x],left:[x],top:[x],target:[x]} )
	if (!props || !props.height || !props.width) return;
	if (props.target) this.win = props.target;
	else this.win = window.top;
	// try and set window to a window size
	this.win.resizeTo(props.width,props.height);
	// get document size after rough resize
	var inner = this.getDocWindowSize();
	// adjust window to get correct document size
	var dw = props.width-inner[0];
	var dh = props.height-inner[1];
	this.win.resizeTo(props.width+dw, props.height+dh);	
	// position and focus window
	if (props.left && props.top) this.win.moveTo(props.left,props.top);
	this.win.focus();
}

OX.getDocWindowSize = function () {
	var w,h;
	if (this.win.innerHeight) { // all except Explorer
		w = this.win.innerWidth;
		h = this.win.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		w = this.win.document.documentElement.clientWidth;
		h = this.win.document.documentElement.clientHeight;
	}
	else if (document.body) { // other Explorers
		w = this.win.document.body.clientWidth;
		h = this.win.document.body.clientHeight;
	}
	return [w,h];
}

OX.popWindow = function (url, type, props) {
	var isProps = (typeof props == 'object');
	var left = (isProps && typeof props.left == 'number') ? props.left : 50;
	var top = (isProps && typeof props.top == 'number') ? props.top : 50;
	var width = (isProps && typeof props.width == 'number') ? props.width : 600;
	var height = (isProps && typeof props.height == 'number') ? props.height : 600;
	switch (type) {
		case 'map':
			var winParams = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=640,height=526,left=50,top=50,screenX=50,screenY=50'; 
			break;
		default: 
			var winParams = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top; 
		break;
	}
	this.newWin = window.open(url, 'popUpWin', winParams);
}