function gallerypic(url) {
  popupWin = window.open(url, 'gallery', 'menubar,status,scrollbars,resizable,width=550,height=400,left=10,top=10')
}
function Start(page) {
OpenWin = this.open(page, "CtrlWindow", "toolbar=no, menubar=yes, location=no, scrollbars=yes, resizable=yes, width=550, height=400, left=30, top=40"); 
// Aug 8th, 2002
}
function Register(page) {
OpenWin = this.open(page, "Register", "toolbar=no, menubar=yes, location=no, scrollbars=yes, resizable=yes, width=620, height=500, left=30, top=40"); 
// Aug 8th, 2002
}
function Start1(page) {
OpenWin = this.open(page, "", "toolbar=no, menubar=yes, location=no, scrollbars=yes, resizable=yes, width=750, height=450, left=20, top=20"); // Aug 8th, 2002
}
function Start2(page) {
OpenWin = this.open(page, "", "toolbar=no, menubar=no, location=no, scrollbars=yes, resizable=yes, width=650, height=640, left=150, top=0"); // Aug 8th, 2002
}
function golfguide(page) {
OpenWin = this.open(page, "", "toolbar=no, menubar=no, location=no, scrollbars=yes, resizable=yes, width=760, height=640, left=10, top=10"); // Aug 8th, 2002
}
function openActiveWord(url) {
	popupWin = window.open(url, 'getword', 'menubar,status,scrollbars,resizable,width=450,height=300,left=10,top=10')
}
function openElection(url) {
	popupWin = window.open(url, 'getword', 'menubar,status,scrollbars,resizable,width=450,height=300,left=10,top=10')
}
function openTopJob(url) {
	popupWin = this.open(url, 'topjob', 'toolbar=no, menubar=no, location=no, scrollbars=yes, resizable=yes, width=450,height=300,left=10,top=10')
}
function openPastPolls(url) {
	popupWin = window.open(url, 'pastpolls', 'menubar,status,scrollbars,resizable,width=450,height=350,left=10,top=10')
}
function openGiftGuide(url) {
	popupWin = window.open(url, 'giftguide', 'status,scrollbars,resizable,width=530,height=390,left=10,top=10')
}
function openStoryComment(url) {
	popupWin = window.open(url, 'storycomment', 'status,scrollbars,resizable,width=450,height=400,left=10,top=10')
}
function openValentinesAd(url) {
	popupWin = window.open(url, 'valentines_ad', 'status,scrollbars,resizable,width=305,height=360,left=10,top=10')
}
function openMomPic(url) {
	popupWin = window.open(url, 'mompic', 'status,scrollbars,resizable,width=375,height=425,left=10,top=10')
}
function openHazardUpdate(url) {
	popupWin = window.open(url, 'hazardupdate', 'status,scrollbars,resizable,width=475,height=325,left=10,top=10')
}
function printarticle(ID) {
	printing = window.open("printing.php?id="+ID+"&lang=en","Printing","width=720,height=450,resizable=yes,menubar=no,scrollbars=yes");
	printing.moveTo(50,50);
	printing.focus();
}

function displayAd(AdURL) { 
	window.open("popup.htm?"+AdURL, "", "resizable=1,height=200,width=200");
}

//PopUnder Power
//Credit notice must stay intact for use.
//Paste this entire javascript between the <head> & </head> tags of your page, 
// Visit http://www.mikenew.net for more scripts. 
// by Mike New, with special thanks to Jeff Phillips of classadrivers.com

// Begin. Specify URLs to randomly select from and pop-under. Edit & add freely.
var popunder=new Array()
popunder[0]="http://www.ludingtondailynews.com/clock.html"
//popunder[1]="http://www.mikenew.net/mini-fetch.php"
//popunder[2]="http://www.classadrivers.com"

// Specify the width and height of new popunder window (in pixels).
var width = '450'; 
var height = '500';

var p = 'scrollbars=no,resizable=no,toolbar=yno,' + //these are obvious variables. set "yes" or "no".
'menubar=no,status=no,location=yes,left=85,top=20,height=' +  //yes/no, & the screen location
height + ',width=' + width;

