﻿var webtag = 'ws-comedy';
var ForumName = 'Comedy &amp; Jokes Community';
var cssurl = 'http://community.compuserve.com/dir-css/667884/.css';

function clearInputField(inputObject) { 
	if(inputObject.value.charAt(0) == '-') 
		{inputObject.value = '';} 
	return false; } 

function LWF(url) { 
	window.open(url,'RatingsWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=500,height=450'); 
return false; } 

function LBB(uName, wtag, uID){  
var ptWin = false; 
if (uID == null || LBB.arguments.length < 3) uID = ''; // username and wtag only passed in 
if (LBB.arguments.length == 1) uID = LBB.arguments[0]; // userid only passed in 
if (uID != '' || LBB.arguments.length == 1) { 
	var ptWin = window.open('/dir-app/bbcard/profile.asp?webtag=' + webtag +'&uID='+uID , 'u'+uID+'Window','scrollbars=yes,width=504,height=460,resizable=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no'); 
} else { 
	var ptWin = window.open('/dir-app/bbcard/profile.asp?webtag=' + webtag +'&uName='+uName , 'ProfileWindow','scrollbars=yes,width=504,height=460,resizable=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no'); 
	} 
if (!ptWin) { alert('Your popup stopper blocked a Member Profile window'); } 
return false;} 

function disableForm(theform) { 
if (document.all || document.getElementById) { 
	for (i = 0; i < theform.length; i++) { 
		var tempobj = theform.elements[i]; 
			if (tempobj.type.toLowerCase() == 'submit' || tempobj.type.toLowerCase() == 'reset') 
				tempobj.disabled = true;}}} 

function LLW() { 
	window.name = 'MsgWin'; 
	var popupList = window.open('/n/mb/list.asp?webtag=' + webtag + '&popup=true&gfc=1','popupList','width=245,height=600,toolbar=no,menubar=no,status=yes,scrollbars=yes,resizable=yes,screenX=10,screenY=10,left=10,top=10'); 
	popupList.focus(); 
	return false;} 

function LOW(folderId,otid) { 
	if (LOW.arguments.length == 0) folderId = '0'; 
	if (LOW.arguments.length < 2) otid = '0'; 
	window.name = 'MsgWin'; 
	var popupOutline = window.open('/n/mb/outline.asp?webtag=' + webtag + '&popup=true&gfc=1&fid=' + folderId + '&tid=' + otid,'popupOutline','width=500,height=600,toolbar=no,menubar=no,status=yes,scrollbars=yes,resizable=yes,screenX=10,screenY=10,left=10,top=10'); 
	popupOutline.focus(); 
	return false; } 

function fixPopup() { 
	var height, width  
	if (document.all) { //ie 
		height = document.body.offsetHeight; 
		width = document.body.offsetWidth; 
	} else { //nn4+  
		height = window.innerHeight; 
		width = window.innerWidth; 
		} 
	if (height > screen.availHeight) {  
		moveTo(10,10); resizeTo(width+10,screen.availHeight-30) 
		}  
}	

function launchIconWindow() { 
	window.open('/n/mydelphi/personalIcon.asp?webtag='+webtag, 'IconWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=550,height=450'); 
	return false; } 

function linkParent(url) { 
	opener.location.href = url; 
	opener.focus(); } 

window.onerror = handleErr; 

function handleErr(){ 
	arAccessErrors = ['permission','access']; 
	mess = arguments[0].toLowerCase(); 
	found = false; 
	for (i=0;i<arAccessErrors.length;i++) { 
		errStr = arAccessErrors[i]; 
		if (mess.indexOf(errStr)!=-1) found = true; 
	} 
	return found; } 

function CheckAll() 
{ 
	for (var i=0;i<document.qs.elements.length;i++) 
	{ 
		var e = document.qs.elements[i]; 
		if ((e.name != 'checkAll') && (e.name != 'confirm') && (e.type=='checkbox')) 
		e.checked = document.qs.checkAll.checked; 
	} 
} 

