//image rollovers and preloader
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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];}
}
//end rollovers and preloader

//open new window function - with toolbars
var win=null;
function NewWindow1(mypage,myname,w,h,scroll,pos)
{
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
		else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=yes,toolbar=yes,resizable=yes';
	win=window.open(mypage,myname,settings);
}
//end open new window function - with toolbars

//open new window function - without toolbars
var win=null;
function NewWindow2(mypage,myname,w,h,scroll,pos)
{
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
		else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);
}
//end open new window function - without toolbars

//open new window function - for displaying PDFs
var win=null;
function NewWindow3(mypage,myname,w,h,scroll,pos)
{
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
		else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
	win=window.open(mypage,myname,settings);
}
//end open new window function - for displaying PDFs

//form validation
function validate(theForm)
{
	var error = ""; 
	
	if (theForm.friendsname.value == "")
	{
		error += "* Please fill in the recipient's Name\n";
	} 
	if (theForm.friendsemail.value == "")
	{
		error += "* Please fill in the recipient's E-mail address\n\n";
	}
	if ((theForm.friendsemail.value.indexOf ('@',0) == -1 ||
		theForm.friendsemail.value.indexOf ('.',0) == -1) &&
		theForm.friendsemail.value != "")
	{
		error += "* You must include the recipient's accurate E-mail address\n\n";
	} 
	if (theForm.name.value == "")
	{
		error += "* Please fill in your Name\n";
	} 
	if (theForm.email.value == "")
	{
		error += "* Please fill in your E-mail address\n";
	}
	if ((theForm.email.value.indexOf ('@',0) == -1 ||
		theForm.email.value.indexOf ('.',0) == -1) &&
		theForm.email.value != "")
	{
		error += "* You must include your accurate E-mail address";
	} 
	if (error != "")
	{
		alert(error);
		return (false);
	} else {
		//alert("You entered the following: \n" + 
		//	theForm.words.value + "\n" + theForm.number.value + "\n" +
		//	theForm.email.value);
		return (true);
	} 
}
//end form validation

//search form validation and submission
function CheckForm () {
	//Check for a word to search
	if (document.frmSiteSearch.search.value==""){
		alert("Please enter at least one keyword to search");
		document.frmSiteSearch.search.focus();
		//return false;
	} else {
		document.frmSiteSearch.submit();
	}
}
//end search form validation

//newsletter form validation
function checkForm(newsletter)
{
	var error = ""; 
	if (newsletter.Name_First.value == "")
	{
		error += "* Please fill in your First Name\n";
	}
	if (newsletter.Name_Last.value == "")
	{
		error += "* Please fill in your Last Name\n";
	}
	if (newsletter.Email.value == "")
	{
		error += "* Please fill in your E-mail address\n";
	}
	if ((newsletter.Email.value.indexOf ('@',0) == -1 ||
		newsletter.Email.value.indexOf ('.',0) == -1) &&
		newsletter.Email.value != "")
	{
		error += "* You must include your accurate E-mail address";
	} 
	if (error != "")
	{
		alert(error);
		return (false);
	} else {
		return (true);
	} 
}
//end newsletter form validation

//feedback form validation
function check(feedback)
{
	var error = ""; 
	if (feedback.Name_First.value == "")
	{
		error += "* Please fill in your First Name\n";
	}
	if (feedback.Name_Last.value == "")
	{
		error += "* Please fill in your Last Name\n";
	}
	if (feedback.Email.value == "")
	{
		error += "* Please fill in your E-mail address\n";
	}
	if ((feedback.Email.value.indexOf ('@',0) == -1 ||
		feedback.Email.value.indexOf ('.',0) == -1) &&
		feedback.Email.value != "")
	{
		error += "* You must include a valid E-mail address\n";
	} 
	if (feedback.Subject.value == "")
	{
		error += "* Please fill in the Subject field\n";
	}
	
	if (feedback.Issue.value == "")
	{
		error += "* Please fill in the IRF Issue number field\n";
	}
	
	if (feedback.Feedback.value == "")
	{
		error += "* Please fill in the Feedback field\n";
	}
	if (error != "")
	{
		alert(error);
		return (false);
	} else {
		return (true);
	} 
}
//end feedback form validation

