/*
 * jrgp - 7/31/2010
 */

// cover the site in gray
function gray_in(){
	
	// create div to be gray
	var boxy = document.createElement('div');
	
	// if it already exists, fuck it
	if (document.getElementById('unified_dark_overlay'))
		return;
		
	// make it the right id
	boxy.setAttribute('id', 'unified_dark_overlay');
	
	// and stick it
	document.body.appendChild(boxy);
}

// remove all gray
function gray_out() {
	
	// if it isn't, ignore
	if (!document.getElementById('unified_dark_overlay'))
		return;
	
	// kill the gray div
	document.body.removeChild(document.getElementById('unified_dark_overlay'));
}

// empty an element
function kill_nodes(element) {
	if (element.hasChildNodes()) {
		while (element.firstChild) {
			element.removeChild(element.firstChild);
		}
	}
}

// Snag ajax handle
function grab_ajax_handle()
{
	var ajax_handle;
	try {
		// Firefox, Opera 8.0+, Safari, other intelligent browsers
		ajax_handle = new XMLHttpRequest();
	}
	catch (e) {
		// Internet Explorer
		try {
			ajax_handle = new ActiveXObject('Msxml2.XMLHTTP');
		}
		catch (e) {
			try {
				ajax_handle = new ActiveXObject('Microsoft.XMLHTTP');
			}
			catch (e) {
				//ajax is not supported
				return false;
			}
		}
	}
	//either we have it or we're dead
	//give it
	return ajax_handle;
}

// Make a mother fucking beep
function unified_beep() {
	var id = 'unified_beep';
	var content = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="1" height="1" id="beep" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="http://static.thd.vg/unified/sites/common/beep.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="http://static.thd.vg/unified/sites/common/beep.swf" quality="high" bgcolor="#ffffff" width="1" height="1" name="beep" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
	if (document.getElementById(id)) 
		document.getElementById(id).innerHTML = content;
	else {
		var div = document.createElement('div');
		div.setAttribute('id', id);
		div.innerHTML = content;
		document.body.appendChild(div);
	}

	// Don't be a mute little cunt; say something for chrissakes
	return true;
}

