function checkPhone(s){
	var sPhone = s.value;
	sPhone = sPhone.replace(/[()]/g,'');
	sPhone = sPhone.replace(/\./g,'-');
	s.value = sPhone;
}

function startChat()
{
      foo = window.open("", "foo", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=400,height=400");
      
      <!-- Hide script from old browsers 
      if (!navigator.javaEnabled()) { 
          foo.document.write('This browser does not have Java enabled.'); 
      } else { 
          if ((navigator.platform == 'MacPPC') && 
              (navigator.appName != 'Microsoft Internet Explorer')) { 
              foo.document.writeln('<APPLET CODEBASE=http://livenj01.rightnowtech.com/mf/mf/rnt/rnl/java  ARCHIVE=user10.jar NAME=userChat CODE=user.UserChatLaunch.class WIDTH=2 HEIGHT=0>'); 
          } else { 
              foo.document.writeln('<APPLET CODEBASE=http://livenj01.rightnowtech.com/mf/mf/rnt/rnl/java ARCHIVE=user.jar NAME=userChat CODE=user.UserChatLaunch.class WIDTH=2 HEIGHT=0>'); 
          } 
          foo.document.writeln('<PARAM NAME=Name Value=>');  
          foo.document.writeln('<PARAM NAME=CABBASE VALUE=user.cab>'); 
          foo.document.writeln('<PARAM NAME=APPLET_START VALUE=1>'); 
          foo.document.writeln('<PARAM NAME=ERROR_MSG VALUE="The messaging server is unavailable.">'); 
          foo.document.writeln('<PARAM NAME=USER_PORT VALUE=10285>'); 
          foo.document.writeln('<PARAM NAME=SERVLET_LIVE_HOSTNAME VALUE=172.29.0.30>'); 
          foo.document.writeln('<PARAM NAME=SERVLET_VIRTUAL_DIR VALUE=servlet>'); 
          foo.document.writeln('<PARAM NAME=SERVLET_HTTP_PORT VALUE=80>'); 
          foo.document.writeln('<PARAM NAME=SERVLET_ENABLED VALUE=1>'); 
          foo.document.writeln('<PARAM NAME=SERVLET_ALWAYS_USE VALUE=1>'); 
          foo.document.writeln('<BLOCKQUOTE><HR>'); 
          foo.document.writeln('Your browser does not understand the &lt;APPLET&gt; tag.'); 
          foo.document.writeln('<HR></BLOCKQUOTE>'); 
          foo.document.writeln('</APPLET>'); 
          foo.document.userChat.launch();
      }
}

function pop(url, width, height){
  popup = window.open(url, 'popup', 'width=' + width + ',height=' + height + ',scrollbars=yes' + ',resizable=yes');
  popup.focus();
  return;
}

function popup_image(img_tag, title, description, width, height) {
var w = window.open('','sound','width=500,height=500,scrollbars=yes,resizable=yes');
var d = w.document;
d.write(
'<html><head><title>Musician\'s Friend: ' + title + '</title></head><body bgcolor=#FFFFFF>' +
'<center><FONT SIZE="2" FACE="Verdana,Arial,Helvetica,sans-serif">b>' + title + '</b><br><br>' + description + '</font><p>' + img_tag +
'<p><FONT SIZE="2" FACE="Verdana,Arial,Helvetica,sans-serif"><a HREF="javascript: self.close()">Close Window</a></font></center></body></html>'); 
d.close();
w.focus();
}

function enlarge_photo(window_name, prod_name, base_pid, pic_width, pic_height, img_path) {
var w = window.open('',window_name,'width=' + (pic_width + 50) + ',height=' + (pic_height + 150) + ',scrollbars=yes,resizable=yes');
var d = w.document;
d.write('\
<HTML><HEAD><TITLE>' + prod_name + '</title></head>\
<BODY BGCOLOR=\"#FFFFFF\">\
<center><FONT SIZE="2" FACE="Verdana,Arial,Helvetica,sans-serif">\
<B>' + prod_name + '</b> (#' + base_pid + ')</font></b>\
<p><IMG SRC="' + img_path + '" WIDTH=' + pic_width + ' HEIGHT=' + pic_height
+ ' ALT="' + prod_name + '">\
<p><FONT SIZE="2" FACE="Verdana,Arial,Helvetica,sans-serif"><a href=# OnClick=\"self.close();\"\>Close Window\</a></font>\
</center></body></html>');
d.close();
w.focus();
}

function bo_popup(duedate) {
var w = window.open('','backorder','width=450,height=225,scrollbars=yes,resizable=yes');
var d = w.document;
d.write('\
<html><head><title>Backordered Item</title></head>\
<body>\
<FONT SIZE="3" FACE="Verdana,Arial,Helvetica,sans-serif">\
<b>Backordered</b></font><hr noshade size=1 color=#CCCCCC>\
<FONT SIZE="2" FACE="Verdana,Arial,Helvetica,sans-serif">\
You can still place your order for this item, although it is not currently \
available for shipment from any of our warehouse \
locations. We have the product on order with our supplier and expect \
to have it in stock around <b>' + duedate + '</b>. This is an estimated \
date from the manufacturer and is subject to change. We appreciate \
your patience on this!<br><br>\
<b><a href=\"javascript: self.close();\" OnClick=\"self.close();\">Close Window</a></b>\
</font>');
d.close();
w.focus();
}

function instock_popup() {
var w = window.open('','instock','width=450,height=225,scrollbars=yes,resizable=yes');
var d = w.document;  
d.write('<html><head><title>Delivery</title></head>\
<body>\
<FONT SIZE="3" FACE="Verdana,Arial,Helvetica,sans-serif">\
<b>Delivery</b></font><hr size=1 noshade color=#CCCCCC>\
<FONT SIZE="2" FACE="Verdana,Arial,Helvetica,sans-serif">\
This item is in stock and available for delivery. \
Most orders received before 2PM Eastern Time are shipped the same day! \
Orders received after 2PM, or on the weekend, are not likely to be processed until the following business day.<br>\
Thank you!<br>\
<br><b><a href=\"javascript: self.close();\"OnClick=\"self.close();\">Close Window</a></b>\
</font></body></html>'); 
d.close();
w.focus();
}

function MM_openBrWindow(theURL,winName,features) { 
window.open(theURL,winName,features);
}

function limit_textarea(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}

function escape_custom(string, delimiter) {
    var new_string = "";
    a = string.split(delimiter);
    for(i = 0; i < a.length; i++) {
        if(i != 0) { 
            new_string = new_string + "\\" + delimiter + a[i];
        } else { new_string = a[i]; }
    }
    return new_string;
}

