/wp-content/themes/mymaxiskirt/js/avia.js

https://bitbucket.org/sanders_nick/my-maxi-skirt · JavaScript · 2573 lines · 1794 code · 590 blank · 189 comment · 324 complexity · 0c54c222124c598d180742ac97f3d974 MD5 · raw file

Large files are truncated click here to view the full file

  1. /* this prevents dom flickering, needs to be outside of dom.ready event: */
  2. document.documentElement.className += 'js_active';
  3. /*end dom flickering =) */
  4. //global path: avia_framework_globals.installedAt
  5. jQuery.noConflict();
  6. jQuery(document).ready(function(){
  7. //browser class jquery
  8. add_browser_class();
  9. //activates the mega menu javascript
  10. if(jQuery.fn.aviaMegamenu)
  11. jQuery(".main_menu .menu").aviaMegamenu({modify_position:true});
  12. //activates the slideshow
  13. if(jQuery.fn.avia_ajax_portfolio)
  14. jQuery('.ajax_portfolio_container').avia_ajax_portfolio();
  15. // actiavte portfolio sorting
  16. if(jQuery.fn.avia_iso_sort)
  17. jQuery('.portfolio-sort-container').avia_iso_sort();
  18. // improves comment forms
  19. if(jQuery.fn.kriesi_empty_input)
  20. jQuery('#s, #search-fail input, .textwidget input, .widget_product_search input').kriesi_empty_input();
  21. // improves menu for mobile devices
  22. jQuery('.responsive .main_menu ul:eq(0)').mobileMenu({
  23. switchWidth: 768, //width (in px to switch at)
  24. topOptionText: jQuery('.main_menu').data('selectname'), //first option text
  25. indentString: '   ' //string for indenting nested items
  26. });
  27. // enhances contact form with ajax capabilities
  28. if(jQuery.fn.kriesi_ajax_form)
  29. jQuery('.ajax_form').kriesi_ajax_form();
  30. //smooth scrooling
  31. if(jQuery.fn.avia_smoothscroll)
  32. jQuery('a[href*=#]').avia_smoothscroll();
  33. //keep ratio of elements
  34. if(jQuery.fn.avia_ratio)
  35. jQuery(".avia_keep_ratio").avia_ratio();
  36. //fancy buttons
  37. if(jQuery.fn.avia_fancy_buttons)
  38. jQuery(".social_bookmarks li").avia_fancy_buttons({target:'a'});
  39. //fixed menu header
  40. if(jQuery.fn.avia_fixed_header)
  41. jQuery("body").avia_fixed_header();
  42. avia_ajax_call();
  43. avia_slideshow_caption_click();
  44. });
  45. // all functions within the avia_ajax_call function will be executed once the dynamic ajax portfolio has loaded
  46. function avia_ajax_call(container)
  47. {
  48. if(typeof container == 'undefined'){ container = 'body';};
  49. //activates the slideshow
  50. if(jQuery.fn.aviapoly)
  51. jQuery('.slideshow', container).aviapoly();
  52. jQuery('#slideshow_big .slideshow, .post-entry-type-gallery .slideshow', container).avia_base_control_hide();
  53. //activates the slideshow
  54. if(jQuery.fn.avia_external_controls)
  55. jQuery('.slide_container_big_thumbs', container).avia_external_controls();
  56. //activates the keyboard controlls
  57. if(jQuery.fn.avia_keyboard_controls)
  58. jQuery('.slideshow_container', container).avia_keyboard_controls();
  59. //activates the prettyphoto lightbox
  60. if(jQuery.fn.avia_activate_lightbox)
  61. jQuery(container).avia_activate_lightbox();
  62. //activates the hover effect for image links
  63. if(jQuery.fn.avia_activate_hover_effect)
  64. jQuery(container).avia_activate_hover_effect();
  65. //activates the shortcode content slider
  66. if(jQuery.fn.avia_sc_slider)
  67. jQuery(".content_slider", container).avia_sc_slider({appendControlls:{}});
  68. //activates the toggle shortcode
  69. if(jQuery.fn.avia_sc_toggle)
  70. jQuery('.togglecontainer', container).avia_sc_toggle();
  71. //activates the tabs shortcode
  72. if(jQuery.fn.avia_sc_tabs)
  73. {
  74. jQuery('.tabcontainer', container).avia_sc_tabs();
  75. jQuery('.sidebar_tabcontainer', container).avia_sc_tabs({heading: '.sidebar_tab', content:'.sidebar_tab_content', active:'sidebar_active_tab', sidebar:true});
  76. }
  77. if(jQuery.fn.hoverdir && jQuery('html').is('.csstransforms'))
  78. {
  79. var checkMobile = document.documentElement.ontouchstart !== undefined ? true : false;
  80. if(!checkMobile)
  81. {
  82. jQuery('.slideshow li:not(#slideshow_big .slideshow li)', container).hoverdir();
  83. }
  84. }
  85. avia_small_fixes(container);
  86. }
  87. function avia_slideshow_caption_click()
  88. {
  89. var body_tag = jQuery('body');
  90. body_tag.on('mouseenter', '.slideshow .container', function()
  91. {
  92. var container = jQuery(this),
  93. link_inner = container.prev('.slideshow_media_wrap').find('a').addClass('no_overlay');
  94. if(link_inner.length)
  95. {
  96. container.addClass('mousePointer');
  97. }
  98. });
  99. body_tag.on('click', '.slideshow .container', function(e)
  100. {
  101. if(!jQuery(e.srcElement).is('a')){
  102. jQuery(this).prev('.slideshow_media_wrap').find('a').trigger('click');
  103. }
  104. });
  105. }
  106. // -------------------------------------------------------------------------------------------
  107. // Header scroll top
  108. // -------------------------------------------------------------------------------------------
  109. (function($)
  110. {
  111. "use strict";
  112. $.fn.avia_fixed_header = function(passed_options)
  113. {
  114. var win = $(window),
  115. menu_header = $('.container_wrap_menu'),
  116. logo_header = $('.container_wrap_logo'),
  117. logo_header_height = 0,
  118. wrap_all_top = parseInt($('#wrap_all').css('margin-top'),10),
  119. top_pos = parseInt($('html').css('margin-top'),10) ,
  120. isMobile = 'ontouchstart' in document.documentElement,
  121. height_tracking = true,
  122. set_pos = function()
  123. {
  124. var st = win.scrollTop(), pos_type = menu_header.css('position');
  125. if(height_tracking || logo_header_height == 0) logo_header_height = logo_header.height();
  126. if (st < logo_header_height +wrap_all_top)
  127. {
  128. if(pos_type != 'relative') menu_header.css({position:'relative', top:0});
  129. }
  130. else
  131. {
  132. if(pos_type != 'fixed') menu_header.css({position:'fixed', top:top_pos});
  133. }
  134. };
  135. //dont apply fixed headers to mobile devices, because of small screen and poor handling of css "fixed" position
  136. if(!isMobile)
  137. {
  138. win.scroll(set_pos);
  139. set_pos();
  140. setTimeout(function(){height_tracking = false;}, 10000)
  141. }
  142. };
  143. })(jQuery);
  144. // -------------------------------------------------------------------------------------------
  145. // fancy hover effect
  146. // -------------------------------------------------------------------------------------------
  147. (function($)
  148. {
  149. "use strict";
  150. $.avia_utilities = $.avia_utilities || {};
  151. $.fn.avia_fancy_buttons = function(passed_options)
  152. {
  153. var win = $(window),
  154. defaults =
  155. {
  156. target: false,
  157. copy_img: true
  158. },
  159. options = $.extend({}, defaults, passed_options);
  160. return this.each(function()
  161. {
  162. //check if the browser supports element rotation
  163. if(!$.avia_utilities.supports('transition', ['Khtml', 'Ms','Moz','Webkit'])) { return false; }
  164. var buttons = $(this),
  165. current = false,
  166. target = false,
  167. html = "<span class='css_3_hover'></span>",
  168. effect = false;
  169. buttons.each(function()
  170. {
  171. current = $(this).addClass('css_3_hover_container');
  172. target = options.target ? current.find(options.target) : current;
  173. effect = $(html).appendTo(current);
  174. //fix the default hover color
  175. target.css('background-color', target.css('background-color'));
  176. if(options.copy_img)
  177. {
  178. effect.css('background-position', target.css('background-position'));
  179. effect.css('background-image', target.css('background-image'));
  180. }
  181. });
  182. });
  183. };
  184. })(jQuery);
  185. // -------------------------------------------------------------------------------------------
  186. // Avia AJAX Portfolio
  187. // -------------------------------------------------------------------------------------------
  188. (function($)
  189. {
  190. "use strict";
  191. $.avia_utilities = $.avia_utilities || {};
  192. $.fn.avia_ajax_portfolio = function(passed_options)
  193. {
  194. var win = $(window),
  195. isMobile = document.documentElement.ontouchstart !== undefined ? true : false,
  196. defaults =
  197. {
  198. open_wrap: '.portfolio-details',
  199. open_in: '.portfolio-details-inner',
  200. items: '.portfolio-sort-container',
  201. easing: 'easeOutQuint',
  202. timing: 800,
  203. transition: 'slide' // 'fade' or 'slide'
  204. },
  205. options = $.extend({}, defaults, passed_options);
  206. return this.each(function()
  207. {
  208. var container = $(this),
  209. target_wrap = container.find(options.open_wrap),
  210. target_container = container.find(options.open_in),
  211. item_container = container.find(options.items),
  212. items = item_container.find('.post-entry'),
  213. content_retrieved = {},
  214. is_open = false,
  215. animating = false,
  216. index_open = false,
  217. ajax_call = false,
  218. methods,
  219. controls,
  220. loader = $.avia_utilities.loading();
  221. methods =
  222. {
  223. load_item: function()
  224. {
  225. if(animating == true) return false;
  226. animating = true;
  227. var link = $(this),
  228. post_container = link.parents('.post-entry:eq(0)'),
  229. post_id = "ID_" + post_container.data('ajax-id'),
  230. clickedIndex = items.index(post_container);
  231. //check if current item is the clicked item or if we are currently animating
  232. if(post_id === is_open)
  233. {
  234. return false;
  235. }
  236. item_container.find('.active_portfolio_item').removeClass('active_portfolio_item');
  237. post_container.addClass('active_portfolio_item');
  238. loader.show();
  239. methods.ajax_get_contents(post_id, clickedIndex);
  240. return false;
  241. },
  242. scroll_top: function()
  243. {
  244. var target_offset = container.offset().top - 100,
  245. window_offset = win.scrollTop();
  246. if(window_offset > target_offset || target_offset - window_offset > 100 )
  247. {
  248. $('html:not(:animated),body:not(:animated)').animate({ scrollTop: target_offset }, options.timing, options.easing);
  249. }
  250. },
  251. attach_item: function(post_id)
  252. {
  253. content_retrieved[post_id] = $(content_retrieved[post_id]).appendTo(target_container);
  254. ajax_call = true;
  255. },
  256. remove_video: function()
  257. {
  258. var del = container.find('iframe, .avia_video').parents('.ajax_slide:not(.open_slide)');
  259. if(del.length > 0)
  260. {
  261. del.remove();
  262. content_retrieved["ID_" + del.data('slideId')] = undefined;
  263. }
  264. },
  265. show_item: function(post_id, clickedIndex)
  266. {
  267. //check if current item is the clicked item or if we are currently animating
  268. if(post_id === is_open)
  269. {
  270. return false;
  271. }
  272. animating = true;
  273. methods.scroll_top();
  274. loader.hide();
  275. if(false === is_open)
  276. {
  277. target_wrap.addClass('open_container');
  278. content_retrieved[post_id].addClass('open_slide');
  279. target_wrap.css({display:'none'}).slideDown(options.timing, options.easing, function()
  280. {
  281. if(ajax_call){ avia_ajax_call(content_retrieved[post_id]); ajax_call = false; }
  282. methods.remove_video();
  283. });
  284. index_open = clickedIndex;
  285. is_open = post_id;
  286. animating = false;
  287. }
  288. else
  289. {
  290. var initCSS = { zIndex:3 },
  291. easing = options.easing;
  292. if(index_open > clickedIndex) { initCSS.left = '-110%'; }
  293. if(options.transition === 'fade'){ initCSS.left = '0%'; initCSS.opacity = 0; easing = 'easeOutQuad'; }
  294. //fixate height for container during animation
  295. target_container.height(target_container.height()); //outerHeight = border problems?
  296. content_retrieved[post_id].css(initCSS).avia_animate({'left':"0%", opacity:1}, options.timing, easing);
  297. content_retrieved[is_open].avia_animate({opacity:0}, options.timing, easing, function()
  298. {
  299. content_retrieved[is_open].attr({'style':""}).removeClass('open_slide');
  300. content_retrieved[post_id].addClass('open_slide');
  301. target_container.avia_animate({height: content_retrieved[post_id].outerHeight()}, options.timing/2, options.easing, function()
  302. {
  303. target_container.attr({'style':""});
  304. is_open = post_id;
  305. index_open = clickedIndex;
  306. animating = false;
  307. methods.remove_video();
  308. if(ajax_call){ avia_ajax_call(content_retrieved[post_id]); ajax_call = false; }
  309. });
  310. });
  311. }
  312. },
  313. ajax_get_contents: function(post_id, clickedIndex)
  314. {
  315. if(content_retrieved[post_id] !== undefined)
  316. {
  317. methods.show_item(post_id, clickedIndex);
  318. return;
  319. }
  320. var url_params = methods.getUrlVars(), add_params = "";
  321. if(typeof url_params.style == "string") add_params = "&style=" + url_params.style
  322. $.ajax({
  323. url: avia_framework_globals.ajaxurl,
  324. type: "POST",
  325. data: "action=avia_check_portfolio&avia_ajax_request="+post_id.replace(/ID_/,"")+add_params,
  326. beforeSend: function()
  327. {
  328. },
  329. success: function(msg)
  330. {
  331. content_retrieved[post_id] = msg;
  332. methods.attach_item(post_id);
  333. setTimeout(function(){ methods.show_item(post_id, clickedIndex); },10);
  334. },
  335. error: function()
  336. {
  337. loader.hide();
  338. }
  339. });
  340. },
  341. add_controls: function()
  342. {
  343. controls = $('<div class="ajax_controlls"><a href="#prev" class="ajax_previous">-</a><a href="#next" class="ajax_next">+</a><a class="avia_close" href="#close">x</a></div>').appendTo(target_wrap);
  344. target_wrap.avia_keyboard_controls({27:'.avia_close', 37:'.ajax_previous', 39:'.ajax_next'});
  345. //target_wrap.avia_swipe_trigger({prev:'.ajax_previous', next:'.ajax_next'});
  346. items.each(function(){
  347. var current = $(this), overlay;
  348. current.addClass('no_combo').bind('click', function(event)
  349. {
  350. overlay = current.find('.slideshow_overlay');
  351. if(overlay.length)
  352. {
  353. event.stopPropagation();
  354. methods.load_item.apply(current.find('a:eq(0)'));
  355. return false;
  356. }
  357. });
  358. });
  359. },
  360. control_click: function()
  361. {
  362. var showItem,
  363. activeID = item_container.find('.active_portfolio_item').data('ajax-id'),
  364. active = item_container.find('.post-entry-'+activeID);
  365. switch(this.hash)
  366. {
  367. case '#next':
  368. showItem = active.nextAll('.post-entry:not(.isotope-hidden):eq(0)').find('a:eq(0)');
  369. if(!showItem.length) { showItem = $('.post-entry:not(.isotope-hidden):eq(0)', container).find('a:eq(0)'); }
  370. showItem.trigger('click');
  371. break;
  372. case '#prev':
  373. showItem = active.prevAll('.post-entry:not(.isotope-hidden):eq(0)').find('a:eq(0)');
  374. if(!showItem.length) { showItem = $('.post-entry:not(.isotope-hidden):last', container).find('a:eq(0)'); }
  375. showItem.trigger('click');
  376. break;
  377. case '#close':
  378. animating = true;
  379. target_wrap.slideUp( options.timing, options.easing, function()
  380. {
  381. item_container.find('.active_portfolio_item').removeClass('active_portfolio_item');
  382. content_retrieved[is_open].attr({'style':""}).removeClass('open_slide');
  383. target_wrap.removeClass('open_container');
  384. animating = is_open = index_open = false;
  385. methods.remove_video();
  386. });
  387. break;
  388. }
  389. return false;
  390. },
  391. getUrlVars: function() {
  392. var vars = {};
  393. var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
  394. vars[key] = value;
  395. });
  396. return vars;
  397. },
  398. resize_reset: function()
  399. {
  400. if(is_open === false)
  401. {
  402. target_container.html('');
  403. content_retrieved = [];
  404. }
  405. }
  406. };
  407. methods.add_controls();
  408. item_container.on("click", "a", methods.load_item);
  409. controls.on("click", "a", methods.control_click);
  410. if(jQuery.support.leadingWhitespace) { win.bind('smartresize', methods.resize_reset); }
  411. });
  412. };
  413. }(jQuery));
  414. // -------------------------------------------------------------------------------------------
  415. // Avia AJAX Sorting
  416. // -------------------------------------------------------------------------------------------
  417. (function($)
  418. {
  419. "use strict";
  420. $.fn.avia_iso_sort = function(options)
  421. {
  422. $.extend( $.Isotope.prototype, {
  423. _customModeReset : function() {
  424. this.fitRows = {
  425. x : 0,
  426. y : 0,
  427. height : 0
  428. };
  429. },
  430. _customModeLayout : function( $elems ) {
  431. var instance = this,
  432. containerWidth = this.element.width(),
  433. props = this.fitRows,
  434. margin = 0,//(containerWidth / 100) * 4, //margin based on %
  435. extraRange = 2; // adds a little range for % based calculation error in some browsers
  436. $elems.each( function() {
  437. var $this = $(this),
  438. atomW = $this.outerWidth() ,
  439. atomH = $this.outerHeight(true);
  440. if ( props.x !== 0 && atomW + props.x > containerWidth + extraRange ) {
  441. // if this element cannot fit in the current row
  442. props.x = 0;
  443. props.y = props.height;
  444. }
  445. //webkit gets blurry elements if position is a float value
  446. props.x = Math.round(props.x);
  447. props.y = Math.round(props.y);
  448. // position the atom
  449. instance._pushPosition( $this, props.x, props.y );
  450. props.height = Math.max( props.y + atomH, props.height );
  451. props.x += atomW + margin;
  452. });
  453. },
  454. _customModeGetContainerSize : function() {
  455. return { height : this.fitRows.height };
  456. },
  457. _customModeResizeChanged : function() {
  458. return true;
  459. }
  460. });
  461. return this.each(function()
  462. {
  463. var container = $(this),
  464. parentContainer = container.parents('.portfolio-wrap'),
  465. filter = parentContainer.prev('.sort_width_container').find('#js_sort_items').css({visibility:"visible", opacity:0}),
  466. links = filter.find('a'),
  467. isoActive = false,
  468. items = $('.post-entry', container);
  469. function applyIso()
  470. {
  471. container.addClass('isotope_activated').isotope({
  472. layoutMode : 'customMode', itemSelector : '.flex_column'
  473. }, function()
  474. {
  475. container.css({overflow:'visible'});
  476. });
  477. isoActive = true;
  478. setTimeout(function(){ parentContainer.addClass('avia_sortable_active'); }, 0);
  479. };
  480. links.bind('click',function()
  481. {
  482. var current = $(this),
  483. selector = current.data('filter');
  484. links.removeClass('active_sort');
  485. current.addClass('active_sort');
  486. parentContainer.find('.open_container .ajax_controlls .avia_close').trigger('click');
  487. container.css({overflow:'hidden'}).isotope({ layoutMode : 'customMode', itemSelector : '.flex_column' , filter: '.'+selector}, function()
  488. {
  489. container.css({overflow:'visible'});
  490. });
  491. return false;
  492. });
  493. // update columnWidth on window resize
  494. $(window).smartresize(function()
  495. {
  496. applyIso();
  497. });
  498. $(window).bind('avia_images_loaded', function()
  499. {
  500. setTimeout(function()
  501. {
  502. filter.animate({opacity:1}, 400);
  503. applyIso();
  504. }, 900);
  505. });
  506. ///applyIso();
  507. });
  508. };
  509. }(jQuery));
  510. // -------------------------------------------------------------------------------------------
  511. // input field improvements
  512. // -------------------------------------------------------------------------------------------
  513. (function($)
  514. {
  515. $.fn.kriesi_empty_input = function(options)
  516. {
  517. return this.each(function()
  518. {
  519. var currentField = $(this);
  520. currentField.methods =
  521. {
  522. startingValue: currentField.val(),
  523. resetValue: function()
  524. {
  525. var currentValue = currentField.val();
  526. if(currentField.methods.startingValue == currentValue) currentField.val('');
  527. },
  528. restoreValue: function()
  529. {
  530. var currentValue = currentField.val();
  531. if(currentValue == '') currentField.val(currentField.methods.startingValue);
  532. }
  533. };
  534. currentField.bind('focus',currentField.methods.resetValue);
  535. currentField.bind('blur',currentField.methods.restoreValue);
  536. });
  537. };
  538. })(jQuery);
  539. // -------------------------------------------------------------------------------------------
  540. // Ratio function
  541. // -------------------------------------------------------------------------------------------
  542. (function($)
  543. {
  544. "use strict";
  545. $.fn.avia_ratio = function()
  546. {
  547. var win = $(window);
  548. return this.each(function()
  549. {
  550. //check if the browser supports element rotation
  551. var container = $(this),
  552. height = container.height(),
  553. width = container.data('imgw'),
  554. ratio = height/width;
  555. function change_ratio()
  556. {
  557. container.height(container.outerWidth() * ratio);
  558. }
  559. change_ratio();
  560. win.bind('smartresize', change_ratio);
  561. });
  562. };
  563. })(jQuery);
  564. // -------------------------------------------------------------------------------------------
  565. // Avia Menu
  566. // -------------------------------------------------------------------------------------------
  567. (function($)
  568. {
  569. $.fn.aviaMegamenu = function(variables)
  570. {
  571. var defaults =
  572. {
  573. modify_position:true,
  574. delay:300
  575. };
  576. var options = $.extend(defaults, variables);
  577. return this.each(function()
  578. {
  579. var isMobile = 'ontouchstart' in document.documentElement,
  580. menu = $(this),
  581. menuItems = menu.find(">li"),
  582. megaItems = menuItems.find(">div").parent().css({overflow:'hidden'}),
  583. menuActive = menu.find('>.current-menu-item>a, >.current_page_item>a'),
  584. dropdownItems = menuItems.find(">ul").parent(),
  585. parentContainerWidth = menu.parent().width(),
  586. delayCheck = {},
  587. mega_open = [];
  588. if(!menuActive.length){ menu.find('.current-menu-ancestor:eq(0) a:eq(0), .current_page_ancestor:eq(0) a:eq(0)').parent().addClass('active-parent-item')}
  589. menuItems.each(function()
  590. {
  591. var item = $(this),
  592. pos = item.position(),
  593. megaDiv = item.find("div:first").css({opacity:0, display:"none"}),
  594. normalDropdown = "";
  595. //check if we got a mega menu
  596. if(!megaDiv.length)
  597. {
  598. normalDropdown = item.find(">ul").css({display:"none"});
  599. }
  600. //if we got a mega menu or dropdown menu add the arrow beside the menu item
  601. if(megaDiv.length || normalDropdown.length)
  602. {
  603. var link = item.addClass('dropdown_ul_available').find('>a');
  604. link.html("<span class='dropdown_link'>"+link.html()+"</span>").append('<span class="dropdown_available"></span>');
  605. //is a mega menu main item doesnt have a link to click use the default cursor
  606. if(typeof link.attr('href') != 'string' || link.attr('href') == "#"){ link.css('cursor','default').click(function(){return false;}); }
  607. }
  608. //correct position of mega menus
  609. if(options.modify_position && megaDiv.length)
  610. {
  611. if(megaDiv.width() > pos.left)
  612. {
  613. megaDiv.css({left: (pos.left* -1)});
  614. //megaDiv.css({left: (Math.ceil() * -1)});
  615. }
  616. else if(pos.left + megaDiv.width() > parentContainerWidth)
  617. {
  618. megaDiv.css({left: (megaDiv.width() - pos.left) * -1 });
  619. }
  620. }
  621. });
  622. function megaDivShow(i)
  623. {
  624. if(delayCheck[i] == true)
  625. {
  626. var item = megaItems.filter(':eq('+i+')').css({overflow:'visible'}).find("div:first"),
  627. link = megaItems.filter(':eq('+i+')').find("a:first");
  628. mega_open["check"+i] = true;
  629. item.stop().css('display','block').animate({opacity:1},300);
  630. if(item.length)
  631. {
  632. link.addClass('open-mega-a');
  633. }
  634. }
  635. }
  636. function megaDivHide (i)
  637. {
  638. if(delayCheck[i] == false)
  639. {
  640. megaItems.filter(':eq('+i+')').find(">a").removeClass('open-mega-a');
  641. var listItem = megaItems.filter(':eq('+i+')'),
  642. item = listItem.find("div:first");
  643. item.stop().css('display','block').animate({opacity:0},300, function()
  644. {
  645. $(this).css('display','none');
  646. listItem.css({overflow:'hidden'});
  647. mega_open["check"+i] = false;
  648. });
  649. }
  650. }
  651. if(isMobile)
  652. {
  653. megaItems.each(function(i){
  654. $(this).bind('click', function()
  655. {
  656. if(mega_open["check"+i] != true) return false;
  657. });
  658. });
  659. }
  660. //bind event for mega menu
  661. megaItems.each(function(i){
  662. $(this).hover(
  663. function()
  664. {
  665. delayCheck[i] = true;
  666. setTimeout(function(){megaDivShow(i); },options.delay);
  667. },
  668. function()
  669. {
  670. delayCheck[i] = false;
  671. setTimeout(function(){megaDivHide(i); },options.delay);
  672. }
  673. );
  674. });
  675. // bind events for dropdown menu
  676. dropdownItems.find('li').andSelf().each(function()
  677. {
  678. var currentItem = $(this),
  679. sublist = currentItem.find('ul:first'),
  680. showList = false;
  681. if(sublist.length)
  682. {
  683. sublist.css({display:'block', opacity:0, visibility:'hidden'});
  684. var currentLink = currentItem.find('>a');
  685. currentLink.bind('mouseenter', function()
  686. {
  687. sublist.stop().css({visibility:'visible'}).animate({opacity:1});
  688. });
  689. currentItem.bind('mouseleave', function()
  690. {
  691. sublist.stop().animate({opacity:0}, function()
  692. {
  693. sublist.css({visibility:'hidden'});
  694. });
  695. });
  696. }
  697. });
  698. });
  699. };
  700. })(jQuery);
  701. // -------------------------------------------------------------------------------------------
  702. // Tab shortcode javascript
  703. // -------------------------------------------------------------------------------------------
  704. (function($)
  705. {
  706. "use strict"
  707. $.fn.avia_sc_tabs= function(options)
  708. {
  709. var defaults =
  710. {
  711. heading: '.tab',
  712. content:'.tab_content',
  713. active:'active_tab',
  714. sidebar: false
  715. };
  716. var win = $(window)
  717. options = $.extend(defaults, options);
  718. return this.each(function()
  719. {
  720. var container = $(this),
  721. tabs = $(options.heading, container),
  722. content = $(options.content, container),
  723. initialOpen = 1,
  724. newtabs = false,
  725. oldtabs = false;
  726. // sort tabs
  727. if(tabs.length < 2) return;
  728. if(container.is('.tab_initial_open'))
  729. {
  730. var myRegexp = /tab_initial_open__(\d+)/;
  731. var match = myRegexp.exec(container[0].className);
  732. if(match != null && parseInt(match[1]) > 0)
  733. {
  734. initialOpen = parseInt(match[1]);
  735. }
  736. }
  737. if(!initialOpen || initialOpen > tabs.length) initialOpen = 1;
  738. if(!options.sidebar)
  739. {
  740. tabs.prependTo(container);
  741. }
  742. else
  743. {
  744. var click_container = $("<div class='sidebar_tab_wrap'></div>").prependTo(container), min_height;
  745. newtabs = tabs.clone();
  746. oldtabs = tabs;
  747. tabs = newtabs;
  748. tabs.prependTo(click_container);
  749. var sidebar_shadow = $("<span class='sidebar_tab_shadow'></span>").prependTo(click_container);
  750. set_size(click_container, sidebar_shadow);
  751. win.smartresize(function(){ set_size(click_container, sidebar_shadow); });
  752. }
  753. tabs.each(function(i)
  754. {
  755. var tab = $(this), the_oldtab = false;
  756. if(newtabs) the_oldtab = oldtabs.filter(':eq('+i+')');
  757. //set default tab to open
  758. if(initialOpen == (i+1))
  759. {
  760. open_content(tab, i, the_oldtab);
  761. }
  762. tab.addClass('tab_counter_'+i).bind('click', function()
  763. {
  764. open_content(tab, i, the_oldtab);
  765. return false;
  766. });
  767. if(newtabs)
  768. {
  769. the_oldtab.bind('click', function()
  770. {
  771. open_content(the_oldtab, i, tab);
  772. return false;
  773. });
  774. }
  775. });
  776. function set_size(click_container, sidebar_shadow)
  777. {
  778. min_height = click_container.outerHeight();
  779. content.css({'min-height': ( min_height - parseInt(content.css('padding-top'),10) - parseInt(content.css('padding-bottom'),10) - parseInt(content.css('border-top-width'),10) - parseInt(content.css('border-bottom-width'),10) ) });
  780. sidebar_shadow.height(content.filter('.'+options.active+'_content').outerHeight());
  781. }
  782. function open_content(tab, i, alternate_tab)
  783. {
  784. if(!tab.is('.'+options.active))
  785. {
  786. $('.'+options.active, container).removeClass(options.active);
  787. $('.'+options.active+'_content', container).removeClass(options.active+'_content');
  788. tab.addClass(options.active);
  789. setTimeout(function(){avia_small_fixes($('.'+options.active+'_content', container));},10);
  790. if(alternate_tab) alternate_tab.addClass(options.active);
  791. var active_c = content.filter(':eq('+i+')').addClass(options.active+'_content');
  792. if(typeof click_container != 'undefined' && click_container.length)
  793. {
  794. sidebar_shadow.height(active_c.outerHeight());
  795. }
  796. }
  797. }
  798. });
  799. };
  800. })(jQuery);
  801. // -------------------------------------------------------------------------------------------
  802. // Toggle shortcode javascript
  803. // -------------------------------------------------------------------------------------------
  804. (function($)
  805. {
  806. $.fn.avia_sc_toggle = function(options)
  807. {
  808. var defaults =
  809. {
  810. heading: '.toggler',
  811. content: '.toggle_wrap'
  812. };
  813. var options = $.extend(defaults, options);
  814. return this.each(function()
  815. {
  816. var container = $(this),
  817. heading = $(options.heading, container),
  818. allContent = $(options.content, container),
  819. initialOpen = '';
  820. //check if the container has the class toggle initial open.
  821. // if thats the case extract the number from the following class and open that toggle
  822. if(container.is('.toggle_initial_open'))
  823. {
  824. var myRegexp = /toggle_initial_open__(\d+)/;
  825. var match = myRegexp.exec(container[0].className);
  826. if(match != null && parseInt(match[1]) > 0)
  827. {
  828. initialOpen = parseInt(match[1]);
  829. }
  830. }
  831. heading.each(function(i)
  832. {
  833. var thisheading = $(this),
  834. content = thisheading.next(options.content, container);
  835. if(initialOpen == (i+1)) { content.css({display:'block'}); setTimeout(function(){avia_small_fixes(content);},10); }
  836. if(content.is(':visible'))
  837. {
  838. thisheading.addClass('activeTitle');
  839. }
  840. thisheading.bind('click', function()
  841. {
  842. if(content.is(':visible'))
  843. {
  844. content.slideUp(300);
  845. thisheading.removeClass('activeTitle');
  846. }
  847. else
  848. {
  849. if(container.is('.toggle_close_all'))
  850. {
  851. allContent.slideUp(300);
  852. heading.removeClass('activeTitle');
  853. }
  854. content.slideDown(300);
  855. thisheading.addClass('activeTitle');
  856. avia_small_fixes(content);
  857. }
  858. });
  859. });
  860. });
  861. };
  862. })(jQuery);
  863. // -------------------------------------------------------------------------------------------
  864. // Smooth scrooling when clicking on anchor links
  865. // -------------------------------------------------------------------------------------------
  866. (function($)
  867. {
  868. $.fn.avia_smoothscroll = function(variables)
  869. {
  870. return this.each(function()
  871. {
  872. $(this).click(function() {
  873. var newHash=this.hash;
  874. if(newHash != '' && newHash != '#' && !$(this).is('.comment-reply-link, #cancel-comment-reply-link, .no-scroll'))
  875. {
  876. var container = $(this.hash);
  877. if(container.length)
  878. {
  879. var target = container.offset().top,
  880. oldLocation=window.location.href.replace(window.location.hash, ''),
  881. newLocation=this,
  882. duration=800,
  883. easing='easeOutQuint';
  884. // make sure it's the same location
  885. if(oldLocation+newHash==newLocation)
  886. {
  887. // animate to target and set the hash to the window.location after the animation
  888. $('html:not(:animated),body:not(:animated)').animate({ scrollTop: target }, duration, easing, function() {
  889. // add new hash to the browser location
  890. window.location.href=newLocation;
  891. });
  892. // cancel default click action
  893. return false;
  894. }
  895. }
  896. }
  897. });
  898. });
  899. };
  900. })(jQuery);
  901. // -------------------------------------------------------------------------------------------
  902. // Ligthbox activation
  903. // -------------------------------------------------------------------------------------------
  904. (function($)
  905. {
  906. $.fn.avia_activate_lightbox = function(variables)
  907. {
  908. var defaults =
  909. {
  910. autolinkElements: 'a[rel^="prettyPhoto"], a[rel^="lightbox"], a[href$=jpg], a[href$=png], a[href$=gif], a[href$=jpeg], a[href$=".mov"] , a[href$=".swf"] , a[href*="vimeo.com"] , a[href*="youtube.com"] , a[href*="screenr.com"]'
  911. };
  912. var options = $.extend(defaults, variables),
  913. win = $(window),
  914. ww = parseInt(win.width(),10) * 0.8, //controls the default lightbox width: 80% of the window size
  915. wh = (ww/16)*9; //controls the default lightbox height (16:9 ration for videos. images are resized by the lightbox anyway)
  916. return this.each(function()
  917. {
  918. var elements = $(options.autolinkElements, this).not('.noLightbox, .noLightbox a'),
  919. lastParent = "",
  920. counter = 0;
  921. elements.each(function()
  922. {
  923. var el = $(this),
  924. parentPost = el.parents('.post-entry:eq(0)'),
  925. group = 'auto_group';
  926. if(parentPost.get(0) != lastParent)
  927. {
  928. lastParent = parentPost.get(0);
  929. counter ++;
  930. }
  931. if((el.attr('rel') == undefined || el.attr('rel') == '') && !el.hasClass('noLightbox'))
  932. {
  933. el.attr('rel','lightbox['+group+counter+']');
  934. }
  935. });
  936. if($.fn.prettyPhoto)
  937. elements.prettyPhoto({ social_tools:'',slideshow: 5000, deeplinking: false, overlay_gallery:false, default_width: ww, default_height: wh });
  938. });
  939. };
  940. })(jQuery);
  941. // -------------------------------------------------------------------------------------------
  942. // Hover effect activation
  943. // -------------------------------------------------------------------------------------------
  944. (function($)
  945. {
  946. $.fn.avia_activate_hover_effect = function(variables)
  947. {
  948. var defaults =
  949. {
  950. autolinkElements: 'a[rel^="prettyPhoto"], a[rel^="lightbox"], a[href$=jpg], a[href$=png], a[href$=gif], a[href$=jpeg], a[href$=".mov"] , a[href$=".swf"] , a[href*="vimeo.com"] , a[href*="youtube.com"], a.external-link, .avia_mega a, .dynamic_template_columns a, .slideshow a'
  951. };
  952. var options = $.extend(defaults, variables), css3 = $('html').is('.csstransforms'), opacity_val = 0.8;
  953. return this.each(function()
  954. {
  955. if(css3)
  956. {
  957. opacity_val = 1;
  958. }
  959. $(options.autolinkElements, this).not(".noLightbox a").contents('img:not(.filtered-image)').each(function()
  960. {
  961. var img = $(this),
  962. a = img.parent(),
  963. preload = img.parents('.preloading'),
  964. $newclass = 'lightbox_video',
  965. applied= false;
  966. if(a.attr('href').match(/(jpg|gif|jpeg|png|tif)/))
  967. {
  968. $newclass = 'lightbox_image';
  969. }
  970. if(a.is('.external-link') || ! a.attr('href').match(/(jpg|gif|jpeg|png|\.tif|\.mov|\.swf|vimeo\.com|youtube\.com)/))
  971. {
  972. $newclass = 'external_image';
  973. }
  974. if(a.is('a'))
  975. {
  976. if(img.is('.alignright')) {img.removeClass('alignright'); a.addClass('alignright')}
  977. if(img.is('.alignleft')) {img.removeClass('alignleft'); a.addClass('alignleft')}
  978. if(img.css('float') == 'left' || img.css('float') == 'right') {a.css({float:img.css('float')})}
  979. if(!a.css('position') || a.css('position') == 'static') { a.css({position:'relative', display:'inline-block'}); }
  980. if(img.is('.aligncenter')) a.css({display:'block'});
  981. if(img.is('.avia_mega img')) a.css({position:'relative', display:'inline-block'});
  982. if(img.css('left')) { a.css({left: img.css('left')}); img.css('left', 0); }
  983. }
  984. var bg = $("<span class='image_overlay_effect'><span class='image_overlay_effect_inside'></span></span>").appendTo(a);
  985. bg.css({display:'block', zIndex:5, opacity:0});
  986. bg.hover(function()
  987. {
  988. if(applied == false && img.css('opacity') > 0.5)
  989. {
  990. bg.addClass($newclass);
  991. applied = true;
  992. }
  993. bg.stop().animate({opacity:opacity_val},400);
  994. },
  995. function()
  996. {
  997. bg.stop().animate({opacity:0},400);
  998. });
  999. });
  1000. });
  1001. };
  1002. })(jQuery);
  1003. // -------------------------------------------------------------------------------------------
  1004. // small js fixes for pixel perfection :)
  1005. // -------------------------------------------------------------------------------------------
  1006. function avia_small_fixes(container)
  1007. {
  1008. if(!jQuery.support.opacity)
  1009. {
  1010. jQuery('.image_overlay_effect', container).css({'background-image':'none'});
  1011. }
  1012. if(jQuery('#slideshow_big').length) { jQuery('body').addClass('js-big-slider'); } else { jQuery('body').addClass('js-big-slider-false'); }
  1013. setTimeout(function()
  1014. {
  1015. jQuery('.twitter-tweet-rendered', container).attr('style',"");
  1016. }, 500);
  1017. var win = jQuery(window),
  1018. iframes = jQuery(' iframe:not(.slideshow iframe):not( iframe.no_resize)', container),
  1019. adjust_iframes = function()
  1020. {
  1021. iframes.each(function(){
  1022. var iframe = jQuery(this), frame_parent_w = iframe.parent().width(), proportions = 16/9;
  1023. if(this.width && this.height)
  1024. {
  1025. proportions = Math.round(this.width / this.height * 1000) / 1000;
  1026. iframes.css({width:frame_parent_w, height: frame_parent_w / proportions});
  1027. }
  1028. });
  1029. };
  1030. adjust_iframes();
  1031. win.smartresize(adjust_iframes);
  1032. }
  1033. // -------------------------------------------------------------------------------------------
  1034. // content slider
  1035. // -------------------------------------------------------------------------------------------
  1036. (function($)
  1037. {
  1038. $.avia_utilities = $.avia_utilities || {};
  1039. $.fn.avia_sc_slider = function(variables, callback)
  1040. {
  1041. return this.each(function()
  1042. {
  1043. var defaults =
  1044. {
  1045. slidePadding: 40,
  1046. appendControlls: {'h1':'pos_h1', 'h2':'pos_h2', 'h3':'pos_h3', 'h4':'pos_h4', 'h5':'pos_h5', 'h6':'pos_h6'},
  1047. controllContainerClass: 'contentSlideControlls',
  1048. transitionDuration: 800, //how fast should images crossfade
  1049. autorotation: true, //autorotation true or false? (this setting gets overwritten by the class autoslide_true and autoslide_false if applied to the container. easier for shortcode management)
  1050. autorotationInterval: 3000, //interval between transition if autorotation is active ()also gets overwritten by autoslidedelay__(number)
  1051. transitionEasing: 'easeOutQuint',
  1052. slide: '.single_slide',
  1053. group: false,
  1054. arrowControll:false
  1055. };
  1056. var options = $.extend(defaults, variables);
  1057. var container = $(this).css({overflow:'hidden'}),
  1058. optionWrap = container.parent(':eq(0)'),
  1059. slides = $(options.slide, container),
  1060. isMobile = 'ontouchstart' in document.documentElement;
  1061. if(!slides.length) { return false; }
  1062. if(optionWrap.data('interval')){ options.autorotationInterval = optionWrap.data('interval') * 1000;}
  1063. if(optionWrap.data('interval') === 0) options.autorotation = false;
  1064. if(options.group)
  1065. {
  1066. var container_new = $('<div>').addClass(container.attr('class')).css({overflow:'hidden', width:'100%', position:'relative'}).insertAfter(container),
  1067. start = 0,
  1068. end = slides.index(slides.filter('.last:eq(0)'));
  1069. if(end === -1) end = slides.length;
  1070. var columns = end + 1,
  1071. elements = slides.length,
  1072. subgroup = {};
  1073. slides.appendTo(container_new);
  1074. for (i = 0; i <= elements; i += columns)
  1075. {
  1076. subgroup = slides.slice(i, i + columns);
  1077. if(subgroup.length)
  1078. {
  1079. subgroup.wrapAll('<div class="single_slide"></div>');
  1080. }
  1081. }
  1082. slides.each(function()
  1083. {
  1084. var current = $(this);
  1085. current.find('>*').wrapAll('<div class="'+current.attr('class')+'"></div>');
  1086. current.find('>div:eq(0)').insertAfter(current);
  1087. });
  1088. //reset values
  1089. slides.remove();
  1090. container.remove();
  1091. container = container_new;
  1092. options.slide = '.single_slide';
  1093. slides = $(options.slide, container);
  1094. }
  1095. var slideCount = slides.length,
  1096. firstSlide = slides.filter(':eq(0)'),
  1097. followslides = $(options.slide+':not(:first)', container),
  1098. innerContainer = "",
  1099. innerContainerWidth = (container.width() * slideCount) + (options.slidePadding * slideCount),
  1100. i = 0,
  1101. interval = "",
  1102. controlls = $(),
  1103. arrowControlls = $(),
  1104. nextArrow,
  1105. prevArrow;
  1106. container.animating = false;
  1107. container.methods =
  1108. {
  1109. resize: function()
  1110. {
  1111. if(!innerContainer) return;
  1112. innerContainerWidth = (container.width() * slideCount) + (options.slidePadding * slideCount);
  1113. innerContainer.width(innerContainerWidth);
  1114. slides.width(container.width());
  1115. container.methods.change();
  1116. },
  1117. preload: function()
  1118. {
  1119. followslides.css({display:"none"});
  1120. if(!slideCount)
  1121. {
  1122. container.methods.init();
  1123. }
  1124. else
  1125. {
  1126. $.avia_utilities.preload({container: container, single_callback: function(){ container.methods.init(); }});
  1127. }
  1128. },
  1129. init: function()
  1130. {
  1131. if(slideCount > 1)
  1132. {
  1133. $(window).resize(container.methods.resize);
  1134. //set container height to match the first slide
  1135. container.height(firstSlide.outerHeight());
  1136. //wrap additional container arround slides and align slides within that container
  1137. slides.wrapAll('<div class="inner_slide_container" />').css({float:'left',
  1138. width:container.width(),
  1139. display:'block',
  1140. paddingRight:options.slidePadding
  1141. });
  1142. innerContainer = $('.inner_slide_container', container).width(innerContainerWidth);
  1143. //attach controll elements
  1144. container.methods.appenControlls();
  1145. //start autoslide
  1146. container.methods.autoRotation();
  1147. //start autoslide
  1148. //container.methods.activate_touch_control();
  1149. }
  1150. container.addClass('not_animating_slides');
  1151. slides.filter(':eq(0)').addClass('active_slide');
  1152. },
  1153. change: function()
  1154. {
  1155. container.animating = true;
  1156. container.removeClass('not_animating_slides');
  1157. var moveTo = ((-i * container.width()) - (i * options.slidePadding)),
  1158. nextSlide = slides.removeClass('active_slide').filter(':eq('+i+')'),
  1159. nextSlideHeight = nextSlide.outerHeight();
  1160. //move inner container
  1161. innerContainer.stop().animate({left: moveTo}, options.transitionDuration, options.transitionEasing, function()
  1162. {
  1163. container.animating = false;
  1164. setTimeout(function(){
  1165. container.addClass('not_animating_slides');
  1166. },10);
  1167. nextSlide.addClass('active_slide');
  1168. });
  1169. //change height of outer container
  1170. container.stop().animate({height: nextSlideHeight}, options.transitionDuration, options.transitionEasing);
  1171. //change active state of controlls
  1172. var controllLinks = $('a', controlls);
  1173. controllLinks.removeClass('activeItem');
  1174. controllLinks.filter(':eq('+i+')').addClass('activeItem');
  1175. },
  1176. activate_touch_control:function()
  1177. {
  1178. var slider = container;
  1179. if(isMobile)
  1180. {
  1181. slider.touchPos = {};
  1182. slider.hasMoved = false;
  1183. slider.bind('touchstart', function(event)
  1184. {
  1185. slider.touchPos.X = event.originalEvent.touches[0].clientX;
  1186. slider.touchPos.Y = event.originalEvent.touches[0].clientY;
  1187. });
  1188. slider.bind('touchend', function(event)
  1189. {
  1190. slider.touchPos = {};
  1191. if(slider.hasMoved) { event.preventDefault(); }
  1192. slider.hasMoved = false;
  1193. });
  1194. slider.bind('touchmove', function(event)
  1195. {
  1196. if(!slider.touchPos.X)
  1197. {
  1198. slider.touchPos.X = event.originalEvent.touches[0].clientX;
  1199. slider.touchPos.Y = event.originalEvent.touches[0].clientY;
  1200. }
  1201. else
  1202. {
  1203. var differenceX = event.originalEvent.touches[0].clientX - slider.touchPos.X;
  1204. var differenceY = event.originalEvent.touches[0].clientY - slider.touchPos.Y;
  1205. //check if user is scrolling the window or moving the slider
  1206. if(Math.abs(differenceX) > Math.abs(differenceY))
  1207. {
  1208. event.preventDefault();
  1209. if(!slider.animating)
  1210. {
  1211. if(slider.touchPos != event.originalEvent.touches[0].clientX)
  1212. {
  1213. if(Math.abs(differenceX) > 50)
  1214. {
  1215. i = differenceX > 0 ? i - 1 : i + 1;
  1216. if(i+1 > slideCount) { i = 0; } else
  1217. if(i < 0) {i = slideCount-1; }
  1218. clearInterval(interval);
  1219. container.methods.change();
  1220. slider.touchPos = {};
  1221. slider.hasMoved = true;
  1222. return false;
  1223. }
  1224. }
  1225. }
  1226. }
  1227. }
  1228. });
  1229. }
  1230. },
  1231. setSlideNumber: function(event)
  1232. {
  1233. var stop = false;
  1234. if(event)
  1235. {
  1236. clearInterval(interval);
  1237. if(event.data.show == 'next') i++;
  1238. if(event.data.show == 'prev') i--;
  1239. if(typeof(event.data.show) == 'number')
  1240. {
  1241. //check if next slide is the same as current slide
  1242. if(i != event.data.show)
  1243. {
  1244. i = event.data.show;
  1245. }
  1246. else
  1247. {
  1248. stop = true;
  1249. }
  1250. }
  1251. }
  1252. else
  1253. {
  1254. i++;
  1255. }
  1256. if(i+1 > slideCount) { i = 0; } else
  1257. if(i < 0) {i = slideCount-1; }
  1258. if(!stop) // prevents transition if the next slide and the current slide are the same
  1259. {
  1260. container.methods.change();
  1261. }
  1262. return false;
  1263. },
  1264. appenControlls: function()
  1265. {
  1266. //if controlls should be added by javascript and we got more than 1 slide
  1267. if(options.appendControlls && slideCount > 1)
  1268. {
  1269. //check where to position the controll element, depending on the first element within the slide
  1270. var positioningClass = '';
  1271. for (var key in options.appendControlls)
  1272. {
  1273. if(!positioningClass)
  1274. {
  1275. if($(':first', firstSlide).is(key))
  1276. {
  1277. positioningClass = options.appendControlls[key];
  1278. }
  1279. }
  1280. }
  1281. //append the controlls
  1282. var firstClass = 'class="activeItem"';
  1283. controlls = $('<div></div>').addClass(options.controllContainerClass)
  1284. .addClass(positioningClass)
  1285. .css({visibility:'hidden', opacity:0});
  1286. if(positioningClass)
  1287. {
  1288. controlls.appendTo(container);
  1289. }
  1290. else
  1291. {
  1292. controlls.insertAfter(container);
  1293. }
  1294. slides.each(function(i)
  1295. {
  1296. var link = $('<a '+firstClass+' href="#">'+(i+1)+'</a>').appendTo(controlls); firstClass = "";
  1297. link.bind('click', {show: i}, container.methods.setSlideNumber);
  1298. });
  1299. controlls.css({visibility:'visible', opacity:0}).animate({opacity:0.7},400);
  1300. }
  1301. //add arrow Controlls
  1302. if(options.arrowControll && slideCount > 1)
  1303. {
  1304. arrowControlls = $('<div class="arrow_container"></div>');
  1305. nextArrow = $('<a class="arrow_controll arrow_controll_next" href="#next">+</a>').appendTo(arrowControlls).bind('click', {show: 'next'}, container.methods.setSlideNumber).css({visibility:'visible', opacity:0});
  1306. prevArrow = $('<a class="arrow_controll arrow_controll_prev" href="#prev">-</a>').appendTo(arrowControlls).bind('click', {show: 'prev'}, container.methods.setSlideNumber).css({visibility:'visible', opacity:0});
  1307. }
  1308. if(positioningClass)
  1309. {
  1310. arrowControlls.appendTo(container);
  1311. }
  1312. else
  1313. {
  1314. arrowControlls.insertAfter(container);
  1315. }
  1316. if(!isMobile)
  1317. {
  1318. arrowControlls.parent().hover(function()
  1319. {
  1320. prevArrow.stop().animate({opacity:0.7},400);
  1321. nextArrow.stop().animate({opacity:0.7},400);
  1322. },
  1323. function()
  1324. {
  1325. prevArrow.stop().animate({opacity:0},400)
  1326. nextArrow.stop().animate({opacity:0},400)
  1327. });
  1328. }
  1329. },
  1330. autoRotation: function()
  1331. {
  1332. if(container.is('.autoslide_true'))
  1333. {
  1334. options.autorotation = true;
  1335. var myRegexp = /autoslidedelay__(\d+)/g;
  1336. var match = myRegexp.exec(container[0].className);
  1337. if(parseInt(match[1]) > 0)
  1338. {
  1339. options.autorotationInterval = parseInt(match[1]) * 1000;
  1340. }
  1341. }
  1342. else if(container.is('.autoslide_false'))
  1343. {
  1344. options.autorotation = false;
  1345. }
  1346. if(options.autorotation)
  1347. {
  1348. interval = setInterval(function()
  1349. {
  1350. container.methods.setSlideNumber();
  1351. },
  1352. options.autorotationInterval);
  1353. }
  1354. }
  1355. };
  1356. container.methods.preload();
  1357. });
  1358. };
  1359. })(jQuery);
  1360. // -------------------------------------------------------------------------------------------
  1361. // contact form ajax improvements
  1362. // -------------------------------------------------------------------------------------------
  1363. (function($)
  1364. {
  1365. $.fn.kriesi_ajax_form = function(variables)
  1366. {
  1367. var defaults =
  1368. {
  1369. sendPath: 'send.php',
  1370. responseContainer: '#ajaxresponse'
  1371. };
  1372. var options = $.extend(defaults, variables);
  1373. return this.each(function()
  1374. {
  1375. var form = $(this),
  1376. form_sent = false,
  1377. send =
  1378. {
  1379. formElements: form.find('textarea, select, input[type=text], input[type=checkbox], input[type=hidden]'),
  1380. validationError:false,
  1381. button : form.find('input:submit'),
  1382. dataObj : {}
  1383. };
  1384. responseContainer = $(options.responseContainer+":eq(0)");
  1385. send.button.bind('click', checkElements);
  1386. function send_ajax_form()
  1387. {
  1388. if(form_sent){ return false; }
  1389. form_sent = true;
  1390. send.button.fadeOut(300);
  1391. responseContainer.load(form.attr('action')+' '+options.responseContainer, send.dataObj, function()
  1392. {
  1393. responseContainer.find('.hidden').css({display:"block"});
  1394. form.slideUp(400, function(){responseContainer.slideDown(400); send.formElements.val('');});
  1395. });
  1396. }
  1397. function checkElements()
  1398. {
  1399. // reset validation var and send data
  1400. send.validationError = false;
  1401. send.datastring = 'ajax=true';
  1402. send.formElements.each(function(i)
  1403. {
  1404. var currentElement = $(this),
  1405. surroundingElement = currentElement.parent(),
  1406. va