//load_jsORcss_file(_scripts_directory + file.js, 'js', 'head');
/*This Function that allows us to include javascript and CSS files inside javascript It needs to be higher in the file than when it it used below*/
function load_jsORcss_file(filename, filetype, pos, getElementBy)
{
	var element_object = false;
	if(getElementBy=="id")
	{
		element_object = document.getElementById(pos);
		/*
		var url = element_object.getAttribute("url");
		var title = element_object.getAttribute("title");
		var widget_url = element_object.getAttribute("widget_url");
		var link = false;
		if(url && title && widget_type)
		{
			link = widget_url+"?url="+url+"&title="+title;
			//http://www.stumbleupon.com/hostedbadge.php?url=<?php echo urlencode ( $row->link_on ); ?>&title=<?php echo urlencode($row->title);
		}
		*/
	}
	else
	{
		element_object = document.getElementsByTagName(pos)[0]
	}
	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" && element_object)
	{
		//element_object.appendChild(fileref);
	}
}
function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}