/*
* RMIT
* Author Adam Phin
* Reactive.com
* Copyright © 2011, RMIT.com
* All rights reserved.
*/
var navigator_is_ie6 = (navigator.appVersion.indexOf("MSIE 6.") == -1) ? false : true;
var $overlay;
var rmit = {
init: function () {
$(document).ready(function () {
$('#expiryTest1').css('border','5px solid #00FF00');
// Don't show group name if sitemap exists
if (($("#sitemap").length == 0) || ($("#subhomepage").length > 0) || ($("#removeSubtitle").length > 0)){
$('#groupName').css('display','none');
}
if(window.location.href.match("VIEW=INTL;")) {
$('.applySection .direct').css('display','none');
$('.applySection .VTAC').css('display','none');
}
if ($(".applySection").length > 0){
$('.applySection').css('float','none');
$('.applySection').css('margin-left','0');
$('.applySection').css('margin-right','0');
$('.applySection').appendTo('#programSecondColumn');
}
// If subhomepage does exist...
if ($("#subhomepage").length > 0){
$('.subhomepageCentrecontent h2:first').replaceWith(function() {
return '
' + $(this).text() + '
';
});
$('.subhomepageCentrecontent h1:first').appendTo('#pageHeading');
$('.subhomepageCentrecontent h2').addClass('h2Fix');
}
// If subhomepage does not exist...
if ($("#subhomepage").length == 0) {
$('#contentpadding h1:first').appendTo('#pageHeading');
}
$('#groupName').css('margin-bottom','20px');
$('#headingContainer').css('display','block');
$('#nav ul').css('display','block');
$('#firstDropMenuLink').click(function(e) { e.preventDefault(); } );
// Site switcher interaction (for Explorer)
jQuery(".dropMenu>li").mouseover(function(e){jQuery(this).addClass("hovermenu")});
jQuery(".dropMenu>li").mouseout(function(e){jQuery(this).removeClass("hovermenu")});
jQuery(".dropMenu li").click(function(e){jQuery(this).toggleClass("hovermenu")});
jQuery(".dropMenu a").focus(function() { $('.dropMenu>li').addClass("hovermenu"); });
jQuery(".dropMenu a").focusout(function() { $('.dropMenu>li').removeClass("hovermenu"); });
// Show skip to content on focus for IE
$('#skipToContent').wrap('');
jQuery("#skipToContent").focus(function() { $(this).css("position","relative"); $(this).css("left","210px"); });
rmit.cufon.init();
rmit.cufon.ready();
rmit.homeUI.init();
rmit.carousel.init();
rmit.promptTexts.init();
});
},
cufon: {
init: function () {
Cufon.replace('.h1, .h2, #groupName, #pageHeading h1, #quickLinks h3', { fontFamily: 'Museo' });
Cufon.replace('#nav a, .titleBlock a h2, .heading', { hover:true });
},
ready: function () {
Cufon.now();
}
},
navigation: {
},
overlay: {
},
homeUI: {
init: function() {
//H3 Placement in dateBlock
$(".dateBlock > div").find("h3:gt(0)").css({ 'padding-top' : '10px'});
// Side Navigation List Borders
$("#sideNav").find("ul:lt(1)").css({ 'border-bottom' : '1px dotted #9c9c9c'});
$('.moreButton').hover(function(){
var panel = $('.panel', $(this).parent());
panel.stop().animate({bottom : '54px'}, {duration: 400, easing:'easeOutCubic'});
}, function() {
var panel = $('.panel', $(this).parent());
panel.stop().animate({bottom : '-30px'}, {duration: 200, easing:'easeOutCubic'});
}
);
$('.moreButton').focusin(function(){
var panel = $('.panel', $(this).parent());
panel.stop().animate({bottom : '54px'}, {duration: 400, easing:'easeOutCubic'});
});
$('.moreButton').focusout(function(){
var panel = $('.panel', $(this).parent());
panel.stop().animate({bottom : '-30px'}, {duration: 200, easing:'easeOutCubic'});
});
}
},
promptTexts: {
init: function() {
// SerachBar
$('#searchBar .searchInput').val('Search');
$('#searchBar .searchInput').bind('focus', function() {
if($(this).val() == 'Search'){
$(this).val('');
}
});
$('#searchBar .searchInput').bind('blur', function(){
if($(this).val() == ''){
$(this).val('Search');
}
});
}
},
carousel: {
init: function () {
var i = 0;
var carouselObj = new Object();
carouselObj.carousel = $('#carouselContent');
carouselObj.currentPage = 1;
carouselObj.totalPages = 0;
//Add THumbnail Holder
$("#carousel").append("");
// Setup Slides
$('li', carouselObj.carousel).each(function () {
i++;
carouselObj.totalPages = i;
$(this).fadeTo(0, 0);
$(this).css({ 'z-index': 1 });
if (i == 1) {
//alert($(".heroContent p" ,this).html() );
$(this).addClass("active");
$(this).fadeTo(0, 1);
$(this).css({ 'z-index': 2 });
}
$(this).addClass("p" + i);
//Add Thumbnails
$("#carouselThumbs").append("Feature " + i + "");
});
$("#carouselThumbs").append("Play / Pause Slideshow");
// Set Thumbnail Click Event
$("#carouselThumbs").css({ 'z-index': 250 });
$('#carouselThumbs li').click(function (e) {
if($(this).hasClass('playPause')) return false;
clearTimeout(window.carouselTimer);
carouselObj.currentPage = $(this).index() + 1;
rmit.carousel.changeSlide(carouselObj.currentPage);
});
// PLAY / PAUSE
$('.playPause').toggle(function(e){
e.preventDefault();
clearTimeout(window.carouselTimer);
$(this).addClass('play')
}, function(e){
e.preventDefault();
rmit.carousel.autoSlide();
$(this).removeClass('play')
})
// Select First Thumbnail
rmit.carousel.highlightThumb(0);
window.carouselObj = carouselObj;
window.carouselTimer = setTimeout(function () { rmit.carousel.autoSlide() }, 10000);
},
autoSlide: function () {
clearTimeout(window.carouselTimer);
window.carouselObj.currentPage++;
if (window.carouselObj.currentPage > window.carouselObj.totalPages) window.carouselObj.currentPage = 1;
rmit.carousel.changeSlide(window.carouselObj.currentPage)
},
changeSlide: function (slideNum) {
$('.active', carouselObj.carousel).removeClass("active").css({'z-index' : 1}).animate({ 'opacity': 0 }, { duration: 500, easing: 'easeOutCubic' });
rmit.carousel.highlightThumb(window.carouselObj.currentPage - 1);
$('.p' + window.carouselObj.currentPage, window.carouselObj.carousel)
.addClass("active").stop().css({'z-index' : 2}).animate({ 'opacity': 1 }, { duration: 500, easing: 'easeOutCubic', complete: function () {
window.carouselTimer = setTimeout(function () { rmit.carousel.autoSlide() }, 10000);
}
});
// IE6 allow hover
if(navigator_is_ie6) {
DD_belatedPNG.fix('.itemPanel');
}
},
highlightThumb: function (thumbNumber) {
$("#carouselThumbs li").each(function () {
if ($(this).index() == thumbNumber) {
$(this).addClass("active");
} else {
$(this).removeClass("active");
}
});
}
}
};
rmit.init();
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}