

	function updateNumberOfItems(numberItems){
		try{
			for (var y = 0; y < 10; y++){
				if(document.getElementById('numCarts' + y)){
					if(numberItems > 0)
						document.getElementById('numCarts' + y).innerHTML = numberItems + ' items';
					else
						document.getElementById('numCarts' + y).innerHTML = ' empty';
				}
			}			
		}catch(e){}
	}
	function searchResponseHandler(respJSON){
		document.getElementById('loadSpinner').style.visibility = 'hidden';
		if(respJSON == "")
			return;
			
		try
		{
			lastGlobalResponse = eval( '(' + respJSON + ')');
		}catch(e){
			alert('error evaluating JSON response\n' + e.message + '\n This is an error in line 25 genlib.\n' + respJSON);
		}
		try{
			document.getElementById('dCLEsearchResults').innerHTML = lastGlobalResponse.HTML;
			if(! isNaN(lastGlobalResponse.CLES.RECORDCOUNT) ){
				document.getElementById('searchRows').innerHTML = lastGlobalResponse.CLES.RECORDCOUNT + "&nbsp;results.";
			}
			
		}catch(e){
			alert('Error acting on JSON struct\n' + e.message + '\n This is an error in line 38 genlib.\n');
		}		
	}

	function addLoadEvent(_function) {
		var _onload = window.onload;
		if ( typeof window.onload != 'function' ) {
			if ( window.onload ) {
				window.onload = _function;
			} else {
				var _addEventListener = window.addEventListener || document.addEventListener;
				var _attachEvent = window.attachEvent || document.attachEvent;
				if ( _addEventListener ) {
					_addEventListener('load', _function, true);
					return true;
				} else if ( _attachEvent ) {
					var _result = _attachEvent('onload', _function);
					return _result;
				} else {
					//todo: preloading fix for ie5.2 on mac os
					return false;
				}
			}
		} else{
			window.onload = function() {
				_onload();
				_function();
			}
		}
	}
	
	function showDiscountInfoWindow(){
		var discountContent = "<div style='width: 400px'><h4>Why aren't my items discounted?</h4>";
		discountContent += "<blockquote>Items in your shopping are not discounted because even though you are a  member, there are only registrations in your shopping cart for non members.";
		discountContent += "<p><strong>What Can I do?</strong>Complete one transaction with the registrations in your shopping cart and then another with the items.</p></blockquote></div>";
		displayDialogue(discountContent, 'NOMEMBERDISCOUNTWINDOW', 400, 600);
	}
	
	
function dateResponseHandler(respJSON){
	document.getElementById('loadSpinner2').style.visibility = 'hidden';
	setTimeout("document.getElementById('dCLEdateResults').style.width = '612px';" ,100);
	setTimeout("document.getElementById('dCLEdateResults').style.border = '1px solid black';" ,105);	
	if(respJSON == "")
		return;
		
	try{
		lastGlobalResponse = eval( '(' + respJSON + ')');
	}catch(e){
		//alert('error evaluating JSON response\n' + e.message + '\n This is an error in line 87 genlib.\n' + respJSON);
	}
	try{
		document.getElementById('dCLEdateResults').innerHTML = lastGlobalResponse.HTML;
		if(! isNaN(lastGlobalResponse.CLES.RECORDCOUNT) ){
			document.getElementById('searchRows').innerHTML = lastGlobalResponse.CLES.RECORDCOUNT + "&nbsp;results.";
		}
	}catch(e){
		//alert('Error acting on JSON struct\n' + e.message + '\n This is an error in line 95 genlib.\n');
	}		
}

var searchtimer = "";
function toggleAppropriate(formCtrl){
	formCtrl.value = formCtrl.checked;
	if(formCtrl.name == 'searchEvents' && formCtrl.checked)
		document.getElementById('extraSearchBox').style.display = "block";
	else if ( formCtrl.name == 'searchEvents' && ! formCtrl.checked)
		document.getElementById('extraSearchBox').style.display = "none";	
			
	if(document.getElementById('searchRows').innerHTML.length > 3){//we have results to refine
		clearTimeout(searchtimer);
		//searchtimer = setTimeout("submitSearch(document.getElementById('keywordSearchBox').value)", 1500);
	}
}