function CheckCheckAll() { 
	var TotalBoxes = 0; 
	var TotalOn = 0; 
	for (var i=0;i<document.qs.elements.length;i++) { 
		var e = document.qs.elements[i]; 
		if ((e.name != 'checkAll') && (e.type=='checkbox')) { 
			TotalBoxes++; 
		if (e.checked) { 
			TotalOn++; 
			} 
		} 
	} 
	if (TotalBoxes==TotalOn) 
	{document.qs.checkAll.checked=true;} 
	else 
	{document.qs.checkAll.checked=false;} 
} 

function launchChatWindow(url,bV) {
	if ((document.startchat.Name.value == '' ) && (bV==false))
		return false;

	window.open(url,'chatWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=638,height=580');
		return false;

}
function launchChatWindow2(url,bV) {
	if ((bV==false))
		return false;

	window.open(url,'chatWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=638,height=580');
		return false; }

function whereToGo2() {  
	if (document.chatctrl.where2go.options[document.chatctrl.where2go.selectedIndex].value == 'Stage') 
		{ top.location='/n/chat/pchat/e/main.asp?webtag='+webtag; } 
	if (document.chatctrl.where2go.options[document.chatctrl.where2go.selectedIndex].value == 'Speaker') 
		{ parent.location=parent.location.pathname+'?webtag='+webtag+'&nav=chat&spk=y'; } 
	if (document.chatctrl.where2go.options[document.chatctrl.where2go.selectedIndex].value == 'Auditorium') 
		{ parent.location=parent.location.pathname+'?webtag='+webtag+'&nav=chat&spk=n'; } 
	if (document.chatctrl.where2go.options[document.chatctrl.where2go.selectedIndex].value == 'Controls') 
		{ var ccWin = window.open('/'+webtag+'/controls','ccWin');  
		  ccWin.focus(); } 
	return false; 
	} 

function setChatUserCount(uCount) {
var found = false; 
var pf = parent.frames; 
var ppf = parent.parent.frames; 
var df = document.forms; 
if ( pf.length == 0 ) {
	 for ( var g = 0; g < df.length; g++ ) {
		  if ( df[g].name == 'mmForm' ) { 
				for ( var h = 0; h < df[g].elements.length; h++ ) {
				if ( df[g].elements[h].name == 'userCountField' ) { 
					df[g].elements[h].value = uCount;
					return false;
					}
				}
		  }
	 }
} 
else 
{ 
	 for ( var i = 0; i < pf.length; i++ ) {
		  for ( var j = 0; j < pf[i].document.forms.length; j++ ) {
				if ( pf[i].document.forms[j].name == 'mmForm' ) { 
					for ( var k = 0; k < pf[i].document.forms[j].elements.length; k++ ) {
						 if ( pf[i].document.forms[j].elements[k].name == 'userCountField' ) {
							  pf[i].document.forms[j].elements[k].value = uCount; 
							  found = true; 
							  return false;
						 }
					}
				}
		  }
	 } 
	 if (!found) { 
		  for ( var m = 0; m < ppf.length; m++ ) {
				for ( var n = 0; n < ppf[m].document.forms.length; n++ ) {
					if ( ppf[m].document.forms[n].name == 'mmForm' ) { 
						 for ( var p = 0; p < ppf[m].document.forms[n].elements.length; p++ ) {
							  if ( ppf[m].document.forms[n].elements[p].name == 'userCountField' ) {
									ppf[m].document.forms[n].elements[p].value = uCount; 
									found = true; 
									return false;
							  }
						 }
					}
				}
		  }
	 }
}
} 

