//Create AJAX request object
function createRequest() {

		var request = null;

		try {
			request = new XMLHttpRequest();
		} catch (trymicrosoft) {

			try {
				request = new ActiveXObject("Msxm12.XMLHTTP");
			} catch (othermicrosoft) {

				try {
					request = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (failed) {
					request = null;
				}
			}
		}

		return request;
}

function getPhotos(MtID) {

	var request = createRequest();

	var mytime= "&ms="+new Date().getTime();

	var url="/mytree/photos.asp?mtid="+MtID+mytime;
	
	request.open("GET", url, true);

	request.onreadystatechange = function() {

					if (request.readyState == 4) {
						if (request.status == 200) {
							document.getElementById('photos').innerHTML = request.responseText;
							
							jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
								return -c * ((t=t/d-1)*t*t*t - 1) + b;
							};

							jQuery(function( $ ){


								$('.slideshow1').serialScroll({
									items:'li',
									prev:'a.prev1',
									next:'a.next1',
									offset:-160, //when scrolling to photo, stop 230 before reaching it (from the left)
									start:1, //as we are centering it, start at the 2nd
									duration:1200,
									force:true,
									stop:true,
									lock:false,
									cycle:true, //don't pull back once you reach the end
									easing:'easeOutQuart', //use this easing equation for a funny effect
									jump: false //click on the images to scroll to them
								});


							});
							
							bindThickBoxEvents();
							

						}
						else {
							//alert(request.responseText);
							document.write(request.responseText);
						}
					}
					}
	request.send(null);

}

function removeThickBoxEvents() {
        $('.thickbox').each(function(i) {
            $(this).unbind('click');
        });
    }

function bindThickBoxEvents() {
        removeThickBoxEvents();
        tb_init('a.thickbox, area.thickbox, input.thickbox');
    }
