// prnpub.js
// 19-oct-06/pp

// menu
function toggle (img) {
	var foo = img.src.toString (), bar;

	if (foo.indexOf ('_off') > 0) {
		bar = foo.substr (0, foo.indexOf ('_off')) + '_on.gif';
	} else {
		bar = foo.substr (0, foo.indexOf ('_on')) + '_off.gif';
	}
	
	img.src = bar;
}

// ** Text selection ** //
function preventSelection () {
    //eturn;
	// works for most browsers; definitely not completely secure
	if (document.selection) {
	    setInterval (deselectText_IE, 1000);
		document.onmouseup = deselectText_IE;
	} else {
		try {
			document.getElementById ('tdContent').innerHTML += '';
			// the following lines will only be processed if no exception was thrown by the line above
	        setInterval (deselectText_Firefox, 1000);
			document.onmousemove = deselectText_Firefox;
		} catch (e) {}
	}
}

function deselectText_Firefox () {
	// quirk: by adding an empty string to the innerHTML property, FireFox and Safari clear their selections
	try {
	    // if (document.getSelection ().length > 0) 
		    document.getElementById ('tdContent').innerHTML += '';
	} catch (e) {}
}

function deselectText_IE () {
	try {
        // empties the selection if any made
	    if (document.selection.createRange ().text.length > 0)
		    document.selection.empty ();
	} catch (e) {}
}

function toggleEventVisibility () {
    if (document.getElementById ('spnShow').innerText == '[Show]') {
        document.getElementById ('spnShow').innerText = '[Hide]';
        document.getElementById ('divSearchEventsResults').style.display = 'block';
    }
    else {
        document.getElementById ('spnShow').innerText = '[Show]';
        document.getElementById ('divSearchEventsResults').style.display = 'none';
    }
}


