/* 2008-06-12 lmcnutt - Depreciated, this code has been copied to true_lib.js 
              Depreciated, but still used by some aspx popup pages that donot use tbhead.inc */


////////////////////////////////////////////////////////////////////////////////
//  Chat 2.0 Functions
//
//  These are the currently-used chat functions. The functiones below this 
// block are depricated, but left in place in case they are still used in 
// other places.
//

function popVideoChat(room_id, room_name,chat_size, version){
		//if(room_id == "room_02") version = '2';
    var windowName = 'ChatRoom';
    var pad = 20;
    var width, Height;
    if(chat_size=="large"){
        width = 1004;
        Height = 633;
    }else{
        width = 780;
        Height = 580;
    }
    var windowUrl = RootPath + '/chat/popVideoChat'+ (version=='2'?'2':'') +'.aspx?room_id=' + room_id + '&room_name=' + room_name +'&chatsize='+ chat_size +'&width='+ (width-pad*2) +'&height='+ (Height-pad*2);
    var windowOptions = 'width='+ width +',height='+ Height +',menubar=0,scrollbars=0,status=1,toolbar=0,resizable=0';
    window.open(windowUrl,windowName,windowOptions);
}

function popPrivateChat(from, to){
    var windowName = 'private_'+ from +'_'+ to;
    var windowUrl = RootPath + '/chat/popChatPrivate.aspx?from_id='+ from +'&to_id='+ to;
    window.open(windowUrl, windowName, 'width=440,height=440,menubar=0,scrollbars=0,status=0,toolbar=0,resizable=0');
}
//
//  End Chat 2.0 Functions
////////////////////////////////////////////////////////////////////////////////






//  02/05/2004 SKM : Chat helper functions 
//      03/16/2004 SKM : Modified conditionalOpen to focus if window already open   
//  03/24/2004 SKM : Added function captureChatRoomExit

  var win = null;

  function captureChatRoomExit(user_id,room_id,roomTypeID) {
   // alert('captureChatRoomExit(' + user_id + ',' + room_id + ',' + roomTypeID + ')');
   var windowUrl = RootPath + '/chat/chatdata.aspx?action=chatexit&user_id=' + user_id +'&room_id=' + room_id + '&roomTypeID=' + roomTypeID;
   var windowName = 'ChatData';
   var windowOptions = 'width=1,height=1,menubar=0,scrollbars=0,status=0,toolbar=0,resizable=0';
   var MyWin = window.open(windowUrl,windowName,windowOptions);
  }
    
  function conditionalOpen(windowUrl,windowName,windowOptions) {
   // alert('actualVersion=' + actualVersion + '\n' + 'requiredVersion=' + requiredVersion + '\n' + 'Acceptable Version =' + (actualVersion >= requiredVersion));
   if(actualVersion >= requiredVersion){
     if(!(win && win.open && !win.closed)){
       win = window.open(windowUrl,windowName,windowOptions); 
       win.focus();
     }else{
       win.focus();
     }
   }else{
     popFlashNotice(); 
   }
  }


  function popChatHelp() {
   var windowUrl = RootPath + '/popMoreText.aspx?id=63'; 
   var windowName = 'ChatHelp';
   var windowOptions = 'width=500,height=350,menubar=0,scrollbars=0,status=0,toolbar=0,resizable=0';
   var myWin = window.open(windowUrl, windowName, windowOptions);        
   myWin.focus();
  }

  function popAbuseReport() {
   var windowUrl = RootPath + '/service.htm?id=748';
   opener.location.href=windowUrl;
      opener.focus();
  }

  function popFlashNotice() {
   var windowUrl = '';
   var windowName = 'FlashUpgrade';
   var windowOptions = 'width=500,height=350,menubar=0,scrollbars=0,status=0,toolbar=0,resizable=0';
   if (actualVersion == 0)
    windowUrl = RootPath + '/popMore.aspx?id=156'; 
   else
    windowUrl = RootPath + '/popMore.aspx?id=157'; 
   var myWin = window.open(windowUrl, windowName, windowOptions);        
   myWin.focus();
  }
   
  function popVideoChatSetLobbyMemberHome(room_id, room_name, chat_size, room_count)
  {
        location.href = RootPath + '/Chat/VideoChatLobby.htm?svw=lnavbar&linkid=18545';
        popVideoChat(room_id, room_name, chat_size);
  }
  
  function popVideoChatSetLobby(room_id, room_name,chat_size){
    location.href = RootPath + '/Chat/VideoChatLobby.htm?svw=lnavbar&linkid=21';
    popVideoChat(room_id, room_name, chat_size);
  }
  
  function popUserProfile(user_id){
  var windowName = 'profile';
  var windowUrl = RootPath + '/chat/popProfileView.aspx?uid=' + user_id + '&chat=true';
  var myWin = window.open(windowUrl, windowName, 'width=710,height=680,menubar=1,scrollbars=1,status=0,toolbar=1,location=1,resizable=1');
  myWin.focus();
  }

  function alertClient (fromID, fromName, to, msg, room_id){
  var windowName = 'private_chat';
          var windowUrl = RootPath + '/chat/popChatInviteRecv.aspx?fromid=' + fromID + '&fromname=' + fromName + '&msg=' + msg.substr(0,500) + '&room_id=' + room_id;
          var windowOptions = 'width=200,height=220,menubar=0,addressbar=0,scrollbars=0,status=0,toolbar=0,resizable=0';
          
          //conditionalOpen(windowUrl,windowName,windowOptions);
          var myWin = window.open(windowUrl,windowName,windowOptions);
          myWin.focus();
  }

