/* -------------------------------------------------------------- */ 
/*   functions required for all web pages                         */
/* -------------------------------------------------------------- */


/* Navigate to a community when it's selected in the dropdown list. */
function jumpPage(newLoc) 
{
     newPage = newLoc.options[newLoc.selectedIndex].value; 
     if (newPage == "thebayview")
		{
		thebayviewWin = window.open("http://www.thebayview.ca", "bayviewWin", "toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,statusbar=yes,directories=no,height=550,width=750,top=100,left=100");
		}
     else
		{
     		if (newPage != "") 
	      	window.location = newPage;
            }
}

/* Give each li within the menu container a class called menuhover. This
will be used to slide the dropdown/dropup menus into view. This function
is needed only for Internet Explorer since it doesn't fully support the 
hover pseudo class. This code is adapted from a script developed by 
Patrick Griffiths and Dan Webb and shown at 
http://www.htmldog.com/articles/suckerfish/dropdowns */

function setLIhover(menuID) {
	var subEls = document.getElementById(menuID).getElementsByTagName("LI");
	for (var i=0; i<subEls.length; i++) {
		subEls[i].onmouseover=function() {
			this.className+=" menuhover";
		}
		subEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" menuhover\\b"), "");
		}
	}
}   

/* -------------------------------------------------------------- */
/*   functions required for image changes                         */
/* -------------------------------------------------------------- */
var homePage = 1;
var bannerPage = 2; 
var image2Name;
var image1Obj;
var image2Obj;
var transparency;

function changeOpacity(objId, opacity) 
{
	if (opacity == 1.00) opacity = 0.999;
	objId.style.KHTMLOpacity = opacity;
	objId.style.MozOpacity = opacity;
	objId.style.opacity = opacity;
}
 
function revealNextPhoto()
{		  
	if (transparency >= 0.02)
		{
		transparency = transparency - 0.02;  
		changeOpacity(image1Obj, transparency);  
		setTimeout("revealNextPhoto()", 30);  
		}
	else
		{
		if (transparency > 0)
			changeOpacity(image1Obj, 0);  
		}  
}

function startTransition() 
{  
	if (image1Obj.filters)
		{
		image1Obj.style.filter="blendTrans(duration=3)";
		image1Obj.filters["blendTrans"].apply(); 
		image1Obj.src = image2Name;
		image1Obj.filters["blendTrans"].play();
		}
	else
		{   
		image2Obj.style.backgroundImage = 'url(' + image2Name + ')';    	
		transparency = 1.0; 
		revealNextPhoto(); 		
		}		 
}

function changeImage(page, currentImageObj, newImageObj, newImageName)
{	 
	image2Name = newImageName;
	image1Obj = currentImageObj;
	image2Obj = newImageObj;

	if (page == homePage)
		setTimeout("startTransition()", 3000); 
	else
		if (page == bannerPage)
 			setTimeout("startTransition()", 3000); 	 
}



 

 