function setPresence(uname) 
{ 
	var imgName = 'IS_' + uname + '_HERE'; 
	var imgList = document.getElementsByName(imgName); 
	var altText; 
	if (imgList[0] && imgList[0].fileSize) 
	{  
		if (imgList[0].fileSize > 50) 
			altText = uname + ' is online! Click the image to Launch Instant Messenger.'; 
		else 
			altText = uname + ' is not online'; 
		for (ix=0; ix < imgList.length; ix++) 
			imgList[ix].alt = altText; 
	} 
} 

function showPresenceStatus(uname) 
{ 
	var imgName = 'IS_' + uname + '_HERE'; 
	var imgList = document.getElementsByName(imgName); 
	if (imgList[0]) 
	{ 
		window.setTimeout('window.status = "' + imgList[0].alt + '"', 5); 
	} 
} 

function launchIM() 
{ 
	// if JabberWindow is already available, use it 
	var jabberWindow = window.open('','JabberWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=200,height=350'); 
	 
	var windowURL = jabberWindow.location.href 
	if (windowURL.substring(0, 58) != 'http://forums.prospero.com/n/chat/jabber/clientwindow.asp?') 
	{ 
		window.status = 'Launching Instant Messenger' 
		jabberWindow.location = 'http://forums.prospero.com/n/chat/jabber/clientwindow.asp?webtag=ws-comedy'; 
	} 
	jabberWindow.focus(); 
	window.status = 'Instant Messenger Activated.' 
} 
var jabberWindow;
function launchJabberWindow(whosCalling)
{
if (jabberWindow && !jabberWindow.closed) return false;
	var launchIt = confirm(whosCalling + ' wants to talk with you. Do you want to launch Instant Messanger?');
	if (launchIt == true)
	{
		launchIM();
	}
	else
	{
		if (document.Presence) document.Presence.SetDND();
	}
return false;
}
var __gbl_qstr = stripQuery(this.location); 

function queryString(key, src) { 
  var __qstr = stripQuery(src); 
  var strIndex = __qstr.indexOf(key+'='); 
  if(strIndex == -1) return null; 
  var strReturn = '', ch = ''; 
 
  for(var i = strIndex + key.length; i < __qstr.length; i++) { 
	ch = __qstr.charAt(i); 
	if(ch == '&' || ch == ';') break; 
	if(ch == '+') strReturn += ' '; 
	else if(ch != '=') strReturn += ch; 
  } 
  return unescape(strReturn); 
} 

function stripQuery(src) { 
  if(src == null) return __gbl_qstr; 
 
  if(typeof src == 'string') { 
	var __qstr = new String(); 
	var __tmpNum = src.indexOf('?'); 
	 
	__qstr = (__tmpNum != -1) 
			 ? src.substr( 
				 __tmpNum + 1, src.length 
				) 
			 : null; 
	 
	delete __tmpNum; 
	return __qstr; 
  } 
  else if(typeof src == 'object') { // assumes the object is of type location 
	return location.search.substr(1, location.search.length); 
  } 
  else return __gbl_qstr; 
} 

function LLW() { 
	window.name = 'MsgWin'; 
	var popupList = window.open('/n/mb/list.asp?webtag=' + webtag + '&popup=true&gfc=1','popupList','width=245,height=600,toolbar=no,menubar=no,status=yes,scrollbars=yes,resizable=yes,screenX=10,screenY=10,left=10,top=10'); 
	popupList.focus(); 
	return false;} 

function print_page(){ 
	if ( navigator.userAgent.toLowerCase().indexOf("mac") != -1 && 
	!window.netscape){ 
	alert("Press Command + P to Print"); 
	}else{ window.print(); 
	} 
} 

function bookmark_page(msg){ 
	if ( navigator.userAgent.toLowerCase().indexOf("mac") != -1 || 
	window.netscape){ 
	alert("Bookmark feature is not supported for this browser. \nUse your browser's Favorites or Bookmarks menu to save this page."); 
	}else{ window.external.AddFavorite('http://://community.compuserve.com/' + webtag + '/messages?msg=' + msg,ForumName + ' #' + msg); 
	} 
} 

/* ---------------------- */

