// JavaScript Document - GENERAL

<!--Change div content-->
var ns4 = (document.layers)? true:false;         //NS 4
var ie4 = (document.all)? true:false;            //IE 4
var dom = (document.getElementById)? true:false; //NS 6 ou IE 5

function SetDiv(ID,Content) {
   if (dom) {
   document.getElementById(ID).innerHTML = Content;
      return;
   }
   if (ie4) {
       document.all[ID].innerHTML = Content;
      return;
   }
   if (ns4) {
       with (eval('document.'+ID+'.document')) {
          open();
          write(Content);
          close();
      }
      return;
   }
}

<!--RANDOM-->
function random_nbr(min_nbr,max_nbr){
	return Math.round((Math.random() * (max_nbr - min_nbr)) + min_nbr);
}

<!--SHOW HIDE-->
function show_hide(Id){	
	obj_status = document.getElementById(Id).style.visibility;
	if(obj_status=="hidden"){document.getElementById(Id).style.visibility = "visible";}
	if(obj_status=="visible"){document.getElementById(Id).style.visibility = "hidden";}	
}

<!--LOAD PAGE-->
function load_page(new_location){
	window.location = new_location;
}

<!--CHANGE CLASS-->
function changeClass(object, newClass){
	object.className = newClass;
}

function changeClassID(Id, newClass){
	document.getElementById(Id).className = newClass;
}

/*function changeClass2(idref, classname) {   
  var el = document.getElementById(idref); 
  var attributeNode = el.getAttributeNode("class"); 
  if( attributeNode ) { attributeNode.value = classname; } 
  else { el.setAttribute("class", classname); } 
 }*/

//---------------------------------------------------------------------------------------------------------------------------------------

function multipleOf(nbrX, nbrY){
	//if X is a multiple of Y return true
	nbr = nbrX/nbrY;
	nbrInteger = Math.floor(nbrX/nbrY);
	if(nbr==nbrInteger){
		//It's a round number, so it was a multiple
		return true;
	}
	else{return false;}

}

//---------------------------------------------------------------------------------------------------------------------------------------
function removeSpaces(string) {
	var tstring = "";
	string = '' + string;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
	tstring += splitstring[i];
	return tstring;
}

/*
function defineTopLeft(w,h) {
	//defines the variable left and top when we wants to center a pop up
	var the_left = (screen.width - w) / 2;
	var the_top = (screen.height - h) / 2;
}
*/

