$(document).ready(function(){
	$(".IL_accordions h3").each(function() {
		$(this).next("div").addClass("accContent");
		var theHeight =	$(this).next("div").outerHeight(true);
		$(this).next("div").css({height:theHeight, display:'none'})
	})
	$(".IL_accordions h3:first").addClass("active").next("div").slideToggle();
	$('.IL_accordions h3').click(function() {
		$(this).css('outline','none');
		if ($(this).hasClass("active")) {
			$(this).next("div").animate({height: "toggle"}, 750,"easeInQuad");
			$(this).removeClass("active");
		}
		else {
			$(this).siblings(".active").next("div").animate({height: "toggle"}, 750,"easeInQuad");
			$(this).next("div").animate({height: "toggle"},750,"easeOutQuad");
			$(this).siblings(".active").removeClass("active");
			$(this).addClass("active");
		}
		return false;
	});	
})
		
/*=====tool tip script	=====*/	

$(document).ready(function(){
	$("#IL_connectBar ul li, #IL_subpageTooltip ul li").hover(
		function(){
			$(this).find("div.toolTip, div.toolTipSubpage").toggle();
		},
		function(){
			$(this).find("div.toolTip, div.toolTipSubpage").toggle();
		})
})


/*======== CASE STUDIES ==============*/

$(document).ready(function() {
    var cs_this = $(".InfoLab_CaseStudies");
    var cs_count = $(".InfoLab_CaseStudies div").length;
    var cs_w = cs_this.width();
    var cs_tw = cs_count * cs_w;
    var current = 1;
    var animate = false;

    cs_this.wrap("<div class='InfoLab_CaseStudies_Wrapper' />");
    $(".InfoLab_CaseStudies_Wrapper").css({ width: $(".InfoLab_CaseStudies_Wrapper").width(), overflow: 'hidden' });
    cs_this.css({ width: cs_tw });

    $(".InfoLab_CaseStudies div").each(function() {
        $(this).css({ float: 'left', width: cs_w });
    })
    cs_this.append("<div class='clear' />");

    //CREATE the CONTROL
    var cs_leftControl = $("<img />").attr("src", "/images/website/arrow-case-studies-left.png").addClass("control_left");
    var cs_rightControl = $("<img />").attr("src", "/images/website/arrow-case-studies-right.png").addClass("control_right");

    cs_this.parent().append("<div class='cs_controlWrapper' />");
    $(".cs_controlWrapper").append(cs_leftControl, cs_rightControl);

    $(".control_left").click(function() {
        if (!animate) {
            ;
            animate = true;
            thisMarginLeft = Number(cs_this.css("marginLeft").replace("px", ""));
            cs_this.animate({ marginLeft: thisMarginLeft + cs_w }, 500, function() {
                current--;
                animate = false;
                if (current == 1) $(".control_left").css({ visibility: 'hidden' });
                if (current == 2) $(".control_right").css({ visibility: 'visible' });
            });
        }
    }).css({ visibility: 'hidden' });

    $(".control_right").click(function() {
        if (!animate) {
            animate = true;
            cs_this.animate({ marginLeft: current * -cs_w }, 500, function() {
                current++;
                animate = false;
                if (current == cs_count) $(".control_right").css({ visibility: 'hidden' });
                if (current == 2) $(".control_left").css({ visibility: 'visible' });

            });
        }
    });
    cs_this.parent().append("<div style='position:absolute;bottom:10px;left:10px;font-weight:bold;font-size:15px;'><img src='/images/website/ourClients_Icon.png'>&nbsp;&nbsp;<a href='/clientlist.html' style='color:#282A65;text-decoration:none'>Our Clients</a></div>");
})
		
		
/*===== Subpage Accordion=====*/

$(document).ready(function(){
$('.itemList').hide();
$('#IL_collapsibleMain h3').click(function() {	 
	 $(this).next().slideToggle('normal',function(){											  
		$(this).prev("h3").find("a").removeClass();										 
		if ($(this).is(":visible")){
		$(this).prev("h3").find("a").addClass("selected");	
		}
		else {
		$(this).prev("h3").find("a").addClass("head");
		}
		});
	}
)
});
	
/*===== Bookmark =====*/																		  

function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

/*===== Subscribe =====*/

$(document).ready(function() {
    $(".IL_subscribeBox input").focus(function() {
        if ($(this).val() == "Enter your email") {
            $(this).val('');
        }
    })
    $(".IL_subscribeBox input").focusout(function() {
        if ($(this).val() == "") {
            $(this).val('Enter your email');
            $(this).css("color", "#cecece");
        }
        else {
            $(this).css("color", "#000");
        }
    })
}) 

/*===== Accordion Stripe =====*/

$(document).ready(function(){
$("#IL_collapsibleMain h3:even").addClass("alt");
});



