window.onload=initproc; function initproc() { var phoneno=""; var phone_google=""; if(urlCheck(document.referrer)==true) { phoneno=phone_google; } if(phoneno!="") { var bodyText = document.body.innerHTML; var arrPhone=phoneno.split("-"); bodyText=bodyText.replace(/\d{4}-\d{2,}-\d{2,}/gi, arrPhone[0]+"-"+arrPhone[1]+"-"+arrPhone[2]); bodyText=bodyText.replace(/\d{4}\.\d{2,}\.\d{2,}/gi, arrPhone[0]+"."+arrPhone[1]+"."+arrPhone[2]); bodyText=bodyText.replace(/\d{4}\s+\d{2,}\s+\d{2,}/gi, arrPhone[0]+" "+arrPhone[1]+" "+arrPhone[2]); bodyText=bodyText.replace(/\(\d{2,}\)\s+\d{2,}\.\d{2,}/gi, "("+arrPhone[0]+") "+" "+arrPhone[1]+"."+arrPhone[2]); bodyText=bodyText.replace(/\(\d{2,}\)\s+\d{2,}\.\d{2,}/gi, "("+arrPhone[0]+") "+" "+arrPhone[1]+"."+arrPhone[2]); bodyText=bodyText.replace(/\(\+\d{2}\s+\d{1}\)\s+\d{4}\s+\d{4}/gi, ""+arrPhone[0]+" "+" "+arrPhone[1]+" "+arrPhone[2]); document.body.innerHTML = bodyText; } } function urlCheck(str) { var v = new RegExp(); //v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\.[A-Za-z0-9-_%&\?\/.=]+$"); v.compile("^http://www.google\..*"); if (!v.test(str)) { return false; } return true; }