function window_close_now() { window.setTimeout("window.close()", 1); top.window.close(); window.close(); } 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 = "MN" ; 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.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' ) { // alert ( " using radio button of single one for routing"); routing1 = document.frm_goto_chat_system.WG.value} 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 ( 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()