function submitSearch(searchArgsIn){
	
		var searchBooks = document.getElementById('searchBooks').checked;		
	
		var searchCLEOnline = document.getElementById('searchCLEOnline').checked;		
	
		var searchEChapters = document.getElementById('searchEChapters').checked;		
	
		var searchHomestudies = document.getElementById('searchHomestudies').checked;		
	
		var searchEvents = document.getElementById('searchEvents').checked;		
	
		var eventStartsAfter = document.getElementById('eventStartsAfter').value;		
	
		var eventStartsBefore = document.getElementById('eventStartsBefore').value;		
	
		var locatedIn = document.getElementById('locatedIn').value;		
			
	$.post("/global/scripts/searchCLE.cfm", {searchArgs : searchArgsIn,searchBooks:searchBooks,searchCLEOnline:searchCLEOnline,searchEChapters:searchEChapters,searchHomestudies:searchHomestudies,searchEvents:searchEvents,eventStartsAfter:eventStartsAfter,eventStartsBefore:eventStartsBefore,locatedIn:locatedIn} ,searchResponseHandler);
	document.getElementById('loadSpinner').style.visibility = 'visible';	
}

function submiteDateFilter(){
	
		var CLEYear = document.getElementById('CLEYear').value;		
	
		var CLEMonth = document.getElementById('CLEMonth').value;		
	
	$.post("/global/scripts/searchCLE.cfm", {mode: 'refineCLECalendar',CLEYear:CLEYear,CLEMonth:CLEMonth} ,dateResponseHandler);
	document.getElementById('loadSpinner2').style.visibility = 'visible';	
}

function loadMyFuncModule(code) {
  var dj_global = this; // global scope reference
  if (window.execScript) {
    window.execScript(code); // eval in global scope for IE
    return null; // execScript doesn’t return anything
  }
  return dj_global.eval ? dj_global.eval(code) : eval(code);
}

function selectPracticeArea(pArea){

}

function selectFormat(sFormat){
	
	if(sFormat == 'SEMINAR' || sFormat == 'VIDEO' || sFormat == 'Webcast' || sFormat == 'TELESEMINAR'){
		document.getElementById('dateSelection').style.display = 'block';
		if(sFormat == 'Webcast'){
			document.getElementById('locationSelection').style.display = 'none';
			document.getElementById('locatedIn').value = '';
		}
	}
	
	if(sFormat == 'SEMINAR' || sFormat == 'VIDEO')
		document.getElementById('locationSelection').style.display = 'block';
		
	//hide the expanded controls, and set their values to null
	if (sFormat != 'SEMINAR' && sFormat != 'VIDEO' && ( sFormat != 'Webcast' && sFormat != 'TELESEMINAR')){
		document.getElementById('dateSelection').style.display = 'none';
		document.getElementById('locationSelection').style.display = 'none';
		document.getElementById('locatedIn').value = '';
		document.getElementById('eventStartsAfter').value = '';
		document.getElementById('eventStartsBefore').value = '';				
	}		
	
}

function validateKeywordSearch(formObj){
	return true;
}

firstRun =true;
lastItem = "";
function activateTab(ele){
	
	if (lastItem == ele)
		return;
	
	var TT = document.getElementById('tab' + ele);
    var oChild = TT;
	var m = 0;
	var classes = new Array();
	classes['leftTabOff'] = 'leftTabOn';
	classes['middleTabOff'] = 'middleTabOn';
	classes['rightTabOff'] = 'rightTabOn';		
    while(oChild) {
       	oChild.className = classes[oChild.className];
		oChild = oChild.nextSibling;
 	}

	var TT = document.getElementById('tab' + lastItem);
    var oChild = TT;
	var m = 0;
	var classes = new Array();
	classes['leftTabOn'] = 'leftTabOff';
	classes['middleTabOn'] = 'middleTabOff';
	classes['rightTabOn'] = 'rightTabOff';		
    while(oChild) {
       	oChild.className = classes[oChild.className];
		oChild = oChild.nextSibling;
 	}

//	document.getElementById('indicator').src = "images/"+ele+".png";
	lastItem = ele;
	fetchForm(ele, "")
	return false;
}



