 
/* MODAL CAHRT */

var ModalCharts = {

	getHtml: function(queryString){
		
		if(typeof reloadNavDetails =='function'){
		
			GlobalModal.onShow = function(){
				jQuery("#j_navigators_wrap").attr("id","j_navigators_wrap_locked");
			}
		
		}
		
		if(typeof reloadNavDetails =='function'){			
			GlobalModal.onHide= function(){
				jQuery("#j_navigators_wrap_locked").attr("id","j_navigators_wrap");
				NavigatorLite.prov='';
			}
		}
	
		this.type='fulltext';
		this.symbolToShrink='';
	
		var advancedForm;
		var html='';
		
		html+='<div class="normal_search" style="">';
			html+='<div style="float:right; margin-right:23px;">';
				html+='<form action="javascript:;" onsubmit="ModalCharts.goSearch()">';
					html+='<input type="text" id="search_chart_value" style="width:196px; margin-right:2px; border:1px solid #DDDDDD; padding:5px;"><input type="submit" value="Search Charts" style="background:#3399DD; border:none; color:white; -moz-border-radius:4px; padding:5px; font-weight:bold;">';
					html+='<a style="margin-top:4px; font-size:11px; text-decoration:underline; font-weight:bold; display:block;" class="show_more" href="javascript:;" onclick="ModalCharts.showMoreSearch()">show more search options</a>';			
				html+='</form>';	
			html+='</div>';
			html+='<div style="clear:both"></div>';
			html+='<div style="float:left; margin-top:-44px;">';
				html+='<div sty class="tip_init"></div>';
				html+='<div class="j_navigator_lite_preview"><div style="border:1px solid #DDDDDD; width:100%; height:100%; background:url(\'/lib/jquery/bgnav.gif\') top left repeat">&nbsp;</div></div>';
			html+='</div>'
			html+='<div id="j_navigators_wrap" style="float:right; margin-top:40px;">';
			html+='</div>';
			html+='<div style="clear:both"></div>';
			html+='<div style="float: right; position: absolute; margin-top: 11px; right: 61px; top: 50px; left:430px; display:none;" id="go_to_normal"><a style="text-decoration: underline; font-weight: bold; font-size: 11px;" onclick="ModalCharts.showNormalSearch()" href="javascript:;">[return]</a></div>';
			html+='<div style="clear:both"></div>';
		html+='</div>';
		
		jQuery.get("/lib/jquery/adv_form_charts.html?rand="+Math.random(5*100), function(data){
			jQuery.getJSON("/charts/search/", function(initJSON){
				ModalCharts.initJSON=initJSON;
				advancedForm=ModalCharts.formatAdvanceSearch(data, initJSON);											 
				
				GlobalModal.init(800,400);
				GlobalModal.appendHtml(html+advancedForm);
				GlobalModal.showWindow();

				jQuery("#go_to_normal a").text(initJSON.RESETTXT);
				
				if(typeof queryString != 'undefined'){
					ModalCharts.callNavigator('http://www.wetradetogether.com/charts/result/?key=&'+queryString);
					ModalCharts.callNavigator('http://www.wetradetogether.com/charts/navigator/?key=&is_external=1');
				}
				else {
					ModalCharts.callNavigator('http://www.wetradetogether.com/charts/navigator/?key=');
				}
								
				jQuery('#date_after, #date_before').datepicker();	
				
				setTimeout(function(){
					jQuery(".datepicker").css("position","fixed");
				},100);
			});
		});
		
	},
	
	callNavigator: function(url){
		var initClassNav='navigator-'+Number(new Date());
		NavigatorLite.makeNavigator(initClassNav, url);
		NavigatorLite.currentNavigator=initClassNav;
	},
	
	formatAdvanceSearch: function(data, initJSON){
		
		var select_search_charts='';
		var select_search_for='';
		var select_search_date='';
		
		data=data.replace("[TITLE]",initJSON.TITLE);
		data=data.replace("[GO BACK]",initJSON.GO_BACK);
		data=data.replace("[search_chart]",initJSON.SEARCH_CHART);
		data=data.replace("[TIP_SEARCH_CHARTS]",initJSON.TIP_SEARCH_CHARTS);
		data=data.replace("[search_for]",initJSON.SEARCH_FOR);
		data=data.replace("[TIP_SEARCH_FOR]",initJSON.TIP_SEARCH_FOR);
		data=data.replace("[None of this words]",initJSON.NONE_OF_THIS_WORDS);
		data=data.replace("[FULLTEXT]",initJSON.FULLTEXT);
		data=data.replace("[TAGS]",initJSON.TAGS);
		data=data.replace("[SYMBOL]",initJSON.SYMBOL);
		data=data.replace("[search_date]",initJSON.SEARCH_DATE);
		data=data.replace("[TIP_SEARCH_DATE]",initJSON.TIP_SEARCH_DATE);
		data=data.replace("[AFTER]",initJSON.AFTER);
		data=data.replace("[BEFORE]",initJSON.BEFORE);
		data=data.replace("[NOTEXT]",initJSON.NOTEXT);
		data=data.replace("[SUBMIT]",initJSON.SUBMIT);
		data=data.replace(/\[DATE_FORMAT\]/g,initJSON.DATE_FORMAT);
		data=data.replace("[return to]",initJSON.FOOTERBACK);
		data=data.replace("[basic search]",initJSON.FOOTERBACK_A);
		
		select_search_charts+='<select onchange="ModalCharts.toggleSelect()" id="select_search_charts" name="select_search_charts" style="width:218px">';
		jQuery.each(initJSON.SELECT_SEARCH_CHART, function(i, val){
			select_search_charts+='<option value="'+(i+1)+'">'+val+'</option>';										
		});
		select_search_charts+='</select>';
		
		select_search_for+='<select name="select_search_for" style="width:218px">';
		jQuery.each(initJSON.SELECT_SEARCH_FOR, function(i, val){
			select_search_for+='<option value="'+(i+1)+'">'+val+'</option>';					
		});
		select_search_for+='</select>';	
		
		select_search_date+='<select name="select_search_date" style="width:218px">';
		jQuery.each(initJSON.SELECT_SEARCH_DATE, function(i, val){
			select_search_date+='<option value="'+(i+1)+'">'+val+'</option>';													
		});
		select_search_date+='</select>';			
		
		data=data.replace("[select_search_chart]",select_search_charts);
		data=data.replace("[select_search_for]",select_search_for);
		data=data.replace("[select_search_date]",select_search_date);
		
		return data;
	},
	
	sendAdvForm: function(){
		
		NavigatorLite.firstPhoto = false;
		NavigatorLite.currentShow = false;
		
		if(jQuery(".adv_form_charts #text").val()=='' && jQuery("#select_search_charts").val()=='1'){
			
			if(
				jQuery(".adv_form_charts form input[name='symbol']").val()=='' &&
				jQuery(".adv_form_charts form input[name='tags']").val()==''
										
			){
				SearchGrid.showMessageChart("KO", CalendarLocalization.NO_VALUE_ADV_FORMS);
				return;	
			}
		}
		
		if(jQuery("#select_search_charts").val()=='2' && jQuery("#select_search_charts_value").val()==ModalCharts.initJSON.TITLE_INPUT){
			SearchGrid.showMessageChart("KO", CalendarLocalization.NO_VALUE_ADV_FORMS);
			return;
		}
		
		jQuery(".adv_form_charts #text").css("border","");
		jQuery(".text_error").hide();		
		
		var queryString='&form=adv_form_charts';
		jQuery.each(jQuery(".adv_form_charts input[type=text]"), function(i, element){
			queryString+='&'+jQuery(element).attr("name")+'='+jQuery(element).val();
		});
		jQuery.each(jQuery(".adv_form_charts input[type=radio]:checked"), function(i, element){
			queryString+='&'+jQuery(element).attr("name")+'='+jQuery(element).val();
		});
		jQuery.each(jQuery(".adv_form_charts select option:selected"), function(i, element){
			queryString+='&'+jQuery(element).parent().attr("name")+'='+jQuery(element).val();
		});
				
		NavigatorLite.currentNavigator='navigator-last-charts';
		NavigatorLite.makeNavigator('navigator-last-charts','http://www.wetradetogether.com/charts/result/?key='+queryString);
		
		NavigatorLite.advSearchOk = true;
		
		ModalCharts.showNormalSearch();
				
		jQuery("#go_to_normal").show();
		
		
	},
	
	externalSearch: function(queryString){
		
		//NavigatorLite.firstPhoto = false;
		
		NavigatorLite.prov='search';
				
		queryString+='&is_external=1';
		
		ModalCharts.getHtml(queryString);
				
		NavigatorLite.advSearchOk = true;
		
		ModalCharts.showNormalSearch();
				
		jQuery("#go_to_normal").show();
		
	},
	
	showMoreSearch: function(){
		jQuery(".normal_search").fadeOut(400);
		jQuery(".adv_form_charts").fadeIn(400);
	},
	
	showNormalSearch: function(){
		
		ModalCharts.goToNormal();		
		
		jQuery(".adv_form_charts").fadeOut(400);
		jQuery(".normal_search").fadeIn(400);
		
		jQuery("#go_to_normal").hide();
		jQuery("#j_navigators_wrap").text("");
		jQuery("#search_chart_value").val("");
		
		if(!NavigatorLite.advSearchOk){
			NavigatorLite.firstPhoto = false;
			ModalCharts.callNavigator('http://www.wetradetogether.com/charts/navigator/?key=');
		}
		
		NavigatorLite.advSearchOk = false;
		
	},	
	
	switchTo: function(type, element){
		this.type=type;
		jQuery(".choose a").css("font-weight","normal");
		jQuery(element).css("font-weight","bold");
	},
	
	goSearch: function(){
		
		NavigatorLite.firstPhoto = false;
		NavigatorLite.currentShow = false;
		
		var val = jQuery("#search_chart_value").val();
		jQuery("#j_navigators_wrap").text("");
		NavigatorLite.currentNavigator='navigator-last-charts';
		NavigatorLite.makeNavigator('navigator-last-charts','http://www.wetradetogether.com/charts/navigator/?type='+this.type+'&text='+val+'&key=');
		jQuery("#go_to_normal").show();
		
		ModalCharts.goToNormal();
		
		return false;
	},
	
	
	
	goToNormal: function(){
		jQuery(".j_navigator_lite_preview").empty();
		jQuery(".j_navigator_lite_preview").html('<div style="background: url(/lib/jquery/bgnav.gif) repeat scroll left top transparent; border: 1px solid #DDDDDD; height: 100%; width: 100%;">&nbsp;</div>');
	},
	
	shrinkUrl: function(url){
		jQuery("#msg-click-box").click();
		ShortenURL.shortenURL(url,ModalCharts.addUrl);
	},
	
	addUrl: function(url){
		jQuery("#msgbox").val("");
		var text = "#chart "+url+' $'+ModalCharts.symbolToShrink;
		if(Twitts.userActive) text = 'd '+Twitts.userActive+' '+text;
		//jQuery("#msgbox").val( jQuery("#msgbox").val() + "#chart "+url+' $'+ModalCharts.symbolToShrink );
		MessageBox.setValue(text);
		GlobalModal.hideWindow();
		Twitts.userActive = false;
	},
	
	toggleSelect: function(){
		
		var val = jQuery("#select_search_charts option:selected").val();
		var sInput = jQuery("#select_search_charts_value");
		
		if(val=='2'){
			sInput.removeAttr("disabled");
			sInput.val(ModalCharts.initJSON.TITLE_INPUT);
			sInput.css("color","#BBBBBB");
		} else {
			sInput.attr("disabled","disabled");
			sInput.val("");
		}
	},
	
	toggleInput: function(){
		var sInput = jQuery("#select_search_charts_value");
		if(sInput.val()==ModalCharts.initJSON.TITLE_INPUT){
			sInput.val("");
			sInput.css("color","");
		} else if(sInput.val()=='') {
			sInput.val(ModalCharts.initJSON.TITLE_INPUT);
			sInput.css("color","#BBBBBB");
		}
	},
	
	toggleInputText: function(val){
		var sInput = jQuery(".adv_form_charts #exclude");
		if(val!=''){
			sInput.removeAttr("disabled");
		} else {
			sInput.attr("disabled","disabled");
		}
	}	
	
};

