<!--
var friendID=1;

function setDateCaption(labelTxt)
{
	document.getElementById("dateCaption").innerHTML = labelTxt;
}

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_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 flvFSTI4(){//v1.01
this.style.filter="";}

function flvFSTI3(v1,v2){//v1.01
var v3;if (v1.filters[0]&&v1.filters[0].status==2){v1.filters[0].Stop();}if (v2==0){v3="blendTrans(Duration="+v1.STI8+")";}else {v3="revealTrans(Duration="+v1.STI8+",Transition="+(v2-1)+")";}v1.style.filter=v3;}

function flvFSTI2(){//v1.01
var v1,v2=document,v3=v2.STI4,v4;for (v4=0;v3&&v4<v3.length&&(v1=v3[v4])&&v1.STI5;v4++){if (v1.filters&&!v2.STI7){flvFSTI3(v1,v1.STI3);v1.filters[0].Apply();}v1.src=v1.STI5;if (v1.filters&&!v2.STI7){v1.filters[0].Play();}}}

function flvFSTI1(){//v1.01
// Copyright 2003, Marja Ribbers-de Vroed, FlevOOware (www.STI1.nl/dreamweaver/)
var v1=arguments,v2=document,v3;v2.STI4=new Array();v2.STI7=(navigator.userAgent.toLowerCase().indexOf("mac")!=-1);for (var v4=0;v4<v1.length-2;v4+=5){v3=MM_findObj(v1[v4]);if (v3){v3.STI5=v3.src;v3.STI6=v1[v4+1];v3.STI2=v1[v4+2];v3.STI3=v1[v4+3];v3.STI8=v1[v4+4];v2.STI4[v2.STI4.length]=v3;if (v3.filters&&!v2.STI7){flvFSTI3(v3,v3.STI2);v3.onfilterchange=flvFSTI4;v3.filters[0].Apply();}v3.src=v3.STI6;if (v3.filters&&!v2.STI7){v3.filters[0].Play();}}}}
//-->

function swapLoginBox()
{
	if(document.getElementById("loginbox").style.display=="none")
	{
		document.getElementById("loginbox").style.display="block";
	}
	else
	{
		document.getElementById("loginbox").style.display="none";
	}
}

function swapCaptcha()
{
	document.getElementById("captcha").src = "captcha.php?"+(new Date()).getTime();
}

function doubleConfirm(msg)
{
	if(confirm(msg+"\n\nClick OK to confirm."))
	{
		if(confirm(msg+"\n\nClick OK AGAIN to verify that you are sure."))
		{
			return 1;
		}
		return 0;
	}
	return 0;	
}

function confirmFilled(contest_id)
{
	if(document.getElementById("name_"+contest_id).value=="") { alert("You must fill in your name to enter a contest."); return false; }
	if(document.getElementById("email_"+contest_id).value=="") { alert("You must fill in your email address to enter a contest."); return false; }
	if(document.getElementById("phone_"+contest_id).value=="") { alert("You must fill in your phone number to enter a contest."); return false; }
	return true;
}

function executeLocationSwap(obj)
{
	if(obj.options[obj.selectedIndex].value)
	{
		window.location="http://www.whatshappening.ca/business/"+obj.options[obj.selectedIndex].value+"/";
	}
	else
	{
		window.location="http://www.whatshappening.ca/business/";
	}
}

function swapOutNumberDraw(obj)
{
	if(obj.options[obj.selectedIndex].value=="draw")
	{
		document.getElementById("number_draw").style.display="block";
	}
	else
	{
		document.getElementById("number_draw").style.display="none";
	}
}

function toggleEndDate()
{
	if(document.getElementById("end_date_check").checked)
	{
		document.getElementById("end_table").style.display="block";
	}
	else
	{
		document.getElementById("end_table").style.display="none";
	}
}

function toggleSearchBox()
{
	var searchBox = document.getElementById("top_search_box");
	var searchBoxToggle = document.getElementById("top_search_toggle");

	if(searchBox.style.display=="inline") 
	{ 
		searchBox.style.display="none"; 
		searchBoxToggle.style.display="inline"; 
	}
	else 
	{ 
		searchBox.style.display="inline"; 
		searchBoxToggle.style.display="none"; 
	}
}