//this function gets called from either an hiden iframe loading or a XHR callback
function getterCallBack(respJSON){
	if(respJSON.trim() == "")
		return;
		
	try{
		lastGlobalResponse = eval( '(' + respJSON + ')');
	}catch(e){
		logError('error evaluating JSON response\n' + e.message + '\n This is an error in line 224 genlib.\n' + respJSON);
		return false;
	}
	try{	
		var m = 0;	
		if(lastGlobalResponse.JAVASCRIPT != "")
			loadMyFuncModule(lastGlobalResponse.JAVASCRIPT);
		m = 1;
		try{
			if(lastGlobalResponse.CONTENTREQUEST){
				if(lastGlobalResponse.DIALOGUE){
					var DD = displayDialogue(lastGlobalResponse.CONTENT, lastGlobalResponse.FORMNAME, 400, 600);
					try{
					 window.scroll(0,-2000);
					 window.scroll(0,-2000);
					 window.scroll(0,-2000);					 					 
					}catch(e){
						
					}
				}else{
					if (lastGlobalResponse.TARGETDIV != ""){
						if(document.getElementById(lastGlobalResponse.TARGETDIV))	 				
							document.getElementById(lastGlobalResponse.TARGETDIV).innerHTML = lastGlobalResponse.CONTENT;						
					}else{
						for(i in windowStack)
							close(windowStack[i]);
						if(document.getElementById('ContentArea'))	 				
							document.getElementById('ContentArea').innerHTML = lastGlobalResponse.CONTENT;
						else if (document.getElementById('bodyBox'))
							document.getElementById('bodyBox').innerHTML = lastGlobalResponse.CONTENT;
					}
				}
			}else if(lastGlobalResponse.ACTIONMESSAGE != ""){
//				document.getElementById('ContentArea').innerHTML = lastGlobalResponse.ACTIONMESSAGE + document.getElementById('ContentArea').innerHTML;
				alert(lastGlobalResponse.ACTIONMESSAGE);
			}
		}catch(e){
			alert(e.message);
		}
		try{
			for (form in lastGlobalResponse.FORMS){
				document.getElementById(form).innerHTML = lastGlobalResponse.FORMS[form];
				if(lastGlobalResponse.DIALOGUE)
					squareAndCenter(document.getElementById(lastGlobalResponse.FORMNAME));
				//document.getElementById(form).onsubmit = function(){submitform(this)};
			}
		}catch(e){}
		if(lastGlobalResponse.ERROR && lastGlobalResponse.ERROR != "")
			logError(lastGlobalResponse.ERROR);
		
		m=2;
		try{
			if(lastGlobalResponse.FIELDTOFOCUSON && document.getElementById(lastGlobalResponse.FIELDTOFOCUSON))
				document.getElementById(lastGlobalResponse.FIELDTOFOCUSON).focus();
		}catch(e){}
		m=3;
		try{
			if(lastGlobalResponse.POSTJAVASCRIPT && lastGlobalResponse.POSTJAVASCRIPT != '')
				loadMyFuncModule(lastGlobalResponse.POSTJAVASCRIPT);
		}catch(e){}
		m=4;		
		
	}catch(e){
		alert('error handling response: ' + m +  "\n" + e.message);
	}

					
	

}

function iframeFinished(){
	if (!document.all){
		var resp = getFramecontent('formFrame');
	}else
		var resp = getFramecontent('formFrame');

	getterCallBack(resp);
}

function getFramecontent(frameid){
			return $('#' + frameid).contents().text(); 

		}

	
function fetchForm(pageName, mode, argsIn){
	var args = argsIn || "";
	if(args != "")
		args = "&" + args;
		
	var getter = new myXMLObj("ignore", "callTaker.cfm", "mode=" + mode + "&pageName=" + pageName + args);
	getter.callback = getterCallBack;
	getter.send();
}

