﻿var webtag = 'agriculturez';
var ForumName = 'Agriculture';
var cssurl = 'http://acx.prospero.com/dir-css/680343/.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=agriculturez'; 
	} 
	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://://dgroups.agriculture.com/' + webtag + '/messages?msg=' + msg,ForumName + ' #' + msg); 
	} 
} 

/* ---------------------- */

ord_now = new Date();
ord_seed = ord_now.getTime();
var ord = ord_rand(9999999999);
function ord_rand(range) {
  ord_seed = ((ord_seed % 4652353) * 492113) + 1;
  return(ord_seed % range);
}

/* support for omniture code BEGIN */
function AreStringsEqual(string1, string2)
{
    if (string1 == null || string1 == '') string1 = ' ';
    if (string2 == null || string2 == '') string2 = ' ';
    var len = string1.length;
    if (len != string2.length) return false; 
    for (var k=0; k<len; k++)
        if (string1.charAt(k).toLowerCase() != string2.charAt(k).toLowerCase()) return false;
    return true;
}

var pNStr = 'index=Talk;messages=View Forum;msgPopup=View Thread:Popup;post=Post Message;TosReport=Report Problem Posts;edit=Edit Post;delete=Delete Message;email=Email Message;display=Email Message;subscribe=Subscribe To Discussion;bbcard=Profile';
var pNArray = pNStr.split(';');var pNInnerStr;var pNInnerArray;var pNInnerTitle = '';var pNInnerItem = 'View Forum';
var pNNav = (queryString('nav',document.location.href.toLowerCase()) == null) ? '' : queryString('nav',document.location.href.toLowerCase())
var pNMsgNav = (queryString('msg',document.location.href.toLowerCase()) == null) ? '' : queryString('msg',document.location.href.toLowerCase())
var pNHrefArray = document.location.href.split('/'); var pnHrefItem = '';

for (var i=0; i < pNArray.length; i++) 
{ 
  pNInnerArray = pNArray[i].split('=');
  if (AreStringsEqual(pNNav, pNInnerArray[0])) 
  {
    pNInnerTitle = pNInnerArray[0]
    pNInnerItem = pNInnerArray[1]

    if (AreStringsEqual('messages', pNInnerTitle)) 
    { 
      if ((queryString('tid',document.location.href.toLowerCase()) != null && queryString('tid',document.location.href.toLowerCase()) != '') || pNMsgNav != '') 
      {
        if (pNMsgNav != '.') 
        {
          pNInnerItem = 'View Thread';
          break;
        }
        break;
      }
      break;
    }

  }
  
  // still in loop - didn't find nav= match on querystring, move on to bbcard possibilities
  if (AreStringsEqual('bbcard',pNInnerArray[0])) {
    for (var ii=0; ii < pNHrefArray.length; ii++) {
      pNHrefItem = pNHrefArray[ii]
      if (pNHrefItem.length > 13) { 
              if (pNHrefItem.toLowerCase().substring(0,9) == 'bbaccount') {
                          pNInnerItem = 'MyPrefSettings';
                          break;
               }
      }
      if (AreStringsEqual(((pNHrefItem == null || pNHrefItem == '') ? '' : pNHrefItem), pNInnerArray[0])) {
        pNInnerTitle = pNInnerArray[0]
        pNInnerItem = pNInnerArray[1]
        if (!(queryString('dmode',document.location.href.toLowerCase()) == null || queryString('dmode',document.location.href.toLowerCase()) == 0)) {
          pNInnerItem = 'Profile Settings';
          //break;
        }
       // break;
      }
    }
  }
}

if (pNInnerTitle == 'index') 
{ 
  var s_pageNameInit = ForumName + ':' + ForumName + ' ' + pNInnerItem;
} else {
  var s_pageNameInit = 'Discussion Groups:' + pNInnerItem;
}
var s_pageName = s_pageNameInit;

 
// debug only
/*
if (queryString('dbg',document.location) != null) {
    alert('s_pageName = ' + s_pageName);
}
*/



/* You may give each page an identifying name, server, and channel on
the next lines. */
var s_pageNav = (queryString('nav',document.location) == null) ? '' : queryString('nav',document.location);
var s_pageName = s_pageNameInit;
var s_server = document.location.host
var s_channel="Discussion Groups"
var s_pageType=""
var s_prop1="Discussion Groups:" + ForumName
var s_prop2=""
var s_prop3=""
var s_prop4=""
var s_prop5=s_channel;
var s_prop6=""
var s_prop7=""
var s_prop8=""
/* E-commerce Variables */
var s_campaign=""
var s_state=""
var s_zip=""
var s_events=""
var s_products=""
var s_purchaseID=""
var s_eVar1=""
var s_eVar2=""
var s_eVar3=""
var s_eVar4=""
var s_eVar5=""
var s_eVar6=""
var s_eVar7=""
var s_eVar8=""

/* support for omniture code END */
var jump; var src;
jump = ''; src = '';
if ((!document.images && navigator.userAgent.indexOf('Mozilla/2.') >= 0) || navigator.userAgent.indexOf("WebTV") >= 0) {
jump='<a href="http://ad.doubleclick.net/jump/bhgapp.mdp.com/dgroups;channel=DGroups;parent=366;gender=0;age=0000;income=00;genderage=0_0000;ageincome=0000_00;genderincome=0_00;user=0_0000_00;ptile=1;sz=728x90;ord=1090006533409? target="_top">';
src='<img src=http://ad.doubleclick.net/ad/bhgapp.mdp.com/dgroups;channel=DGroups;parent=366;gender=0;age=0000;income=00;genderage=0_0000;ageincome=0000_00;genderincome=0_00;user=0_0000_00;ptile=1;sz=728x90;ord=1090006533409?></a>';
}
function csPostShowHideDiv(id)
{
  var myDiv = document.getElementById(id);
  myDiv.style.display = (myDiv.style.display != "block") ? "block" : "none";
}

function checkChar(inptext, wtVal)
{
  var Cr = String.fromCharCode(13); // Gets ASCII 13
  var Lf = String.fromCharCode(10); // Gets ASCII 10
  var strSearchPrefix =  "forum.aspx?webtag=" + wtVal + "&nav=search&q=";
  var textbox = inptext //puts textbox into local var
  var s = new String(); // declares new string var
  s=  inptext.value; // Gets value of textbox1

  if (s.indexOf(Cr)>=0 || s.indexOf(Lf)>=0) // if either character is present in submitted string
  {
    s =  strSearchPrefix + s;
    textbox.value = ""; // Clear the original box
    location.href =  s
  }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


