function clear_input(e,value) { if( e.value==value) e.value=""; else if( e.value.length==0 ) e.value=value; } function delete_confirm(url) { var agree=confirm("Are you sure you wish to delete?"); if (agree) window.location=url; else return false ; } function popup(url,width,height) { newwindow=window.open(url,'name','height='+height+',width='+width+',toolbar=no,menubar=no,scrollbars=yes,resizable=no'); if (window.focus) {newwindow.focus()} return false; } function validate_form() { if( document.getElementById('email') ) { var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; var email = document.getElementById('email'); var email_text = document.getElementById('email_text'); var error1 = false; if(!filter.test(email.value)) { error1 = true; email_text.style.color="red"; } else { error1 = false; email_text.style.color="#0091CB"; } } if( document.getElementById('message') ) { var message = document.getElementById('message'); var message_text = document.getElementById('message_text'); var error2 = false; if( message.value.length<10 ) { error2 = true; message_text.style.color="red"; } else { error2 = false; message_text.style.color="#0091CB"; } } if( !error1 && !error2 ) { change_element_type('submit','submit'); } } function align_center(element_id) { function getWindowHeight() { var windowHeight = 0; if (typeof(window.innerHeight) == 'number') { windowHeight = window.innerHeight; } else { if (document.documentElement && document.documentElement.clientHeight) { windowHeight = document.documentElement.clientHeight; } else { if (document.body && document.body.clientHeight) { windowHeight = document.body.clientHeight; } } } return windowHeight; } function setContent() { if (document.getElementById) { var windowHeight = getWindowHeight(); if (windowHeight > 0) { var contentElement = document.getElementById(element_id); var contentHeight = contentElement.offsetHeight; if (windowHeight - contentHeight > 0) { contentElement.style.position = 'relative'; contentElement.style.top = ((windowHeight / 2) - (contentHeight / 2)) + 'px'; } else { contentElement.style.position = 'static'; } } } } window.onload = function() { setContent(); } window.onresize = function() { setContent(); } }