if (!Array.prototype.indexOf)
{
Array.prototype.indexOf = function(elt /*, from*/)
{
var len = this.length >>> 0;
var from = Number(arguments[1]) || 0;
from = (from < 0)
? Math.ceil(from)
: Math.floor(from);
if (from < 0)
from += len;
for (; from < len; from++)
{
if (from in this &&
this[from] === elt)
return from;
}
return -1;
};
}
function window_close_now() {
window.setTimeout("window.close()", 1);
top.window.close();
window.close();
}
function change_state(market){
if (market != ""){
document.data_passer.region_code.value=market;
document.frm_goto_chat_system.market.value=market;
indx=st.indexOf(market);
//alert(csmsg[indx][1]);
if (csmsg[indx][0] == 0){
//display_hours_open = display_hours_open + document.data_passer.sac_care_hrs.value + "\r\n";
document.getElementById('CARE_CLOSED').innerHTML = " Customer Service is currently closed. "
+ "Customer Service Chat Hours " ;
}
else{ document.getElementById('CARE_CLOSED').innerHTML =" Residential Customer Service";
}
}
else{ document.getElementById('CARE_CLOSED').innerHTML = "Residential Customer Service" ;}
if (market != ""){
document.data_passer.region_code.value=market;
document.frm_goto_chat_system.market.value=market;
indx=st.indexOf(market);
//alert(csmsg[indx][1]);
if (csbusmsg[indx][0] == 0){
//display_hours_open = display_hours_open + document.data_passer.sac_care_hrs.value + "\r\n";
document.getElementById('BUS_CARE_CLOSED').innerHTML = " Business Customer Service is currently closed. "
+ "Business Customer Service Chat Hours " ;
}
else{ document.getElementById('BUS_CARE_CLOSED').innerHTML =" Business Customer Service";
}
}
else{ document.getElementById('BUS_CARE_CLOSED').innerHTML = "Business Customer Service" ;}
if (market != ""){
document.data_passer.region_code.value=market;
document.frm_goto_chat_system.market.value=market;
indx=st.indexOf(market);
//alert(csmsg[indx][1]);
if (ccrmsg[indx][0] == 0){
//display_hours_open = display_hours_open + document.data_passer.sac_care_hrs.value + "\r\n";
document.getElementById('CCR_CLOSED').innerHTML = " Collections is currently closed. "
+ "Collections Chat Hours " ;
}
else{ document.getElementById('CCR_CLOSED').innerHTML =" Collections";
}
}
else{ document.getElementById('CCR_CLOSED').innerHTML = "Collections" ;}
if (market != ""){
document.data_passer.region_code.value=market;
document.frm_goto_chat_system.market.value=market;
indx=st.indexOf(market);
//alert(csmsg[indx][1]);
if (busisrmsg[indx][0] == 0){
//display_hours_open = display_hours_open + document.data_passer.sac_care_hrs.value + "\r\n";
document.getElementById('BUS_ISR_CLOSED').innerHTML = " Business Sales is currently closed. "
+ "Business Sales Chat Hours " ;
}
else{ document.getElementById('BUS_ISR_CLOSED').innerHTML =" Business Sales";
}
}
else{ document.getElementById('BUS_ISR_CLOSED').innerHTML = "Business Sales" ;}
if (busisrmsg[indx][0] == 2){
document.getElementById('BUS_ISR_CLOSED').innerHTML = "";
}
if (market != ""){
document.data_passer.region_code.value=market;
document.frm_goto_chat_system.market.value=market;
indx=st.indexOf(market);
//alert(csmsg[indx][1]);
if (tsmsg[indx][0] == 0){
//display_hours_open = display_hours_open + document.data_passer.sac_care_hrs.value + "\r\n";
document.getElementById('TECH_CLOSED').innerHTML = " Technical Support is currently closed. "
+ "Technical Support Chat Hours " ;
}
else{ document.getElementById('TECH_CLOSED').innerHTML =" Technical Support - Internet Technical Support - Digital TV Technical Support - Voice ";
}
}
else{ document.getElementById('TECH_CLOSED').innerHTML = "Technical Support" ;}
}
function check_open()
{
changeScreenSize(1000,800) ;
return_code = true ;
now = new Date();
localtime = now.toString() ;
hours = now.getHours();
minutes = now.getMinutes() ;
weekdaypos = now.getDay() ; // is a number between 0 and 6. Sunday is 0, Monday is 1 and so on.
local_time = hours + minutes / 60 ;
delta_time = Math.abs( local_time - document.data_passer.server_time.value ) ;
//document.getElementById('contact_us_after_hours').style.visibility='hidden';
// alert(local_time+" "+document.data_passer.server_time.value);
document.frm_goto_chat_system.timestamp_client.value = now ; // hours * 100 + minutes ;
document.data_passer.region_code.value = "IL" ;
document.getElementById('PHONE_SAMPLE_TEXT').innerHTML = document.data_passer.kc_phone.value ;
//
// - determine if KC or SAC customer
//
// if ( delta_time < .5 ) { // kc customer
//if (document.data_passer.region_code.value == "KC"){
//document.frm_goto_chat_system.REASON_TAG.value = "KCCUSTOMERSUPPORTWCDATA" ;
// document.data_passer.region_code.value = "MN" ;
// document.getElementById('PHONE_SAMPLE_TEXT').innerHTML = document.data_passer.kc_phone.value ;
//document.frm_goto_chat_system.__gTranscriptEmailFrom.value = document.data_passer.kc_care_email.value ;
// }
// else { // SAC customer
//document.frm_goto_chat_system.REASON_TAG.value = "SACCUSTOMERSUPPORTWCDATA" ;
// document.data_passer.region_code.value = "SAC" ;
// document.getElementById('PHONE_SAMPLE_TEXT').innerHTML = document.data_passer.sac_phone.value ;
//document.frm_goto_chat_system.__gTranscriptEmailFrom.value = document.data_passer.sac_care_email.value ;
// }
//alert(document.data_passer.region_code.value);
// - determine KC or SAC center is open and if not tell customer
//
someone_open = false ;
display_hours_open = "";
if ( document.data_passer.region_code.value == "SAC" ) {
if ( document.data_passer.sac_care_open.value == 0 ) {
display_hours_open = display_hours_open + document.data_passer.sac_care_hrs.value + "\r\n";
document.getElementById('CARE_CLOSED').innerHTML = " Customer Service is currently closed."
+ " Customer Service Chat Hours " ;
}
else { someone_open = true ; }
if ( document.data_passer.sac_tech_open.value == 0 ) {
display_hours_open = display_hours_open + document.data_passer.sac_tech_hrs.value + "\r\n";
document.getElementById('TECH_CLOSED').innerHTML = " Technical Support is currently closed."
+ " Technical Support Chat Hours " ;
}
else {
someone_open = true ; }
if ( document.data_passer.sac_sales_open.value == 0 ) {
display_hours_open = display_hours_open + document.data_passer.sac_sales_hrs.value + "\r\n";
document.getElementById('SALES_CLOSED').innerHTML = " Sales is currently closed."
+ " Sales Chat Hours " ;
}
else {
someone_open = true ; }
} // if SAC
else {
if ( document.data_passer.kc_care_open.value == 0 ) {
display_hours_open = display_hours_open + document.data_passer.kc_care_hrs.value + "\r\n";
document.getElementById('CARE_CLOSED').innerHTML = " Customer Service is currently closed. "
+ "Customer Service Chat Hours " ;
}
else {
someone_open = true ; }
if ( document.data_passer.kc_tech_open.value == 0 ) {
display_hours_open = display_hours_open + document.data_passer.kc_tech_hrs.value + "\r\n";
document.getElementById('TECH_CLOSED').innerHTML = " Technical Support is currently closed. "
+ "Technical Support Chat Hours " ;
}
else {
someone_open = true ; }
if ( document.data_passer.kc_sales_open.value == 0 ) {
display_hours_open = display_hours_open + document.data_passer.kc_sales_hrs.value + "\r\n";
document.getElementById('SALES_CLOSED').innerHTML = " Sales is currently closed. "
+ "Sales Chat Hours " ;
}
else {
someone_open = true ; }
} // if KC
if ( someone_open == false ) {
alert ( "Currently all Consolidated Communications chat support is closed. \r\n" + display_hours_open ) ;
document.getElementById('form_button').style.visibility='hidden';
}
if ( document.frm_goto_chat_system.client_browser.value.indexOf("APPLEWEBKIT") > 0 ) {
tmp1 = "Consolidated Communications Chat is optimized for use with Internet Explorer and Firefox. " +
"You can still chat but you will need to enable your caps lock for a better experience. " +
"Sorry for any inconvenience. \r\n\r\n-" ;
alert( tmp1 ) ;
}
return return_code ;
}
function validate_form() {
return_code = true ;
// alert(document.frm_goto_chat_system.UNAME.value);
//alert(document.frm_goto_chat_system.kc_care_queue.value);
// - remove spaces
document.frm_goto_chat_system.UNAME.value = trim( document.frm_goto_chat_system.UNAME.value ) ;
document.frm_goto_chat_system.UEMAIL.value = trim( document.frm_goto_chat_system.UEMAIL.value ) ;
document.frm_goto_chat_system.UPHONE.value = trim( document.frm_goto_chat_system.UPHONE.value ) ;
// document.frm_goto_chat_system.ACCOUNTID.value = trim( document.frm_goto_chat_system.ACCOUNTID.value ) ;
// - format check
document.frm_goto_chat_system.UPHONE.value = return_num_only( document.frm_goto_chat_system.UPHONE.value ) ;
// document.frm_goto_chat_system.ACCOUNTID.value= return_num_only( document.frm_goto_chat_system.ACCOUNTID.value ) ;
return_alert_text = "Please enter the following: \r\n";
//alert("in function - validate_form ");
if (document.frm_goto_chat_system.UNAME.value.length < 3 )
{
return_alert_text = return_alert_text + "* your name \r\n";
return_code = false;
}
if (document.frm_goto_chat_system.UEMAIL.value.length < 5 )
{
return_alert_text = return_alert_text + "* your email address \r\n";
return_code = false;
}
// if ( (document.frm_goto_chat_system.ACCOUNTID.value.length > 0 ) &&
// ((document.frm_goto_chat_system.ACCOUNTID.value == 0 ) || (document.frm_goto_chat_system.ACCOUNTID.value.length < 2 ) ) )
// {
// return_alert_text = return_alert_text + "* Invalid account was detected. \r\n";
// return_code = false;
// }
if ( (document.frm_goto_chat_system.UPHONE.value.length > 0 ) &&
((document.frm_goto_chat_system.UPHONE.value == 0 ) || (document.frm_goto_chat_system.UPHONE.value.length < 10 ) ) )
{
return_alert_text = return_alert_text + "* Invalid phone number was detected. \r\n";
return_code = false;
}
// if (document.frm_goto_chat_system.ACCOUNTID.value == document.frm_goto_chat_system.UPHONE.value )
// {
// return_alert_text = return_alert_text + "* phone or account number \r\n";
// return_code = false;
// }
//if (typeof document.frm_goto_chat_system.WG[0] == 'undefined' ) {
if (!document.frm_goto_chat_system.WG){
// alert ( " using radio button of single one for routing");
//routing1 = document.frm_goto_chat_system.WG.value
routing1="";
}
else {
// ( " using array routing");
routing1 = get_radio_value() ; }
//alert ( "WG = " + routing1) ;
document.frm_goto_chat_system.REASON_TAG.value = "" ; // REASON_TAG = routing to chat queue
if (routing1 == "" ){
return_code = false;
return_alert_text = return_alert_text + "* area of assistance \r\n";
}
if (document.frm_goto_chat_system.CUSTOM.value.length < 5 )
{
return_alert_text = return_alert_text + "* Please Describe your request. \r\n";
return_code = false;
}
// if ( document.data_passer.region_code.value == "SAC" ) {
//
// if (routing1 == "CustomerService" ) {
// document.frm_goto_chat_system.REASON_TAG.value = document.data_passer.sac_care_queue.value ;
// document.frm_goto_chat_system.__gTranscriptEmailFrom.value = document.data_passer.sac_care_email.value ; }
// else if (routing1 == "TechnicalSupport" ) {
// document.frm_goto_chat_system.REASON_TAG.value = document.data_passer.sac_tech_queue.value ;
// document.frm_goto_chat_system.__gTranscriptEmailFrom.value = document.data_passer.sac_tech_email.value ; }
// / else if (routing1 == "TechnicalSupport2" ) {
// document.frm_goto_chat_system.REASON_TAG.value = document.data_passer.sac_tech_queue.value ;
// document.frm_goto_chat_system.__gTranscriptEmailFrom.value = document.data_passer.sac_tech_email.value ; }
// else if (routing1 == "TechnicalSupport3" ) {
/// document.frm_goto_chat_system.REASON_TAG.value = document.data_passer.sac_tech_queue.value ;
// document.frm_goto_chat_system.__gTranscriptEmailFrom.value = document.data_passer.sac_tech_email.value ; }
// else if (routing1 == "Sales") {
// document.frm_goto_chat_system.REASON_TAG.value = document.data_passer.sac_sales_queue.value ;
// document.frm_goto_chat_system.__gTranscriptEmailFrom.value = document.data_passer.sac_sales_email.value ; }
// else {
// return_code = false;
// return_alert_text = return_alert_text + "* area of assistance \r\n";
// }
// }
// else {
// if (routing1 == "CustomerService" ) {
// document.frm_goto_chat_system.REASON_TAG.value = document.data_passer.kc_care_queue.value ;
// document.frm_goto_chat_system.__gTranscriptEmailFrom.value = document.data_passer.kc_care_email.value ; }
// else if (routing1 == "TechnicalSupport" ) {
// document.frm_goto_chat_system.REASON_TAG.value = document.data_passer.kc_tech_queue.value ;
// document.frm_goto_chat_system.__gTranscriptEmailFrom.value = document.data_passer.kc_tech_email.value ; }
// else if (routing1 == "TechnicalSupport2" ) {
// document.frm_goto_chat_system.REASON_TAG.value = document.data_passer.kc_tech_queue.value ;
// document.frm_goto_chat_system.__gTranscriptEmailFrom.value = document.data_passer.kc_tech_email.value ; }
// else if (routing1 == "TechnicalSupport3" ) {
// document.frm_goto_chat_system.REASON_TAG.value = document.data_passer.kc_tech_queue.value ;
// document.frm_goto_chat_system.__gTranscriptEmailFrom.value = document.data_passer.kc_tech_email.value ; }
// else if (routing1 == "Sales") {
// document.frm_goto_chat_system.REASON_TAG.value = document.data_passer.kc_sales_queue.value ;
// document.frm_goto_chat_system.__gTranscriptEmailFrom.value = document.data_passer.kc_sales_email.value ; }
// else {
// return_code = false;
// return_alert_text = return_alert_text + "* area of assistance \r\n";
// }
// }
if ( return_code != true ) {
alert(return_alert_text) ;
} else {
setcookie(document.frm_goto_chat_system.ACCOUNTID.value,
document.frm_goto_chat_system.UPHONE.value,
document.frm_goto_chat_system.REASON_TAG.value
) ;
}
// alert(return_code);
if (return_code){
//document.frm_goto_chat_system.CUSTOM.value=document.frm_goto_chat_system.CUSTOM.value + "|OS=" + document.frm_goto_chat_system.OS.value + "|browser=" + document.frm_goto_chat_system.browser.value + "|Mobile=" + document.frm_goto_chat_system.mobile.value;
document.frm_goto_chat_system.market.value=document.data_passer.region_code.value;
//alert(document.frm_goto_chat_system.CUSTOM.value);
}
return return_code ;
}
function changeScreenSize(w,h) {
window.resizeTo( w,h )
}
function setcookie(account_id, phone_num, queue) {
phone = escape(phone_num);
phone_num = phone.lpad("0",10);
account = escape(account_id);
var date = new Date();
date.setTime(date.getTime()+86400);
var expires = "; expires="+date.toGMTString();
document.cookie ="c=" + account + phone_num + expires + "; domain=.surewestchat.com ; path=/";
document.cookie ="q=" + queue + expires + "; domain=.surewestchat.com ; path=/";
}
function return_num_only( temp_var ) {
var temp_var = new String(temp_var);
var temp_var = temp_var.replace(/[^0-9]/g, '');
return ( temp_var ) ;
}
//pads left
String.prototype.lpad = function(padString, length) {
var str = this;
while (str.length < length)
str = padString + str;
return str;
} // function
//pads right
String.prototype.rpad = function(padString, length) {
var str = this;
while (str.length < length)
str = str + padString;
return str;
} // function
function trim(stringToTrim) {
return stringToTrim.replace(/^\s+|\s+$/g,"");
} // function
function get_radio_value() {
//alert ( " length= " + document.frm_goto_chat_system.WG.length ) ;
for (var i=0; i < document.frm_goto_chat_system.WG.length; i++) {
// alert ( i + " | " + document.frm_goto_chat_system.WG.length ) ;
if (document.frm_goto_chat_system.WG[i].checked) {
var rad_val = document.frm_goto_chat_system.WG[i].value;
}
} // for loop
return rad_val ;
} // function
//--------------------------------------------------------------
//
//
//
//--------------------------------------------------------------
function CheckMessages() {
if (typeof document.frm_goto_chat_system.WG[0] == 'undefined' ) {
routing1 = document.frm_goto_chat_system.WG.value
} else {
routing1 = get_radio_value() ;
}
//alert ( "ROUTING1 = " + routing1) ;
var ChatMessage = "";
if (document.data_passer.region_code.value == "SAC") {
if (routing1 == "CustomerService" ) {
if (document.data_passer.sac_care_msg.value != "") {
ChatMessage += document.data_passer.sac_care_msg.value;
}
if (document.data_passer.all_care_msg.value != "") {
ChatMessage += document.data_passer.all_care_msg.value;
}
} else if (routing1 == "TechnicalSupport" ) {
if (document.data_passer.sac_tech_msg.value != "") {
ChatMessage += document.data_passer.sac_tech_msg.value;
}
if (document.data_passer.all_tech_msg.value != "") {
ChatMessage += document.data_passer.all_tech_msg.value;
}
} else if (routing1 == "Sales") {
if (document.data_passer.sac_sales_msg.value != "") {
ChatMessage += document.data_passer.sac_sales_msg.value;
}
if (document.data_passer.all_sales_msg.value != "") {
ChatMessage += document.data_passer.all_sales_msg.value;
}
}
} else {
if (routing1 == "CustomerService" ) {
if (document.data_passer.kc_care_msg.value != "") {
ChatMessage += document.data_passer.kc_care_msg.value;
}
if (document.data_passer.all_care_msg.value != "") {
ChatMessage += document.data_passer.all_care_msg.value;
}
} else if (routing1 == "TechnicalSupport" ) {
if (document.data_passer.kc_tech_msg.value != "") {
ChatMessage += document.data_passer.kc_tech_msg.value;
}
if (document.data_passer.all_tech_msg.value != "") {
ChatMessage += document.data_passer.all_tech_msg.value;
}
} else if (routing1 == "Sales") {
if (document.data_passer.kc_sales_msg.value != "") {
ChatMessage += document.data_passer.kc_sales_msg.value;
}
if (document.data_passer.all_sales_msg.value != "") {
ChatMessage += document.data_passer.all_sales_msg.value;
}
}
}
if (ChatMessage != "") {
alert(ChatMessage);
}
} //end function CHeckMessages()