function loadMyFuncModule(code) {
  var dj_global = this; // global scope reference
  if (window.execScript) {
	
    window.execScript(code); // eval in global scope for IE
    return null; // execScript doesn’t return anything
  }
  return dj_global.eval ? dj_global.eval(code) : eval(code);
}

var windowStack = new Array();

function displayDialogue(content, divName, height, width, bgcolor){
	grayOut(true);	
	if(document.all && parseInt(navigator.appVersion) < 7){
		var elements = document.documentElement.getElementsByTagName('select');
		for (var i=0; i<elements.length; i++)
           	elements[i].style.visibility = "hidden";
    }
	
	try{
		if(document.getElementById(divName)){
			document.body.removeChild(document.getElementById(divName));
			windowCount--;
		}
	}catch(e){}
	
	var modalDialogue = document.createElement("div");
	modalDialogue.id = divName;
	modalDialogue.width = width;
	modalDialogue.height = height;
    
		modalDialogue.innerHTML = '<table cellpadding=0 cellspacing=0 class="modalDialogue"><tr><td class="FGUpperLeft"> </td> <td class="FGUpperMiddle"><a href="javascript: close(\'' + divName + '\');" title="close this window dialogue"><img border=0 src="/image/blackCloseButton.jpg" height=17 style="position:relative; top:2px"></a> </td> <td class="FGUpperRight">  </td></tr>			<tr><td class="FGMiddleLeft"> </td> <td class="FGContentArea">  '+content+'</td> <td class="FGMiddleRight">  </td></tr>			<tr><td class="FGLowerLeft"> </td> <td class="FGLowerMiddle">  </td> <td class="FGLowerRight">  </td></tr>		</table>';
   	
	
	var myWidth = "";
	var myHeight = "";
	if( typeof( window.innerWidth ) == 'number' ) {
    	myWidth = window.innerWidth;
	    myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    myWidth = document.documentElement.clientWidth;
    	myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    myWidth = document.body.clientWidth;
    	myHeight = document.body.clientHeight;
	}
	var yOffset = (myHeight - height) / 2;
	var xOffset = (myWidth - width) / 2;	
	modalDialogue.style.position = "absolute";
	if(xOffset < 0)
		modalDialogue.style.left 	= '0px';	
	else
		modalDialogue.style.left 	= xOffset + 'px';
	if(yOffset < 0)
		modalDialogue.style.top 	= '0px';
	else
		modalDialogue.style.top 	= yOffset + 'px';

	modalDialogue.style.zIndex 	= 26;
	document.body.appendChild(modalDialogue);
	windowStack[windowStack.length] = divName;
	windowCount++;
	//alert();
	return modalDialogue;
}
function JSEnabledForm(fObj, useIFrameIn){
	var useIFrame = useIFrameIn | false;
	
	
	//this sets everyting valid, in anticipation of the server resetting any continued invalidity
	// this failes on hidden forms, but hey, they are hidden anyways..
	try{
		for(i in fObj.elements){
			if(fObj.elements[i] && fObj.elements[i].style)
				fObj.elements[i].style.border = "";
		}
	}catch(e){}
		
	//if we dont have a target iframe lets create one.
	if(! document.getElementById('formFrame')){
		alert('no iframe to hit, trying to create');
		var frmFrm = document.createElement("iframe");
		frmFrm.id="formFrame";
		frmFrm.height = 0;
		frmFrm.width = 0;
		frmFrm.style.visibility = "hidden";
		document.body.appendChild(frmFrm);
		if(document.all)
			document.getElementById('formFrame').attachEvent('onload',function(){iframeFinished('')});
		else
			document.getElementById('formFrame').addEventListener('load',function(){iframeFinished('')},false);		
	}  



	// did we succesffully ad the frame and are we supposed to use it?
	if( document.getElementById('formFrame') && useIFrame){	
		fObj.action = "/global/scripts/callTaker.cfm?xml=true";		
		fObj.target = "formFrame";
	}
	fObj.enctype = "multipart/form-data";

	try{
		for(i in fObj.elements){
			if(fObj.elements[i] && fObj.elements[i].style)
				fObj.elements[i].style.border = "";
		}
	}catch(e){}
	
	return true;
}