function popPrivateInvite(user_id){
  var windowName = 'ChatInvite';
  var windowUrl = RootPath + '/chat/popChatInviteSend.aspx?userID=' + user_id;
  var windowOptions = 'width=200,height=220,menubar=0,scrollbars=0,status=1,toolbar=0,resizable=0';
  conditionalOpen(windowUrl,windowName,windowOptions);
 }
 
//  2/5/2004 SKM : Flash version detection 
 var requiredVersion = 7;  // set version required
 var actualVersion = 0;          // version the user really has
 var maxVersion = 7;             // highest version we can actually detect
 var flash2Installed = false;    // boolean. true if flash 2 is installed
 var flash3Installed = false;    // boolean. true if flash 3 is installed
 var flash4Installed = false;    // boolean. true if flash 4 is installed
 var flash5Installed = false;    // boolean. true if flash 5 is installed
 var flash6Installed = false;    // boolean. true if flash 6 is installed
 var flash7Installed = false; // boolean. true if flash 7 is installed

	// Check the browser...we're looking for ie/win
	var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if we're on ie
	var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // true if we're on windows

	// Write vbscript detection on ie win
	
	if(isIE && isWin){
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
		document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
		document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
		document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
		document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
		document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
		document.write('</SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
	}

	// detect using the navigator.plugins array
	function detectFlash() {  
		if (navigator.plugins) {
			// ...then check for flash 2 or flash 3+.
			if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
				// Some version of Flash was found. Time to figure out which.
	      
				// Set convenient references to flash 2 and the plugin description.
				var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
				var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;

				// DEBUGGING: uncomment next line to see the actual description.
				// alert("Flash plugin description: " + flashDescription);
				var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
			     
				// found version, set flags, use >= on the highest version
				flash2Installed = flashVersion == 2;    
				flash3Installed = flashVersion == 3;
				flash4Installed = flashVersion == 4;
				flash5Installed = flashVersion == 5;
				flash6Installed = flashVersion == 6;
				flash7Installed = flashVersion >= 7;
			}
		}

		// loop through versions and set actualVersion to highest detected
		for (var i = 2; i <= maxVersion; i++) {	
			if (eval("flash" + i + "Installed") == true) actualVersion = i;
		}
		
		// webtv support (2 pre-summer2000, or 3 post-summer2000)
		if (navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 2;	
	}

	detectFlash();	// call our detector now that it's safely loaded.	
