// JavaScript Document


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[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];}
}



// This is the randomizer for feature images

var totalImgs = 5;

var r = Math.round(Math.random()*totalImgs);
if (r == 0) { r = 1; }

var img = "<img src='images/photo" + r + ".png' name='randimg' width='633' height='195' id='pic" + r + "' border='0' alt='pic" + r + "'>";




function validate(frm) {

  var goodEmail = frm.email.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
  
  if (frm.name.value=="") { 
  	alert("Please include your name"); 
	frm.name.focus(); 
	frm.name.select(); 
	return false; 
	}
	
  if (!goodEmail) { 
  	alert("Please check the formatting of your email address"); 
	frm.email.focus(); 
	frm.email.select(); 
	return false; 
	} 
	
  if (frm.Message.value=="") { 
  	alert("Please include your Message!"); 
	frm.message.focus(); 
	frm.message.select(); 
	return false; 
	} 
	
  if (frm.subject.value=="") { 
	frm.subject.value = "FNAWS Online Comment";
	return true; 
	} 
	  
  return true;
}


// - - - - - - - - - INDEX.HTML FEATURED EVENTS RANDOMIZER - - - - - - - - - - - - - - - - >>

/*
This script called from intro page as <SCRIPT language="JavaScript" SRC="random_img.js"></SCRIPT> 

Instructions for script:
1. Try to keep text at 40 words or less for optimal layout.
2. Change "totalImgs" value if needed, to reflect actual number of possible images in folder. 
3. Images named "1.png", "2.png", etc. (use photoshop file to generate correct size)
4. Only single quotes allowed in text.

*/



var totalFeatures = 4;		// INDEX event feature images

// This is the randomizer for feature photos
var p = Math.round(Math.random()*totalFeatures);
if (p == 0) { p = 1; }

// - - - - - - - - - BEGIN EDITABLE AREA (please only make changes here) - - - - - - - - - - - - - - - - >>

features = new Array;
features[1] = new Image();
features[1].title = "Struggle With Department of Fish and Game Over 'Any Ram' Season to 'Protect Dall Sheep Genetics'";
features[1].url = "science/article_apr4.html";
features[1].txt = "Find out what happened at the Board Game meeting in March - <a href='/science/article_apr4.html'>president's message</a>.";

features[2] = new Image();
features[2].title = "Northern Wild Sheep And Goat Council 'Posts' Proceedings";
features[2].url = "science/article_0408a.html";
features[2].txt = "The Northern Wild Sheep and Goat Council is the pre-eminent group of wild sheep biologists working with Northern wild sheep.";

features[3] = new Image();
features[3].title = "'Membership Year' Changed To June 1 Start Date";
features[3].url = "news.html#1";
features[3].txt = "The Alaska FNAWS 'membership' year for annual memberships has been changed from 'whenever you joined' to June 1-May 31.";

features[4] = new Image();
features[4].title = "Is It Ok For Adf&G To 'Blow Off' Its Earlier Dall Sheep Research?";
features[4].url = "issues/issue4.html";
features[4].txt = "Alaska FNAWS leadership, particularly Chapter President, Wayne Heimer (who may be biased because his life’s work, discovering 'full-curl' is being ignored) doesn't think so.";

// - - - - - - - - - END OF EDITABLE AREA - - - - - - - - - - - - - - - - >>

var newsImg = "<a href='" + features[p].url + "' >" + "<img src='images/news_photo" + p + ".png' alt='news' width='129' height='97' border='0' class='feature' /></a>";
var newsTitle = "<a href='" + features[p].url + "' class='feature_headline'>" + features[p].title + "</a>";
var newsTxt = features[p].txt + " - <a href='" + features[p].url + "'>read more</a>."