// Load new PopUnder only once per browser session? (0=no, 1=yes)
// Putting 0 will cause the Popunder to load every time page is loaded
// Specifying 1 will cause it to load only once per session
var one_time=1

// That's it! Don't edit the code below unless you're really good. :-P //

function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if the cookie exists
      offset += search.length
      end = document.cookie.indexOf(";", offset); // set the index of beginning value
      
    if (end == -1) // set the index of the end of cookie value
         end = document.cookie.length;
         returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function loadornot(){
if (get_cookie('popunder')==''){
load_pop_power()
document.cookie="popunder=yes"
}
}

function load_pop_power(){
win2=window.open(popunder[Math.floor(Math.random()*(popunder.length))],"bw",p)
win2.blur()
window.focus()
}
// Pop Up commented out July 11, 2003
//if (one_time==0)
//load_pop_power()
//else
//loadornot()

// YDirectory JavaScript
function openpopup() {
	var popurl="bookmark.php"
	winpops=window.open(popurl,"","width=200,height=270,")
}

function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function loadornot(){
	if (get_cookie('poppedup')==''){
	openpopup()
	document.cookie="poppedup=yes"
	}
}

function validateAllRequired(form) { // validates registerUnifiedForm.php
	var myForm = document.foobar;
	// Email
	if ( myForm.email.value.length < 6) {
		alert("You MUST submit a valid email address.");
		myForm.email.focus();
		return false;
		// needs better validation
	}
	// Password
	if ( myForm.password.value.length < 1) {
		alert("You MUST enter a password.");
		myForm.password.focus();
		return false;
	}
	// Confirm Password
	if ( myForm.confirmPassword.value.length < 1) {
		alert("You MUST enter a confirming password.");
		myForm.confirmPassword.focus();
		return false;
	}

	// start of organization
	if ( myForm.organization.value.length < 1) {
		alert("You MUST enter a publishable organization, or business, or other name.");
		myForm.organization.focus();
		return false;
	}
	// end of organization
/*
	// start of address
	if ( myForm.address.value.length < 1) {
		alert("You MUST enter an address.");
		myForm.address.focus();
		return false;
	}
	// end of address
// start of firstname
	if ( myForm.firstname.value.length < 2) {
		alert("You MUST enter a first name.");
		myForm.firstname.focus();
		return false;
	}
	// end of firstname
	// start of lastname
	if ( myForm.lastname.value.length < 2) {
		alert("You MUST enter a last name.");
		myForm.lastname.focus();
		return false;
	}
	// end of lastname
*/
	// Category - uses newer April 2003 textbox for category variable
	// start of category
	if( myForm.category.value == '*') {
			alert("You MUST choose a category.");
			myForm.category.focus();
			return false;
	}
	// end of category

	// Description
	if ( myForm.description.value.length <= 9 ) {
		alert("Make your description 10 characters or longer.");
		myForm.description.focus();
		return false;
	}
return true;
}
function forceCategoryAndDescription(form) {
	var myForm = document.foobar;
	// Category - uses newer April 2003 textbox for category variable
	// start of category
	if ( myForm.category.value.length < 1) {
		alert("You MUST choose a category.");
		myForm.category.focus();
		return false;
	}
	// end of category
	// Description
	if ( myForm.description.value.length <= 9 ) {
		alert("Make your description 10 characters or longer.");
		myForm.description.focus();
		return false;
	}
return true;
}
// browser detection - load css file
function loadCSSFile() {
  	/* this script determines the user browser and loads an appropriate external cascading style sheet.
	   If the browser is an Internet Explorer browser then an IE compatible external css file is loaded.
	   If the browser is a Netscape browser then a Netscape compatible external css file is loaded.
	   If the browser is an Opera browser then an an Internet Explorer compatible external css file is loaded.
	   If the browser is anything else no css file is loaded.
	   You can add more browser types by adding another case and a related css file. Based on an analysis 
	   of website traffic most surfers use recent browser versions. You can add specific versioning if you want
	   but the traffic that will use it will be negligible.
	   Richard Creech info@dreamriver.com http://www.dreamriver.com
	*/
	var cssFileName = "";
	var browser = navigator.appName;
	switch(browser) {
		case "Microsoft Internet Explorer":
			cssFileName = "yellow.css";
			//cssFileName = "netscape.css";
			break;
		case "Netscape":
			cssFileName = "netscape.css";
			break;
		case "Opera":
			cssFileName = "yellow.css";		
			break;	
		default:
			/* if there is no switch(browser) match then no css file is loaded */
	}
	document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + cssFileName + "\">");
  }
