// JavaScript Document

jQuery(document).ready(function(){
	if(jQuery('#portalPanel').length){
		var po = new SWFObject("http://www.gold.org/common/swf/portal.swf", "portalswf", "100%", "60", "6", "#ffffff");
		if(portalZone != null){ // has portalZone been defined by the module?
			po.addVariable('portalZone', portalZone);
			po.addVariable('hostZone', hostZone);
			//alert(portalZone);
		}
		po.addParam('allowScriptAccess','always');
		po.addParam("wmode", "opaque");
		po.write("portalPanel");
	}
	//analytics tracking for downloads
	jQuery('a[href]').click(function(e)
	{
		href = jQuery(this).attr('href');
		filetypes = Array('.pdf','.doc','.xls');
		for(c=0;c<filetypes.length;c++)
		{
		   if (href.indexOf(filetypes[c]) !== -1)
		   {
			   if(href.indexOf('deliver.php') == -1)// protected downloads are tracked via the deliver.php script.
			   {   
					pageTracker._trackEvent("Publications", "Download", href);
			   }
		   }
		}
	});	
	jQuery('a#portalMinimalPanelLink').click(function(e)
	{
		e.preventDefault();
		showPortalMaximised();
	});
});
 

function showPortalMaximised(){
	jQuery('#portalTop').show();
	jQuery('#portalMinimalPanel').height('60px');
   	var po = new SWFObject("http://www.gold.org/common/swf/portal.swf", "portalswf", "100%", "60", "6", "#ffffff");
	if(portalZone != null){ // has portalZone been defined by the module?
		po.addVariable('portalZone', portalZone);
		po.addVariable('hostZone', hostZone);
	}
	po.addParam('allowScriptAccess','always');
	po.addParam("wmode", "opaque");
  	po.write("portalMinimalPanel");	
}


