function updateSections(adType,categoryID)
	{
	sectionCount = 0;
	sectionCount2 = 0;

	sectionBrowser = document.getElementById('onlineSectionID');
	// determine which array we're using
		sectionNames = eval('sectionNames' + categoryID);
		sectionIDs = eval('sectionIDs' + categoryID);
		sectionOnlineOnly = eval('sectionOnlineOnly' + categoryID);
	
	// clear the contents of section list
	for (i=0; i < sectionBrowser.length; i++){
		sectionBrowser.options[i] = null;
	}
	
	for (i=0; i < sectionNames.length; i++){
		if((adType[1].checked && sectionOnlineOnly[i] == 0)||(adType[0].checked)){ 
			sectionCount++;	
		}
	}
	
	sectionBrowser.options.length = sectionCount;
	
	// populate section list
	for (i=0; i < sectionNames.length; i++){
		// if print & online selected & category set to online only, do not display
		if((adType[1].checked && sectionOnlineOnly[i] == 0)||(adType[0].checked)){ 
			sectionBrowser.options[sectionCount2].text = sectionNames[i];
			sectionBrowser.options[sectionCount2].value = sectionIDs[i];
			sectionCount2++;
		}
	}
	
	sectionBrowser.selectedIndex = 1; 
}

function checkForSubsection(){
	if ( (document.newAd.elements[1].options[0].value == "b") || (document.newAd.elements[1].selectedIndex == 0) )
		{ alert('Pick a subcategory.'); return false; }
	else return true;
	}


function collapseLiners(state) {
	if ( state == 1 ) {
		state = 'none';
		elState = 'inline'; 
		} 
	else {
		state = 'inline';
		elState = 'none';
		}
	document.getElementById('triggerExpandAll').style.display = elState;
	document.getElementById('triggerCollapseAll').style.display = state;
	// Cycle through the tags using a for loop
	for (i=0; i<allPageTags.length; i++) {
		// Pick out the tags with our class name
		if (allPageTags[i].className == 'fullCaption')
			allPageTags[i].style.display = state;
		else if (allPageTags[i].className == 'ellipses') 
			allPageTags[i].style.display = elState;
		}
	}

function expand( liner ) {
	document.getElementById('liner' + liner).style.display='inline';
	document.getElementById('ellipses' + liner).style.display='none';
	}

function enableFields()
	{
	if (document.newAd.imageCheck.checked == 0 )
		{
		document.newAd.imageFileName.disabled = 1; 
		document.newAd.imageFileName.className = "textDisabled";
		}
	else
		{
		document.newAd.imageFileName.disabled = 0;
		document.newAd.imageFileName.className = "textEnabled";
		document.newAd.imageFileName.click();
		}
	}

function updatePreview()
	{
	var countCash = 1;
	var countCashAmount = 0;
	var liner;
	if (document.newAd.email.value != null)
		{
		countCashAmount = countCashAmount + document.newAd.email.value.length;
		liner = "<a href=\"#\" >" + document.newAd.email.value + "</a>";
		}
	if ((document.newAd.url.value != null) && (document.newAd.url.value != "http://" ))
		{
		countCashAmount = countCashAmount + document.newAd.url.value.length;
		liner =  liner + " <a href=\"#\" >" + document.newAd.url.value  + "</a>";
		}
	if ( (document.newAd.head.value == "enter the headline of your ad here" ) 
		|| (document.newAd.captionShort.value == "enter your classified ad text here" ) )
		{
		var head = "CLASSIFIED AD";
		var liner = "Please enter your classified ad headline and body." 
		var countCash = 0;
		}
	else {
		var head = document.newAd.head.value.toUpperCase();
		var liner = document.newAd.captionShort.value + " " + liner;
		countCashAmount = countCashAmount + parent.document.newAd.captionShort.value.length + parent.document.newAd.head.value.length;
		}
	if (document.newAd.headBold.checked) 
		{
		head = "<b>" + head + "</b>";
		countCashAmount = countCashAmount+100;
		}
	if (document.newAd.headLargeType.checked) 
		{
		head = "<span style=\"font-size:11pt;\">" + head + "</span>" ;
		countCashAmount = countCashAmount+150;
		}
	if (document.newAd.prefPlacement.checked) 
		{countCashAmount = countCashAmount+200; }
	if (document.newAd.imageCheck.checked) 
		{
		countCashAmount = countCashAmount+100; 
		}
	document.all.liner.innerHTML = head + " " + liner + "<span style=\"font-size:8pt; \">(adlink:xxxxx)</span>";
	if (countCash == 1) {counter.value = "$" + Math.round(countCashAmount)/100 };
	}


		function enablephotoFileName() {
			if ( document.newAd.photoCheck.checked == 0 ) {
				document.newAd.photoFileName.disabled = 1; 
				document.newAd.photoFileName.className = "textDisabled";
				}
			else {
				document.newAd.photoFileName.disabled = false;
				document.newAd.photoFileName.className = "textEnabled";
				}
			}
		
		function enablephotoCheck() {
			if ( document.newAd.runsOnline.checked == 0 ) document.newAd.photoCheck.disabled = 1; 
			else document.newAd.photoCheck.disabled = 0;
			}
			
		function updatePreview() {
			var head;
			var liner;
			var charSize = 11;
			if( document.newAd.onlineColorBack.selectedIndex == 0 )
				backgroundColor = 'FFF';
			else if( document.newAd.onlineColorBack.selectedIndex == 1 )
				backgroundColor = 'DDF';
			else if( document.newAd.onlineColorBack.selectedIndex == 2 )
				backgroundColor = 'FFD';
			else if( document.newAd.onlineColorBack.selectedIndex == 3 )
				backgroundColor = 'FDD';
			if ( (document.newAd.head.value == "enter headline here" ) 
				|| (document.newAd.caption.value == "enter your classified ad text here" ) ) {
					head = "This is a preview of your ad.";
					liner = "Enter your classified ad headline and body; your ad will appear here as you type it." 
					}
			else {
				head = document.newAd.head.value;
				liner = document.newAd.caption.value;
				}
			head = "<span style='font-weight:bold;text-transform:uppercase;'>" + head  + "</span> ";
			document.getElementById('adPreview').innerHTML = "<div style=\"border:1px solid black; background:#" + backgroundColor + "; padding:4px; \" >" + head + " " + liner + "</div>";
			}
		


