//var $j = jQuery.noConflict();
// passing the jQuery object to prevent conflict with
// other libraries that are potentially using the $
(function ($) {
// shorthand for $(document).ready(function(){});
$(function () {
// Skip link fix for Webkit and Opera
// The focus order doesn't move when an anchor links to an element
// in the same page
var is_webkit = navigator.userAgent.toLowerCase().indexOf('webkit') > -1,
is_opera = navigator.userAgent.toLowerCase().indexOf('opera') > -1;
if (is_webkit || is_opera) {
if (location.hash) { setFocus(location.hash); }
$('.accessLink').click(function () { setFocus($(this).attr('href')); });
function setFocus(href) { $(href).attr('tabindex', 0).focus(); };
}
//Support html entities in titles
function isPageEditor() {
if (typeof Sitecore == "undefined") {
return false;
}
if (typeof Sitecore.PageModes == "undefined" || Sitecore.PageModes == null) {
return false;
}
return Sitecore.PageModes.PageEditor != null;
}
if (isPageEditor() == false) {
$('h1, .sidenav a, .breadcrumb a, .breadcrumb strong, .navItem').each(function () {
var encode = $(this).text();
$(this).html(encode);
});
}
//Main Navigation Equal Height
var nMaxHeight = 0;
$('.mnlist').find('li').each(function () {
var h = $(this).height() + 5;
nMaxHeight = (nMaxHeight < h) ? h : nMaxHeight;
});
$('.mnlist').find('li').each(function () {
var $this = $(this),
nMT = Math.round((nMaxHeight - $this.height()) / 2) + 5;
$this.css({ height: (nMaxHeight / 13) + 'em' });
$this.find('span.navItem').css({ 'padding': nMT + 'px 0' });
});
// Sliders
$('.textSlider').nlcslider({
transitionType: 'slideHor',
isAutoPlay: true,
autoHideControls: false,
showNumbersBtn: false,
showProgress: false,
btnPlayLabel: '',
btnPauseLabel: ''
});
$('.bannerSlider').nlcslider({
transitionType: 'fade',
showProgress: false,
onLoaded: function () {
setupSlideAnimation(this);
animateSlideIn(this);
},
beforeSlide: function () {
setupSlideAnimation(this);
},
afterSlide: function () {
animateSlideIn(this);
}
});
function animateSlideIn($slide) {
$slide.find('h2').stop().animate({ opacity: 1, 'top': '20px' }).animate({ 'top': '0' });
$slide.find('p').stop().delay(100).animate({ opacity: 1, 'top': '20px' }).animate({ 'top': '0' });
$slide.find('.nlcslider-slideContentText').animate({ opacity: 1, bottom: '150px' }).animate({ bottom: '150px' });
}
function setupSlideAnimation($slide) {
$slide.find('h2').css({ opacity: 0, position: 'relative', 'top': '-150px;' });
$slide.find('p').css({ opacity: 0, position: 'relative', 'top': '-150px' });
$slide.find('.nlcslider-slideContentText').css({ opacity: 0, bottom: '150px' });
}
$('.nlcslider-slideJS').css('position', 'absolute');
$('.ie6').find('.customDDParent').hover(function () {
$(this).addClass('dd-hover');
}, function () {
$(this).removeClass('dd-hover');
});
// =PrettyPhoto
// $("a[rel^='prettyPhoto']").prettyPhoto({
// animationSpeed: 'fast',
// padding: 30,
// opacity: 0.60,
// showTitle: true,
// allowresize: true,
// counter_separator_label: '/',
// theme: 'dark_square',
// close_text: "Close",
// previous_text: "Previous",
// next_text: "Next",
// deeplinking: false,
// arrow_previous_text: "Previous",
// arrow_next_text: "Next",
// modal: false,
// social_tools: false,
// changepicturecallback: function () {
// $('.pp_close').focus();
// },
// callback: function () {
// $('.mainContent .mainVideo').css('visibility', 'visible');
// }
// }).click(function () {
// $('.mainContent .mainVideo').css('visibility', 'hidden');
// });
// =PrettyPhoto
// $("a[class^='prettyPhoto']").prettyPhoto({
// animationSpeed: 'fast',
// padding: 30,
// opacity: 0.60,
// showTitle: true,
// allowresize: true,
// counter_separator_label: '/',
// theme: 'dark_square',
// close_text: "Close",
// previous_text: "Previous",
// next_text: "Next",
// deeplinking: false,
// arrow_previous_text: "Previous",
// arrow_next_text: "Next",
// modal: false,
// social_tools: false,
// changepicturecallback: function () {
// $('.pp_close').focus();
// },
// callback: function () {
// $('.mainContent .mainVideo').css('visibility', 'visible');
// }
// }).click(function () {
// $('.mainContent .mainVideo').css('visibility', 'hidden');
// });
// =Placeholder fallback
$('input[placeholder]').placeholder();
// Custom dropdown items (Homepage)
$('.content ul.customDDChildren').hide();
$('.content a.customDDParentLink').live('click', function (e) {
$(this).next('ul.customDDChildren').addClass('showdd');
if ($(this).next('ul.customDDChildren').hasClass('showdd')) {
$(this).next('ul.customDDChildren').css('display', 'block');
}
e.preventDefault();
});
// Hide dropdowns on mouseleave
$('.content li.customDDParent').mouseleave(function () {
$(this).find('ul.customDDChildren').delay(0).slideUp(0).removeClass('showdd');
});
// =Common tab component
$('div.tabComponent div.componentPane').hide();
$("div.tabComponent ul.tabs").each(function () {
$(this).find('li:first').addClass("active");
$(this).next('div.panes').find('div.componentPane:first').show();
});
$("div.tabComponent ul.tabs li a").click(function () {
var cTab = $(this).closest('li');
cTab.siblings('li').removeClass("active");
cTab.addClass("active");
cTab.closest('ul.tabs').nextAll('div.panes:first').find('div.componentPane').hide();
var activeTab = $(this).attr("href");
$(activeTab).fadeIn(800);
return false;
});
// =Simple accordion widget
$('div.accordion h3 a').click(function () {
$(this).parent().toggleClass('active');
$(this).parent().next('div.accordion div.accordionPane').slideToggle('fast');
return false;
});
//$('div.accordion div.accordionPane').hide();
//$('div.accordion div.accordionPane:first').show();
if ($('div.accordion div.accordionPane').is(':visible')) {
$('div.accordion h3:first').addClass('active');
}
// =Addional form validation
$('.textField').find('.input-text').each(function () {
if ($(this).hasClass('error')) {
$(this).parent().addClass('error');
}
else {
$(this).parent().removeClass('error');
}
});
// Insert YouTube API
// var tag = document.createElement('script');
// tag.src = "http://www.youtube.com/player_api";
// $j('body').append(tag);
function BindDDLProvinceSelected(itemid, selected) {
var divProvince = $j('#' + itemid).parent().next(".provinceddl");
if (divProvince.length > 0) {
var lblprovince = divProvince.children("label");
var ddProvince = divProvince.children("select");
var hdnProvince = divProvince.children(":hidden");
var txtProvince = divProvince.find("input:text");
var txtWrapper = divProvince.find(".wrapper");
var foundselected = false;
if (lblprovince.attr('default') == null) { lblprovince.attr('default', lblprovince.html()); }
if (selected != "") {
$j.ajax({
type: "POST",
url: "/WebMethods/WebMethods.asmx/GetProvinces",
data: "{selectedCountryID: '" + selected + "', currentCountryText: '" + txtProvince.val() + "', selectedProvince: '" + hdnProvince.val() + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
if (data == null || data.d.length == 0) {
ddProvince.hide();
txtProvince.show();
txtWrapper.addClass("textField");
ddProvince.children().remove();
} else {
ddProvince.children().remove();
$j.each(data.d, function (i, item) {
var selected = false;
if (item.Selected) { selected = true; foundselected = true; }
if (selected) {
ddProvince.append($j('