/*
 * Project: Western Gold & Copper Corporation
 * Author: Rudy Affandi
 * Created: 09/22/2011
 * File name: functions.js
 */

// Basic settings
var companyName = 'Western Gold & Copper 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
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 from CSS
	$.preloadCssImages();

   // Set language information, default to English
   $('html').attr('lang', 'en');

	// Set h tag margin
   $('.content_body h2:first, .content_body h3:first').not('.col h2').css('margin-top', '0');

	// Financials, check if PDF exist
	$('.fs_format div.link a').each(function() {
		if	( $(this).attr('href').length <= 0 )
		{
			$(this).hide();
		}
	});

   // Home page slideshow
   var path = $(location).attr('href');
   var filename = path.match(/.*\/([^/]+)\.([^?]+)/i)[1];
   filename = filename.toLowerCase();
   if (filename == 'home')
   {
      $('#slideshow').cycle({
         fx: 'fade',
         speed: 'slow',
         pager: '#slidenav',
         timeout: 5000
      });
   }

   // Fix Cufon refresh issue with navigation colour
   if (cufon_nav == 'yes')
   {
		$('.dropdown li a').ready(function(){
			Cufon.refresh();
		});

		$('.dropdown li').mouseout(function(){
			Cufon.refresh();
		});
   }

   // Initiate shadowbox
    Shadowbox.init();

	// Table cleanup
	//$('table.table1 td[rowspan]').css('background', '#f0f0f0');

});
