/*
 * Project: Laurion Mineral Exploration Inc.
 * Author: Rudy Affandi
 * Created: 05/21/2011
 * File name: functions.js
 */

// Basic settings
var companyName = 'Laurion Mineral Exploration Inc.';

// 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);

// jQuery initialization and CSS settings, waiting for DOM tree to initialize
$(document).ready(function(){

   // Set language information and retrieve associated content
   if (lang_selector == 'esp'){
      $('html').attr('lang', 'es');
   }
   else {
      $('html').attr('lang', 'en');
   }

   // Home page slideshow
   var path = $(location).attr('href');
   var filename = path.match(/.*\/([^/]+)\.([^?]+)/i)[1];
   if (filename == 'home')
   {
      $('.front_img').cycle({
         fx:     'fade',
         speed:  'slow',
         timeout: 4000,
         pager:  '.front_img_nav',
		   slideExpr: 'img'
      });
   }
   
   // Home page tagline
   $('.front_tagline').wrapInner('<h1></h1>');

   // Remove separator from main nav
   $('#nav li:nth-child(2)').css('background', 'none');

   // Get section title and display in header image
   var sectionTitle = $('.content_side h2').text();
   $('.header_img').append('<h2>' + sectionTitle + '</h2>');
   
   // Rounded corners
   $('input.field').addClass('ui-corner-left');
   $('input.submit').addClass('ui-corner-right');
   
   
   // Projects map tooltip
   $('area').each(function(){
      $(this).qtip(
      {
         content: $(this).attr('alt'), // Use the ALT attribute of the area map
         style: {
            name: 'dark', // Give it the preset dark style
            color: '#5e4400',
            background: '#ffffff',
            border: {
               width: 0,
               radius: 4,
               color: '#ffffff'
            }, 
            tip: true // Apply a tip at the default tooltip corner
         }, 
         position: { corner: { target: 'topLeft', tooltip: $(this).attr('rel') } },
         hide: { when: 'mouseout', fixed: true }
      });
   });
});




