function include_dom (script_filename, external) 
{
	html_doc = document.getElementsByTagName('head').item(0);
	js = document.createElement('script');
	js.setAttribute('language', 'javascript');
	js.setAttribute('type', 'text/javascript');
	if ( external ) { 
		js.setAttribute('src', script_filename);
	} else {
		js.setAttribute('src', httproot + 'client/' + script_filename + '.js');
	}
	html_doc.appendChild(js);
	return false;
}

function appendFunc (func) 
{
	thisobj = document.getElementsByTagName('head').item(0);
	script = document.createElement('script');
	script.text = func + '();';
	script.type = 'text/javascript';
	//script.setAttribute('language', 'javascript');
	thisobj.appendChild(script);
	return false;
}

/* Shorthand Functions*/
function $ (id) { return document.getElementById(id); }



function div (id, content, append)
{
	if ( append ) {
		appendto = $(append);
	} else {
		appendto = document.getElementsByTagName('body').item(0);
	}
	thisdiv = document.createElement('div');
	thisdiv.id = id;
	thisdiv.innerHTML = content;
	thisdiv.style.display = 'none';
	appendto.appendChild(thisdiv);
	return thisdiv;
}

function afterload ()
{
	div('loadingblock', '<div id="loading">Loading</div>');
	initLightbox();
}

function go ( url ) 
{
	window.location = url;
}

function changeband ( bid ) 
{
	if ( bid > 0 ) go(httproot + 'index.php?viewband=' + bid);
}

function areyousure (str, moreinfo) 
{ 	
	if ( moreinfo ) { 
		moreinfo = "\n" + moreinfo;
	} else { 
		moreinfo = '';
	}
	return ( confirm('Are you sure you want to ' + str + '?' + moreinfo) ) ? true : false; 	
}

function str_replace (str, find, replace)
{
	while ( str != (temp = str.replace(find, replace)) ) { str = temp; }
	return str;
}




include_dom('ajax_class');
include_dom('ajax_custom');
include_dom('ajax_admin');
include_dom('js_select');
include_dom('url_encode');
//include_dom('prototype');
include_dom('lightbox_org');
//include_dom('lightbox_ajax');