/*
----------------------------
Web-master: Natalia Onischuk
Email: info@webwizard.in.ua
ICQ: 471029619
SKYPE: Na2se4ka
URL: http://webwizard.in.ua/
---------------------------- */
/* home slider ~~~~~~~~~~~~~~~~~~~~~~ */
function homeSlider(hs){
nLi = $(hs+' li').size()-1;
if(nLi>0){
ll=0-$(hs+' li:first-child').width();
$(hs).append('
');
$('.hsNavi a').click(function(e) {
th=$(this);
c=th.parent().attr('num');
th.hasClass('hsPrev') ? c>0 ? c-- : c=nLi : c');
$(b).parent().find(l).hover(
function (){
Li = $(this).parents('li');
bb=Li.find(b);
//bb.stop(true,true).fadeIn();
bb.show();
liX=Li.offset().left; liY=Li.offset().top;
h=bb.height();
},
function (){
//bb.stop(true,true).fadeOut();
bb.hide();
}
).mousemove(function(e){
x=e.pageX-liX;
y=e.pageY-liY;
bb.css({left:x+30, top:y-20-h/2});
});
}
}
// toggle block
function toggle_blocks(a,b){
if($(a).size()){
$(a).each(function(index, element) {
hr=$(this).attr('href');
if(!$(this).hasClass('active')) $(hr).show(0).slideUp(0);
else $(hr).slideDown(0);
});
$(a).click(function(e){
if($(a+'[rel='+$(this).attr('rel')+']').size()==1 || !$(this).attr('rel')){
$(this).toggleClass('active');
$($(this).attr('href')).stop(true,true).slideToggle();
}
else if(!$(this).hasClass('active')){
prevL = $(a+'[rel='+$(this).attr('rel')+'].active');
$(prevL.attr('href')).stop(true,true).slideUp();
prevL.removeClass('active');
$(this).addClass('active');
$($(this).attr('href')).stop(true,true).slideDown();
}
return false;
});
}
}
// li wrapper
function liWrapper(ul){
if($(ul+' li').size()>2){
$(ul+' li:nth-child(2n)').after('');
$(ul+' li:last').addClass('last');
}
}
/* init functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
$(document).ready(function(e) {
// home slider
$(window).load(function(){
$('.top_menu').fadeIn(100);
});
homeSlider('.home_slider');
// home logos
toggleLogo('.ColoredImageinLink a');
// toggle descr
toggle_text('.hidd_text',200);
// toggle block
toggle_blocks('.togg_link','.toggle_text_cont');
// tooltips
tooltips('.long_descr','.tooltip_link img');
// li wrapper
liWrapper('.capabilities_list_more',2);
});