jQuery(function ($) {
$(".active").parent().parent(".menu-item").addClass('active');
//$(" ").appendTo(".menu-item-has-children > a")
//$(".menu-item-has-children > a").append(" ")
//]\]equalCols();
$("[data-toggle='tooltip']").tooltip();
$("[data-toggle='popover']").popover();
textFit($('#welcome-box h1'),{minFontSize:18, maxFontSize: 28})
textFit($('#welcome-box .lead'),{minFontSize:16, maxFontSize: 18})
// Javascript to enable link to tab
/* var hash = document.location.hash;
var prefix = "tab-";
if (hash) {
var tab_link='.nav a[href='+hash.replace("#","#"+prefix)+']';
if($(tab_link).lenght>0){
$(tab_link).tab('show');
$('html, body').animate({
scrollTop: $(tab_link).offset().top
}, 1000);
}
}
// Change hash for page-reload
$('.nav a').on('shown.bs.tab', function (e) {
window.location.hash = e.target.hash.replace("#" + prefix, "#");
});*/
jQuery(".nav-list .menu-item a[href$='#']").click(function(){
jQuery('.active').removeClass('active current_page_item');
jQuery(this).parent().addClass('active');
});
$('.gallery').each(function() {
$(this).magnificPopup({
delegate: "a",
type: "image",
gallery: {
enabled: true,
navigateByImgClick: true,
preload: [0,1] // Will preload 0 - before current, and 1 after the current image
}
});
});
$('.yt_video').magnificPopup({
type: 'iframe',
});
//var icl_vars;
//icl_vars['current_language']="en";
//alert(icl_vars['current_language']);
if(typeof icl_vars != "undefined"&&icl_vars['current_language']=="ar"){
listen_txt="استمع";
lang='ar_ar';
}
else{
listen_txt="Listen";
lang='en_uk';
}
$('.breadTrail ol, .page-services .wpb_wrapper').append(
'
' +
'
| ' +
'
| ' +
'
| ' +
'
| ' +
'
| ' +
'
| ' +
'
| ' +
'
العربية ');
if($.cookie("hct-color"))
$("html").addClass($.cookie("hct-color"));
$(".color-switch a").click(function() {
cur_btn=$(this);
$.each(["tdefault","tred","tblue","tgreen",'torange'], function(index,value){
$("html").removeClass(value);
if(cur_btn.hasClass(value)){
$("html").addClass(value);
$.cookie("hct-color", value, { path: '/', expires: 365, domain:'.hct.ac.ae' });
}
});
return false;
});
if (LangPref == "ARB")
{
$("#langRefText").text('English');
$("#langRefText").attr("dir", "ltr");
}
else
{
$("#langRefText").text('العربية');
$("#langRefText").attr("dir", "rtl");
}
// if (BW == "") { BW = "N"; }
//if (BW == 'Y') {
// $("#lnkcss").attr("href", '//cdn.hct.ac.ae/bootstrap/3.3.4/css/bootstrap_black_theme.css');
// $("#lnkcssstyle").attr("href", 'Content/hct-style_bw.css');
//}
//else {
// $("#lnkcss").attr("href", 'Content/themes/bootstrap/bootstrap.min.css');
// $("#lnkcssstyle").attr("href", 'Content/hct-style.css');
//}
if(typeof spotlight_carousel != "undefined"){
//$("#"+spotlight_carousel.carousel_id).carousel({interval: spotlight_carousel.interval});
carousel_parent="#"+spotlight_carousel.carousel_id;
if(spotlight_carousel.items)
items_count=spotlight_carousel.items;
else
items_count=4;
$(carousel_parent).owlCarousel({
items : items_count,
loop:true,
autoPlay: 7000,
stopOnHover:true,
navigation:true,
lazyLoad: true,
rtl:true,
navigationText: [
'',
''
],
scrollPerPage:true,
afterUpdate: function () {
updateSize();
},
afterInit:function(){
updateSize();
}
});
// equalCols("#"+spotlight_carousel.carousel_id);
}
if(typeof news_carousel != "undefined"){
carousel_parent="#"+news_carousel.carousel_id;
$( carousel_parent ).sliderPro({
width: "100%",
height: 480,
orientation: 'vertical',
loop: false,
autoplay:true,
autoplayDelay:8000,
arrows: true,
buttons: false,
thumbnailsPosition: news_carousel.thumb_position,
thumbnailPointer: true,
thumbnailWidth: 340,
breakpoints: {
992: {
thumbnailsPosition: 'bottom',
thumbnailWidth: 270,
thumbnailHeight: 100,
orientation: 'horizontal',
height: 400
},
500: {
thumbnailsPosition: 'bottom',
thumbnailWidth: 135,
thumbnailHeight: 100,
orientation: 'horizontal',
height: 320
}
}
});
}
if(typeof events_carousel != "undefined"){
carousel_parent="#"+events_carousel.carousel_id;
$( carousel_parent ).sliderPro({
width: 450,
height: 300,
loop: true,
autoplay:true,
autoplayDelay:4000,
arrows: true,
buttons: false,
aspectRatio: 1.5,
visibleSize: '100%',
slideDistance:30,
imageScaleMode:'contain',
});
}
if(typeof carousel != "undefined"){
$.each(carousel,function (index,item) {
//$("#"+item.carousel_id).carousel({interval: item.interval});
carousel_parent="#"+item.carousel_id+' .slides';
$(carousel_parent).owlCarousel({
autoPlay: item.interval,
stopOnHover:true,
slideSpeed : 300,
paginationSpeed : 400,
singleItem:true,
transitionStyle : "fade",
lazyLoad: true,
rtl:true,
afterInit: function(){
var caption = $(carousel_parent).find(".item").eq(0).find('.carousel-caption');
$('#right .overlay-caption').html(caption.html());
},
afterMove: function(){
var caption=$(carousel_parent).find(".item").eq(this.currentItem).find('.carousel-caption');
$('#right .overlay-caption').fadeOut(500,function(){
$('#right .overlay-caption').html(caption.html());
$('#right .overlay-caption').fadeIn(500);
});
}
});
/*if(item.carousel_id=="home-slider"){
var caption = $('#home-slider .item:nth-child(1) .carousel-caption');
$('#right .overlay-caption').html(caption.html());
caption.css('display','none');
$("#home-slider").on('slide.bs.carousel', function(evt) {
var caption = $('#home-slider .item:nth-child(' + ($(evt.relatedTarget).index()+1) + ') .carousel-caption');
caption.css('display','none');
$('#right .overlay-caption').fadeOut(500, function() {
$('#right .overlay-caption').html(caption.html());
$('#right .overlay-caption').fadeIn(500);
});
});
}*/
});
}
if(typeof page_top_box_bg != "undefined"){
var bg_images=page_top_box_bg.bg_images;
var rand_index= Math.floor(Math.random() * bg_images.length);
$('#page-top-box').css({'background-image': 'url(' + bg_images[rand_index] + ')'});
}
/*$.ajax({
url: "http://www.hct.ac.ae/content/uploads/menu-top-links.json",
//force to handle it as text
dataType: "json",
async: true,
success: function(data) {
//data downloaded so we call parseJSON function
//and pass downloaded data
alert(data);
var json = $.parseJSON(data);
//now json variable contains data in json format
//let's display a few items
$('#results').html('Plugin name: ' + json.name + '
Author: ' + json.author.name);
}
});
*/
/*
var flickerAPI = "http://www.webtest1.hct.ac.ae/files/menu-test.json";
$.getJSON( flickerAPI)
.done(function( data ) {
alert(data);
/* $.each( data.items, function( i, item ) {
$( "" ).attr( "src", item.media.m ).appendTo( "#images" );
if ( i === 3 ) {
return false;
}
});*/
//});
});
/*if(item.carousel_id=="home-slider"){
var caption = $('#home-slider .item:nth-child(1) .carousel-caption');
$('#right .overlay-caption').html(caption.html());
caption.css('display','none');
$("#home-slider").on('slide.bs.carousel', function(evt) {
var caption = $('#home-slider .item:nth-child(' + ($(evt.relatedTarget).index()+1) + ') .carousel-caption');
caption.css('display','none');
$('#right .overlay-caption').fadeOut(500, function() {
$('#right .overlay-caption').html(caption.html());
//$('#right .overlay-caption p,#right .overlay-caption h3,#right .overlay-caption blockquote').fitText(.8, { minFontSize: '15px', maxFontSize: '21px' })
//textFit($('#right .overlay-caption p, #right .overlay-caption blockquote'),{minFontSize:12, maxFontSize: 14});
$('#right .overlay-caption').fadeIn(500);
});
});
}
*/
function updateSize(){
var minHeight=parseInt($('.owl-item .equalHero1').eq(0).css('height'));
$('.owl-item .equalHero1').each(function () {
var thisHeight = parseInt($(this).css('height'));
minHeight=(minHeightminHeight){
$(this).css('margin-top',-1*(thisHeight-minHeight)+'px');
}
});*/
}
(function( $ ){
$.fn.fitText = function( kompressor, options ) {
// Setup options
var compressor = kompressor || 1,
settings = $.extend({
'minFontSize' : Number.NEGATIVE_INFINITY,
'maxFontSize' : Number.POSITIVE_INFINITY
}, options);
return this.each(function(){
// Store the object
var $this = $(this);
// Resizer() resizes items based on the object width divided by the compressor * 10
var resizer = function () {
$this.css('font-size', Math.max(Math.min($this.width() / (compressor*10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)));
};
// Call once to set.
resizer();
// Call on resize. Opera debounces their resize by default.
$(window).on('resize.fittext orientationchange.fittext', resizer);
});
};
})( jQuery );
$.fn.max = function(selector) {
return Math.max.apply(null, this.map(function(index, el) { return selector.apply(el); }).get() );
};
//Textfit
(function(e,t){"use strict";if(typeof define==="function"&&define.amd){define([],t)}else{e.textFit=t()}})(typeof global==="object"?global:this,function(){"use strict";return function(t,n){function u(e){if(!l(e)||!r.reProcess&&e.getAttribute("textFitted")){return false}if(!r.reProcess){e.setAttribute("textFitted",1)}var t,n,i,s;var o,u,p;i=e.innerHTML;s=f(e);n=a(e);if(!s||!r.widthOnly&&!n){if(window.console&&!r.suppressErrors){if(!r.widthOnly)console.info("Set a static height and width on the target element "+e.outerHTML+" before using textFit!");else console.info("Set a static width on the target element "+e.outerHTML+" before using textFit!")}return false}if(i.indexOf("textFitted")===-1){t=document.createElement("span");t.className="textFitted";t.style["display"]="inline-block";t.innerHTML=i;e.innerHTML="";e.appendChild(t)}else{t=e.querySelector("span.textFitted");if(c(t,"textFitAlignVert")){t.className=t.className.replace("textFitAlignVert","")}}if(r.alignHoriz){e.style["text-align"]="center";t.style["text-align"]="center"}var d=r.multiLine;if(r.detectMultiLine&&!d&&t.offsetHeight>=parseInt(window.getComputedStyle(t)["font-size"],10)*2){d=true}if(!d){e.style["white-space"]="nowrap"}o=r.minFontSize+1;p=r.maxFontSize+1;while(o<=p){u=parseInt((o+p)/2,10);t.style.fontSize=u+"px";if(t.offsetWidth<=s&&(r.widthOnly||t.offsetHeight<=n)){o=u+1}else{p=u-1}}t.style.fontSize=u-1+"px";if(r.alignVert){h();var v=t.offsetHeight;if(window.getComputedStyle(e)["position"]==="static"){e.style["position"]="relative"}if(!c(t,"textFitAlignVert")){t.className=t.className+" textFitAlignVert"}t.style["height"]=v+"px"}}function a(e){var t=window.getComputedStyle(e,null);return e.clientHeight-parseInt(t.getPropertyValue("padding-top"),10)-parseInt(t.getPropertyValue("padding-bottom"),10)}function f(e){var t=window.getComputedStyle(e,null);return e.clientWidth-parseInt(t.getPropertyValue("padding-left"),10)-parseInt(t.getPropertyValue("padding-right"),10)}function l(e){return typeof HTMLElement==="object"?e instanceof HTMLElement:e&&typeof e==="object"&&e!==null&&e.nodeType===1&&typeof e.nodeName==="string"}function c(e,t){return(" "+e.className+" ").indexOf(" "+t+" ")>-1}function h(){if(document.getElementById("textFitStyleSheet"))return;var e=[".textFitAlignVert{","position: absolute;","top: 0; right: 0; bottom: 0; left: 0;","margin: auto;","}"].join("");var t=document.createElement("style");t.type="text/css";t.id="textFitStyleSheet";t.innerHTML=e;document.body.appendChild(t)}var r={alignVert:false,alignHoriz:false,multiLine:false,detectMultiLine:true,minFontSize:6,maxFontSize:80,reProcess:true,widthOnly:false,suppressErrors:false};for(var i in n){if(n.hasOwnProperty(i)){r[i]=n[i]}}if(typeof t.toArray==="function"){t=t.toArray()}var s=Object.prototype.toString.call(t);if(s!=="[object Array]"&&s!=="[object NodeList]"){t=[t]}for(var o=0;o0.7) font_size=font_size-0.2;
//if(!((c.style.fontSize=="2.0em"&&multiplier==-1)||(c.style.fontSize=="0.6em"&&multiplier==1)))
// c.style.fontSize = parseFloat(c.style.fontSize) + (multiplier * 0.2) + "em";
c.style.fontSize = font_size+"em";
c.style.lineHeight = "1.5em";
}
function equalCols(parent){
//var maxHeight;
parent = (typeof parent === "undefined") ? ".row" : parent;
$(parent + ' .equalHero').height(function () {
current_row=$(this).closest(parent);
if(current_row.maxHeight==null)
current_row.maxHeight=
current_row.find('.equalHero').max( function () {
return $(this).height();
});
return current_row.maxHeight;
});
}
function getDD2DMS(dms, type){
var sign = 1, Abs=0;
var days, minutes, secounds, direction;
if(dms < 0) { sign = -1; }
Abs = Math.abs( Math.round(dms * 1000000.));
//Math.round is used to eliminate the small error caused by rounding in the computer:
//e.g. 0.2 is not the same as 0.20000000000284
//Error checks
if(type == "lat" && Abs > (90 * 1000000)){
//alert(" Degrees Latitude must be in the range of -90. to 90. ");
return false;
} else if(type == "lon" && Abs > (180 * 1000000)){
//alert(" Degrees Longitude must be in the range of -180 to 180. ");
return false;
}
days = Math.floor(Abs / 1000000);
minutes = Math.floor(((Abs/1000000) - days) * 60);
secounds = ( Math.floor((( ((Abs/1000000) - days) * 60) - minutes) * 100000) *60/100000 ).toFixed();
days = days * sign;
if(type == 'lat') direction = days<0 ? 'S' : 'N';
if(type == 'lon') direction = days<0 ? 'W' : 'E';
//else return value
return (days * sign) + 'º ' + minutes + "' " + secounds + "'' " + direction;
}
var trackOutboundLink = function(url,target) {
ga('send', 'event', 'outbound', 'click', url, {
'transport': 'beacon',
'hitCallback': function(){window.open(url,(target?target:'_blank'));}
});
}
function OpenPrint(){
window.print();
}