tooltip = null;
document.onmousemove = updateTT;

function ttoff() {
     if (tooltip != null) {
       tooltip.style.display = "none";
     }
     tooltip == null;
}

function tton(toolId) {    
    ttoff();
    tooltip = document.getElementById(toolId);
    if (tooltip != null) {
      tooltip.style.display = "block";
    }
}

function updateTT(e) {
	if (tooltip != null) {
		x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
	    y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
		tooltip.style.left = (x + 20) + "px";
		tooltip.style.top 	= (y + 20) + "px";
	}
}

function popup(datei,breit,hoch) {
    big=window.open(datei,breit+"zoomed"+hoch,"width="+breit+",height="+hoch+",menubar=no,status=no,locationbar=no");
    big.focus();
}
			
function zoom(datei,breit,hoch) {
    zoom(datei,breit,hoch,"no","no");
}

function zoom(datei,breit,hoch,resizable,scrollbars) {
    big=window.open(datei,breit+"zoomed"+hoch,"width="+breit+",height="+hoch+", scrollbars="+scrollbars+",resizable="+resizable+",menubar=no,status=no,locationbar=no");
    if (big) {
        big.focus();
    }
}

function limitInput(input, maxInput) {
    if (input.value.length>maxInput){
        alert("Es können maximal "+maxInput+" Zeichen eingegeben werden!");
        input.value = input.value.substring(0,maxInput);
    } else {
        document.ratingform.output.value = maxInput - input.value.length;
    }
}

function image_resize(img,w,h) {
    var proc = 1;
    if (img.width > w) {
        proc = w/img.width;
        img.width = w;
        img.height = Math.round(img.height * proc);
    } else if(img.height > h) {
        proc = h/img.height;
        img.height = h;
        img.width = Math.round(img.width * proc);
    }
}



