
function createQRButton(pDiv, lbl, code) {
	
	pDiv.style.cursor = 'pointer';
	pDiv.onmouseover = function() {
		var bigCode = document.getElementById('bigQRCode');
		bigCode.style.height = '0px';
		bigCode.style.width = '0px';
		bigCode.style.display = 'block';
		enlargeQRCode(bigCode);	
	};
	pDiv.onmouseout = function() {
		document.getElementById('bigQRCode').style.display = 'none';
	};
	
	var img = document.createElement('img');
	img.id = 'bigQRCode'
	img.src = 'http://chart.apis.google.com/chart?cht=qr&chs=350x350&chl=' + code;
	img.style.display = 'none';
	img.style.position = 'absolute';
	img.style.top = '0px';
	img.style.right = '0px';
	img.style.border = '1px solid #999999';
	pDiv.appendChild(img);

	return pDiv;
}

function enlargeQRCode(img) {
	img.style.height = (parseInt(img.style.height)+10) + 'px';
	img.style.width = (parseInt(img.style.width)+10) + 'px';
	if (parseInt(img.style.height) < 350) {
		setTimeout(function() { enlargeQRCode(img) }, 10);
	}
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
		return [curleft,curtop];
	}
}
function windowSize() {
	if (window.innerHeight !=null) {
		return [window.innerWidth, window.innerHeight];
	} else {
		if (document.documentElement && document.documentElement.clientHeight) {
			return [document.documentElement.clientWidth, document.documentElement.clientHeight];
		} else if (document.body != null) {
			return [document.body.clientWidth, document.body.clientHeight];
		}
	}
	return null;
}

