﻿// This is variable for storing callback function
var ae_cb = null;
 
// this is a simple function-shortcut
// to avoid using lengthy document.getElementById
function ae$(a) { return document.getElementById(a); }
 
// This is a main ae_prompt function
// it saves function callback 
// and sets up dialog
function ae_prompt(cb, q, a) {
	ae_cb = cb;
	hideSelects('hidden');
	ae$('aep_t').innerHTML = document.domain; //+ ' question:';
	ae$('aep_prompt').innerHTML = q;
	ae$('aep_text').value = a;
	ae$('aep_ovrl').style.display = ae$('aep_ww').style.display = '';
	ae$('aep_text').focus();
	ae$('aep_text').select();
	hideSelects('visible');
}
 
// This function is called when user presses OK(m=0) or Cancel(m=1) button
// in the dialog. You should not call this function directly.
function ae_clk(m) {
	// hide dialog layers 
	ae$('aep_ovrl').style.display = ae$('aep_ww').style.display = 'none';
	if (!m)  
		ae_cb(null);  // user pressed cancel, call callback with null
	else
		ae_cb(ae$('aep_text').value); // user pressed OK 
}

//documentation for this script at http://www.shawnolson.net/a/1198/hide-select-menus-javascript.html
//hide selects on page - copy code below
function hideSelects(action) { 
    //possible values for action are 'hidden' and 'visible'
    if (action!='visible'){action='hidden';}
    if (navigator.appName.indexOf("MSIE")) {
        for (var S = 0; S < document.forms.length; S++){
            for (var R = 0; R < document.forms[S].length; R++) {
                if (document.forms[S].elements[R].options) {
                    document.forms[S].elements[R].style.visibility = action;
                }
            }
        } 
    }
}
//end code 