function validateLoginForm(form) {

	var myForm = document.loginForm;

	// Email
	if ( myForm.email.value.length < 6) {
		alert("You MUST submit a valid email address.");
		myForm.email.focus();
		return false;
		// needs better validation
	}

	// Password
	if ( myForm.password.value.length < 1) {
		alert("You MUST enter a password.");
		myForm.password.focus();
		return false;
	}
return true;
}
function validate(form) {

	var myForm = document.foobar;

	// Email
	if ( myForm.email.value.length < 6) {
		alert("You MUST submit a valid email address.");
		myForm.email.focus();
		return false;
		// needs better validation
	}

	// Password
	if ( myForm.password.value.length < 1) {
		alert("You MUST enter a password.");
		myForm.password.focus();
		return false;
	}

	// start of Country
	// this has problems, so it is commented out - look at category processing for correct option handling
	/*
	var mycountryList = myForm.country;
	var mySelectedCountryIndex= mycountryList.selectedIndex;
	if( mycountryList.options[mySelectedCountryIndex].value ) {
		countryItem = mycountryList.options[mySelectedCountryIndex].value;
	}else{ // if it is null then give it a value to satisfy javascript
		countryItem = "*";
	}
	if(countryItem == "*") {
		alert("Choose a country.");
		mycountryList.focus();
		return false;
	}
	if(countryItem == "") {
		alert("Choose a country.");
		mycountryList.focus();
		return false;
	}
	// end of Country
	*/

	// start of Website
	if( myForm.website.value.length >= 1 ) {
		if ( myForm.website.value.substring(0,7) != "http://" ) {
			alert("You must enter a clickable link.\nThe link must begin with 'http://'");
			myForm.website.focus();
			return false;
		}
	}
	// end of Website
	// paste below this line






	// paste above this line
/* 
	HOW TO MAKE DATA REQUIRED
	To require certain data to be entered by the user:
		1. save this file as yellowORIGINAL.js
		2. open yellow.js in your html editor
		3. find the data below: example: locate the // Phone section
		4. copy the phone section from the // start of ... to the // end of ... 
		5. paste the phone section in above where it says "paste below this line"
		6. save this file yellow.js and upload to your web server
		7. test by adding a new record
		8. [OPTIONAL] color code [red] the new fields you require in the file registerForm.php
*/
/*
	// start of firstname
	if ( myForm.firstname.value.length < 2) {
		alert("You MUST enter a first name.");
		myForm.firstname.focus();
		return false;
	}
	// end of firstname

	// start of lastname
	if ( myForm.lastname.value.length < 2) {
		alert("You MUST enter a last name.");
		myForm.lastname.focus();
		return false;
	}
	// end of lastname

	// start of Company
	if ( myForm.organization.value.length < 3) {
		alert("You MUST enter a company name.");
		myForm.organization.focus();
		return false;
	}
	// end of Company

	// start of Phone
	if ( myForm.phone.value.length < 7 ) {
		alert("Your phone number must be at least 7 numbers or longer.\nEnter 7 spaces if not applicable.");
		myForm.phone.focus()
		return false;
		// needs validation for a number value, but allowing hyphens or dots
	}
	// end of Phone
	
	// start of Fax
	if ( myForm.fax.value.length < 7 ) {
		alert("Your fax number must be at least 7 numbers or longer.");
		myForm.fax.focus()
		return false;
	}
	// end of Fax
	
	// start of Street Address
	if ( myForm.address.value.length < 6 ) {
		alert("Your street address appears invalid.\nEnter 6 spaces if not applicable.");
		myForm.address.focus()
		return false;
	}
	// end of Street Address

	// start of City
	if ( myForm.city.value.length < 3 ) {
		alert("The city appears invalid.\nEnter 3 spaces if not applicable.");
		myForm.city.focus()
		return false;
	}
	// end of City

	// start of ZIP or Postal code
	if ( myForm.postalcode.value.length < 5 ) {
		alert("Your ZIP or postal code must contain at least 5 characters.\nEnter 5 spaces if not applicable.");
		myForm.postalcode.focus()
		return false;
	}
	// end of ZIP or Postal Code

	// start of Country
	var mycountryList = myForm.country;
	var mySelectedCountryIndex= mycountryList.selectedIndex;
	countryItem = mycountryList.options[mySelectedCountryIndex].value;
	if(countryItem == "*") {
		alert("Choose a country.");
		mycountryList.focus();
		return false;
	}
	if(countryItem == "") {
		alert("Choose a country.");
		mycountryList.focus();
		return false;
	}
	// end of Country

	// start of Website
	if( myForm.website.value.length > 1) {
		if ( myForm.website.value.substring(0,7) != "http://" ) {
			alert("You must enter a clickable link.\nThe link must begin with 'http://'");
			myForm.website.focus();
			return false;
		}
	}
	// end of Website
*/
	return true
}

