var timer;

function FixFlash(containerID){
	if (document.getElementById(containerID)){
		var flashContainer = document.getElementById(containerID);
		var flashMovie = document.createElement("div");
		flashMovie.innerHTML = flashContainer.innerHTML.replace(/</g, "<").replace(/>/g, ">");
		flashContainer.parentNode.insertBefore(flashMovie, flashContainer);
		flashContainer.parentNode.removeChild(flashContainer);
		flashMovie.setAttribute("id",containerID);
	}
}

function ToggleVisibility(elid){
	if (document.getElementById(elid)){
		if (document.getElementById(elid).style.display == 'none'){
			document.getElementById(elid).style.display = 'block';
		}else{
			document.getElementById(elid).style.display = 'none';
		}
	}
}

function findPosition(oEl) {
	if(oEl.offsetParent) {
		for( var posX = 0, posY = 0; oEl.offsetParent; oEl = oEl.offsetParent ) {
			posX += oEl.offsetLeft;
			posY += oEl.offsetTop;
		}
		return [ posX, posY ];
	} else {
		return [ oEl.x, oEl.y ];
	}
}

function showregions(id, img, hnum, hlang){
	hideregions();
	var temp=findPosition(document.getElementById(img));
	document.getElementById(id).style.left = temp[0];
	document.getElementById(id).style.top = temp[1] - hnum*17 - hlang*19 - 15;
	document.getElementById(id).style.visibility = 'visible';	
}

function hideregions() {
	document.getElementById('langchoice').style.visibility = 'hidden';
	for (i=0; i<10; i++){
		if (document.getElementById('langchoice_'+i)) {
			document.getElementById('langchoice_'+i).style.visibility = 'hidden';
		}
	}
}

function WriteToDocument(text){
	document.write(text);
}
