/*
 * Project: Coro Mining Corporation
 * Author: Rudy Affandi
 * Created: 07/05/2011
 * File name: functions.js
 */

// Basic settings
var companyName = 'Coro Mining Corporation';

// Main navigation drop down, 3rd level settings (please enter 'yes' or 'no')
var allow_main_3rd_level = 'no';

// 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);

// jQuery initialization and CSS settings, waiting for DOM tree to initialize
$(document).ready(function(){
   // Set language information and retrieve associated content
   if (lang_selector == 'de'){
      $('html').attr('lang', 'de');
      $('.header_lang a[href*="/de/"]').addClass('active');
      // Translate elements to German
   }
   else {
      $('html').attr('lang', 'en');
      $('.header_lang a[href*="/s/"]').addClass('active');
   }

	// Preload images
	$.preLoadImages('/i/common_2011/front_content_bg.png', '/i/common_2011/main_bg.jpg', '/i/common_2011/section_img_1.jpg', '/i/common_2011/section_img_2.jpg', '/i/common_2011/section_img_3.jpg', '/i/common_2011/section_img_4.jpg', '/i/common_2011/section_img_5.jpg');

   $('.front_feat ul li').each(function(index, element){
      $(element).attr('id', 'f'+index);
   });

   $('.content_body h2:first').css('margin', '0');

   // Projects map tooltip using imagemap
   $('#map area').each(function(){
      $(this).qtip(
      {
         content: $(this).attr('alt'), // Use the ALT attribute of the area map
         style: {
            color: '#fff',
            background: '#0c383d',
            border: {
               width: 0,
               radius: 4,
               color: '#c8a54e'
            },
            tip: true // Apply a tip at the default tooltip corner
         },
         position: { corner: { target: 'topLeft', tooltip: $(this).attr('rel') } },
         hide: { when: 'mouseout', fixed: true }
      });
   });

});
