
$(document).ready(function(){
				
		function makeMyHeight(){
			//var col1 = $("#col1").height();
			//var col3 = $("#col3").height();
			//if(col1 > col3){$("#col3").height(col1);}
			//if(col3 > col1){$("#col1").height(col3);}	
		}
		

		$("#col1_content img").css({background:"#000"});
		$("#pricing").hide();
		$("#subnav a.pricing").click(function(){
									$("#session").fadeOut(1000);
									$("#pricing").fadeIn(1000);
									//makeMyHeight();
									return false;
							 });
		$("#subnav a.session").click(function(){
									$("#pricing").fadeOut(1000);
									$("#session").fadeIn(1000);
									//makeMyHeight;
									return false;
							 });
		
		//$("#subnav").hide().show('drop',{duration:1500, direction:'left'});
		$(".rollover").hover(function(){
                rollsrc = $(this).attr("src");
				rollON = rollsrc.replace(/.jpg$/ig,"_f2.jpg");
				$(this).attr("src", rollON);
        		},function(){
                $(this).attr("src", rollsrc);
         });
		
		$('.client_edit a').livequery("click",function(){
												var galleryid = $(this).parent("div.client_edit").attr("id");
												if(confirm("Are you sure you want to delete?"))
												{
												$.post('http://www.mcfrederickphotography.com/smile/clients_edit_gallery/clear',{clients_gallery_id: galleryid},function(){$("div#" + galleryid).fadeOut(1000);});												
												return false;
												} else {
													return false;
												}
												});
		/*$('select[name="category"]').change(
				function(){
					var category = this.value;
					$.post('http://www.mcfrederickphotography.com/smile/portfolio_edit/category/' + category,{image: category},function(data){
						$("#target").empty().append(data).livequery("click",
							function(){
								$('.gallery_edit form').submit(
										function(){
										   var divid = $(this).parent().attr('id');
										   var title = $(this).children('input[@name]="gallery_title"').val();
										   var categoryid = $(this).children('select[@name="gallery_name"').val();
										   //alert("gallery_id " + divid + " select " +$(this).select[gallery_name].value + " title " + $(this).gallery_title.value);
										   $.post('http://www.mcfrederickphotography.com/smile/portfolio_edit/update',
												  {gallery_title: title, gallery_id: divid, gallery_to_category_id: categoryid},
												  function(form_message){$("#"+divid).fadeTo("slow",0.25);});
										   
										 return false; 
										} 
								)
								$('.gallery_edit input, .gallery_edit select').focus(function(){$(this).parent().parent().fadeTo("fast",1.00);});
								
							}
						);
					});
			});
			$('.gallery_edit a').livequery("click",function(){
												var galleryid = $(this).parent("div.gallery_edit").attr("id");
												if(confirm("Are you sure you want to delete?"))
												{
												$.post('http://www.mcfrederickphotography.com/smile/portfolio_edit/clear',{gallery_id: galleryid},function(){$("div#" + galleryid).fadeOut(1000);});
												return false;
												} else {
													return false;	
												}
												});
		*/
		//when clicking  a thumbnail change background to match image
		/*
			$("ul.gallery_unstyled li img").click(function(){
				var new_image = $(this).attr("src");
				
            	$.get('http://www.mcfrederickphotography.com/includes/make_bg.php',{image: new_image},function(data){$("#col1").css({background: "#" + data});});});
		
		
		$('.gallery_unstyled').addClass('gallery'); // adds new class name to maintain degradability
		var galleriaOptions ={
			history   : true, // activates the history object for bookmarking, back-button etc.
			clickNext : true, // helper for making the image clickable
			insert    : '#main_image', // the containing selector for our main image
			onImage   : function(image,caption,thumb) { // let's add some image effects

				// fade in the image & caption
				image.css('display','none').fadeIn(1000);
				caption.css('display','none').fadeIn(1000);

				// fetch the thumbnail container
				var _li = thumb.parents('li');

				// fade out inactive thumbnail
				_li.siblings().children('img.selected').fadeTo(500,0.3);

				// fade in active thumbnail
				thumb.fadeTo('fast',1).addClass('selected');

				// add a title for the clickable image
				image.attr('title','Next image >>');
			},
			onThumb : function(thumb) { // thumbnail effects goes here

				// fetch the thumbnail container
				var _li = thumb.parents('li');

				// if thumbnail is active, fade all the way.
				var _fadeTo = _li.is('.active') ? '1' : '0.3';

				// fade in the thumbnail when finnished loading
				thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);

				// hover effects
				thumb.hover(
					function() { thumb.fadeTo('fast',1); },
					function() { _li.not('.active').children('img').fadeTo('fast',0.3); } // don't fade out if the parent is active
				)
			}
		};
		$('ul.gallery_unstyled li:first').addClass("active");
		$('ul.gallery').galleria(galleriaOptions);
		
		$('#main_image').change(function(){ makeMyHeight();});
		*/
		$('.thickbox').each(function(){
    		var url = $(this).attr('href') + '?height=400&width=800';
    		$(this).attr('href', url);
     	});
		/*
		//Disable click menu
		$(document).bind("contextmenu",function(e){
			return false;
		});
*/

		/*
		$('#portfolio_pagination').pagination(getRows(),{
											  items_per_page: 5,
											  callback: loadContents
											  });
		$('#client_pagination').pagination(getClientRows(),{
											  items_per_page: 5,
											  callback: loadClientContents
											  });
		//var col1 = $("#col1").height();
		//var col3 = $("#col3").height();
		//	if(col1 > col3){$("#col3").height(col1);}
		//	if(col3 > col1){$("#col1").height(col3);}
		
		//load thumbnail for portfolio page
		function loadContents (page_id){
			
			var gallery_id = $("ul.galleria li").attr("class");
			$('div.subcolumn div.c50l').hide('drop',{duration:1500, direction: 'left'});
			$('ul.galleria').children().remove();
			$('#main_image').children().remove();
			$.get('http://www.mcfrederickphotography.com/smile/get_pagination/' + gallery_id + '/' + page_id,{},
				  function(data){
					$('ul.galleria').append(data).galleria(galleriaOptions);
					$('div.subcolumn div.c50l').show("slow",loadFirstImage);
					$("ul.gallery_unstyled li img").bind("click",function(){
						
					var new_image = $(this).attr("src");
            		$.get('http://www.mcfrederickphotography.com/includes/make_bg.php',
						  {image: new_image},
						  function(data){
							  $("#col1").css({background: "#" + data});
							});
					});
			});
			
			
			
		}
		//load thumbnail for client page
		function loadClientContents (page_id){
			var gallery_id = $("ul.galleria li").attr("class");
			$('div.subcolumn div.c50l').hide('drop',{duration:1500, direction: 'left'});
			$('ul.galleria').children().remove();
			$('#main_image').children().remove();
			$.get('http://www.mcfrederickphotography.com/smile/get_clients_pagination/' + gallery_id + '/' + page_id + '/clients',{},
				  function(data){
					$('ul.galleria').append(data).galleria(galleriaOptions);
					$('div.subcolumn div.c50l').show("slow",loadFirstImage);
					$("ul.gallery_unstyled li img").bind("click",function(){
					var new_image = $(this).attr("src");
            		$.get('http://www.mcfrederickphotography.com/includes/make_bg.php',{image: new_image},function(data){$("#col1").css({background: "#" + data});});});
			});
						
		}
		function loadFirstImage(){
			var main_image = $("ul.gallery_unstyled li:first img").attr("src");
			$("img[src='" + main_image + "']").click();
		}
		*/
		$("span.image-wrapper a img").change(function(){
			var new_image = $(this).attr("src");
            		$.get('http://www.mcfrederickphotography.com/includes/make_bg.php',
						  {image: new_image},
						  function(data){
							  $(".bars").css({background: "#" + data});
							});
		});
		
		$('ul.jd_menu ul:visible li').hide();
		
		
	});
		