$(document).ready(
function(){	

    $('#video-thumbs-container,#doc-thumbs-container,#radio-thumbs-container').children('div').each(function()
    {
        var albumId = $(this).attr('id');
        $('#'+albumId).html("<img src='./images/ajax-loader.gif' alt='' />&nbsp;&nbsp;Loading Video Thumbnails...");
		$('#'+albumId).css('color', 'white');   
        var pageCount =$(this).attr('name');
        var dataString = 'id='+albumId+'&pages='+pageCount;        
    $.ajax({
	type: "GET",
	url: "./php/get_vimeo_album.php",
    data: dataString, 
	dataType: "xml",
	success: function(xml)
	{
           $('#'+albumId).html('');
		$(xml).find('video').each(function(){
	
            var id    = $(this).find('id').text();
			var title = $(this).find('title').text();
            var thumb = $(this).find('thumbnail_small').text();
			var info  = $(this).find('description').text();
			var date  = $(this).find('upload_date').text();
			var url   = $(this).find('url').text();
			var dur   = $(this).find('duration').text();			
			date = date.substring(0,10);

			var videoThumb = "<div id='singlecontainer'><div id='thumbnail' name='thumb_"+id+"'><a class='vimeo' href='"+url+"' title='"+title+"' ><img src='"+thumb+"'/></a></div></div>";
			$('#'+albumId).append(videoThumb);
			$('#vidtitle_'+id).append(title);
			$('#viddur_'+id).append(dur);
			$('#viddate_'+id).append(date);
			
		}); // close XML response
	} //close ajax success
    });   // close AJAX
  }); // close each child loop 
  
  $(".vimeo").live('click',function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: true,
			'title'			: this.title,
			'href'			: this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1'),
			'type'			: 'swf',
			'transitionIn'  : 'elastic',
			'transitionOut' : 'elastic',
			'overlayColor'  : '#000', 
		});
		return false;
	});
	
	 $(".thumb").fancybox({
			'padding'		: 0,
			'autoScale'		: true,
			'title'			: $(this).title,
			'titlePosition'	: 'inside',
			'transitionIn'  : 'elastic',
			'transitionOut' : 'elastic',
			'overlayColor'  : '#000', 
	});
	
	$("#emaillink").fancybox({
             'autoScale' : true,
			 'href'		 : 'email.php',
	         'transitionIn' : 'none',
       	     'transitionOut' : 'none',
             'type' : 'iframe',
			 'transitionIn'  : 'elastic',
			 'transitionOut' : 'elastic',
			 'overlayColor'  : '#000',
			 'padding'		 : '0',
			 'margin'		 : '0',
			 
     });
	
	$('#categories ul li').click(function(){
		var cat = $(this).attr('id');
		var catbox = $('#hidden' + cat);		
		if($(catbox).hasClass('active') != true){
			//alert(catbox.height());
			var catboxheight = catbox.height() +10;
			$('#canvas').animate({
				'marginTop' : +(catboxheight),
				
			},700);
			$('#bottomcopy').animate({
				'marginTop' : 100+(catboxheight),
				
			},700);
			$('#footer').animate({
				'marginTop' : 300+(catboxheight),
				
			},700);
			$('.active').animate({marginTop:'0px', opacity: 'hide'}).removeClass('active');		
			$(catbox).animate({marginTop : '120px', opacity : 'show'}, 700).addClass('active');		
	
		};  //close if catbox
	});	 // close categories click
	
	$('#bottomcopy').click(function(){
									window.location.replace("http://mtmansfieldmedia.com/email.php");
									});
  }); // close doc ready

	

