/*Javascript*/
function goBack(url){
	window.location.href=url;
}	

function popupChat(buddy) {
	var url = SameTimeHostName +"/eog/nl/stsignature.nsf/STWidget_Emb?OpenPage&logintype=anonymous&onlinecheck=yes&mybuddies="+buddy+"&initialbuddy="+buddy
	var win = window.open(url,'newwindow','scrollbars=1,width=620,height=600,toolbar=no,location=no,directories=no,menubar=no,resizable=no')
	if (win.focus) { 
		win.focus() 
	}
}

/*TWITTER Scripts*/
function relative_time(time_value) {
  var values = time_value.split(" ");
  time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3];
  var parsed_date = Date.parse(time_value);
  var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
  var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
  delta = delta + (relative_to.getTimezoneOffset() * 60);

  if (delta < 60) {
    return 'less than a minute ago';
  } else if(delta < 120) {
    return 'about a minute ago';
  } else if(delta < (60*60)) {
    return (parseInt(delta / 60)).toString() + ' minutes ago';
  } else if(delta < (120*60)) {
    return 'about an hour ago';
  } else if(delta < (24*60*60)) {
    return 'about ' + (parseInt(delta / 3600)).toString() + ' hours ago';
  } else if(delta < (48*60*60)) {
    return '1 day ago';
  } else {
    return (parseInt(delta / 86400)).toString() + ' days ago';
  }
}	

var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0; 
function collapseBlock(katman){
 	if ( document.getElementById(katman) != null ) {
    		document.getElementById(katman).style.display='none'
    }
}

function restoreBlockRow(katman){
	if (isIE ){
		document.getElementById( katman ).style.display = 'inline'
	}else{
		document.getElementById( katman ).style.display = 'table-row'
	}
}

function restoreBlock(katman){
	document.getElementById(katman).style.display='block'
}
//ContentCommonFieldsContainer
function openFieldBlock(oLink){
	oImg = document.getElementById('img'+oLink.id)
	oImg.src = '/'+dbPath+'/minusButton.gif'
	oLink.onclick = function() { closeFieldBlock(this); };
	oLink.title = 'close panel';
	restoreBlock('ContentCommonFieldsContainer')
}

function closeFieldBlock(oLink){
	oImg = document.getElementById('img'+oLink.id)
	oImg.src = '/'+dbPath+'/plusButton.gif'
	oLink.onclick = function() { openFieldBlock(this); };
	oLink.title = 'open panel';
	collapseBlock('ContentCommonFieldsContainer')
}

/*WebChat - OCS code*/
$(function() {

            // Specify license Id
            var licenseId = '7E7204A5-34A3-483F-9D59-0E49D54A0408';
            // Number of milliseconds before a presence check is performed
            var presenceTimeout = 5000;

            // Find all the places where a webchat should be enabled
            $("div.chat").each(function() {
                $(this).webchat(licenseId,
                {
                    identifier: $(this).attr("identifier"),
                    displayName: 'Ik',
                    emptyInputText: 'stel uw vraag hier',
                    offlineText: 'er is momenteel niemand die u kan helpen.',
                    nameTimeSeperator: ' &gt; ',
                    showAvailableText: true,
                    availableText: 'bereikbaar per chat',
                    unavailableText: 'niet bereikbaar per chat',
                    collapsed: true,
                    showEmail: false
                });
            });

        });
