$(function(){
	
	//$('img').lazyload({
	//    placeholder : '/fileadmin/templates/scoopmodelscom/images/grey.gif',
	//    event : 'click'
	//});	
	
	
	$('div.tx_scoopmodelscom_pi2 input[type=checkbox]').click(function(){
		$('body').css('cursor','wait');
		$(this).get(0).form.submit();
		$('div.tx_scoopmodelscom_pi2 input[type=checkbox]').attr('disabled','disabled');
	});
	
	$('#select_model').change(function(){
		var selectObj = $(this).get(0);
		if(selectObj.options[selectObj.selectedIndex].value){
			$('body').css('cursor','wait');
			location.href = 'http://' + top.location.host + '/' + selectObj.options[selectObj.selectedIndex].value;
		}
	});
	
	
//	$('div.tx_scoopmodelscom_pi2 ul.modelslist li').hover(
//		function(){
//			var damuid = $(this).attr('rel');
//			var image = $(this).find('span.image img');
//			image.attr('rel',image.attr('src'));			
//			image.attr('src','/?eID=tx_scoopmodelscom_roimage&damuid='+damuid);
//		},
//		function(){
//			var image = $(this).find('span.image img');
//			image.attr('src',image.attr('rel'));			
//		}
//	);


//	$('div.tx_scoopmodelscom_pi2 ul.modelslist li span.image img').each(function(){
//		$this = $(this);
//		
//		var file = $this.attr('rel');
//		var imageid = $this.attr('id');
//
////		$.ajax({
////			type: 'GET',
////			url: 'http://' + top.location.host + '/?eID=tx_scoopmodelscom_roimage&key=greyscale&getfilename=1&file='+file+'&imageid='+imageid,
////			dataType: 'text',
////		  success: function(str){
////		  	parts = str.split('|');
////		  	$('#'+parts[1]).attr('src',parts[0]);
////		  }
////	 	});
//
//		
//		$this.hover(
//			function(){
//				$this = $(this);
//				var file = $this.attr('rel');
//				$this.attr('src','/?eID=tx_scoopmodelscom_roimage&key=color&file='+file);
//			},
//			function(){
//				$this = $(this);
//				var file = $this.attr('rel');
//				$this.attr('src','/?eID=tx_scoopmodelscom_roimage&key=greyscale&file='+file);	
//			}				
//		);		
//	});


	$('div.tx_scoopmodelscom_pi2 ul.modelslist li span.image img').hover(
		function(){
			$this = $(this);
			var file = $this.attr('rel');
			$this.attr('src','/?eID=tx_scoopmodelscom_roimage&key=color&file='+file);
		},
		function(){
			$this = $(this);
			var file = $this.attr('rel');
			$this.attr('src','/?eID=tx_scoopmodelscom_roimage&key=greyscale&file='+file);	
		}				
	);	


//	$(window).load(function(){
//		$('div.tx_scoopmodelscom_pi2 ul.modelslist li span.image img').each(function(){
//			$this = $(this);
//			
//			var file = $this.attr('rel');
//			var imageid = $this.attr('id');
//
//			$.ajax({
//				type: 'GET',
//				url: 'http://' + top.location.host + '/?eID=tx_scoopmodelscom_roimage&key=greyscale&getfilename=1&file='+file+'&imageid='+imageid,
//				dataType: 'text',
//			  success: function(str){
//			  	parts = str.split('|');
//			  	$('#'+parts[1]).attr('src',parts[0]);
//			  }
//		 	});
//
//			
//			$this.hover(
//				function(){
//					$this = $(this);
//					var file = $this.attr('rel');
//					$this.attr('src','/?eID=tx_scoopmodelscom_roimage&key=color&file='+file);
//				},
//				function(){
//					$this = $(this);
//					var file = $this.attr('rel');
//					$this.attr('src','/?eID=tx_scoopmodelscom_roimage&key=greyscale&file='+file);	
//				}				
//			);		
//		});
//	});

	
});

