var sbx = window.parent.Shadowbox;
var section;
function openTopSBX(el,h){
	if(sbx){
		
		var url = el.name;
		var container;
		if(url.indexOf('recipe') > -1){
			container = '/smg/templateFramework/images/microSites/singletons/miraclegroedibles/mod_recipes_container.html';
            section = 'cook';//recipe
		}else if(url.indexOf('project') > -1){
			container = '/smg/templateFramework/images/microSites/singletons/miraclegroedibles/mod_projects_container.html';
            section = 'gro';//project
		}
		
		// live environment requires this override for the lightboxes to pull in the correct content
		url = "/smg/templateFramework/images/microSites/singletons/miraclegroedibles/" + el.name;
		
		var newHeight = h != undefined ? h : 694;
		window.parent.location.hash = '#'+url;
        //alert(window.parent.location.hash = '#'+url);
		sbx.open(	
			{
				player:		"html",
				height:		806,
				width:		849,
				content: '<iframe marginwidth="0" marginheight="0" width="806" scrolling="no" height="'+newHeight+'" id="modal-iframe" src="'+container+'" frameborder="0"></iframe>',
			    options:{
							modal: false,

							// check the height of the content and resize the top iframe onOpen
							// might need to do this onLoad of the iframe instead to get it to recognize the actual height of the content
							//onOpen: function(){ alert(url); },
							
							// not working yet...trying to get the height of the content in the iframe with id of "modal-iframe" so we can use that to set the height dynamically
							//onOpen: function(){ alert("height = " + document.getElementById("modal-iframe").style.height); },
							
							// remove the hashed URL and replace with only '#' onClose
							onClose: function(){ window.parent.location.hash = '#'; }
						} 
					
			}
		);
		//Track Analytics
		s.t(this,'e','edibles:'+section+":"+url);
		//alert('edibles:'+section+":"+url);
		return false;
	}else{
		return true;
	}
}
