/*
* It is of critical importance that this file is referenced inside the
tag of every page
* on your site. For example:
*
*
*
*
* !!! WE HIGHLY RECOMMEND YOU LEAVE up_bDoPresence TO true AND TO IMPLEMENT THE CODE IN ALL php
* PAGES IN THIS FOLDER !!!
*
* Set up_bDoPresence to false if you have your own presence detection and will check for pending WM
* windows and call up_launchWM on your own. If so, you will need to call up_launchWM for every
* pending WM window every time the user changes pages. Also, you will need to implement the logic
* in the wmWindowOpened.php page to let you know when requests have been denied and also when windows
* have successfully popped up
*/
var up_bDoPresence = true;
/*
* If you have up_bDoPresence set to true, this is how often (in seconds) we will connect to your
* server via wmLauncher.php or win_ie_pd.php
*/
//yoes jan 27 2010
//this one is for IM windows
var up_iCheckSeconds = 10;
//this one will be for 'update member status'
var up_iCheckSeconds_members = 10;
// PLEASE DO NOT CHANGE ANY CODE BELOW THIS LINE
var userplane_path = 'http://www.thailovelines.com/userplane';
function up_launchWM( userID, destinationUserID, destinationName, destinationImage )
{
up_localUserID = userID;
var popupWindowTest = null;
popupWindowTest = window.open( "http://www.thailovelines.com/chatlines/pre_load.php?from="+ userID +"&strDestinationUserID=" + destinationUserID, "WMWindow_" + up_replaceAlpha(userID) + "_" + up_replaceAlpha(destinationUserID), "width=360,height=397,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=1" );
if( popupWindowTest == null )
{
up_showWMNotify( userID, destinationUserID, destinationName, destinationImage );
}
else
{
up_clearWMNotify( destinationUserID, false );
}
}
function up_launchWM_free( userID, destinationUserID, destinationName, destinationImage )
{
up_localUserID = userID;
var popupWindowTest = null;
popupWindowTest = window.open( "http://www.thailovelines.com/chatlines/pre_load.php?from="+ userID +"&strDestinationUserID=" + destinationUserID, "WMWindow_" + up_replaceAlpha(userID) + "_" + up_replaceAlpha(destinationUserID), "width=360,height=397,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=1" );
if( popupWindowTest == null )
{
up_showWMNotify( userID, destinationUserID, destinationName, destinationImage );
}
else
{
up_clearWMNotify( destinationUserID, false );
}
}
function up_showWMNotify( userID, destinationUserID, destinationName, destinationImage )
{
up_localUserID = userID;
var bAdd = true;
for( var i = 0 ; i < up_launchArray.length ; i++ )
{
if( up_launchArray[i].destID == destinationUserID )
{
if( destinationName != undefined )
{
up_launchArray[i].destName = "" + destinationName + "";
}
bAdd = false;
}
}
destinationName = destinationName == undefined ? "A website member" : "" + destinationName + "";
if( bAdd )
{
var userObj = new Object();
userObj.destID = destinationUserID;
userObj.destName = destinationName;
userObj.destImage = destinationImage;
up_launchArray.push( userObj );
}
up_showNotification();
}
function up_clearWMNotify( clearDestID, bForceClear )
{
var tempArray = up_launchArray;
up_launchArray = new Array();
var bRemoved = false;
while( tempArray.length > 0 )
{
var userObj = tempArray.pop();
if( userObj.destID != clearDestID )
{
up_launchArray.push( userObj );
}
else
{
bRemoved = true;
}
}
if( bRemoved || !bForceClear )
{
if( bForceClear )
{
frames['up_wmReject'].location.href = userplane_path + "/cmd.php?strDestinationUserID=" + clearDestID + "&refresh=" + Math.floor( Math.random() * 100000000000 );
}
frames['up_wmLauncher'].location.href = userplane_path + "/wmWindowOpened.php?destinationUserID=" + clearDestID + "&doPresence=" + ( up_bDoPresence && !up_is_win_ie ? "true" : "false" ) + "&forceClear=" + ( bForceClear ? "true" : "false" ) + "&iRefreshInterval=" + up_iCheckSeconds_members + "&refresh=" + Math.floor( Math.random() * 100000000000 );
}
up_showNotification();
}
function up_showNotification()
{
var elem = document.getElementById( "up_wmNotifications" );
if( up_launchArray.length > 0 )
{
if( up_displayedNotificationID != up_launchArray[0].destID )
{
elem.innerHTML = '' + ( up_is_win_ie ? '' : '
' ) + '' + ( up_is_win_ie ? '' : ' |
' ) + '
';
up_displayedNotificationID = up_launchArray[0].destID;
up_animate( 30 );
}
}
else
{
up_displayedNotificationID = "";
up_animate( -200 );
}
}
function up_animate( iWhereTo )
{
var elem = document.getElementById( "up_wmNotifications" );
if( up_iDivCurrentY != iWhereTo || up_launchArray.length > 0 )
{
if( up_iDivCurrentY != iWhereTo )
{
up_iDivCurrentY += iWhereTo < up_iDivCurrentY ? -10 : 10;
}
var px = up_iDivCurrentY + document.body.scrollTop + 'px';
elem.style.top = px;
clearTimeout( up_animate_timeoutID );
up_animate_timeoutID = setTimeout( "up_animate(" + iWhereTo + ")", 33 );
}
else
{
elem.style.top = iWhereTo;
}
}
function up_replaceAlpha( strIn )
{
var strOut = "";
for( var i = 0 ; i < strIn.length ; i++ )
{
var cChar = strIn.charAt(i);
if( ( cChar >= 'A' && cChar <= 'Z' )
|| ( cChar >= 'a' && cChar <= 'z' )
|| ( cChar >= '0' && cChar <= '9' ) )
{
strOut += cChar;
}
else
{
strOut += "_";
}
}
return strOut;
}
function refreshMembersIE(){
up_wmCheckImage_members = new Image();
up_wmCheckImage_members.onLoad = up_onImageLoad_members();
up_wmCheckImage_members.src = userplane_path + "/wmUpdateMembers_ie.php?refresh=" + Math.floor( Math.random() * 100000000000 );
}
function up_checkWM()
{
if( up_is_win_ie )
{
up_wmCheckImage = new Image();
up_wmCheckImage.onLoad = up_onImageLoad();
up_wmCheckImage.src = userplane_path + "/win_ie_pd_split.php?refresh=" + Math.floor( Math.random() * 100000000000 );
clearTimeout( up_checkWM_timeoutID );
up_checkWM_timeoutID = setTimeout("up_checkWM()", 1000 * up_iCheckSeconds);
clearTimeout( up_checkWM_timeoutID_members );
up_checkWM_timeoutID_members = setTimeout("refreshMembersIE()", 1000 * up_iCheckSeconds_members);
}
else
{
frames['up_wmLauncher'].location.href = userplane_path + "/wmLauncher_split.php?iRefreshInterval=" + up_iCheckSeconds + "&refresh=" + Math.floor( Math.random() * 100000000000 );
frames['up_wmMembers'].location.href = userplane_path + "/wmUpdateMembers.php?iRefreshInterval=" + up_iCheckSeconds_members + "&refresh=" + Math.floor( Math.random() * 100000000000 );
}
}
function up_onImageLoad()
{
if (!up_wmCheckImage.complete)
{
clearTimeout( up_onImageLoad_timeoutID );
up_onImageLoad_timeoutID = setTimeout("up_onImageLoad()", 250);
}
else
{
if( up_wmCheckImage.height == 2 )
{
frames['up_wmLauncher'].location.href = userplane_path + "/wmLauncher_split.php?iRefreshInterval=0&refresh=" + Math.floor( Math.random() * 100000000000 );
frames['up_wmMembers'].location.href = userplane_path + "/wmUpdateMembers.php?iRefreshInterval=0&refresh=" + Math.floor( Math.random() * 100000000000 );
}
else
{
//alert( "Nothing to launch" );
}
clearTimeout( up_checkWM_timeoutID );
up_checkWM_timeoutID = setTimeout("up_checkWM()", 1000 * up_iCheckSeconds);
}
}
////////////////
function up_onImageLoad_members()
{
if (!up_wmCheckImage_members.complete)
{
clearTimeout( up_onImageLoad_timeoutID_members );
up_onImageLoad_timeoutID_members = setTimeout("up_onImageLoad_members()", 250);
}
else
{
clearTimeout( up_checkWM_timeoutID_members );
up_checkWM_timeoutID_members = setTimeout("up_checkWM()", 1000 * up_iCheckSeconds_members);
}
}
document.write( '' );
document.write( '' );
document.write( '' );
document.write( '' );
document.write( '' );
var up_iDivCurrentY = -200;
var up_launchArray = new Array();
var up_localUserID = "";
var up_displayedNotificationID = "";
//added var for ie members update
var up_wmCheckImage = null;
var up_wmCheckImage_members = null;
var up_checkWM_timeoutID = null;
var up_checkWM_timeoutID_members = null;
var up_onImageLoad_timeoutID = null;
var up_onImageLoad_timeoutID_members = null;
var up_animate_timeoutID = null;
var up_animate_timeoutID_members = null;
// determine if is Windows IE (up_is_win_ie)
var up_agt = navigator.userAgent.toLowerCase();
var up_appVer = navigator.appVersion.toLowerCase();
var up_is_mac = up_agt.indexOf('mac') != -1;
var up_is_safari = up_agt.indexOf('safari') != -1 && up_is_mac;
var up_is_khtml = up_is_safari || up_agt.indexOf('konqueror') != -1;
var up_is_ie = up_appVer.indexOf('msie') != -1 && up_agt.indexOf("opera") == -1 && !up_is_khtml;
var up_is_win = up_is_mac ? false : (up_agt.indexOf("win") != -1 || up_agt.indexOf("16bit") != -1);
var up_is_win_ie = up_is_win && up_is_ie;
if( up_bDoPresence )
{
up_checkWM();
}