//var settings = new KCustomSettings();
//var stg = new KCustomSettings();
//var LastPubDate = null;
//var GettaPager = new KCollectionPager();
//var TemplateSource_News = "";
//var TemplateMappingSchema_News;
//var Kidget_SiteId = 196;
//var Kadget_RealmID = '0a871740-9cb1-427c-b1c5-bbed7cec66fa';
//var Kadget_CultureID = '93c0e788-40e3-4cef-9780-3be290b3cfd6';

//function OnMouseWheelNavigate() {
//	if (event.wheelDelta < -20) {
//		GettaPager.goToNextPage();
//	}

//	if (event.wheelDelta > 20) {
//		GettaPager.goToPrevPage();
//	}
//}

//function checkVisibility() {}

//function RefreshCurrentPage() {
//	$get("Container_NewsCollection").innerHTML = new KNewsCollection(GettaPager.getPage()).ReplaceInTemplate(TemplateSource_News, TemplateMappingSchema_News);
//	$get("PagerStat").innerHTML = (GettaPager.PageIndex + 1).toString() + "/" + GettaPager.getPagesCount().toString();
///////// Stats Trace ///////
//	traceStat("run");
/////// End Stats Trace /////
//}

//function OnNewsCollectionUpdating() {
//	GettaPager.ItemsCollection = KNewsManagerStatic_NewsCollection;

//	RefreshCurrentPage();

//	if (LastPubDate == null) {
//		if (GettaPager.ItemsCollection.Items.length > 0 ) {
//			LastPubDate = GettaPager.ItemsCollection.Items[0].PubDate.toString();
//		}
//	}else{
//		if (GettaPager.ItemsCollection.Items.length > 0 ) {
//			if (LastPubDate != GettaPager.ItemsCollection.Items[0].PubDate.toString()) {
//				LastPubDate = GettaPager.ItemsCollection.Items[0].PubDate.toString();
//			}
//		}
//	}
//}

//function OnNewsCollectionUpdatingError() {
//	KMessageManagerStatic_Info_Show("<span class='checkConn'>Connessione Internet non attiva</span>");
//}
//	
//function AutoFormatDate(TheDate) {
//	var pepe = TheDate.getDate() + "/" + (TheDate.getMonth()+1) + "/" + TheDate.getFullYear();// + " - " + TheDate.getHours() + ":" + TheDate.getMinutes();
//	//var pepe = TheDate.format("dd/MM/yy - HH:mm");
//	return pepe;
//}
//	
//function AutoFormatTime(TheTime) {
//	return TheTime;
//}
//	
//function AutoFormatTitle(TheTitle) {
//	return TheTitle;
//}
//   
//function AutoFormatTooltip(TheTooltip) {
//	return "\"" + TheTooltip + "\"";;
//}
//   
//function AutoFormatText(TheText) {
//	return TheText;
//}

//function chkImgError(error1){
//	return error1;
//}
//	
//function StartMeUp2(){
//	var TemplateSource_Id;

//	// BODY HANDLERS
//	document.body.onunload = StopMeUp2;
//	document.body.onmousewheel = OnMouseWheelNavigate;

//	// SETUP VARIABILI GLOBALI
//	TemplateSource_Id = "Template_News_TextImage";
//	TemplateSource_News = $get(TemplateSource_Id).innerHTML;
//	GettaPager.PageSize = 3;

//	GettaPager.PageChangedCallback = RefreshCurrentPage; 
//	TemplateMappingSchema_News = [{placeholderName : "PubDate", elementName : "PubDate", mappingFunction : AutoFormatDate}
//								, {placeholderName : "Title", elementName : "Title", mappingFunction : AutoFormatTitle}
//								, {placeholderName : "NavigateUrl", elementName : "NavigateUrl"}
//								, {placeholderName : "Text", elementName : "Text", mappingFunction : AutoFormatText}
//								, {placeholderName : "ImageUrl", elementName : "ImageUrl", mappingFunction : chkImgError}
//								, {placeholderName : "Tooltip", elementName : "Title", mappingFunction : AutoFormatTooltip}
//								, {placeholderName : "Price", elementName : "ProductPrice"}];