/*
Select and Copy form element script- By Dynamicdrive.com
For full source, Terms of service, and 100s DTHML scripts
Visit http://www.dynamicdrive.com
*/

//specify whether contents should be auto copied to clipboard (memory)
//Applies only to IE 4+
//0=no, 1=yes
var copytoclip=1

function HighlightAll(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
if (document.all&&copytoclip==1){
therange=tempval.createTextRange()
therange.execCommand("Copy")
window.status="Contents highlighted and copied to clipboard!"
setTimeout("window.status=''",1800)
}
}

function stopJunk(form) {
	var badData = "false";
	var myForm = document.forms[0];
	// recipient
	if ( myForm.friendEmail.value < 6 ) {
		alert("You MUST enter a friend's email address in order to send them email.");
		myForm.friendEmail.focus();
		return false;	
	}
	// userEmail
	if ( myForm.userEmail.value < 6 ) {
		alert("You MUST enter your email address so your friend may easily reply to you.");
		myForm.userEmail.focus();
		return false;	
	}
return true
}

function loadSelection(category){
	opener.document.foobar.category.value = category;
	opener.document.foobar.description.focus();
	window.close();
}

function right(e) {
var msg = "Sorry, you don't have permission to right-click images.";
if (navigator.appName == 'Netscape' && e.which == 3) {
alert(msg);
return false;
}
if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
alert(msg);
return false;
}
else return true;
}

function trap() 
  {
  if(document.images)
    {
    for(i=0;i<document.images.length;i++)
      {
      document.images[i].onmousedown = right;
      document.images[i].onmouseup = right;
      }
    }
  }


function changeCamPic(cam_id, text) {
	document.getElementById('phonecam').src = 'getphoto.php?id=' + cam_id;
	document.getElementById('phonecam_text').innerHTML = text;
}

function launch(newURL, newName, newFeatures, orgName) {
  var remote = open(newURL, newName, newFeatures);
  if (remote.opener == null)
    remote.opener = window;
  remote.opener.name = orgName;
  return remote;
}


function OpenWindow(sURL, nw,nh, sOptions) {
   if (nw<1) {nw=500;}
   if (nh<1) {nh=300;}
   if (sOptions == '') { sOptions='screenX=125,left=125,screenY=125,top=125,channelmode=0,dependent=0,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=no,left=0,top=0,screenX=0,screenY=0';}

   myRemote2 = launch(sURL, "myRemote2", "height=" + nh + ",width=" + nw + "," + sOptions, "HAMweather_Popup");

   return false;
}

function addClass(element, value) {
	if(!element.className) {
		element.className = value;
	} else {
		newClassName = element.className;
		newClassName+= " ";
		newClassName+= value;
		element.className = newClassName;
	}
}

function setIssueDate(issue, selectday) {
  document.getElementById('issue_date').value = issue;
  document.getElementById('issue_order').style.display = 'block';
  document.getElementById('issue_preview').src = 'eedition/frontpage.php?date=' + issue;
/*  addClass(document.getElementById(selectday), "selected");*/
}

function setReturn(issueField) {
  var issue = document.getElementById(issueField).value;
  document.getElementById('return').value = document.getElementById('return').value + '/issue_date/' + issue;
/*  alert(document.getElementById('return').value);*/
} 

