/*
 * Project: Uracan Resources Ltd.
 * Author: Rudy Affandi
 * Created: 04/01/2011
 * File name: functions.js
 */

// Basic settings
var companyName = 'Uracan Resources Ltd.';
var companyNameShort = 'Uracan Resources';
var ext_link_fr = 'Vous quittez ' + companyNameShort + ' site. Etes-vous sūr de vouloir continuer?';


// 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 = 'no';

// 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 == 'fr'){
      $('html').attr('lang', 'fr');
      // Translate elements to French
		// External link warning dialog
		$('a.ext_link').live('click', function(){
			var link = $(this).attr('href');
			$('<div>Vous quittez ' + companyNameShort + ' site. Etes-vous sūr de vouloir continuer?</div>').dialog({
				title: "Lien externe",
				width: 400,
				modal : true,
				overlay: {
					backgroundColor: '#000',
					opacity: 0.5
				},
				buttons: {
					'Procéder': function() {
						$(this).dialog('close').remove();
						window.open(link);
					},
				  'Annuler': function() {
					  $(this).dialog('close').remove();
					  return false;
					}
				}
			});
			return false;
		});
   }
   else {
      $('html').attr('lang', 'en');
		// External link warning dialog
		$('a.ext_link').live('click', function(){
			var link = $(this).attr('href');
			$('<div>You are leaving ' + companyNameShort + ' site. Are you sure you want to proceed?</div>').dialog({
				title: "External Link",
				width: 400,
				modal : true,
				overlay: {
					backgroundColor: '#000',
					opacity: 0.5
				},
				buttons: {
					'Proceed': function() {
						$(this).dialog('close').remove();
						window.open(link);
					},
				  'Cancel': function() {
					  $(this).dialog('close').remove();
					  return false;
					}
				}
			});
			return false;
		});

   }



});
