function liveInit(){
    //do nothing
    /*
    checkOnline();
    Event.observe("ils_live", "click", function(){
        //open layer to show support ...
        if(!$("live_win")){
            //check status ...
            srcValue = $("status_signal").readAttribute("src");
            if(srcValue == "images/green_light.png"){
                displaySupportLyr();
            }
            else{
                window.location = "http://www.inquirylearning.com/inner.php?sid=5&link_url=contact.php";
            }
        }
    });
    //keep checking every 5 minutes ...
    new PeriodicalExecuter(function(pe){
        checkOnline();
    }, 300);
    */
}

function displaySupportLyr(){
    
    var lwidth = 520;
    var lheight = 400;
    
    //get top Z
    allZ = new Array();
    $$("div").each(function(lyr){
        var thisZ = $(lyr).getStyle("zIndex");
        if(thisZ != null){
            allZ.push(thisZ);
        }
    });
    
   //console.log(allZ.inspect());
    maxZ = allZ.max();

    if(typeof(maxZ) == "undefined"){
        maxZ = 1;
    }
    layerZ = maxZ + 1; //always on top ...
    
    //get scroll offsets
    scrollOffset = $("main").cumulativeScrollOffset();
    
    //create the layer ...
    
    $("main").insert({Bottom: "<div id=\"live_win\"></div>"});
    
    $("live_win").hide();
    
    $("live_win").setStyle({
        position: "absolute",
        top: 20 + parseInt(scrollOffset.top) + "px",
        left: 20 + parseInt(scrollOffset.left) + "px",
        width: lwidth + "px",
        height: lheight + "px",
        border: "4px solid rgb(169, 170, 174)",
        backgroundColor: "rgb(197, 197, 197)",
        zIndex: layerZ
    });
    
    new Effect.Appear("live_win", {duration: 0.8});

    
    loadIframe();
}
function loadIframe(){
    //support iframe
    if($("live_win")){
        //pre code ... title bar ...
        titleBar = "<div id=\"ttl_bar\" style=\"width:100%;height:25px;font-family:Arial,sans-serif;font-size:20px;background-color:rgb(205, 27, 28);color:rgb(197, 197, 197);cursor:move\">Inquiry Learning Customer Support</div>";
        //adding drag capacity using title bar, only after it (ttitle bar has been added)
        new PeriodicalExecuter(function(pe){
                if($("ttl_bar")){
                        dragWin();
                        pe.stop();
                }
        },1);
        //post iframe code ... close button
        clsButton = "<br /><br /><div style=\"width: 50px; height: 20px; text-align: center; color: rgb(123, 111, 123); font-family: Tahoma,Verdana,sans-serif; font-size: 14px; font-weight: bold; cursor: pointer; margin-left: 10px; background-color: rgb(230, 230, 230); border: 1px solid rgb(123, 111, 123);\" id=\"cls_button\">Close</div>";
        
        iframeCode = titleBar + "<iframe border=\"0\" height=\"315\" width=\"518\" src=\"support/index.php\" style=\"border:0;background-color:rgb(255,255,255);overflow:hidden;\"></iframe>" + clsButton;
        $("live_win").insert(iframeCode);

        
        //add functionalities ...
        if($("cls_button")){
            Event.observe("cls_button", "click", function(){
                $("live_win").remove();
            });

            Event.observe("cls_button", "mouseover", function(){
                $("cls_button").setStyle({
                    backgroundColor: "rgb(123, 111, 123)",
                    color: "rgb(197, 197, 197)"
                });
            });
            
            //restore
            
            Event.observe("cls_button", "mouseout", function(){
                $("cls_button").setStyle({
                    backgroundColor: "rgb(197, 197, 197)",
                    color: "rgb(123, 111, 123)"
                });
            });

        }
 
    }
    function dragWin(){
        new Draggable("live_win", { handle: "ttl_bar" });
    }
}
function checkOnline(){
    url = "support/online.check.php";
    new Ajax.Request(url, {
            method: "get",
            onSuccess: function(transport){
                if(transport.responseText == "1"){
                    $("ils_live").update("<img src=\"images/green_light.png\" width=\"5\" height=\"5\" align=\"absmiddle\" id=\"status_signal\" hspace=\"5\">Talk to Us Live!");
                    new Effect.Pulsate("status_signal", { pulses: 500, duration: 750.0});
                }
                else{
                    $("ils_live").update("<img src=\"images/red_light.png\" width=\"5\" height=\"5\"  align=\"absmiddle\" id=\"status_signal\" hspace=\"5\">Talk to Us Now!");
                }
            }
        });
  
}