function switchSearch(first){
	document.getElementById('firstName').value = first;
	if(JSEnabledForm(document.getElementById('memberSearchForm'), true))
		document.getElementById('memberSearchForm').submit();
}	
	
function logError(errorText){
	try{
	globalLoggerDiv.innerHTML = errorText + globalLoggerDiv.innerHTML;
	}catch(e){
		document.getElementById('logger').innerHTML += errorText;
	}
	
}

function squareAndCenter(targetElement){
	var myWidth = "";
	var myHeight = "";
	if( typeof( window.innerWidth ) == 'number' ) {
    	myWidth = window.innerWidth;
	    myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    myWidth = document.documentElement.clientWidth;
    	myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    myWidth = document.body.clientWidth;
    	myHeight = document.body.clientHeight;
	}

	var eleHeight = targetElement.offsetHeight;
	var eleWidth = targetElement.offsetWidth;
	var yOffset = (myHeight - eleHeight) / 2;
	var xOffset = (myWidth - eleWidth) / 2;
	if(xOffset < 0)
		targetElement.style.left 	= '0px';	
	else
		targetElement.style.left 	= xOffset + 'px';
	if(yOffset < 0)
		targetElement.style.top 	= '0px';
	else
		targetElement.style.top 	= yOffset + 'px';

}


function submitform(fObj){
	//var fObj = document.getElementById('daCreateform');
	for(i in fObj.elements){
		if(fObj.elements[i] && fObj.elements[i].style)
			fObj.elements[i].style.border = "";
	}
}
windowCount = 0;



function cclose(divId){
	close(divId);
}

function doClose(divId){
	close(divId);
	return false;
}

function close(divId){
	if(document.getElementById(divId)){
		document.body.removeChild(document.getElementById(divId));
		for (i in windowStack)
			if(windowStack[i] == divId)
		 		delete windowStack[i];	 	
		if (--windowCount <= 0){
			grayOut(false);	
			if(document.all && parseInt(navigator.appVersion) < 7){
				var elements = document.documentElement.getElementsByTagName('select');
				for (var i=0; i<elements.length; i++)
					elements[i].style.visibility = "visible";
			}
		}				
	}
}

function grayOut(vis, options) {
  var options = options || {}; 
  var zindex = options.zindex || 25;
  var opacity = options.opacity || 70;
  var opaque = (opacity / 100);
  var bgcolor = options.bgcolor || '#000000';
  var dsID = options.id || 'darkenScreenObject';
  var dark=document.getElementById(dsID);
  if (!dark) {
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');           // Create the layer.
        tnode.style.position='absolute';                 // Position absolutely
        tnode.style.top='0px';                           // In the top
        tnode.style.left='0px';                          // Left corner of the page
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.id=dsID;                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    dark=document.getElementById(dsID);  // Get the object.
  }
  if (vis) {
    if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
        var pageWidth = document.body.scrollWidth+'px';
        var pageHeight = document.body.scrollHeight+'px';
    } else if( document.body.offsetWidth ) {
      var pageWidth = document.body.offsetWidth+'px';
      var pageHeight = document.body.offsetHeight+'px';
    } else {
       var pageWidth='100%';
       var pageHeight='100%';
    }   
	var myWidth = "";
	var myHeight = "";
	if( typeof( window.innerWidth ) == 'number' ) {
    	myWidth = window.innerWidth;
	    myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    myWidth = document.documentElement.clientWidth;
    	myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    myWidth = document.body.clientWidth;
    	myHeight = document.body.clientHeight;
	}
	if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		if (document.body.clientWidth > myWidth)
		    myWidth = document.body.clientWidth;
		if (document.body.clientHeight > myHeight)
	    	myHeight = document.body.clientHeight;
	}

    dark.style.opacity=opaque;                      
    dark.style.MozOpacity=opaque;                   
    dark.style.filter='alpha(opacity='+opacity+')'; 
    dark.style.zIndex=zindex;        
    dark.style.backgroundColor=bgcolor;  
	if(true){
	    dark.style.width= myWidth +'px';
    	dark.style.height= myHeight+'px';
	}else{
	    dark.style.width= pageWidth;
    	dark.style.height= pageHeight;	
	}
    dark.style.display='block';                          
  } else {
     dark.style.display='none';
  }
}

