/* zvetsovani rovnic v SVG */
var tmpImgSize;
var zoomEqFactor = 1.3;

function zoomEq() {
	var spans = document.getElementsByTagName('span');
	var span = null;
	for (var i = 0; i < spans.length; i++) {
		span = spans[i];
		if 	(span.getAttribute('class') == 'eq') {
			span.onmouseenter = function() { magnifyEq(this); }
			span.onmouseleave = function() { reduceEq(this); }
		}
	}
}

/* zvetseni rovnice */
function magnifyEq(obj) {
	aImg = obj.getElementsByTagName("img");
	if (aImg.length > 0) {
		tmpImgSize = aImg[0].style.width;
		tmpImgWidthUnits = tmpImgSize.slice(-2);
		tmpImgWidth = tmpImgSize.substr(0,tmpImgSize.length-2);
		aImg[0].style.width = tmpImgWidth*zoomEqFactor + tmpImgWidthUnits;
		obj.style.width = aImg[0].style.width;
	}
}

/* zmenseni rovnice */
function reduceEq(obj) {
	aImg = obj.getElementsByTagName("img");
	if (aImg.length > 0) {
		aImg[0].style.width = tmpImgSize; 
		obj.style.width = aImg[0].style.width;
	}
}

/* rozbaleni Long textu */
function show_eBlockLongText(obj, objLink) {
	document.getElementById(obj).style.display ='block';
	objLink.parentNode.style.display = 'none';
	if (parent && typeof(parent.scorm_resize)=='function') {
	  parent.scorm_resize(0, 0);
	}
}

/* rozbaleni reseni Practice textu */
function show_eBlockSolutionPractice(obj, objLink) {
	document.getElementById(obj).style.display ='block';
	objLink.parentNode.style.display = 'none';
	if (parent && typeof(parent.scorm_resize)=='function') {
	  parent.scorm_resize(0, 0);
	}
}

/* dynamic load css, js */
function loadjscssfile(filename, filetype){
 if (filetype=="js"){ //if filename is a external JavaScript file
  var fileref=document.createElement('script')
  fileref.setAttribute("type","text/javascript")
  fileref.setAttribute("src", filename)
 }
 else if (filetype=="css"){ //if filename is an external CSS file
  var fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet")
  fileref.setAttribute("type", "text/css")
  fileref.setAttribute("href", filename)
 }
 if (typeof fileref!="undefined")
  document.getElementsByTagName("head")[0].appendChild(fileref)
}

/* je treba upravit funkci onload() v nasledujicim skriptu! */
loadjscssfile("../shared/zoom.js", "js") //dynamically load and add this .js file
