jQuery(document).ready(function(){ initSifr(); // popup jQuery('#fader').css('opacity','0.6'); jQuery('a.view-popup').click(function(){ jQuery('#fader').css('display','block'); jQuery.ajax({ type: "GET", url: "http://slottochkoja.se/wp-content/themes/communix/inc/tos.php", success: function(msg){ jQuery('#terms-service').find('div.text div').html(msg).end().fadeIn(500); poupUp_height('terms-service'); } }); }); jQuery('.spam a').click(function(){ jQuery('#fader').css('display','block'); jQuery.ajax({ type: "GET", url: "/wp-content/themes/communix/inc/your-privacy.tpl", success: function(msg){ jQuery('#privacy').find('div.text div').html(msg).end().fadeIn(500); poupUp_height('privacy'); } }); }); jQuery('#fader, .popup a.close').click(function(){ jQuery('.popup').fadeOut(500, function(){ jQuery('#fader').css('display','none'); return false; }); }); // choose lg if (jQuery('#choose').length) { var _chooseHeight = jQuery('#choose ul').get(0).offsetHeight; jQuery('#choose ul').css({ visibility:'visible', display:'none', height:'0px', overflow:'hidden' }); jQuery('#choose li').hover(function(){ jQuery(this).children('ul').css('display','block').animate({height:_chooseHeight+"px"},{queue:false,duration:400}); }, function(){ jQuery(this).children('ul').animate({height:"0px"},{queue:false,duration:400, easing:'easeOutCubic'}); }); } // gallery jQuery('div.featured-members').galleryScroll({ holderList:'div.wrap-gallery', btPrev:'a.prev', btNext:'a.next', duration: 2500 }); jQuery('body').append('
'); var _photo = []; jQuery('#popup-preview').addClass("popup-preview"); jQuery('div.featured-members li a').click(function(){ var photoOffset = jQuery(this).parent('li').offset(); var _contentPopup = jQuery(this).parent().find('div.pop-up-content').html(); jQuery('#popup-preview') .children('div') .children('div') .html(_contentPopup) .end() .end() .css({ top:photoOffset.top+"px", left:photoOffset.left+"px", visible:"hidden", display:'block', marginTop:"0px", marginLeft:"0px", width:"300px", height:"auto" }); var _heightIMG = jQuery('#popup-preview').height(); jQuery('#popup-preview').css({ width:"50px", height:"50px", visible:"visible" }) .animate({ width:"300px", height:_heightIMG+"px", marginTop:(-_heightIMG+30)/2+"px", marginLeft:"-70px" },300); document.body.onclick = function(e) { if(!e) e = window.event; var _target = (e.target || e.srcElement); var _par = getElementBefore(_target,"popup-preview"); if (_par.id != 'popup-preview') { closePreview(); document.body.onclick = null; } } return false; }); jQuery('#popup-preview a.close-popup').click(function(){ jQuery(this).parents('#popup-preview').fadeOut(300, function(){ jQuery(this).css({ top:"0px", left:"0px", display:'none', marginTop:"0px", marginLeft:"0px" }); }) return false; }); //navigation var divs = []; jQuery('#nav div.sub-nav').each(function(i, el){ divs[i] = jQuery(el).get(0).offsetHeight; }); jQuery('div.sub-nav').css({ display:'none', visibility:'hidden', height:'0px' }); jQuery('#nav li').hover(function(){ jQuery(this).find('div.sub-nav').css('display','none'); if (jQuery.browser.msie && jQuery.browser.version == "6.0") jQuery(this).addClass('hover'); if (jQuery(this).find('div.sub-nav').length) { var _index = jQuery('#nav div.sub-nav').index(jQuery(this).find('div.sub-nav:eq(0)')); jQuery(this).find('ul:eq(0)').css('paddingBottom','15px'); jQuery(this).find('div.sub-nav:eq(0)').css({display:'block',height:'0px',visibility:'visible'}); jQuery(this).find('div.sub-nav:eq(0)').animate({height:divs[_index]+15+'px'},500, function(){ jQuery(this).css({overflow:'visible'}); jQuery(this).find('ul:eq(0)').animate({paddingBottom:'0px'},250); jQuery(this).animate({height:divs[_index]+'px'},200); }); } }, function(){ if (jQuery.browser.msie && jQuery.browser.version == "6.0") jQuery(this).removeClass('hover'); if (jQuery(this).find('div.sub-nav').length) { jQuery('div.sub-nav').stop(); jQuery(this).find('div.sub-nav').css({display:'none',visibility:'visible'}); } }); jQuery('#nav').hover(function(){ return false; }, function() { jQuery('div.sub-nav').stop(); jQuery(this).find('div.sub-nav').css({display:'none',visibility:'visible'}); }); // tabs button animate jQuery('ul.post-tabs').each(function(i, el){ animateTabs(el); }); jQuery('ul.member-tabs').each(function(i, el){ animateTabsV(el); }); // tooltip jQuery('.tooltip').parent().find('input').focus(function(){ var offset = jQuery(this).offset(); var _html = jQuery(this).parent().find('.tooltip').html(); jQuery('#tooltip-holder').css({ top: offset.top - 6 +'px', left: offset.left+jQuery(this).width()+ 10 +'px' }).html(_html).fadeIn(400); }); jQuery('.tooltip').parent().find('input').blur(function(){ jQuery('#tooltip-holder').css('display','none'); }); // tooltip-left jQuery('.tooltip-left').parent().find('input').focus(function(){ var offset = jQuery(this).offset(); var _html = jQuery(this).parent().find('.tooltip-left').html(); jQuery('#tooltip-holder').css({ top: offset.top - 6 +'px', left: offset.left - 183 +'px' }).html(_html).fadeIn(400); }); jQuery('.tooltip-left').parent().find('input').blur(function(){ jQuery('#tooltip-holder').css('display','none'); }); // buttons hover var _src; var _img = new Image(); _img.src = 'images/sign-up-hover-sv_SE.gif' jQuery('input.bt-hover').hover(function(){ _src = jQuery(this).attr('src'); jQuery(this).attr('src',_src.replace('sign-up-sv_SE.gif','sign-up-hover-sv_SE.gif')); }, function(){ jQuery(this).attr('src',_src); }); // hide input text var _inputs = document.getElementsByTagName('input'); var _value = ''; if (_inputs) { for(var i=0; i<_inputs.length; i++) { if (_inputs[i].type == 'text' || _inputs[i].type == 'password' || _inputs[i].type == 'comment-form-name' || _inputs[i].type == 'comment-form-email' || _inputs[i].type == 'comment-form-homepage') { _inputs[i].onfocus = function(){ _value = this.value; this.value = ''; } _inputs[i].onblur = function(){ if (this.value == '') this.value = _value; _value = ''; } } } } }); function closePreview(){ jQuery('#popup-preview').fadeOut(300, function(){ jQuery(this).css({ top:"0px", left:"0px", display:'none', marginTop:"0px", marginLeft:"0px" }); }) } // tabs button animate functions (horizontal) function animateTabs(_obg){ var _liWidth = []; var _lis = jQuery(_obg).children('li'); var _links = jQuery(_obg).find('a'); var _linkIndex = _links.index(_links.filter('.active')); _lis.each(function(i, el){ _liWidth[i] = jQuery(el).get(0).offsetWidth; }); if (jQuery.browser.msie) jQuery('