document.getElementsByClass = function (needle){
  var         my_array = document.getElementsByTagName("*");
  var         retvalue = new Array();
  var        i;
  var        j;

  for (i = 0, j = 0; i < my_array.length; i++)
  {
    var c = " " + my_array[i].className + " ";
    if (c.indexOf(" " + needle + " ") != -1)
      retvalue[j++] = my_array[i];
  }
  return retvalue;
}

function swapElement(fromList,toList){
	var selectOptions = document.getElementById(fromList);
	for (var i = 0; i < selectOptions.length; i++) {
		var opt = selectOptions[i];
		if (opt.selected) {
			document.getElementById(fromList).removeChild(opt);
			document.getElementById(toList).appendChild(opt);
			i--;
		}
	}
}


function resizeHandler(){
	try{
		squareAndCenter(document.getElementById(lastGlobalResponse.FORMNAME));
	  	var dark=document.getElementById('darkenScreenObject');
		if(dark && dark.style.display == 'block'){
			grayOut(false);
			grayOut(true); 
		}
	}catch(e){}
}

window.onresize=resizeHandler;

var searchTimer = "";
var searchTerm = "";
function keyHandler(searchBox){
	if(searchBox.value.trim() != searchTerm.trim() && searchBox.value.length > 2){
		searchTerm = searchBox.value.trim();
		//start timer if we have more than 3 letters and we aren't searching for the same value we just did
		var searchTimer = setTimeout('executeRegistrationSearch("' + searchBox.value + '");', 1000);
	}
}

function executeRegistrationSearch(searchTermIn){
	if(searchTermIn.trim().length > 2){
		var searchRequest = new myXMLObj("searchResults", "/global/scripts/userSearch.cfm", "searchTerm=" + searchTermIn);
		searchRequest.callback = searchRequestHandler;
		searchRequest.send();
	}else{
		document.getElementById('searchResults').innerHTML = "Please enter at least 3 letters to begin search<br>";
		document.getElementById('searchResults').innerHTML += "Enter any part of first name, last name, practice name, or zipcode";
	}
}


function addLoadEvent(_function) {
	var _onload = window.onload;
	if ( typeof window.onload != 'function' ) {
	if ( window.onload ) {
	window.onload = _function;
	} else {
	var _addEventListener = window.addEventListener || document.addEventListener;
	var _attachEvent = window.attachEvent || document.attachEvent;
	if ( _addEventListener ) {
	_addEventListener('load', _function, true);
	return true;
	} else if ( _attachEvent ) {
	var _result = _attachEvent('onload', _function);
	return _result;
	} else {
	//todo: preloading fix for ie5.2 on mac os LOL aint gonna happen.
	return false;
	}
	}
	} else {
			window.onload = function() {
			_onload();
			_function();
		}
	}
}
	

function updateQuantities(quantityList){
	quantityList = quantityList.substring(0, quantityList.length - 1);
	var products = quantityList.split(',');
	var quantities = new Array();
	
	var 	productList = "";
	var		quantityList = "";
	
	for(i in products){
		if(typeof products[i] == 'string'){
			productList += products[i] + ',';
			try{
				quantityList += document.getElementById(products[i] + 'quantity').value + ',';
			}catch(e){
			
			}
		}
	}
	
	var args = "&productList=" + productList.substring(0, productList.length - 1) + "&quantityList=" + quantityList.substring(0, quantityList.length - 1);
	args += "&mode=updtquantities&pagename=viewcart";
	
	var updateQtys = new myXMLObj("ignore", "/global/scripts/callTaker.cfm",args);
	updateQtys.callback = getterCallBack;
	updateQtys.send();
}

function setAddress(mode, address1, address2, city, stateprovince, zipcode, country, dayphone, email, fname, lname, orgname){
	var fields = new Array('address1', 'address2', 'city', 'stateprovince', 'zipcode', 'country', 'dayphone', 'email', 'fname', 'lname', 'orgname');
	//only accept blank updates for addres2 and orgname
	for(i in fields)
		if( eval(fields[i]) != '' || ( eval(fields[i]) == '' && (fields[i] == "address2" || fields[i] == 'orgname')) )
			try{
				eval("document.getElementById('" + mode + fields[i] + "').value = '" + eval(fields[i]) + "';");
			}catch(e){
			}
}


function updatePageAttendees(eid){
	if(eid && eid != ''){
		try{
		if(document.getElementById('regsForCourse')){
			var regUpdater = new myXMLObj('regsForCourse', '/global/scripts/calltaker.cfm', 'pagename=viewcart&mode=updtPageRegs&eventid=' + eid);
			regUpdater.callback = getterCallBack;
			regUpdater.send();
		}
		}catch(e){alert(e.message);}
	}else{
		alert('no id: ' + eid);
	}
}
function toggleBilling(inputObject, type){
	if(inputObject.value == -1 && inputObject.checked){
		document.getElementById('save'+type+'as').disabled = false;
		try{
			document.getElementById('save'+type+'as').focus();
			document.getElementById('addressForm').style.display = "block";
		}catch(e){}		
	}else{
		document.getElementById('save'+type+'as').disabled = true;
		document.getElementById('addressForm').style.display = "none";
	}
}

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

//<!-- myXMLObj(targDivIn, targUrlIn, postParamsIn)
function myXMLObj(targDivIn, targUrlIn, postParamsIn){

	this.targetDiv 	= targDivIn;
	this.targUrl 	= targUrlIn;
	this.postParams 	= postParamsIn;
	this.callback = "undef";
	this.send = function()
    {
		if(document.getElementById(this.targetDiv))
			var theTargetDivObj = document.getElementById(this.targetDiv);
		this.req = false;
		params = this.postParams;
		if (params != "")
			method = "POST";
		else
			method = "GET";
		contentType = "application/x-www-form-urlencoded";
		if(window.XMLHttpRequest) {
    		try {
		    	this.req = new XMLHttpRequest();
	        }catch(e) {
			    this.req = false;
        	}
      	}else if(window.ActiveXObject)
		{
    	    try
			{
				this.req = new ActiveXObject("Msxml2.XMLHTTP");
	        } catch(e) {
          		try {
					this.req = new ActiveXObject("Microsoft.XMLHTTP");
			    } catch(e) {
        		    this.req = false;
				}
			}
		}
		if(this.req) {
			var self = this; // put a reference to "this" in a local-scoped variable
			this.req.onreadystatechange = function()
			{
        	    self.processReqChange();
			};
			result = this.targUrl.match(/\?/gi);
			if(method == "GET")
			{
				if (result != null){ 
					this.req.open(method, this.targUrl + "&test=" + Math.random() , true);
		    	}else{
					this.req.open(method, this.targUrl + "?DD_test=" + Math.random() , true);
			    }
			}else{
			    this.req.open(method, this.targUrl, true);
	  		}
			if(contentType)
			{
				this.req.setRequestHeader("Content-Type", contentType);
			}
			this.req.send(params);	
		}
	} 
	this.processReqChange = function()
	{
        if (this.req.readyState == 4)
		{
			if(this.targetDiv != "usersName" && typeof(closeLoad) != "undefined")
				closeLoad();
    		if (this.req.status == 200)
			{
				if( this.targetDiv != "ignore")
	    			document.getElementById(this.targetDiv).innerHTML = this.req.responseText;
				if(this.callback != "undef"){
					this.callback(this.req.responseText);
				}
		    } else {
				//alert ( "An Error: " + this.req.status + " \n Text: " + this.req.statusText + "\n" + this.targUrl + "\n\n" + this.req.responseText);
				document.getElementById("logger").innerHTML = this.req.responseText;
			}
		}
	}
}
//-->



