function Bugaboo_Compare2() {
	this.fn = null;
	strollers = "";
	this.detailstitles = "";
	this.dragme = "";
	this.clickme = "";
	this.t=null;
	this.dragEnabled = false;
	this.namespace = "";

	this.getColorName = function (color){
		return t["color_"+color];
	}
	
	this.test = function(){
		if(this.fn == 'undefined'){
			alert("undefined");
		}else{
			alert("YES");
		}
		
	
	}
	
	this.init = function(){
		// get country and language
		var gli = jQuery.cookie('GUEST_LANGUAGE_ID');
		var language = gli.substring(0,2);
		var country = gli.substring(3,5);
		
		var callBackMeta1 = {
			async: false,
//			arg: this.strollers,
			callback: wrapper1
		};
		
		function wrapper1(data){
			strollers = eval('('+data+')');
		}
		
		DWRView.getStrollersJSON(country, language, callBackMeta1);
		
		DWRView.getDetailsTitles(country, language, {
			async: false,
			callback:  function(data){
				detailstitles = eval('('+data+')');
				this.t = detailstitles.detailstitles[0];
				
				for (var key in this.t) {
				    if (this.t.hasOwnProperty(key)) {
						if(key === "dropstroller"){
							jQuery("div#exp1").html(this.t[key]);	
						}else if(key === "dropstrollercompare"){
							jQuery("div#exp2").html(this.t[key]);	
							jQuery("div#exp3").html(this.t[key]);	
						}else if(key === "dragme"){
							dragme = this.t[key];
						}else if(this.dragEnabled && key === "clickme"){
							clickme = this.t[key];
						}else{
							jQuery("tr#"+key+" div.detail_name").html(this.t[key]);
						}
				    }
				}
			}
		});
		
		var wrapper = function (data, params){
			var _fn = params.a;
			var dragEnabled = params.b;
			var namespace = params.c;
			
			var html = "";
			var arr = new Array();
			for (var i = 0; i < data.length; i++){
				arr[i] = new Image();
				arr[i] = data[i][1];
			}
			
			for (var i = 0; i < data.length; i++){
				var height = 250 / data.length;
				if(height > 100){
					height = 100;
				}
				html += "<div id=\"draggable"+(i+1)+"\" style=\"width: 250px; cursor:move;height: "+height+"px; background: url('/product_comparison-portlet/grad.png');background-repeat:repeat-y;background-position:0 0;\">"+
							"<div id=\""+data[i][2]+"\">"+
								"<div style='float:left;'>"+
									"<img height="+height+" src='"+data[i][1]+"'>"+
								"</div>"+
								"<div style='color: white; bottom: 0px; position: absolute; left: "+height+"px;'>bugaboo "+data[i][0]+"<br>"+
									"<div style='color:#9c9c9c;font-size:9px;'>"+
										(!dragEnabled ? "<img src='/product_comparison-portlet/cursor_drag_hand.png' height=16>"+dragme :clickme) + 
									"</div>"+
								"</div>"+
							"</div>"+
						"</div>";
			}
			jQuery("div#"+namespace+"drag #draggables").html(html);		

			for (var j = 0; j < data.length; j++){
				_fn.setDraggable("div#"+namespace+"drag #draggable"+(j+1));
			}
			if(dragEnabled){
				for (var j = 0; j < data.length; j++){
					jQuery("div#"+namespace+"drag #draggable"+(j+1)).click(function(){
						
						var id = this.id.substring(this.id.length-1);
						placeDraggableManual("draggable"+id);
					});
				}
			}
			if(window[namespace+"prePopulate"]){
				for (var j = 0; j < data.length && j < 3; j++){
					placeDraggableAutomatic("draggable"+(j+1), data[j][0]);
				}
			}
		}
		
		var callBackMeta = {
			async: false,
			arg: {a:this.fn, b:this.dragEnabled, c:this.namespace},
			callback: wrapper
		};


		DWRView.getStrollerNamesAndImage(country, language, callBackMeta);

		jQuery("div[@id*='droppable']").css({ "width": "250px", "height": "250px", "float": "left"});
		var previousSwitch = 0;
		jQuery("div[@id*='droppable']").droppable({
					accept:function(a){
						

						return true;
					},
					tolerence: 'touch',
					activeClass: 'ui-state-hover',
					hoverClass: 'ui-state-active',
					drop:function(event, ui){
						var stamp = new Date().getTime();
						if(stamp < previousSwitch + 100){
							previousSwitch = stamp;
							return;
						}
						previousSwitch = stamp;
						fn.placeDraggable(ui.draggable[0], ui.element[0]);
					},
					over:function(event, ui){
						jQuery(ui.element[0]).css("background","#FF6600");
					},
					out:function(event, ui){
						jQuery(ui.element[0]).css("background","none");
					}
		});

	}
	
}
