                                                                     
                                                                     
                                                                     
                                             
$(document).ready(function()
	{
		/* expandable blocks styles */
		$(".info-block h2 a").click(function () {
			if($(this).parents('div.info-block').hasClass("collapsed")) {
				$(this).parents('div.info-block').find(".content").slideDown("1000");
				$(this).parents('div.info-block').removeClass("collapsed");
				$(this).removeClass("off");
			}
			else {
				$(this).parents('div.info-block').find(".content").slideUp("1000");
				$(this).parents('div.info-block').addClass("collapsed");
				$(this).addClass("off");
			}
			return false;
		});
		$("a.expand").click(function () {
			alterVisibleElements($(this).parents('div.info-block').find(".content"), 1);
			return false;
		});
		$("a.collapse").click(function () {
			alterVisibleElements($(this).parents('div.info-block').find(".content"), -1);
			return false;
		});
	});
	
	
	function alterVisibleElements(objectToAlter, AddReduce)
	{
	    //debugger
		if (objectToAlter)
		{
		    var oContentUls = objectToAlter.children();
		    if (!oContentUls) {
		        return false;
		    }
		    if (oContentUls.length == 0) {
		        return false;
		    }
		    if (oContentUls[0].nodeName.toLowerCase() != 'ul') {
		        return false;
		    }
		    var oContentLls = oContentUls.children();
		    
		    var oContentLl;
		    var oContentLlStyleDisplay;
		    var i;
		    var nVisible = 0;
		    if (oContentLls) {
		        for (i = 0; i < oContentLls.length; i++) {
		            oContentLl = oContentLls[i];
		            if (oContentLl.nodeName.toLowerCase() == 'li') {
		                oContentLlStyleDisplay = oContentLl.style.display;
		                if (oContentLlStyleDisplay == '' || oContentLlStyleDisplay == 'block') {
		                    nVisible++;
		                }   
		            }
		        }
		        if (AddReduce > 0) {
		            if (nVisible < oContentLls.length) {
		                /*
		                for (i = 1; i < oContentLls.length; i++) {
		                    oContentLl = oContentLls[i];
		                    oContentLl.style.display = 'none';
		                }
		                for (i = 0; i < oContentLls.length; i++) {
		                    if (i <= (nVisible + AddReduce - 1)) {
		                        oContentLl = oContentLls[i];
		                        oContentLl.style.display = 'block';
		                    }
		                }
                        */

		                for (i = nVisible; i < (nVisible + AddReduce); i++) {
		                    if (i >= 0 & i < oContentLls.length) {
		                        //alert(i + '|' + (nVisible + AddReduce) + '|' + oContentLls.length);
								oContentLl = oContentLls[i];
		                        if (oContentLl.nodeName.toLowerCase() == 'li') {
		                            oContentLl.style.display = 'block';
		                        }
		                    }
		                }
		            }
		        }
		        if (AddReduce < 0) {
		            if (nVisible > 0) {
		                /*
		                for (i = 1; i < oContentLls.length; i++) {
		                    oContentLl = oContentLls[i];
		                    oContentLl.style.display = 'none';
		                }
		                for (i = 0; i < oContentLls.length; i++) {
		                    if (i <= (nVisible + AddReduce - 1)) {
		                        oContentLl = oContentLls[i];
		                        oContentLl.style.display = 'block';
		                    }
		                }
                        */
                        for (i = (nVisible + AddReduce); i <= (oContentLls.length - 1); i++) {
                            if (i >= 1 && i < oContentLls.length) {
								oContentLl = oContentLls[i];
                                if (oContentLl.nodeName.toLowerCase() == 'li') {
                                    oContentLl.style.display = 'none';
                                }
		                    }
		                }
		            }
		        }
		    }
		}
		return false;
	}
