// temp suppression for the menu JS error
function handleError() {
	return true;
}
window.onerror = handleError;

// external window popup (neccesary to avoid standards confilcts)
function doitAP() {
	newWindow = open("","external","toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=yes,width=800,height=600");
	}
function doit() {
	newWindow = open("","external","toolbar=yes,scrollbars=yes,resizable=yes,width=600,height=400");
	}
// popup for larger image, call like: javascript:PopupPic('imagename.jpg')

function PopupPic(sPicURL) { 
      window.open( "showpic.php?"+sPicURL, "", 
      "resizable=0,HEIGHT=400,WIDTH=300,left=362,top=159"); 
    } 
	// another popup
function OpenPopup (c) {
window.open(c,
'window',
'resizable=0,HEIGHT=550,WIDTH=500,left=362,top=159, scrollbars=yes');
}
// popup or dynamic page
function popUp(sPicURL) { 
      window.open( "showdetails.php?"+sPicURL, "", 
      "resizable=0,HEIGHT=500,WIDTH=375,left=362,top=159,scrollbars=auto"); 
    } 
// send page to a friend
function sendPage(url){
	window.open(url,"pop","width=650,height=500,toolbars=0,scrollbars=1")
}

 // recommend popup
 function mailamate()
				{
					var winl	= (screen.width - 400) / 2;
					var wint	= (screen.height - 350) / 2;
					winprops	= 'height=317,width=400,top='+wint+',left='+winl+',scrollbars=auto';
					win			= window.open("includes/mailamate.php", "RecommendUs", winprops);
					if (parseInt(navigator.appVersion) >= 4)
						{
							win.window.focus();
						}
				}

// function to pop a chromeless window
function NewWindow(mypage, myname, w, h, scroll)
	{
		var winl = (screen.width - w) / 2;
        var wint = (screen.height - h) / 2;
        winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
        win = window.open(mypage, myname, winprops)
        if (parseInt(navigator.appVersion) >= 4) { win.window.focus();}
    }

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// drop menu changer
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// opens in new window (hack for xhtml complaince)
function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank"; 
 } 
} 
window.onload = externalLinks;

// script for popup to send parent item to chosen page
//javascript:window.opener.location.href='pagename.php';window.self.close();

// jump menu 2
function P7_JumpMenu(selObj,restore){ //v1.4 by Project Seven
	var theFullString = selObj.options[selObj.selectedIndex].value;
	if (restore) selObj.selectedIndex=0;
	var theLength = theFullString.length;
	var endPos = theFullString.lastIndexOf("~");
	var theUrl, theTarget, theParent;
	if (endPos > 0) {theUrl = theFullString.substring(0,endPos);}
	else {theUrl = theFullString;}
	endPos++
	if (endPos < theLength) {theTarget = theFullString.substring(endPos,theLength)}
	else {theTarget = "window:Main";}
	if (theTarget == "window:New") {window.open(theUrl);}
	else if (theTarget == "window:Main") {eval("parent.location='"+theUrl+"'");}
	else {eval("parent.frames[\'"+theTarget+"\'].location='"+theUrl+"'");}
}

// show hide div layers
var state = 'none'; 
function showhide(layer_ref) { 
if (state == 'block') { 
state = 'none'; 
} 
else { 
state = 'block'; 
} 
if (document.all) { //IS IE 4 or 5 (or 6 beta) 
eval( "document.all." + layer_ref + ".style.display = state"); 
} 
if (document.layers) { //IS NETSCAPE 4 or below 
document.layers[layer_ref].display = state; 
} 
if (document.getElementById &&!document.all) { 
hza = document.getElementById(layer_ref); 
hza.style.display = state; 
} 
} 

// agree before entry checkbox
function checkCheckBox(f){
if (f.agree.checked == false )
{
alert('Please check the box to continue.');
return false;
}else
document.location.href=(window.self.location);
//document.location.href='content/view/981/720/';
showhide('div1');
return true;
}

// stop double submissions of forms	
var form_submitted = false;

function submit_form ( )
{
  if ( form_submitted )
  {
    alert ( "Your form has already been submitted. Please wait..." );
    return false;
  }
  else
  {
    form_submitted = true;
    return true;
  }
}

//set the below to the image you wish to use as the "new" image
var imagetag='<img src="images/stories/icons/new.gif" width="23" height="12" alt="Icon represents previous item is new" />'
var today=new Date()
function expireat(expiredate){
var expire=new Date(expiredate)
if (today.getTime()<=expire.getTime())
document.write(imagetag)
}

// call like: < script>expireat("March 21, 2006")< / script>