//	// Lavoro sui Settings //

//	var chnId = $get("ddlCanali").options[$get("ddlCanali").selectedIndex].value;
//	//var _feedUrl = "http://kadgetms.kgroup.eu/feedjson/GetChannelJsonConcat.aspx?RID=" + Kadget_RealmID + "&CHID=" + chnId + "&CULT=" + Kadget_CultureID;
//	var _feedUrl = "http://kadgetms.kgroup.eu/FeedJson/XmlProxySop.aspx?URL=" + chnId;
//	// IMPOSTO I PARAMETRI DEL BACKGROUND UPDATER DELLE NEWS
//	KNewsManagerStatic_Url = _feedUrl;
//	KNewsManagerStatic_AutoUpdateOkCallback = OnNewsCollectionUpdating;
//	KNewsManagerStatic_AutoUpdateErrorCallback = OnNewsCollectionUpdatingError;

//	KNewsManagerStatic_StartAutoUpdate();
//}
//   
//function StopMeUp2() {
//	KNewsManagerStatic_StopAutoUpdate();
//}
//   
//function StartMeUp() {
///////// Stats Trace ///////
//	//traceStat("run");
/////// End Stats Trace /////
//	StartMeUp2();
//	var qs = location.search;
//	if (qs =='?debug=pepe'){
//		debugPep();
//	}
//}
//	
//function checkSezionePerDefault(chid){
//var tmp = '';
//	switch (chid){
//		case "23852c29-a4ff-434e-b838-c9d3ca817300":
//			tmp = "img/PicPromozioni.png";
//			break;
//		default:SendDataForOption
//			tmp = 'img/imgDefault.gif';
//	}
//return tmp;
//}
//   
//function OnMandatoryUpdatePresent(LatestVersion) {
//	KMessageManagerStatic_Error_Show("<a class='upgrade' target=\"_blank\" href=\"" + LatestVersion.UpdateUrl + "\">E\' necessario installare la nuova versione (" + LatestVersion.Version + ")</A>");
//}

//// SETUP MESSAGE MANAGER
//KMessageManagerStatic_ElementId = "Container_NewsCollection";


//////////////////////////////////////////////////////////////////////////////////
////
//// canali dinamici
////
//////////////////////////////////////////////////////////////////////////////////
//function SendDataForOption(){
//	var _url = "http://kadgetms.kgroup.eu/FeedJson/AllChannelsJson.aspx?RID=" + Kadget_RealmID + "&ID=" + Kidget_SiteId;

//	var w1 =  null;
//	w1 = loadObj(_url);
//	KNewsManagerStatic_OnRetrievingData(w1.responseText);
//}

//function RetriveDataOption(executor){
//	if(executor.get_responseAvailable()){
//		var resp;
//		resp = eval( "(" + executor + ")");


//		for (var i = 0; i < resp.length; i++) {
//			CategoryValueList[i] = resp[i].Id;
//			CategoryTitleList[i] = resp[i].Name;
//		}

//		StartMeUp3();
//	}
//}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//function StartMeUp3(){
//	// CURRENT CATEGORY 
//    Utils_AppendOptionsFromObject($get("ddlCanali"), CategoryValueList, CategoryTitleList);
//	StartMeUp();
//}

//function wsStart(){
//	if($get("ddlCanali").style.display == "none"){
//		StartMeUp();
//	}else{
//		StartMeUp();
//		GettaPager.goToPage(0);
//		//SendDataForOption();
//	}
//}

//function flyStat(){
///////// Stats Trace ///////
//	traceStat("o_flyout", GettaPager.ItemsCollection.Items[GettaPager.PageIndex].Id, GettaPager.ItemsCollection.Items[GettaPager.PageIndex].FlyoutPageUrl);
/////// End Stats Trace /////
//}