/* END MODAL CHART */

/* NAVIGATOR LITE */

var NavigatorLite = {
	
	firstPhoto: false,
	currentShow: false,
	
	init: function(){	

		this.previewClass='j_navigator_lite_preview';	
		
		this.previewWidth=360;
		this.previewHeight=278;
	
		jQuery("."+this.previewClass).css("width",this.previewWidth+'px');
		jQuery("."+this.previewClass).css("height",this.previewHeight+'px');
		jQuery("."+this.previewClass).css("position","relative");
		
	},
	
	makeNavigator: function(_navigatorClass, _urlJson){
		
		NavigatorLite.init();
		this.refresh(_navigatorClass,_urlJson,'null');
		
	},
	
	createLi: function(_navigatorClass, dataJSON){
		
		var htmlLi='';
		var onclickPreview='';
		if(NavigatorLite.magicThumb && NavigatorLite.prov!='search'){
			var magicClass='MagicThumb';
			var cursorReset='cursor:url(\'/magicthumb/magicthumb/graphics/zoomin.cur\'), pointer';
		} else {
			var cursorReset='cursor:pointer';
			var magicClass='';
		}
		
		//if(NavigatorLite.currentNavigator==_navigatorClass){
		if(dataJSON.STATUS){
			var display='block';
			var display2='none';
		} else {
			var display2='inline';
			var display='none';
		}
		
		dataJSON.TITOLO = dataJSON.TITOLO.replace("&amp;","&");
		
		htmlLi+='<h5><a href="javascript:;" onclick="NavigatorLite.toggle(this,\''+_navigatorClass+'\')"><span style="display:'+display2+'">&nbsp;</span>&nbsp;'+dataJSON.TITOLO+'</a></h5>';	
		
		htmlLi+='<ul class="c_navigator" style="display:'+display+'">';
			
			jQuery.each(dataJSON.FOTO, function(field, photo){
				
				var imgSpecialClass='';
				var borderLi = '2px solid #DDDDDD';
				if( NavigatorLite.idObj && photo.IDBIS && NavigatorLite.idObj==photo.IDBIS){
					imgSpecialClass='focusme';
					magicClass='';
					cursorReset='cursor:default';
				} else if(NavigatorLite.prov!='search') {
					if( NavigatorLite.magicThumb && dataJSON.STATUS){
						magicClass='MagicThumb';
						cursorReset='cursor:url(\'/magicthumb/magicthumb/graphics/zoomin.cur\'), pointer';
					}	
				}
				
				if(!NavigatorLite.disableOnclick || NavigatorLite.prov=='search'){
					onclickPreview='onclick="NavigatorLite.preview(\''+photo.PATHMEDIUM+photo.IMG+'\',jQuery(this).parent().find(\'img\'), \''+photo.ANALYSIS+'\', \''+photo.TITOLO+'\', \''+photo.FOOTER+'\', \''+photo.ID+'\', \''+photo.SYMBOL+'\', \''+dataJSON.SHRINK+'\', \''+photo.IDBIS+'\'); "';
				} else {
					onclickPreview='onclick="NavigatorLite.spanClick(this)"';
				}
				
				if(NavigatorLite.currentShow == "selected_"+photo.IDBIS && NavigatorLite.firstPhoto === false){
					borderLi = '2px solid #3399DD';
						
				}
				
				htmlLi+='<li class="thumb selected_'+photo.IDBIS+'" style="border:'+borderLi+'">'
					+'<span style="'+cursorReset+'" class="photo_label">'+photo.LABEL+'</span>'
					+'<span style="'+cursorReset+'" class="photo_symbol '+imgSpecialClass+'" '+onclickPreview+'>'+photo.SYMBOL+'</span>';
					if(photo.IMG){
						if(magicClass && NavigatorLite.prov!='search' ){
							htmlLi+='<a style="display:block; width:75px; height:75px" rel="group: default-speed; click-to-initialize: true; background-color:#000; background-opacity:60; slideshow-effect: expand; caption-position: right; link:'+photo.ID+'&name='+dataJSON.NAME+';" class="'+magicClass+'" href="'+photo.PATHMEDIUM+photo.IMG+'">';
						}
						htmlLi+='<img style="'+cursorReset+'" '+onclickPreview+' src="'+photo.PATHSQUARE+photo.IMG+'">';
						if(magicClass && NavigatorLite.prov!='search'){
							htmlLi+='<span><p style="cursor:pointer; margin:0px; padding:0px; font-size:20px; font-weight:normal; margin-top:-6px; color:blue; text-decoration:underline" onclick="document.location.href=\''+photo.ID+'&name='+dataJSON.NAME+'\'">'+photo.TITOLO+'<img style="width:auto; height:auto;" align="absmiddle" onload="jQuery(this).attr(\'style\',\'width:22px; margin-left:2px; cursor:pointer\')" onclick="document.location.href=\''+photo.ID+'\'" src="/images/fullscreen.png"></p>'+photo.ANALYSISFULL.replace(/\\/g,"")+'</span>';
							htmlLi+='</a>';
						}
					}
				htmlLi+='</li>';
				
				if(field=='0' && NavigatorLite.firstPhoto !='selected_'+photo.IDBIS && NavigatorLite.currentShow === false){
					NavigatorLite.firstPhoto = 'selected_'+photo.IDBIS;
				}
				
			});
		
		htmlLi+='</ul>';
		
		if(NavigatorLite.firstPhoto !== false && !NavigatorLite.idObj){
			setTimeout(function(){
				
				var currentToShow = jQuery("."+NavigatorLite.firstPhoto);
				var firstCurrentToShow = jQuery(currentToShow[0]);
				
				if(firstCurrentToShow.length>0){
					firstCurrentToShow.find("img").click();
				}
				
			},100);
		}
			
		if(parseInt(dataJSON.CURRENTPAGE)>1){
			htmlLi+='<a class="controls prev" href="javascript:;"><span></span></a>';
		}
		
		if(parseInt(dataJSON.CURRENTPAGE)<parseInt(dataJSON.TOTPAGES)){
			htmlLi+='<a class="controls next" href="javascript:;"><span></span></a>';
		}		
		
		jQuery("."+_navigatorClass).html(htmlLi);
		
		if(NavigatorLite.magicThumb && NavigatorLite!='search'){
			MagicThumb.start();
			MagicThumb.refresh();
		}
		
		if(jQuery(".focusme").length){
			NavigatorLite.selectMe(jQuery(".focusme"));
		}
		
		jQuery.each( jQuery("."+_navigatorClass+' .thumb'), function(i, element){
			NavigatorLite.effect(element,'in',i);
		});
		
		if(!NavigatorLite.shrink){
			NavigatorLite.shrink=dataJSON.SHRINK;
		}
	},
	
	spanClick: function(element){
		var id=jQuery(element).parent().find("a").attr("id");
		MagicThumb.expand(id);
	},
	
	createControls: function(_navigatorClass, dataJSON){
		
		jQuery('.'+_navigatorClass+' .prev').unbind("click");
		jQuery('.'+_navigatorClass+' .next').unbind("click");
		
		jQuery('.'+_navigatorClass+' .prev').bind("click", function(){
			NavigatorLite.refresh(_navigatorClass, dataJSON.INDIETRO+'&STATUS=true','prev'); 
			NavigatorLite.firstPhoto = false;
		});
		
		jQuery('.'+_navigatorClass+' .next').bind("click", function(){
			NavigatorLite.refresh(_navigatorClass, dataJSON.AVANTI+'&STATUS=true','next'); 
			NavigatorLite.firstPhoto = false;
		});
		jQuery('.'+_navigatorClass).bind("mouseover", function(){
			if(jQuery('.'+_navigatorClass+' .thumb').css("display")=='list-item'){
				jQuery("."+_navigatorClass+" .controls").css("display","block");
			}
		});
		jQuery("."+_navigatorClass).bind("mouseout", function(){
			jQuery("."+_navigatorClass+" .controls").css("display","none");
		});	
	},
	
	preview: function(imgUrl, element, ANALYSIS, TITOLO, FOOTER, LINK, SYMBOL, SHRINK, ID){
		
		NavigatorLite.currentShow = "selected_"+ID;
		
		ModalCharts.symbolToShrink=SYMBOL;
		
		if(!NavigatorLite.shrink){
			NavigatorLite.shrink=SHRINK;
		}
		if(NavigatorLite.prov=='search'){
			NavigatorLite.shrink='&nbsp;&nbsp;Show this chart';
		}
		//jovertext action
		var htmlJoverText='';
		htmlJoverText+='<div class="blockimg" id="o_navigator">'
			+'<img style="width:'+this.previewWidth+'px; height:'+this.previewHeight+'px" src="'+imgUrl+'">'
			+'<div class="title_description">'
				+'<h2 style="color:white">'+TITOLO+'</h2>'
				+'<p style="line-height:18px">'+ANALYSIS+'</p>'
				+'<span style="display:block; font-size:11px; margin-left:5px; border-top:1px solid; position:absolute; width:100%; bottom:5px;">'+FOOTER+'</span>'
			+'</div>'
		+'</div>';
		if(NavigatorLite.prov=='msg'){
			htmlJoverText+='<a onclick="ModalCharts.shrinkUrl(\''+LINK+'\')" class="shrink_action_text" href="##">'+NavigatorLite.shrink+'</a>';
		} else {
			htmlJoverText+='<a onclick="document.location.href=\''+LINK+'\'" class="shrink_action_text" href="##">'+NavigatorLite.shrink+'</a>';
		}
		jQuery("."+this.previewClass).html(htmlJoverText);
		
		jQuery("#o_navigator").overText({
			opacity: 0.8,
			speed:1000,
			background:'#1d93c3'
		});
		
		NavigatorLite.selectMe(element);
		
	},
	
	selectMe: function(element){
		jQuery(".thumb").css("border","2px solid #DDDDDD");
		jQuery(".thumb").css("padding:","0px");
		jQuery(".thumb, .thumb img").css("width","72px");
		jQuery(".thumb, .thumb img").css("height","72px");
		
		jQuery(element).parent().css("border","2px solid #3399DD");
		jQuery(element).parent().css("width","75px");
		jQuery(element).parent().css("height","75px");

		jQuery(element).css("width","75px");
		jQuery(element).css("height","75px");
	},
	
	refresh: function(_navigatorClass, _urlJson, type){
		
		var timeoutSlide=400;
		
		if(type=='prev'){
			var newMargin=+(75*5);
		} else if(type=='next') {
			var newMargin=-(75*5);
		}
		
		if(jQuery("."+_navigatorClass+" .c_navigator").length ){
			jQuery("."+_navigatorClass+" .c_navigator").animate({
				left: newMargin
			},timeoutSlide);
		}
		
		setTimeout(function(){
			jQuery.getJSON(_urlJson+'&jsonp=?', function(dataJSON){
				NavigatorLite.goJson(_navigatorClass, dataJSON, type);
				
			});
		},timeoutSlide/2);
		
	},
	
	controlAction: function(_navigatorClass, _urlJson){
		NavigatorLite.refresh(_navigatorClass, _urlJson);
	},
	effect: function(element,type,i){
		var initialTimeout=220;
		if(type=='out'){
			setTimeout(function(){
				jQuery(element).fadeOut(initialTimeout);
			}, initialTimeout*i);
		}
		if(type=='in'){
			setTimeout(function(){
				jQuery(element).fadeIn(initialTimeout);
			}, initialTimeout*i);
		}
	}, 
	toggle: function(element,_navigatorClass){
		
		var thumbDivPersonal = jQuery("."+_navigatorClass).find(".c_navigator");
		var thumbDivALL = jQuery("."+_navigatorClass).parent().find(".c_navigator");
		var controlsDivPersonal = jQuery("."+_navigatorClass).find(".controls");
		var controlsDivALL = jQuery("."+_navigatorClass).parent().find(".controls");
		
		if(thumbDivPersonal.css("display")=='none'){
			
			thumbDivALL.slideUp(200);
			controlsDivALL.slideUp(200);
			
			thumbDivPersonal.slideDown(200);
			controlsDivPersonal.slideDown(200);
			
			jQuery(".c_navigator").parent().height("auto");
			jQuery('.'+_navigatorClass).height("120px");
			
			NavigatorLite.currentNavigator=_navigatorClass;
			
			jQuery(".j_navigator_lite h5 a").find("span").remove()
			
			jQuery(".j_navigator_lite h5 a").prepend("<span>&nbsp;</span>");
			
			jQuery(element).find("span").remove();
			
			if(NavigatorLite.magicThumb){
				MagicThumb.start();
				MagicThumb.refresh();
			}		
				
		} else {
			thumbDivPersonal.slideUp(200);
			controlsDivPersonal.slideUp(200);
			//jQuery(".c_navigator").parent().height("auto");
			jQuery('.'+_navigatorClass).height("auto");
			jQuery(element).prepend("<span>&nbsp;</span>");
			if(NavigatorLite.magicThumb){
				MagicThumb.start();
				MagicThumb.refresh();
			}			
		}
	},
	goJson: function(_navigatorClass, dataJSON, type){
		
		var is_external = dataJSON.IS_EXTERNAL;	
		
		if(is_external>0){
			
			jQuery(".tip_init").html(dataJSON.ISTRUZIONI);
			jQuery(".tip_init").css("width","362px");
			jQuery(".tip_init").css("background","#ECEFF5");
			jQuery(".tip_init").css("padding-bottom","6px");
			jQuery(".tip_init h5").css({
				"background":"white",
				"width":"420px"
			});
			
			return
					
		}
		
		if(!jQuery("."+_navigatorClass).length){
			jQuery("#j_navigators_wrap").append('<div class="j_navigator_lite '+_navigatorClass+'"></div>');
		}
		
		NavigatorLite.createLi(_navigatorClass, dataJSON);
		NavigatorLite.createControls(_navigatorClass,dataJSON);
		
		if(type=='null'){
			
			jQuery(".tip_init").html(dataJSON.ISTRUZIONI);
			jQuery(".tip_init").css("width","362px");
			jQuery(".tip_init").css("background","#ECEFF5");
			jQuery(".tip_init").css("padding-bottom","6px");
			jQuery(".tip_init h5").css({
				"background":"white",
				"width":"420px"
			});
			
			if(dataJSON.QUERYNAVIGATOR){
				var idObj = '';
				if(NavigatorLite.idObj){
					idObj = '&ID='+NavigatorLite.idObj;
				}
				jQuery.each(dataJSON.QUERYNAVIGATOR, function(i, val){
						NavigatorLite.makeNavigator('navigator-'+Number(new Date()),val.PATHNAVIGATOR+'?key='+idObj+'&STATUS='+val.STATUS);
				});
			}						
			
			//NavigatorLite.preview(dataJSON.FOTO[0].PATHMEDIUM+dataJSON.FOTO[0].IMG, jQuery("."+_navigatorClass+' .thumb img:first'),dataJSON.FOTO[0].ANALYSIS, dataJSON.FOTO[0].TITOLO, dataJSON.FOTO[0].FOOTER, dataJSON.FOTO[0].ID, dataJSON.FOTO[0].SYMBOL, dataJSON.SHRINK);
			
		}
		if(NavigatorLite.MagicThumb){
			setTimeout(function(){
				MagicThumb.refresh(); 
			},1000);
		}
	},
	cleanNavigators: function(){
		jQuery('#j_navigators_wrap').text("");
	},
	addMeToMagic: function(element){
		/*meelement = jQuery(element).clone(true);
		jQuery(element).parent().append(meelement);*/
	}
	
};

/* END NAVIGATOR LITE */
