/*
 * Project: Adanac Molybdenum Corporation
 * Author: Rudy Affandi
 * Created: 09/15/2011
 * File name: functions.js
 */

// Basic settings
var companyName = 'Adanac Molybdenum Corporation';

// Main navigation drop down, 3rd level settings (please enter 'yes' or 'no')
var allow_main_3rd_level = 'yes';

// Side navigation drop down, 3rd level settings (please enter 'yes' or 'no')
var allow_side_3rd_level = 'yes';

// Grab language selector from scripts alias
if (jQuery().url){// Check if plugin loaded
	var lang_selector = jQuery.url.segment(0);
}
// Cufon usage in main navigation
var cufon_nav = 'yes';

// jQuery initialization and CSS settings, waiting for DOM tree to initialize
$(document).ready(function(){
	// Preload images
	$.preLoadImages('/i/common/front_img.jpg');

   // Set language information and retrieve associated content
   $('html').attr('lang', 'en');

	// Set h tag margin
   $('.content_body h2:first, .content_body h3:first').css('margin-top', '0');

	// Financials, check if PDF exist
	$('.fs_format div.link a').each(function() {
		if	( $(this).attr('href').length <= 0 )
		{
			$(this).hide();
		}
	});

   // Fix Cufon refresh issue with navigation colour
   if (cufon_nav == 'yes')
   {
		$('.dropdown li a').ready(function(){
			Cufon.refresh();
		});

		$('.dropdown li').mouseout(function(){
			Cufon.refresh();
		});
   }

	// Table cleanup
	$('table.table1 td[rowspan]').css('background', '#f0f0f0');

	// Play video
   var path = $(location).attr('href');
   var filename = path.match(/.*\/([^/]+)\.([^?]+)/i)[1];
   filename = filename.toLowerCase();
   if (filename == 'historical_video')
   {
		flowplayer(
			"fp",
			"/cc/lib/flowplayer/flowplayer-3.2.7.swf",
			"/i/media/historical_video.flv"
		);
	}

});
