$j(document).ready(function() {

		var address = $j.url($j(this).attr("href"));
		
        $j('.product_preview').mouseenter(function(e) {
            //$j(this).children('a').children('img').animate({ height: '200', left: '-20', top: '-20', width: '200'}, 100);
			$j(this).children('a').css("z-index", "100");
			//$j(this).children('a').animate({width: '320'}, 300);
			$j(this).children('a').css("width", "320");
			//$j(this).children('a').children('img').animate({ left: '-160'}, 100);
        }).mouseleave(function(e) {
           	//$j(this).children('a').children('img').animate({ height: '160', left: '0', top: '0', width: '160'}, 100);
  			$j(this).children('a').css("z-index", "1");
           	//$j(this).children('a').animate({width: '160'}, 100);
			$j(this).children('a').css("width", "160");
        });
		
		//start before / after functionality
		$j('#before_after_container').beforeAfter();
	
		$j('#product_image_link').fancybox({
			
			'autoDimensions': false,
			'scrolling'		: 'auto',
			'width'			: '900',
			'height'		: '90%'
			});
		/*
		$j('#product_image_link').mouseover(function(){
			$j('#image_preview').animate({height:425},"slow");
			$j('#image_preview').animate({height:120},"slow");
			})
		*/
		
		$j(".product_image").click(function(){
			//alert($j(this).attr("rel"));			
				$j('#product_image_link img').attr("src", "http://www.pmdstudio.com/img_preview.php?image_file="+$j(this).attr("rel")+"&img_width=466&ratio=strict");
			})
		
		//star rating
		$j('input.star').rating();
		/*
		$j(".star-rating a").click(function(){
			$j('#product_rating').submit();
		})
		*/
		$j('#product_rating a').click(function(){
			var rating_value = $j(this).attr("title");
			var product_id = $j('#product_id').val();
			$j('#vote_results').load("http://www.pmdstudio.com/includes/star_rating.php?id="+product_id+"&rating_value="+rating_value);
		})
		

		//show comments form, simulate button click
		//alert(address.attr('fragment'));
		if(address.attr('fragment') != "")
			{			
				if(address.attr('fragment') == "post-comments")
					$j('#add_comments').trigger('click');
			}
			
		/*
		$j('#box_services').accordion();
		$j('#box_services2').accordion();
		*/
		
		$j("#box_services .box div").hide();
		$j("#box_services .open div").show();
		
		$j("#box_services .box").each(function(index, element){
				$j(element).hover(function(){
					$j(element).toggleClass("open");
					});
				$j(element).find('h3 a').click(function(){
					$j(element).find('div').toggle(300);
					$j(element).toggleClass("open");
					});
			})
		
		$j("#s_open").click(function(){
				$j("#box_services .box").find('div').show(300);
				$j("#box_services .box").addClass("open");
			})
		
		$j("#s_close").click(function(){
				$j("#box_services .box").find('div').hide(300);
				$j("#box_services .box").removeClass("open");
			})
					
		//$j("#news_feed").load("http://www.pmdstudio.com/includes/boxes/rss_news.php");
		
		$j('#submit_ticket').fancybox({	
			'autoDimensions': true,
			'scrolling'		: 'auto',
			'width'			: '900',
			'height'		: '90%',
			'type'			: 'iframe'
			});

});
