notmembermsg = "This is a member only feature. Please login or create your free membership."; function isLoggedIn(){ return false;} function IsNumeric(sText) { var ValidChars = "0123456789"; var IsNumber=true; var Char; for (i = 0; i < sText.length && IsNumber == true; i++) { Char = sText.charAt(i); if (ValidChars.indexOf(Char) == -1) { IsNumber = false; } } return IsNumber; } function validphone(areacode,prefix,suffix){ valid=true; iphonenum = areacode+""+suffix+""+prefix; if(!IsNumeric(iphonenum) || iphonenum.length != 10){ valid=false; } return valid; } function findPosX(obj) { var curleft = 0; if(obj.offsetParent) while(1) { curleft += obj.offsetLeft; if(!obj.offsetParent) break; obj = obj.offsetParent; } else if(obj.x) curleft += obj.x; return curleft; } function findPosY(obj) { var curtop = 0; if(obj.offsetParent) while(1) { curtop += obj.offsetTop; if(!obj.offsetParent) break; obj = obj.offsetParent; } else if(obj.y) curtop += obj.y; return curtop; } function ShowNetwork(){ headerobj = document.getElementById("headerimage"); document.getElementById("networkiconsdiv").style.left = findPosX(headerobj) + "px"; document.getElementById("networkiconsdiv").style.top = findPosY(headerobj) + "px"; el = document.getElementById("networkiconsdiv"); el.style.display = 'inline'; } function hidediv(divid){ el = document.getElementById(divid); el.style.display = 'none'; } function HideNetwork(){ hidediv("networkiconsdiv"); } function HideSaveAddress(){ hidediv("savetoaddressbookdiv"); } function HideSendToPhone(){ hidediv("sendtophonediv"); } function HideUpdateAddress(){ hidediv("updateaddressbookdiv"); } function LoadSaveToAddressBook(company_id){ if(isLoggedIn()){ divid = "savetoaddressbookdiv"; FRM = document.forms["saveaddressbk"]; FRM.company_id.value = company_id; headerobj = document.getElementById("listing_" + company_id); document.getElementById(divid).style.left = findPosX(headerobj) + "px"; document.getElementById(divid).style.top = findPosY(headerobj) + "px"; el = document.getElementById(divid); el.style.display = 'inline'; } else{alert(notmembermsg);} } function LoadUpdateAddressBook(company_id,category_id){ if(isLoggedIn()){ divid = "updateaddressbookdiv"; FRM = document.forms["saveaddressbk"]; FRM.company_id.value = company_id; FRM.oldcategory_id.value = category_id; headerobj = document.getElementById("listing_" + company_id); document.getElementById(divid).style.left = findPosX(headerobj) + "px"; document.getElementById(divid).style.top = findPosY(headerobj) + "px"; el = document.getElementById(divid); el.style.display = 'inline'; } else{alert(notmembermsg);} } function UpdateAddressBook(){ FRM = document.forms["saveaddressbk"]; //category_id = FRM.category_id.options[FRM.category_id.options.selectedIndex].value; newcategory_id = FRM.newcategory_id.options[FRM.newcategory_id.options.selectedIndex].value; oldcategory_id = FRM.oldcategory_id.value; company_id = FRM.company_id.value; SaveIMG = new Image(); SaveIMG.src = "saveaddressbook.asp?update=1&oldcategory_id="+oldcategory_id+"&newcategory_id=" + newcategory_id + "&company_id="+company_id; //HideUpdateAddress(); location.href="members_addressbook.asp?action=My Favorites has been updated"; } function SaveToAddressBook(){ FRM = document.forms["saveaddressbk"]; category_id = FRM.category_id.options[FRM.category_id.options.selectedIndex].value; company_id = FRM.company_id.value; SaveIMG = new Image(); SaveIMG.src = "saveaddressbook.asp?category_id=" + category_id + "&company_id="+company_id; HideSaveAddress(); alert("Company has been saved to My Favorites"); } function SendToPhone(){ FRM = document.forms["sendtophoneform"]; carrier_id = FRM.carrier_id.options[FRM.carrier_id.options.selectedIndex].value; company_id = FRM.company_id.value; areacode = FRM.areacode.value; prefix = FRM.prefix.value; suffix = FRM.suffix.value; errors=""; if(!validphone(areacode,prefix,suffix)){ errors="Please enter in a valid 10 digit phone number"; } if(errors!=""){ alert(errors); } else{ phonenum = areacode+""+prefix+""+suffix; SendIMG = new Image(); SendIMG.src = "sendtophone.asp?carrier_id=" + carrier_id + "&company_id="+company_id+"&phonenum="+phonenum; HideSendToPhone(); alert("Requested information is being sent to your cell phone"); } } function ShowSendToPhone(company_id){ if(isLoggedIn()){ divid = "sendtophonediv"; FRM = document.forms["sendtophoneform"]; FRM.company_id.value = company_id; headerobj = document.getElementById("listing_" + company_id); document.getElementById(divid).style.left = findPosX(headerobj) + "px"; document.getElementById(divid).style.top = findPosY(headerobj) + "px"; el = document.getElementById(divid); el.style.display = 'inline'; } else{alert(notmembermsg);} } function DeleteFromAddressBook(company_id,category_id){ if(confirm("Are you sure you want to delete this?"))location.href="members_addressbook.asp?delete=1&company_id="+company_id+"&category_id="+category_id; }