//print date for previous issues
function print_date(){

	if (document.selector.issue.value=="issue_80"){
		document.selector.date.value="February 2010";
	}
	if (document.selector.issue.value=="issue_79"){
		document.selector.date.value="November 2009";
	}
	if (document.selector.issue.value=="issue_78"){
		document.selector.date.value="August 2009";
	}
	if (document.selector.issue.value=="issue_77"){
		document.selector.date.value="May 2009";
	}
	if (document.selector.issue.value=="issue_76"){
		document.selector.date.value="February 2009";
	}
	if (document.selector.issue.value=="issue_75"){
		document.selector.date.value="November 2008";
	}
	if (document.selector.issue.value=="issue_74"){
		document.selector.date.value="August 2008";
	}
	if (document.selector.issue.value=="issue_73"){
		document.selector.date.value="May 2008";
	}
	if (document.selector.issue.value=="issue_72"){
		document.selector.date.value="February 2008";
	}
	if (document.selector.issue.value=="issue_71"){
		document.selector.date.value="November 2007";
	}
	if (document.selector.issue.value=="issue_70"){
		document.selector.date.value="August 2007";
	}
	if (document.selector.issue.value=="issue_69"){
		document.selector.date.value="May 2007";
	}
	if (document.selector.issue.value=="issue_68"){
		document.selector.date.value="February 2007";
	}
	if (document.selector.issue.value=="issue_67"){
		document.selector.date.value="November 2006";
	}
	if (document.selector.issue.value=="issue_66"){
		document.selector.date.value="August 2006";
	}
	if (document.selector.issue.value=="issue_65"){
		document.selector.date.value="May 2006";
	}
	if (document.selector.issue.value=="issue_64"){
		document.selector.date.value="February 2006";
	}
	if (document.selector.issue.value=="issue_63"){
		document.selector.date.value="November 2005";
	}
	if (document.selector.issue.value=="issue_62"){
		document.selector.date.value="August 2005";
	}
	if (document.selector.issue.value=="issue_61"){
		document.selector.date.value="May 2005";
	}
	if (document.selector.issue.value=="issue_60"){
		document.selector.date.value="February 2005";
	}
	if (document.selector.issue.value=="issue_59"){
		document.selector.date.value="November 2004";
	}
	if (document.selector.issue.value=="issue_58"){
		document.selector.date.value="August 2004";
	}
	if (document.selector.issue.value=="issue_57"){
		document.selector.date.value="May 2004";
	}
	if (document.selector.issue.value=="issue_56"){
		document.selector.date.value="February 2004";
	}
	if (document.selector.issue.value=="issue_55"){
		document.selector.date.value="November 2003";
	}
	if (document.selector.issue.value=="issue_54"){
		document.selector.date.value="August 2003";
	}
	if (document.selector.issue.value=="issue_53"){
		document.selector.date.value="May 2003";
	}
	if (document.selector.issue.value=="issue_52"){
		document.selector.date.value="February 2003";
	}
	if (document.selector.issue.value=="issue_51"){
		document.selector.date.value="November 2002";
	}
	if (document.selector.issue.value=="issue_50"){
		document.selector.date.value="August 2002";
	}
	if (document.selector.issue.value=="issue_49"){
		document.selector.date.value="May 2002";
	}
	if (document.selector.issue.value=="issue_48"){
		document.selector.date.value="February 2002";
	}
	if (document.selector.issue.value=="issue_47"){
		document.selector.date.value="November 2001";
	}
	if (document.selector.issue.value=="issue_46"){
		document.selector.date.value="August 2001";
	}
	if (document.selector.issue.value=="issue_45"){
		document.selector.date.value="May 2001";
	}
	if (document.selector.issue.value=="issue_44"){
		document.selector.date.value="February 2001";
	}
	if (document.selector.issue.value=="issue_43"){
		document.selector.date.value="November 2000";
	}
	if (document.selector.issue.value=="issue_42"){
		document.selector.date.value="August 2000";
	}
	if (document.selector.issue.value=="issue_41"){
		document.selector.date.value="May 2000";
	}
	if (document.selector.issue.value=="issue_40"){
		document.selector.date.value="February 2000";
	}
	if (document.selector.issue.value=="issue_39"){
		document.selector.date.value="November 1999";
	}
	if (document.selector.issue.value=="issue_38"){
		document.selector.date.value="August 1999";
	}
	if (document.selector.issue.value=="issue_37"){
		document.selector.date.value="May 1999";
	}
	if (document.selector.issue.value=="issue_36"){
		document.selector.date.value="February 1999";
	}
	if (document.selector.issue.value=="issue_35"){
		document.selector.date.value="November 1998";
	}
	if (document.selector.issue.value=="issue_34"){
		document.selector.date.value="August 1998";
	}
	if (document.selector.issue.value=="issue_33"){
		document.selector.date.value="May 1998";
	}
}
//end print date for previous issues

