// JavaScript Document
function do_dynamic_js(url){ //just add an element, the URL should provide additional scripts if necessary.
	var script = document.createElement('script');
	script.type = 'text/javascript';
	script.src = url;
	document.getElementsByTagName('head')[0].appendChild(script); 
}

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)
}

function writeWin(window_name,content, title, params){
	if(!params || params == null || params == '') params = 'width=350,height=250'
	   +',menubar=0'
	   +',toolbar=1'
	   +',status=0'
	   +',scrollbars=1'
	   +',resizable=1';
	top.consoleRef=window.open('',window_name,params);
	top.consoleRef.document.writeln(
		'<html><head><title>'+title+'</title></head>'
		+'<body bgcolor=white onLoad="self.focus()">'
		+content
		+'</body></html>'
	)
	top.consoleRef.document.close()
}
