// JavaScript Document

//---------------------------------------------------------------------------
//    Check to see if dubugging is enabled :
//---------------------------------------------------------------------------
if(!eval(debug)==true)
  var debug = false;;


//---------------------------------------------------------------------------
//    Let's load some JavaScripts :
//---------------------------------------------------------------------------
function load_script(filename) {
  var script = document.createElement('script'); 
  script.type = 'text/javascript'; 
  script.src = filename; 
  document.getElementsByTagName('head')[0].appendChild(script);
  if(debug)
    monitor(dynScripts, filename);
}


//---------------------------------------------------------------------------
//    Let's load some Stylesheets :
//---------------------------------------------------------------------------
function load_stylesheet(filename) {
	var objHead = document.getElementsByTagName('head');
	/*var objCss = document.getElementById(filename);
	if (objCss!=null){
		alert(objCss.type+"<--->"+objCss.tagName);
		//objHead[0].removeChild(objCss);
	}*/
	var css = objHead[0].appendChild(document.createElement('link'));
//  var css = document.createElement('link');
	css.setAttribute('id',filename);
	css.rel = 'stylesheet';
	css.type = 'text/css';
	try{
		css.href = filename;
		document.body.appendChild(css);
	}catch(err){
		// Si quiero hacer algo con error, va acá, de momento solo me importa ignorarlo y que no rompa las pelotas
	}
	if (debug){
		monitor(dynStyles, filename);
	}
}


//---------------------------------------------------------------------------
//    Watch the status - IF enabled :
//---------------------------------------------------------------------------
function stat() {
  // IF debugging is enabled, then dump via the dynStatus() function :
  if(debug)
    dynStatus();
  // ELSE say that debugging is disabled ::
  else
    alert('Debug not enabled');
}