//-------------------------------------------------------------------------------------------------------------------------//
// Current Date

function currentDate () {
	var date=new Date()
	var year=date.getYear()
	if (year < 1000)
	year+=1900
	var day=date.getDay()
	var month=date.getMonth()
	var daym=date.getDate()
	if (daym<10)
	daym="0"+daym
	var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
	var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
	document.write(""+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+"")
}

//-------------------------------------------------------------------------------------------------------------------------//
// Supplements Rollover Function

function preloadImages()
{
  if(document.images)
  {
    if(!document.imageArray) document.imageArray = new Array();
    var i,j = document.imageArray.length, args = preloadImages.arguments;
    
    for(i=0; i<args.length; i++)
    {
      if (args[i].indexOf("#")!=0)
      {
        document.imageArray[j] = new Image;
        document.imageArray[j++].src = args[i];
      }
    }
  }
}


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_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); 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];}
}


//-------------------------------------------------------------------------------------------------------------------------//
// Dynamic Select for Classifieds

function populate(o)
{
	d=document.getElementById('subcategory');
	if(!d){return;}			
	var mitems=new Array();
	var mvalues=new Array();

	// Classified Directory
	mitems['Announcements']=['General','Card of Thanks'];
	mvalues['Announcements']=['905','910'];
	
	mitems['Automotive']=['Cars & Trucks','Classics','Garage Space','Motorcycles & Mopeds','RVs','Miscellaneous'];
	mvalues['Automotive']=['1010','1020','1030','1040','1050','1060'];

	mitems['Business Opportunities']=['General'];
	mvalues['Business Opportunities']=['1100'];
	
	mitems['Help Wanted']=['Building Trades','Child Care','Domestic','Home Health Care','Food & Drink','Landscape & Garden','Office & Professional','Painting','Retail','Volunteers','General'];
	mvalues['Help Wanted']=['1205','1210','1215','1220','1225','1230','1235','1240','1245','1250','1255'];

	mitems['Marine']=['Boats','Charters','Dockage','Motors','Storage','Trailers','Miscellaneous'];
	mvalues['Marine']=['1310','1320','1330','1340','1345','1350','1360','All'];

	mitems['Merchandise']=['Ad-Vantages','Antiques','Articles For Sale','Auctions','Dogs, Cats, Pets','Equestrian','Heavy Machinery','Lost & Found','Trees & Plants','Wanted To Buy','Yard Sales'];
	mvalues['Merchandise']=['1402','1405','1410','1415','1420','1425','1430','1440','1445','1450','1455'];

	mitems['Personal']=['General'];
	mvalues['Personal']=['1500'];
		
	mitems['Professional']=['Computer','Counseling','Health & Fitness','Home Health Care','Instruction','General']; 
	mvalues['Professional']=['1610','1620','1630','1640','1650','1660']; 

	mitems['Real Estate']=['Accommodations','Commercial Properties','Co-ops & Condos','Exchanges/Swaps','Houses For Sale','Housing to Share','Land For Sale','Open Houses','Real Estate Wanted','Rentals-Year Round','Rentals-Summer','Rentals-Winter','Vacation Properties','Wanted to Rent','Miscellaneous']; 
	mvalues['Real Estate']=['1705','0','1715','0','1720','1725','1730','1735','1740','1745','1750','1755','1760','1765','1770']; 

	mitems['Services']=['Carpentry','Carpet & Upholstery','Child Care','Cleaning','Landscaping','Painting','Party Services','Security General']; 
	mvalues['Services']=['1805','1807','1810','1820','1822','1825','1830','1835']; 
	
	mitems['General']=['Situation Wanted','General'];
	mvalues['General']=['1900','1900'];
		
	d.options.length=0;
	cur=mitems[o.options[o.selectedIndex].value];
	curval=mvalues[o.options[o.selectedIndex].value];
	if(!cur){return;}
	d.options.length=cur.length;
	for(var i=0;i<cur.length;i++)
	{
		d.options[i].text=cur[i];
		d.options[i].value=curval[i];
	}
}


