function unscrambleLink (id, sUrl, sText, isEmail) {
	var obj = document.getElementById (id);
	if (obj == null) {
		alert ('unscrambleLink: Object not found (' + id + ')');
		return;
	}
	var parent = obj.parentNode;
	if (parent == null) {
		alert ('unscrambleLink: Parent object not found');
		return;
	}
	// to create standards compliant xhtml, use <div><a></a><-- scramble --></div>
	if (parent.nodeName.toLowerCase () == 'div') parent = parent.firstChild;
	if (parent.nodeName.toLowerCase () != 'a') {
		alert ('unscrambleLink: Parent object is not an anchor tag');
		return;
	}
	if (sUrl != null && sUrl.length > 0) {
		eval ('var txt = String.fromCharCode(' + sUrl + ');');
		parent.href = txt;
	}
	if (sText != null && sText.length > 0) {
		var firstChild = parent.firstChild;
		//First node is a text node with input
		if (firstChild && firstChild.nodeType == 3 && firstChild.nodeValue != null && firstChild.nodeValue.replace (' ', '').length > 0) return;
		eval ('var txt = String.fromCharCode (' + sText + ');');
		txt = txt.replace (/&amp;/g, '&');
		parent.innerHTML = txt;
		if (parent.title != null && parent.title.length == 0) {
			parent.title = txt;
		}
	}
}

function calcImg(arg,arg2,arg3) {
	return Math.round(arg3 * (1 / arg2 * arg));
}

function handleResize(evt) {
  var img = document.getElementById('img');
  if(img==null)
    return;
  
  var body = img.parentNode;
  while(body!=null && body.nodeName.toLowerCase()!='body'){
    body = body.parentNode; 
  }
  if(body==null)
    return;
  
  if(img.initWidth==null){
    img.initWidth = img.scrollWidth;
    img.initHeight = img.scrollHeight;
  }
  
  var winW = window.innerWidth  || document.documentElement.clientWidth;
  var winH = window.innerHeight || document.documentElement.clientHeight;
  
  var res = new Array(winW,calcImg(winW,img.initWidth,img.initHeight),calcImg(winH,img.initHeight,img.initWidth),winH);
	var key = (winW > winH) ? ((res[1] > winH)? 0: 2) :((res[2] > winW) ? 2:0);
	img.width = res[key];
	img.height = res[key+1];
}