function showAjaxEmailForm(emailType, id) { //scroll to the top window.scrollTo(0,0); if (parseInt(navigator.appVersion)>3) { if (navigator.appName=="Netscape") { winW = window.innerWidth; winH = window.innerHeight; winH = document.body.offsetHeight; //this gets the whole page in FF //alert(document.body.offsetHeight); } if (navigator.appName.indexOf("Microsoft")!=-1) { winW = document.body.offsetWidth; winH = document.body.offsetHeight; } } left = Math.floor(winW/2) - 250; if (left <= 0) left = 0; ajaxDiv = window.document.getElementById("ajaxDivLayer"); ajaxDiv.style.width = "500px"; ajaxDiv.style.height = "350px"; ajaxDiv.style.position = "absolute"; ajaxDiv.style.top = "200px"; ajaxDiv.style.left = left + "px"; //"250px"; ajaxDiv.style.padding = "10px 10px 10px 10px"; ajaxDiv.style.zIndex = "50"; ajaxDiv.style.backgroundColor = "#FFFFFF"; ajaxDiv.style.border = "#CCCCCC 1px solid"; iHtml = '
Send to a Friend
Close this window

Enter the following information for you and your friend and we\'ll email \'em a link to this page (and don\'t worry, we don\'t keep any of this information for future use)!

'; iHtml = iHtml + '
'; iHtml = iHtml + ''; iHtml = iHtml + ''; iHtml = iHtml + ''; iHtml = iHtml + ''; iHtml = iHtml + ''; iHtml = iHtml + ''; iHtml = iHtml + ''; iHtml = iHtml + ''; iHtml = iHtml + ''; iHtml = iHtml + '
Your Name:
Your Email:
  
Your Friend\'s Name:
Your Friend\'s Email:
  
Comments:
 
'; iHtml = iHtml + ''; iHtml = iHtml + ''; iHtml = iHtml + '
'; //emailType : productReview ajaxDiv.innerHTML = iHtml; ajaxDiv.style.display = "block"; ajaxDiv.style.visibility = "visible"; //alert(screen.width); //screen, not brwoser width //alert(winW); // /////////////// //hide the ad box (for firefox) //window.document.getElementById("sidebar").style.display = "none"; //window.document.getElementById("sidebar").style.visibility = "hidden"; aajaxDiv = window.document.getElementById("ajaxDivBlackLayer"); aajaxDiv.style.width = winW + "px"; aajaxDiv.style.height = winH + "px"; aajaxDiv.style.position = "absolute"; aajaxDiv.style.top = "1px"; aajaxDiv.style.left = "1px"; aajaxDiv.style.zIndex = "30"; aajaxDiv.style.backgroundColor = "#000000"; aajaxDiv.style.opacity = "10"; aajaxDiv.style.display = "block"; aajaxDiv.style.visibility = "visible"; ovalue = 3; aajaxDiv.style.opacity = ovalue/10; aajaxDiv.style.filter = 'alpha(opacity=' + ovalue*10 + ')'; //aajaxDiv.style.overflow = "hidden"; } //hide form //function hideAjaxEmailForm() { function checkAjaxForm() { if (window.document.forms.ajaxForm.yourEmail.value.length == 0) { alert("Please enter your email address."); window.document.forms.ajaxForm.yourEmail.focus(); return false; } if (validateEmailAddress(window.document.forms.ajaxForm.yourEmail.value) == false) { alert("Please enter a valid email address."); window.document.forms.ajaxForm.yourEmail.focus(); return false; } //alert('pre pre friend email'); /* if (window.document.forms.ajaxForm.friendEmail.value.length == 0) { alert("Please enter your friend's email address."); window.document.forms.friendForm.yourEmail.focus(); return false; } */ //alert('pre friend email'); if (validateEmailAddress(window.document.forms.ajaxForm.friendEmail.value) == false) { alert("Please enter a valid friend's email address."); window.document.forms.ajaxForm.friendEmail.focus(); return false; } //alert('post friend email'); formStringArray = new Array('yourName', 'yourEmail', 'friendName', 'friendEmail', 'emailType', 'comments', 'id'); formString = makeFormString('ajaxForm', formStringArray); //alert(formString); //alert('form submited'); request('ajaxDivLayer', 'http://www.cyclematters.com/ajax/send-to-a-friend.cfm?' + formString); return false; } function validateEmailAddress(email) { var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; if (email.search(reg) == -1) { return false } else { return true; } // return reg.test(email); // if(reg.test(email) == false) { } function makeFormString(formName, fieldArray) { returnString = 'd=a'; for (i in fieldArray) { t1 = typeof fieldArray[i]; if (t1 == 'string' && fieldArray[i].substring(1, 8) != 'function') { returnString += '&' + fieldArray[i] + "=" + escape( eval('window.document.' + formName + '.' + fieldArray[i] + '.value') ); } } return returnString; } /* ------------------------- AJAX FUNCS ------------------------- *\ |* *| \* -------------------------------------------------------------- */ function getRequestObject(){ if (window.XMLHttpRequest) { // Mozilla, Safari, ... return new XMLHttpRequest(); } else if (window.ActiveXObject) { // IE return new ActiveXObject("Microsoft.XMLHTTP"); } } function request(divName, url){ // BUILD THE HTTPREQUEST OBJECT //................................ var httpRequest = getRequestObject(); // BUILD THE ELEMENT TO ADD THE RETURNED CODE TO //............................................... var contentElement = null; try{ contentElement = document.getElementById(divName); } catch(e){ //alert("Error: " + e.message); return; } //alert("URL:"+url); // BUILD THE STATE HANDLER //......................... httpRequest.onreadystatechange = function() { if (httpRequest.readyState == 4) { if (httpRequest.status == 200) { contentElement.innerHTML = httpRequest.responseText; } else { contentElement.innerHTML = httpRequest.responseText; } } }; httpRequest.open('GET', url, true); httpRequest.send(null); }