﻿var lc_root = (location.protocol.indexOf("https")==0?"https://":"http://")
var lc_imgs = lc_root + "www.ticketseating.com/com/img/livechat";
var lc_on = lc_imgs + "/chat-online.jpg";
var lc_off = lc_imgs + "/call-toll-free.gif";
var lc_blank = lc_imgs + "/blank.gif";
var lc_tpage = lc_imgs + "/chat-online.jpg";
var lc_cpage = lc_imgs + "/chat-online.jpg";
var lc_provider = "providesupport"

function lc_icons(lc_btn, lc_on, lc_off) {
    this.lc_btn = lc_btn;
    this.lc_on = lc_on;
    this.lc_off = lc_off;
    this.lc_status = null;
}


var lc_list = new Array();
var lc_img = new Image();
lc_img.onload = lc_imgonload;


function lc_open() {
    var append = '';
    if (pstslcsid != null && pstslcmht != null) {
        append = "?ps_s=" + pstslcsid + "&ps_mht=" + pstslcmht + "";
    }
	var url = 'http://messenger.' + lc_provider + '.com/messenger/ticketseating.html' + append;
	window.open(url, '_blank', 'menubar=0,location=0,scrollbars=auto,resizable=1,status=0,width=500,height=460'); 
}

function lc_imgonload() {
	var w = lc_img.width;
	for (var i=0; i<lc_list.length; i++) {
	    var d = document.getElementById(lc_list[i].lc_btn);
	    var lc_status = lc_list[i].lc_status;
	    if (d != null) {
	        if (w == 2 && (lc_status == null || lc_status == 0)) {
	            d.innerHTML = "<div style=\"display:inline;cursor:pointer;\" onclick=\"lc_open();return false;\"><img src=\"" + lc_list[i].lc_on + "\" alt=\"Live Chat\" /></div>";
	            lc_list[i].lc_status = 1;
	        } else if (w != 2 && (lc_status == null || lc_status == 1)) {
                d.innerHTML = "<div style=\"display:inline;\"><img src=\"" + lc_list[i].lc_off + "\" alt=\"Call\" /></div>";
                lc_list[i].lc_status = 0;
            }
        }
	}
}


function lc_refresh() {
    setTimeout("lc_refresh()", 10000);
	lc_img.src = lc_root + "image." + lc_provider + ".com/online-presence-image/ticketseating?t=" + (new Date()).getTime();
}

function lc_init() {
    if(lc_list.length > 0) {
        lc_refresh();
    }  
}
