/* Toggles Live chat on if JS is turned on, if JS is off Live chat stays invisible */
$(document).ready(function(){
    $(".livechatWrapper").toggle();
    $(".livechatMenu").toggle();
  });




/* popup page */
function pop(url, w, h) {
  win=window.open(url,'tCw','width=' + w + ',height=' + h + ',resizable=1,scrollbars=1');
  if (win.opener) { win.moveTo(0,0); } else { win.opener=self; }
  if (win.focus) win.focus();
} 




$(document).ready(function(){
    checkQueryString();
    $('.capability2').click(function(){
	   toggleTabs('capability');
    });
    $('.choose2').click(function(){
	   toggleTabs('choose');
    });
    $('.use2').click(function(){
	   toggleTabs('use');
    }); 
    $('.key').click(function(){
	   toggleTabs('capability');
    });
    $('.why').click(function(){
	   toggleTabs('choose');
    });
    $('.ways').click(function(){
	   toggleTabs('use');
    });    
    
    function toggleTabs(tab){
        switch(tab){
            case 'use':
                $(".toggleTabs1").css({'display' : 'none'});
                $(".toggleTabs2").css({'display' : 'none'});
                $(".toggleTabs3").css({'display' : 'inline'});
                break;    
            case 'choose':
                $(".toggleTabs1").css({'display' : 'none'});
                $(".toggleTabs2").css({'display' : 'inline'});
                $(".toggleTabs3").css({'display' : 'none'});
                break;
            default:
                $(".toggleTabs1").css({'display' : 'inline'});
                $(".toggleTabs2").css({'display' : 'none'});
                $(".toggleTabs3").css({'display' : 'none'});
        }
    }
    
    function checkQueryString(){
        var query = document.location.search;
        var reg ='tab=[0-9a-zA-Z]+';
        var tab = query.match(reg)
        if (tab != null){
            tab[0] = tab[0].substring(4);
            toggleTabs(tab[0]);
        }else{
            toggleTabs('triggerDefault');
        }
    } 
    
    $('.key').hover(
		function () {
			if ($('.key').hasClass('tabInfoBottomLeft')) {
				$('.key').addClass('tabInfoBottomLefthover');
				$('.key').removeClass('tabInfoBottomLeft');
			}
		}, 
		function () {
			if ($('.key').hasClass('tabInfoBottomLefthover')) {
				$('.key').removeClass('tabInfoBottomLefthover');
				$('.key').addClass('tabInfoBottomLeft');	
			}
		}
	);
	
	$('.why').hover(
		function () {
			if ($('.why').hasClass('tabInfoBottomLeft')) {
				$('.why').addClass('tabInfoBottomLefthover');
				$('.why').removeClass('tabInfoBottomLeft');
			}
		}, 
		function () {
			if ($('.why').hasClass('tabInfoBottomLefthover')) {
				$('.why').removeClass('tabInfoBottomLefthover');
				$('.why').addClass('tabInfoBottomLeft');	
			}
		}
	);
	
	$('.ways').hover(
		function () {
			if ($('.ways').hasClass('tabInfoBottomLeft')) {
				$('.ways').addClass('tabInfoBottomLefthover');
				$('.ways').removeClass('tabInfoBottomLeft');
			}
		}, 
		function () {
			if ($('.ways').hasClass('tabInfoBottomLefthover')) {
				$('.ways').removeClass('tabInfoBottomLefthover');
				$('.ways').addClass('tabInfoBottomLeft');	
			}
		}
	);
});


$(document).ready(function() {
	$('.questionSearch').click(function() {
		$('.questionFormContent').slideToggle("fast");
	});
	
	$('.questionSearch').click(function (){
		 if ($('.questionSearch').hasClass('questionSearch')) {
			 $('.questionSearch').addClass('questionSearch2');
			 $('.questionSearch').removeClass('questionSearch');
			}
	});
	
	$('.closeFromButton').click(function() {
		$('.questionFormContent').slideToggle("fast");
		if ($('.questionSearch2').hasClass('questionSearch2')) {
			 $('.questionSearch2').addClass('questionSearch');
			 $('.questionSearch2').removeClass('questionSearch2');
			}
	});	
});


$(document).ready(function(){
	$(".container").hide();
	$(".seeExample").hover(
		function () {
			if (!$(this).hasClass("seeExampleOpen")) {
				$(this).addClass('seeExampleOver');
				$(this).removeClass('seeExampleUp');
			}
		}, 
		function () {
			if (!$(this).hasClass("seeExampleOpen")) {
				$(this).removeClass('seeExampleOver');
				$(this).addClass('seeExampleUp');	
			}
		}
	);
	
	$(".titleImage").hover(
		function () {
			if (!$(this).parent().parent().siblings().filter(".seeExample").hasClass("seeExampleOpen")) {
				$(this).parent().parent().siblings().filter(".seeExample").addClass('seeExampleOver');
				$(this).parent().parent().siblings().filter(".seeExample").removeClass('seeExampleUp');
			}
		}, 
		function () {
			if (!$(this).parent().parent().siblings().filter(".seeExample").hasClass("seeExampleOpen")) {
				$(this).parent().parent().siblings().filter(".seeExample").removeClass('seeExampleOver');
				$(this).parent().parent().siblings().filter(".seeExample").addClass('seeExampleUp');	
			}
		}
	);	
	
	$(".seeExample").click(function (){
	 var hide = $(this).parent().siblings().filter(".container");
	 hide.slideToggle("fast");

	 if ($(this).hasClass('seeExampleOpen')) {
	     $(this).addClass('seeExampleUp');
	     $(this).removeClass('seeExampleOpen');
        }else{
	     $(this).addClass('seeExampleOpen');
	     $(this).removeClass('seeExampleOver');	
	 }
	});

    $(".podWrapper .seeExample:eq(0)").trigger('click');
    
	$(".titleImage").click(function (){
		var hide = $(this).parent().parent().parent().siblings().filter(".container");
		hide.slideToggle("fast");
	 	
		var tag = $(this).parent().parent().siblings().filter(".seeExample");
		
		if (tag.hasClass('seeExampleOver')) {
			tag.addClass('seeExampleOpen');
			tag.removeClass('seeExampleOver');
		}else{
			tag.addClass('seeExampleUp');
			tag.removeClass('seeExampleOpen');
		}
	});

    $(".other").hover(function () {
		  if ($(".other").hasClass("otherSol")) {
			 $(".other").removeClass("otherSol");
			 $(".other").addClass("otherSolHover");
	  }
      }, 
      function () {
		  if ($(".other").hasClass("otherSolHover")) {
			 $(".other").removeClass("otherSolHover");
			 $(".other").addClass("otherSol");
	  }
      }
    );

    
    
    
    
});