//-------------------------------------------------------------------------------------------------------------------------//
// Ad Rates Dynamic Select

var textBlocks = new Array('Please select a zone.','<ul><li>$1.10 per word, first week</li><li>95&cent; per word each additional week</li><li>10 word minimum</li></ul><ul><li><strong>Enhancements</strong><ul><li><label><input type="checkbox" value="internet" /> Internet: $1.50 per week</label></li><li><label><input type="checkbox" value="boxed_ad" /> Boxed ad: $5.00 per week</label></li><li><label><input type="checkbox" value="shaded_box" /> Shaded Box: $10.00 per week</label></li></ul></li></ul>','<ul><li>$1.10 per word, first week</li><li>95&cent; per word each additional week</li><li>10 word minimum</li></ul><ul><li><strong>Enhancements</strong><ul><li><label><input type="checkbox" value="internet" /> Internet: $1.50 per week</label></li><li><label><input type="checkbox" value="boxed_ad" /> Boxed ad: $5.00 per week</label></li><li><label><input type="checkbox" value="shaded_box" /> Shaded Box: $10.00 per week</label></li></ul></li></ul>','<ul><li>$1.35 per word, first week</li><li>$1.20 per word each additional week</li><li>10 word minimum</li></ul><ul><li><strong>Enhancements</strong><ul><li><label><input type="checkbox" value="internet" /> Internet: $1.50 per week</label></li><li><label><input type="checkbox" value="boxed_ad" /> Boxed ad: $5.00 per week</label></li><li><label><input type="checkbox" value="shaded_box" /> Shaded Box: $10.00 per week</label></li></ul></li></ul>');

function changeText(elemid) {
	var ind = document.getElementById(elemid).selectedIndex;
	document.getElementById("rates").innerHTML=textBlocks[ind];
}


//-------------------------------------------------------------------------------------------------------------------------//
//Contact Form disablization

function disable() {
	document.getElementById("Eedition").disabled=true;
	document.getElementById("Wedition").disabled=true;
	document.getElementById("Medition").disabled=true;
}
function enable() {
	document.getElementById("Eedition").disabled=false;
	document.getElementById("Wedition").disabled=false;
	document.getElementById("Medition").disabled=false;
}

//-------------------------------------------------------------------------------------------------------------------------//
//Subscriber Form disablization

// PUT IN_LINE

//-------------------------------------------------------------------------------------------------------------------------//
//Subscriber Form Copy fields

var billing_first = "";
var billing_last = "";
var billing_address1 = "";
var billing_address2 = "";
var billing_city = "";
var billing_state = "";
var billing_stateIndex = 0;
var billing_zip = "";
 
function InitSaveVariables(form) {
	billing_first = form.billing_first.value;
	billing_last = form.billing_last.value;
	billing_address1 = form.billing_address1.value;
	billing_address2 = form.billing_address2.value;
	billing_city = form.billing_city.value;
	billing_zip = form.billing_zip.value;
	billing_stateIndex = form.billing_state.selectedIndex;
	billing_state = form.billing_state[billing_stateIndex].value;
}
   
function billToShipPerson(form) {
	if (form.copy.checked) {
		InitSaveVariables(form);
		form.billing_first.value = form.sb_fname.value;
		form.billing_last.value = form.sb_lname.value;
		form.billing_address1.value = form.del_street.value;
		form.billing_address2.value = form.del_street2.value;
		form.billing_city.value = form.del_city.value;
		form.billing_zip.value = form.del_zip.value;
		form.billing_state.selectedIndex = form.del_state.selectedIndex;
	}
	else {
		form.billing_first.value = billing_first;
		form.billing_last.value = billing_last;
		form.billing_address1.value = billing_address1;
		form.billing_address2.value = billing_address2;
		form.billing_city.value = billing_city;
		form.billing_zip.value = billing_zip;
		form.billing_state.selectedIndex = billing_stateIndex;
	}
}

//-------------------------------------------------------------------------------------------------------------------------//
//Pop up window

function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=565,height=275,left = 212,top = 259');");
}

//-------------------------------------------------------------------------------------------------------------------------//
//Ad rotator
