|
<html>
<head>
</head>
<body bgcolor="#f3f3ec">
<script type="text/javascript">
var contactid = "{!Lead.Id}";
var callcontact = "{!User.Call_Contact_with__c}";
function trimString (str) {
str = this != window? this : str;
return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}
String.prototype.trim = trimString;
function validatePhoneNumber(value){
p=value
p=p.replace("(","")
p=p.replace(")","")
p=p.replace("-","")
p=p.replace("-","")
p=p.replace(" ","")
if (isNaN(p)==true){
return "";
}
return p;
}
function phonetype( ptype ) {
phonetype="#1";
ptype = ptype.toLowerCase();
switch( ptype ) {
case "worldsmart softphone" : phonetype = "#1"; break;
case "worldsmart ip phone 1" : phonetype = "#2"; break;
case "worldsmart ip phone 2" : phonetype = "#3"; break;
case "user phone no." : phonetype = "#4"; break;
}
return phonetype;
}
var alltags=parent.document.all? parent.document.all : parent.document.getElementsByTagName("td");
var expr1 = new Image();
expr1.src="https://central.wspbx.com/webimages/dial.gif";
try {
ptype = phonetype( callcontact );
for (i=0; i<alltags.length; i++){
if (alltags[i].className.indexOf("PhoneNumberElement") != -1 ) {
num = alltags[i].innerHTML.trim();
if( num != "" ) {
pnumber = validatePhoneNumber(num);
if ( pnumber.trim() != "" ) {
if("{!User.Worldsmart_Log_a_Call__c}"==1){
callnum ="window.location.href='callto://"+pnumber+"/"+contactid+"/"+ptype+"'";
if("{!User.Worldsmart_Log_a_Call_Popup__c}"==1)
stim = "setTimeout(\"window.open('/00T/e?retURL=%2F"+contactid+"&tsk5=worldsmart%20Call&who_id="+contactid+"&title=worldsmart%20Call&followup=1&isdtp=mn')\",1000)";
else
stim = "setTimeout(\"window.location.href='/00T/e?retURL=%2F"+contactid+"&tsk5=worldsmart%20Call&who_id="+contactid+"&title=worldsmart%20Call&followup=1'\",1000)";
linkval = "<a href=javascript:"+callnum+";"+stim+";void(0);><img src='"+expr1.src+"' title='Click to Call from worldsmart' border='0' /></a>";
}else{
callnum ="callto://"+pnumber+"/"+contactid+"/"+ptype;
linkval = "<a href="+callnum+" target='_self'><img src='"+expr1.src+"' title='Click to Call from Worldsmart' /></a>"
}
alltags[i].innerHTML = num+" "+linkval;
}
}
}
}
} catch (e) {
alert("Error e"+ e);
}
</script>
</body>
</html>
|