function executeTypeSwap(obj,calchunk,sidechunk)
{
	if(obj.options[obj.selectedIndex].value)
	{
		window.location="http://www.whatshappening.ca/"+calchunk+sidechunk+obj.options[obj.selectedIndex].value+"/";
	}
	else
	{
		window.location="http://www.whatshappening.ca/"+calchunk+sidechunk;
	}
}

function popupAutoresize(imageURL)
{
	window.open("http://www.whatshappening.ca/includes/popup_window_autoresize.php?imageURL="+imageURL,"wh_imagepreview","status=0,toolbar=0,menubar=0,directories=0,resizable=0,scrollbars=0,top=5,left=5");
}

function toggleLoginBoxShow()
{
	var loginBox = document.getElementById("login_box");
	var loginClick = document.getElementById("login_click");

	if(loginBox.style.display=="inline")
	{
		loginBox.style.display="none";
		loginClick.style.display="inline";
	}
	else
	{
		loginBox.style.display="inline";
		loginClick.style.display="none";
	}
}

function changeMonths(monthSelected, idToChange)
{
	var str = "";
	var monthArray = new Array(31,29,31,30,31,30,31,31,30,31,30,31);
	document.getElementById(idToChange).innerHTML = "";
	for(var i=1;i<=monthArray[monthSelected];i++)
	{
		var newI;
		if(i>=10) newI = i;
		else newI = "0"+i;

		var myOption = document.createElement("option");
		myOption.value = newI;
		myOption.innerHTML = newI;
		document.getElementById(idToChange).appendChild(myOption);
	}
}

function toggleMore(event_id)
{
	var firstBox = document.getElementById("click_for_more-"+event_id);
	var secondBox = document.getElementById("hidden_more-"+event_id);
	if(firstBox.style.display=="none")
	{
		firstBox.style.display="inline";
		secondBox.style.display="none";
	}
	else
	{
		firstBox.style.display="none";
		secondBox.style.display="inline";
	}
}

function addAnotherFriend()
{
	if(friendID>=8) return;
	friendID++;
	
	var appendString = '<table><tr><td width="150">Friend #'+(friendID)+'\'s Email</td><td><input type="text" size="30" name="e_email[]" onfocus="if(this.value==\' e-mail address\')this.value=\'\';" onblur="if(this.value==\'\')this.value=\' e-mail address\';" value=" email address"/></td></tr></table>'+"\n";

	document.getElementById("add_friends_table").innerHTML += appendString;
	if(friendID>=8) {document.getElementById("add_more_friends").style.display="none";}
}

function confirmPhotoValid()
{
	if(!document.getElementById("img_upload").value) return true;
	else
	{
		var fileName = document.getElementById("img_upload").value;
		if(fileName.match(/gif$/i)) return true;
		else if(fileName.match(/(jpg|jpe|jpeg)$/i)) return true;
		else if(fileName.match(/png$/i)) return true;
		else
		{
			alert("We only accept GIF, JPG, and PNG image submissions.\n\nPlease submit your image in a different format.");
			return false;
		}
	}
}

/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Contents for menu 1
var menu1=new Array()
menu1[0]="<a href='/business/'>&nbsp;&nbsp;All Locations</a>"
menu1[1]="<a href='/business/st_johns_metro/'>&nbsp;&nbsp;St. John's Metro</a>"
menu1[2]="<a href='/business/avalon_eastern/'>&nbsp;&nbsp;Avalon and Eastern</a>"
menu1[3]="<a href='/business/central/'>&nbsp;&nbsp;Central</a>"
menu1[4]="<a href='/business/west/'>&nbsp;&nbsp;West</a>"
menu1[5]="<a href='/business/labrador/'>&nbsp;&nbsp;Labrador</a>"
menu1[6]="<a href='/business/canada/'>&nbsp;&nbsp;Canada</a>"

//Contents for menu 2, and so on
//var menu2=new Array()
//menu2[0]='<a href="http://cnn.com">CNN</a>'
//menu2[1]='<a href="http://msnbc.com">MSNBC</a>'
//menu2[2]='<a href="http://news.bbc.co.uk">BBC News</a>'
		
var menuwidth='175px' //default menu width
var menubgcolor='#666666'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu
