
function zStdErr(e)	{
	if(typeof console != 'undefined'){
		if(typeof e == 'object')
			console.dir(e);
		else
			console.log(e);
		}
	}

function clearText(thefield)	{
	if (thefield.defaultValue == thefield.value)
		thefield.value = "";
	}

function bookmarksite(title, url){
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
	}

function eventCountdown(myToday,deadline)	{
	if($('eventDayCountdown'))	{
		msPerDay = 24 * 60 * 60 * 1000 ;
		timeLeft = (deadline.getTime() - myToday.getTime());
	
	zStdErr('timeLeft = '+timeLeft);
	
		e_daysLeft = timeLeft / msPerDay;
		daysLeft = Math.floor(e_daysLeft);
		$('eventDayCountdown').innerHTML = daysLeft;
		}
	}

function selectOption(itemToSelect,formField)	{
//	itemToSelect = itemToSelect.replace('%3A',':') //for finders
// Get a reference to the drop-down
	var myDropdownList = formField;
// Loop through all the items
	for (iLoop = 0; iLoop< myDropdownList.options.length; iLoop++)	{    
		if (myDropdownList.options[iLoop].id == itemToSelect)	{
// Item is found. Set its selected property, and exit the loop
			myDropdownList.options[iLoop].selected = true;
			break;
			}
		}
	}

//used for events tracking in multipage header.
function pleaseTrackMultipage()	{
	var s = 'sortOrder='+document.getElementById('sortby').value;
	s += '|itemsPerPage='+document.getElementById('size').value;
	if(typeof PleaseTrackClick == 'function')	{
		PleaseTrackClick('form-viewSortCriteria',s);
		}
	zStdErr(s);
	document.forms.viewSortCriteria.submit();
//	return false; //for testing. set to true at deployment
	}

function openWindow(url,w,h) {
	adviceWin = window.open(url,'advice','status=no,width='+w+',height='+h+',menubar=no,scrollbars=yes');
	adviceWin.focus(true);
	}

