	

	//set up a couple of variables
	var oFlv;
	var prevPage = "";
	var curPage = "";
	var pageClosed = true;
	var tId = 0;
	var pageTimeoutValue = 600000;



	//identify the flash object on the page
	function getFlashMovieObject()
	{ 
		var movieName = "bbrbg";

		if(document.embeds[movieName])	return document.embeds[movieName];
		if(window.document[movieName])	return window.document[movieName];
		if(window[movieName])	return window[movieName];
		if(document[movieName])	return document[movieName];
		return null;
	}
	
	//use this to pass a different bg pic into the flash app
	function changeFlashImage(thePic)
	{
		oFlv.changePic(thePic);
	}
	
	//old function - this will cause the viewport of the flas bg to change in size (%)
	function changeFlashSize(newSize)
	{
		oFlv.changeSize(newSize);
	}


	// exit the gallery	
	function exitGallery()
	{
		setTimeout('document.location = "index.php"', 500);
		
		//objMenu.style.visibility = "visible";
		//changeFlashSize(100);
		//oFlv.galleryMode();
		//animatedcollapse.show("menu");
	}
	
	// take me to the gallery	
	function goToGallery()
	{
		//objMenu.style.visibility = "hidden";
		//changeFlashSize(100);
		
		oFlv.galleryMode();
        
        //animatedcollapse.hide(prevPage);
		//animatedcollapse.hide("menu");
		//pageTracker._trackPageview("galleryPage");
	}
	
	//use this to read url string
	function getUrlVars()
	{
	    var vars = [], hash;
	    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
	 
	    for(var i = 0; i < hashes.length; i++)
	    {
	        hash = hashes[i].split('=');
	        vars.push(hash[0]);
	        vars[hash[0]] = hash[1];
	    }	 
	    return vars;
	}


	
	function openMap()
	{
		window.open('includes/map.htm','x','menubar=1,scrollbars=1,toolbar=1,resizable=0,height=700,width=500,top=0,left=0');
	}


	function doExplore()
	{
		$("#mainPic").fadeOut(1000);
		$('.slidebox .slide').dumbCrossFade("jump", 0);
		setTimeout('$("#promo").fadeIn(1000)', 500);
		setTimeout("$('.slidebox .slide').dumbCrossFade('start')", 500);
	}

	function goHome()
	{
		$(function() 
		{
			$('.slidebox .slide').dumbCrossFade("jump", 0);
			$('.slidebox .slide').dumbCrossFade('stop');
		});
		$("#promo").fadeOut(1300);
		$("#mainPic").fadeIn(1300);
	}


function getNewSubmitForm()
{
    var submitForm = document.createElement("form");
    document.body.appendChild(submitForm);
    submitForm.method = "post";
    return submitForm;
}


function createNewFormElement(inputForm, elementName, elementValue)
{
    //var el = "<input name='" + elementName + "' type='hidden'>";
    
    var newElement = document.createElement("input");
    newElement.setAttribute("name", elementName);
    newElement.setAttribute("value", elementValue); 
    inputForm.appendChild(newElement);
    newElement.value = elementValue;
    return newElement;
}

function loadPromoPicture(picName)
{
    var submitForm = getNewSubmitForm();
    createNewFormElement(submitForm, "p", picName);
    submitForm.action= "gallerypromo.php";
    submitForm.submit();
}








    
    function getQuerystring(key, default_)
	{
	    if (default_==null) default_="";
	    key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	    var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
			    var qs = regex.exec(window.location.href);
			    if(qs == null)
				    return default_;
			    else
				    return qs[1];
	}
    
    
    
    
    
    
