// menu rollover - AJ
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_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_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}
//-->

function viewfullsize(photo) {
  width= 480;
  height=600;
settings="toolbar=no,location=no,directories=no,"+
"status=no,menubar=no,scrollbars=yes,"+
"resizable=no,width=480,height=470";
url = '/viewfullsize.html?photo='+photo;
var name = '_blank';
NewWindow=window.open(url,name,settings);
NewWindow.focus();
}

//adding map popup window for hullo system - JB
function hullofullsize(photo) {
  width= 600;
  height=480;
settings="toolbar=no,location=no,directories=no,"+
"status=no,menubar=no,scrollbars=auto,"+
"resizable=no,width=480,height=600";
url = '/hullofullsize.html?photo='+photo;
var name = '_blank';
NewWindow=window.open(url,name,settings);
NewWindow.focus();
}


function hullogoomap(url, name, width, height)
{
settings=
"toolbar=no,location=no,directories=no,"+
"status=no,menubar=no,scrollbars=yes,"+
"resizable=yes,width="+width+",height="+height;

NewWindow=window.open(url,name,settings);
NewWindow.focus();
}


function emailarticle(story) {
settings="toolbar=no,location=no,directories=no,"+
"status=no,menubar=no,scrollbars=yes,"+
"resizable=yes,width=600,height=500";
url = '/scripts/email_article.html?story='+story;
var name = '_blank';
NewWindow=window.open(url,name,settings);
NewWindow.focus();
}

function printarticle(story) {
settings="toolbar=no,location=no,directories=no,"+
"status=no,menubar=yes,scrollbars=yes,"+
"resizable=yes,width=600,height=600";
url = '/print_article.html?story='+story;
var name = '_blank';
NewWindow=window.open(url,name,settings);
NewWindow.focus();
}


function popup(url, name, width, height)
{
settings=
"toolbar=no,location=no,directories=no,"+
"status=no,menubar=no,scrollbars=yes,"+
"resizable=yes,width="+width+",height="+height;

NewWindow=window.open(url,name,settings);
NewWindow.focus();
}
 <!-- Scroll = yes for 800x600 screens  - AJ -->

function pop_gam_up(url, name, width, height)
{
settings=
"toolbar=no,location=no,directories=no,"+
"status=no,menubar=no,scrollbars=yes,"+
"resizable=yes,width="+width+",height="+height;

NewWindow=window.open(url,name,settings);
NewWindow.focus();
}

function poprgb(url, name, width, height)
{
settings=
"toolbar=no,location=no,directories=no,"+
"status=no,menubar=yes,scrollbars=yes,"+
"resizable=yes,width="+width+",height="+height;

NewWindow=window.open(url,name,settings);
NewWindow.focus();
}

//view cammie - JB
function viewfullcam(photo) {
settings="toolbar=no,location=no,directories=no,"+
"status=no,menubar=no,scrollbars=yes,"+
"resizable=yes,width=645,height=550";
url = 'http://myconnect.ca/cammie.html?photo='+photo;
var name = '_blank';
NewWindow=window.open(url,name,settings);
NewWindow.focus();
}


// Scrap for offsite vid at news10now Serial Killer caught
// stale after May 23rd - but please comment out rather
// than kill - also on head_noad - JB
//function watchVid(vid) {
//	var newWindow;
//	var vidlist = "";
//	pageurl = "http://news10now.com/shared/video/video_pop.asp?destlist=" + vid;
//	var props = 'scrollBars=yes,resizable=no,toolbar=no,menubar=no,location=no,directories=no,width=729,height=518,status=no';
//	newWindow = window.open(pageurl, "view_vids", props);
//	newWindow.focus();
//}


 var urlAddress = 'http://thechronicleherald.ca';
 var pageName = 'The ChronicleHerald.ca';

 function addToFavorites()
 {
  if (window.external)
  {
   window.external.AddFavorite(urlAddress,pageName)
  }
  else
  {
   alert('Sorry! Your browser doesn\'t support this function.');
  }
 }
function clear_votes(form) {
  for (i = 0; i < 5; i++) {
    name = 'votes['+i+']';
    if (form[name].value) {
      alert(form[name].value);
      form[name].value= 0;
    }
  }
}

//Math based form-bot solution - JB

//CATCHA for contest forms - AJ
var $capa_a = randomnumber=Math.floor(Math.random()*11);
var $capa_b = randomnumber=Math.floor(Math.random()*11);
//Added two new operations - AJ
var $capa_c = randomnumber=Math.floor(Math.random()*11);

var $capa_e = ($capa_a*$capa_b+$capa_c);

function capa(){
document.write('Skill Testing Question: ',$capa_a,' x ',$capa_b,' + ',$capa_c,' =');
}

function hellohu(){
var $capa_f = document.heraldform.question.value;
if ($capa_f != $capa_e){
alert ('Please answer the Skill Testing Question correctly to proceed. Please note this equation is a number multiplied by another number plus a third number.');
return false;
} else {
 return true;
 }
}

//CATCHA for non contest forms - AJ
var $capa2_a = randomnumber=Math.floor(Math.random()*11);
var $capa2_b = randomnumber=Math.floor(Math.random()*11);

var $capa2_answer = ($capa2_a+$capa2_b);

function capa2(){
document.write($capa2_a,' + ',$capa2_b,' =');
}

function capa2Alert(){
var $capa2_f = document.heraldform.question.value;
if ($capa2_f != $capa2_answer){
alert ('Please calculate correctly to proceed.');
return false;
} else {
return true;
 }
}


// -->


	//Programmed by Shawn Olson
	//Copyright (c) 2006
	//Permission to use this function provided that it always includes this credit text
	//  http://www.shawnolson.net
function checkUncheckAll(theElement) {
     var theForm = theElement.form, z = 0;
	 for(z=0; z<theForm.length;z++){
      if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
	  theForm[z].checked = theElement.checked;
	  }
     }
    }

// Drop Down Menu developed for blogs - AJ & JR(developed by JR)
<!--
function startDropNav() {
            if (document.all && document.getElementById) {
                                var navRoot = document.getElementById("dropnav");
                                var liNodes = navRoot.getElementsByTagName("LI");
                                for (var i=0; i < liNodes.length; i++) {
                                                node = liNodes[i];
                                                node.onmouseover=function() {
                                                                this.className+=" over";
                                                                positionBlocker(this);
                                                }
                                                node.onmouseout=function() {
                                                                this.className=this.className.replace(" over", "");
                                                                positionBlocker();
                                                }
                                }
                }
}

function positionBlocker(oNode){
                var oframe=document.getElementById("blockframe");
                if (oNode) {
                                var ulNodes = oNode.getElementsByTagName("UL");
                                if (ulNodes.length > 0) {
                                                oframe.style.display = "block";
                                                oframe.style.top = oNode.offsetTop + ulNodes[0].offsetTop;
                                                oframe.style.left = oNode.offsetLeft + ulNodes[0].offsetLeft;
                                                oframe.width = ulNodes[0].offsetWidth;
                                                oframe.height = ulNodes[0].offsetHeight;
                                }
                }
                else
                {
                                oframe.style.display = "none";
                }
}
-->


