// JavaScript main scripts

function checkUncheckAll(theElement) {
var theForm = theElement.form, z = 0;
for(z=0; z<theForm.length;z++){ if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
theForm[z].checked = theElement.checked;
}
}
}

function checkUncheckSome(controller,theElements) {
//theElements is an array of objects designated as a comma separated list of their IDs
//If an element in theElements is not a checkbox, then it is assumed
//that the function is recursive for that object and will check/uncheck
//all checkboxes contained in that element

var formElements = theElements.split(',');
var theController = document.getElementById(controller);
for(var z=0; z<formElements.length;z++){
theItem = document.getElementById(formElements[z]);
if(theItem.type){
if (theItem.type=='checkbox') {
theItem.checked=theController.checked;
}
} else {
theInputs = theItem.getElementsByTagName('input');
for(var y=0; y<theInputs.length; y++){
if(theInputs[y].type == 'checkbox' && theInputs[y].id != theController.id){
theInputs[y].checked = theController.checked;
}
}
}
}
}
/* TOOTIP FUNCTION
// usage:
<script type="text/javascript" src="mktooltip.js"></script>
<a href="javascript:void(0)" onmouseover="showtip(event, 'Simple tooltip');"
onmouseout="hidetip();">Hover your mouse here to see simplet tooltip.</a><br>
<div id="mktipmsg" class="mktipmsg" ></div> 
if html, all elements need to be transformed with the http_translation_table($string)

*/
function showtip(e,message){var x=0;var y=0;var m;var h;if(!e)
var e=window.event;if(e.pageX||e.pageY){x=e.pageX;y=e.pageY;}
else if(e.clientX||e.clientY){x=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;y=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;}
m=document.getElementById('mktipmsg');if((y>10)&&(y<450)){m.style.top=y-4+"px";}
else{m.style.top=y+4+"px";}
var messageHeigth=(message.length/20)*10+25;if((e.clientY+messageHeigth)>510)
{m.style.top=y-messageHeigth+"px";}
if(x<850){m.style.left=x+20+"px";}
else{m.style.left=x-170+"px";}
m.innerHTML=message;m.style.display="block";m.style.zIndex=203;}
function hidetip(){var m;m=document.getElementById('mktipmsg');m.style.display="none";}



