﻿// JScript File
$(document).ready(function() {



//TAG LINKS
 
    $('.allTags').click(function() {
	    $('.knowledge2').show();
    		});

    $('.minTags').click(function() {
   	    $('.knowledge2').hide(); 
   		 });

	 

    //SIGN IN

    $('.signinButton').click(function() {
    		
 	    x=$('#signinBox').css("display");
	    if (x=="none")
	    {
   		    $('#signinBox ').slideDown('slow', function() {
   			    $('#signinBox FORM').fadeIn('slow', function() {
     				checkCookie();
      			    });
      		    })
	    }
	    else
	    {
		    $('.closeMe').click();
	    }
	   
    });
    
    
     $('.closeMe').click(function() {
     	 $('#signinBox FORM').fadeOut('fast', function() {
	            $('#signinBox').slideUp('slow', function() {
    	
      			    });
      		    })
      		});


	$('.products').click(function() {
		$('.comingSoon').fadeIn('slow', function() {
		setTimeout('ComingSoon()', 2000) ;	
        	});
	}); 
	

})


 function ComingSoon() {
	$('.comingSoon').fadeOut('slow', function() {

		});
	}; 

var headline_count;
var headline_interval;
var old_headline = 0;
var current_headline = 0;

var content_height = 188;

function start_ticker() {
    headline_count = $("li.headline").size();
    $("li.headline:eq("+current_headline+")").css('top', '0');
 
    if (headline_count>1)
    {
        headline_interval = setInterval(headline_rotate,7000);
        $('#testimonyScroll').hover(function() {
            clearInterval(headline_interval);
        }, function() {
            headline_interval = setInterval(headline_rotate,7000);
            headline_rotate();
        });
    }
}
 
function headline_rotate() {
  current_headline = (old_headline + 1) % headline_count;
  $("li.headline:eq(" + old_headline + ")")
    .animate({top: -content_height},"slow", function() {
      $(this).css('top', content_height+'px');
    });
  $("li.headline:eq(" + current_headline + ")")
    .animate({top: 0},"slow"); 
  old_headline = current_headline;
}


function valid_subscribe_form() {
    if (validEmail(document.getElementById("email").value)) {
        return true;
    } else {
        $("#emailError").slideDown();
        return false;
    }
}


function getCookie(c_name) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1;
            c_end = document.cookie.indexOf(";", c_start);
            if (c_end == -1) c_end = document.cookie.length;
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return "";
}

function checkCookie() {
   
    username = getCookie("LHPuser");

    if (username != null && username != "") {
         
        document.getElementById("username").value = username;

        password = getCookie('LHPword');
        document.getElementById("password").value = password;
    }

}

