
/* - test.js - */
$(document).ready(function(){

		if ($("#right-col")[0]){
                        $('#right-col').append('<div id="showSocialMedia"></div>');
			showSocialMedia();
		}

		function showSocialMedia() {
				$.ajax({
					url : "showSocialMedia.txt",
					dataType: "text",
					success : function (data) {
						$("#showSocialMedia").html(data);
					}
				});
		}


			$("#fees-struct").fancybox({'titlePosition': 'inside'});
			$("#fees-unstruct").fancybox({'titlePosition': 'inside'});
			$("#fees-unstruct2").fancybox({'titlePosition': 'inside'});

$("#various3").fancybox({
    'width': 690,
    'height': 440,
    'autoScale'		: false,
    'transitionIn'	: 'none',
    'transitionOut'	: 'none',
    'type'		: 'iframe',
    'title'         : 'UHI Interactive referencing tutorial'
});

$("#various4").fancybox({
    'width': 690,
    'height': 440,
    'autoScale'		: false,
    'transitionIn'	: 'none',
    'transitionOut'	: 'none',
    'type'		: 'iframe',
    'title'         : 'UHI Interactive referencing tutorial'
});


var url = document.URL;	     


// Show and hide the english and gaelic footers //
if(url.indexOf('/en') > -1) {
    $('#showGaelic').css('display','none');
    $('#showEnglish').css('display','block');
    $('#showG').css('display','none');
    $('#showE').css('display','block');
}
else if(url.indexOf('/gd') > -1) {
    $('#showGaelic').css('display','block');
    $('#showEnglish').css('display','none');
    $('#showG').css('display','block');
    $('#showE').css('display','none');
}


// underline the sub-actions when active //
if(url.indexOf('/students') > -1) {
    $('#portal-subactions #siteaction-STUDENTS a').css('text-decoration', 'underline');
    $('#portal-subactions #siteaction-Oileanaich a').css('text-decoration', 'underline');
}
if(url.indexOf('/alumni') > -1) {
    $('#portal-subactions #siteaction-ALUMNI a').css('text-decoration', 'underline');
}
if(url.indexOf('/staff') > -1) {
    $('#portal-subactions #siteaction-STAFF a').css('text-decoration', 'underline');
    $('#portal-subactions #siteaction-copy_of_Oileanaich a').css('text-decoration', 'underline');
}

// Change colour of headings in each section to match the menu colour //

if(url.indexOf('/courses') > -1) {
	if (document.createStyleSheet){
		document.createStyleSheet('courses_public.css');
	}
	else {
	$("head").append($("<link rel='stylesheet' href='courses_public.css' type='text/css' media='screen' />"));
	}
}
if(url.indexOf('/studying-at-uhi') > -1) {
	if (document.createStyleSheet){
		document.createStyleSheet('study_public.css');
	}
	else {
	$("head").append($("<link rel='stylesheet' href='study_public.css' type='text/css' media='screen' />"));
	}
}

if(url.indexOf('/libraries') > -1) {
	if (document.createStyleSheet){
		document.createStyleSheet('study_public.css');
	}
	else {
	$("head").append($("<link rel='stylesheet' href='study_public.css' type='text/css' media='screen' />"));
	}
}

if(url.indexOf('/campuses') > -1) {
	if (document.createStyleSheet){
		document.createStyleSheet('campuses_public.css');
	}
	else {
	$("head").append($("<link rel='stylesheet' href='campuses_public.css' type='text/css' media='screen' />"));
	}
}

if(url.indexOf('/research-enterprise') > -1) {

	if (document.createStyleSheet){
		document.createStyleSheet('research_public.css');
	}
	else {
		$("head").append($("<link rel='stylesheet' href='research_public.css' type='text/css' media='screen' />"));
	}
}

if(url.indexOf('/students') > -1) {
	if (document.createStyleSheet){
		document.createStyleSheet('students_public.css');
	}
	else {
	$("head").append($("<link rel='stylesheet' href='students_public.css' type='text/css' media='screen' />"));
	}
}


$('ul.tabs li a').click(function () {location.hash = $(this).attr('href');
																  
}); 


if(url.indexOf('/support/red-button') > -1) {
     var submit = $('div.formControls').find('input[type=submit]');
     submit.hide();
     submit.after('<input type=image src=redButton.png />');
};


	   });

