/*
Skype Reception, Copyright 2006 John King All rights reserved. 

Permission is given for the modification but not the resale of this script. You also may not modify 
the script then resell it. If you wish to allow the download of this script through your site you 
must include a link to http://www.seoandstuff.com/skypereception.php and the must be in plain view. 
This statement must stay intact if you distribute it in way (you do not however need to include this 
on pages which use Skype Reception. I am not responsible for the impact of Skype Reception on your 
site any problems which result from installation are not my responsibility. If you need please 
contact me through http://www.seoandstuff.com for further details involving your use of Skype Reception. 
*/
function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}

var http = createRequestObject();

function sndReq(action) {
	loading(action);
    http.open('get', '../skype/rpc.php?action='+action);
    http.onreadystatechange = handleResponse;
    http.send(null);
}

function loading(action){
	something = action.split('-');
	document.getElementById(something[0]).innerHTML="<img src=\"../images/loading.gif\">";
}
function handleResponse() {
    if(http.readyState == 4){
        var response = http.responseText;
        var update = new Array();

        if(response.indexOf('|' != -1)) {
            update = response.split('|');
            document.getElementById(update[0]).innerHTML = update[1];
			document.location= update[2]
        }
    } //
}
var timerID = null
//var timerID = null
var timerRunning = false
function stopclock(){
   if(timerRunning)
      clearTimeout(timerID)
   timerRunning = false
}
function startclock(){
   // Make sure the clock is stopped
   stopclock()
   showtime()
}

function showtime(){
   sndReq('show')
   timerID = setTimeout("showtime()",5500)
   timerRunning = true
}