function post_suggest_a_form() { // handle the AJAX reequest var xmlHttp; try // Firefox, Opera 8.0+, Safari { xmlHttp = new XMLHttpRequest(); } catch (e) { try // Internet Explorer { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } // Event Handler - EventListener xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) // 4: The Request is complete { var result = xmlHttp.responseText; // Response var result_parts = result.split("|"); if(result_parts[0] == "error") // BAD { document.getElementById('suggest_submit_button').disabled = false; document.getElementById('suggest_a_name_results').innerHTML = ''+result_parts[1]+''; } else // GOOD { document.getElementById('suggest_a_name_results').innerHTML = ''+result_parts[1]+''; } document.getElementById('suggest_a_name_results').style.display = "block"; } } // Request document.getElementById('suggest_a_name_results').style.display = "none"; document.getElementById('suggest_submit_button').disabled = true; var url = "/popup_suggest_a_name.php?input=post&your_name="+document.suggest_a_name.your_name.value+"&your_email="+document.suggest_a_name.your_email.value+"&suggested_name="+document.suggest_a_name.suggested_name.value+"&security_code="+document.suggest_a_name.security_code.value; xmlHttp.open("GET", url, true); xmlHttp.send(null); } function close_popup_suggest_a_name() { document.getElementById('popDiv').style.display = "none"; gray_out(false); } function popup_suggest_a_name() { document.getElementById('popDiv').style.zIndex = 99; showdeadcenterdiv(300,300,'popDiv') document.getElementById('suggest_submit_button').disabled = false; gray_out(true); } // put popup window in the middle of the screen function showdeadcenterdiv(Xwidth,Yheight,divid) { var scrolledX, scrolledY; if( self.pageYOffset ) { scrolledX = self.pageXOffset; scrolledY = self.pageYOffset; } else if( document.documentElement && document.documentElement.scrollTop ) { scrolledX = document.documentElement.scrollLeft; scrolledY = document.documentElement.scrollTop; } else if( document.body ) { scrolledX = document.body.scrollLeft; scrolledY = document.body.scrollTop; } // Next, determine the coordinates of the center of browser's window var centerX, centerY; if( self.innerHeight ) { centerX = self.innerWidth; centerY = self.innerHeight; } else if( document.documentElement && document.documentElement.clientHeight ) { centerX = document.documentElement.clientWidth; centerY = document.documentElement.clientHeight; } else if( document.body ) { centerX = document.body.clientWidth; centerY = document.body.clientHeight; } // Xwidth is the width of the div, Yheight is the height of the // div passed as arguments to the function: var leftOffset = scrolledX + (centerX - Xwidth) / 2; var topOffset = scrolledY + (centerY - Yheight) / 2; // The initial width and height of the div can be set in the // style sheet with display:none; divid is passed as an argument to // the function var o=document.getElementById(divid); var r=o.style; r.position='absolute'; r.top = topOffset + 'px'; r.left = leftOffset + 'px'; r.display = "block"; } //------------------------------------------------------------------------------------------------- function gray_out(vis, options) { var options = options || {}; var zindex = options.zindex || 50; var opacity = options.opacity || 50; var opaque = (opacity / 100); var bgcolor = options.bgcolor || '#000000'; var dark=document.getElementById('darkenScreenObject'); if (!dark) { // The dark layer doesn't exist, it's never been created. So we'll // create it here and apply some basic styles. // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917 var tbody = document.getElementsByTagName("body")[0]; var tnode = document.createElement('div'); // Create the layer. tnode.style.position='absolute'; // Position absolutely tnode.style.top='0px'; // In the top tnode.style.left='0px'; // Left corner of the page tnode.style.overflow='hidden'; // Try to avoid making scroll bars tnode.style.display='none'; // Start out Hidden tnode.id='darkenScreenObject'; // Name it so we can find it later tbody.appendChild(tnode); // Add it to the web page dark=document.getElementById('darkenScreenObject'); // Get the object. } if (vis) { // Calculate the page width and height if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) { var pageWidth = document.body.scrollWidth+'px'; var pageHeight = document.body.scrollHeight+'px'; } else if( document.body.offsetWidth ) { var pageWidth = document.body.offsetWidth+'px'; var pageHeight = document.body.offsetHeight+'px'; } else { var pageWidth='100%'; var pageHeight='100%'; } //set the shader to cover the entire page and make it visible. dark.style.opacity=opaque; dark.style.MozOpacity=opaque; dark.style.filter='alpha(opacity='+opacity+')'; dark.style.zIndex=zindex; dark.style.backgroundColor=bgcolor; dark.style.width= pageWidth; dark.style.height= pageHeight; dark.style.display='block'; } else { dark.style.display='none'; } }