//disable some previous-articles (html)
function disable_format(){
	if (document.selector.issue.value=="issue_57"){
		document.all.webtext.className="lite";
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
	}
	if (document.selector.issue.value=="issue_56"){
		document.all.webtext.className="lite";
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
	}
	if (document.selector.issue.value=="issue_55"){
		document.all.webtext.className="lite";
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
	}
	if (document.selector.issue.value=="issue_54"){
		document.all.webtext.className="lite";
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
	}
	if (document.selector.issue.value=="issue_53"){
		document.all.webtext.className="lite";
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
	}
	if (document.selector.issue.value=="issue_52"){
		document.all.webtext.className="lite";
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
	}
	if (document.selector.issue.value=="issue_51"){
		document.all.webtext.className="lite";
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
	}
	if (document.selector.issue.value=="issue_50"){
		document.all.webtext.className="lite";
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
	}
	if (document.selector.issue.value=="issue_49"){
		document.all.webtext.className="lite";
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
	}
	if (document.selector.issue.value=="issue_48"){
		document.all.webtext.className="lite";
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
	}
	if (document.selector.issue.value=="issue_47"){
		document.all.webtext.className="lite";
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
	}
	if (document.selector.issue.value=="issue_46"){
		document.all.webtext.className="lite";
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
	}
	if (document.selector.issue.value=="issue_45"){
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
		document.all.webtext.className="lite";
	}
	if (document.selector.issue.value=="issue_44"){
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
		document.all.webtext.className="lite";
	}
	if (document.selector.issue.value=="issue_43"){
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
		document.all.webtext.className="lite";
	}
	if (document.selector.issue.value=="issue_42"){
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
		document.all.webtext.className="lite";
	}
	if (document.selector.issue.value=="issue_41"){
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
		document.all.webtext.className="lite";
	}
	if (document.selector.issue.value=="issue_40"){
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
		document.all.webtext.className="lite";
	}
	if (document.selector.issue.value=="issue_39"){
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
		document.all.webtext.className="lite";
	}
	if (document.selector.issue.value=="issue_38"){
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
		document.all.webtext.className="lite";
	}
	if (document.selector.issue.value=="issue_37"){
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
		document.all.webtext.className="lite";
	}
	if (document.selector.issue.value=="issue_36"){
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
		document.all.webtext.className="lite";
	}
	if (document.selector.issue.value=="issue_35"){
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
		document.all.webtext.className="lite";
	}
	if (document.selector.issue.value=="issue_34"){
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
		document.all.webtext.className="lite";
	}
	if (document.selector.issue.value=="issue_33"){
		document.selector.format[0].disabled=false;
		document.selector.format[0].checked=true;
		document.all.webtext.className="lite";
	} 
}
//end disable some previous-articles (html)

//load page in parent via popup window
function loadinparent(url, closeSelf){
	self.opener.location = url;
	if(closeSelf) self.close();
	}
//end load page in parent via popup window