//Products functionality

	 $(document).ready(function(){

		//Bind function to click event of contact types
		$("div.producttype").click(function() {
			var baseURL = "http://www.yourdesigner.com/workshop/";
			var imgSrc = $("input[name='image']", this).val();
			imgSrc = baseURL+"phpThumb/phpThumb.php?src="+imgSrc+"&#38;w=195&#38;h=140&#38;f=png";
			$("#serviceimage").attr("src", imgSrc);
			$("div.producttype").addClass("product_sidebar").removeClass("product_sidebar_selected");
			$(this).addClass("product_sidebar_selected").removeClass("product_sidebar");
			$("#rate").text($("input[name='rate']", this).val());
			$("#min_rate").text($("input[name='min_rate']", this).val());
			$("#designers").text($("input[name='designers']", this).val());
			$("#concepts").text($("input[name='concepts']", this).val());
			$("#hours").text($("input[name='hours']", this).val());
			$("#revisions").text($("input[name='revisions']", this).val());
			$("#desc").text($("input[name='desc']", this).val());
			$("#size").text($("input[name='size']", this).val());
			//load samples into service_samples
			var html='';
			if($("input[name='samples']", this).length) {
				var sampleFiles = $("input[name='samples']", this).val().split(",");
				for ( var i=0, len=sampleFiles.length; i<len; ++i ){
					imgSrc = baseURL+"phpThumb/phpThumb.php?src="+sampleFiles[i]+"";
					html += "<div class='grid_2' style='margin-left:0px;height:220px;'><a href='"+sampleFiles[i]+"' class='zoom1' rel='illus'><img src='"+imgSrc+"' alt='' width='139' height='171' border='1' class='image' /></a></div>";
				}
			}
			$("#service_samples").html(html);
			$("a.zoom").fancybox();
		
					$("a.zoom1").fancybox({
						'overlayOpacity'	:	0.7,
						'overlayColor'		:	'#FFF'
					});
		
					$("a.zoom2").fancybox({
						'zoomSpeedIn'		:	500,
						'zoomSpeedOut'		:	500
					});
		});
		
		
		//Simulate click of first product
		var id = parseInt(window.location.search.substring(1));
		if(!isNaN(id)) {
			$("#productid_"+id).click();
		} else {
			$($("div.producttype")[0]).click();
		}
		
	});

