/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


function changeTopMenuImage(id,image_name,state){
    img = document.getElementById(id);
    if (state){

        img.src = './images/icons_hover/' + image_name + '.gif';
    }
    else{

   
        img.src = './images/icons/' + image_name  + '.gif';
    }

}

function onPageLoad(){


 }





function addToggle(t,c){
    $(t).click(function () {
        //  $('.front_intro').css('display','none');
        $(c).slideToggle("slow");
    });

}

function addPortfolioPageToggles(){
    for(i=1;i<13;i++){
        t = '#title' + i + '_t';
        c = '#title' + i + '_c';
        addToggle(t,c);
    }
}





function showLightBox(nloverlay){
    nlcontainer = '#lb-container';

    documentHeight = ($(document).height());
    documentWidth = ($(document).width());
    windowHeight = ($(window).height());
    windowWidth = ($(window).width());


    noticeLbContainerWidth = $(nloverlay).css('width');

noticeLbContainerWidth = noticeLbContainerWidth.replace(/px/,'');

    $(nlcontainer).css('opacity',0);
    $(nloverlay).css('opacity',0);


    $(nlcontainer).css('display','block');
    $(nloverlay).css('display','block');

    $(nlcontainer).css('width',documentWidth);
    $(nlcontainer).css('height',documentHeight);


    nlcLeftPos = (windowWidth - noticeLbContainerWidth) / 2;
    nlcTopPos = $(window).scrollTop() + 200;
    // nlcTopPos = ((windowHeight - 100) / 2);
    $(nloverlay).css('left',nlcLeftPos);
    $(nloverlay).css('top',nlcTopPos);

    $(nlcontainer).fadeTo(100,.5);
    $(nloverlay).fadeTo(300,1);
}

function clearLb(nloverlay){
    $(nlcontainer).css('display','none');
    $(nloverlay).css('display','none');
}

	animate_count = 0;
	animate_array = Array();

	function animate(arr,interval){
            height = 0;
		for (i in arr){
                    if ($(arr[i]).height() > height){
                        height = $(arr[i]).height();
                    }
			$(arr[i]).css('display','none');
			$(arr[i]).css('opacity',0);

		}
                $('#quote-box').height(height);

		//speed = Math.floor(interval/4);
                speed = interval;
		animate_array = arr;
		animator(animate_array,speed);
		setInterval("animator(animate_array,speed)",interval + 2500);
	}


	function animator(arr,speed){
		if (animate_count >= arr.length){
			animate_count = 0;
		}
		//		alert(i);
		box = arr[animate_count];
		$(box).css('display','block');
		$(box).animate(
		{opacity: 1},
		1000,
		null,
		function(){
			$(box).animate(
			{opacity: 1},
			speed,
			null,
			function(){
				$(box).animate(
				{opacity: 0},
				1000,
				null,
				function(){
					$(box).animate({opacity: 0},
					500,
					null,
					$(box).css('display','none')
				)}
			)}
		)}
	);
		animate_count++;
	}