rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zh...@apache.org
Subject svn commit: r1087520 [34/35] - in /incubator/rave/donations/ogce-gadget-container: ./ config/ config/shindig-1.1-BETA5/ config/shindig-2.0.0/ db-cleaner/ examples/ examples/src/ examples/src/main/ examples/src/main/java/ examples/src/main/java/cgl/ exa...
Date Fri, 01 Apr 2011 00:29:38 GMT
Added: incubator/rave/donations/ogce-gadget-container/third-party-gadgets/todo.xml
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/third-party-gadgets/todo.xml?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/third-party-gadgets/todo.xml (added)
+++ incubator/rave/donations/ogce-gadget-container/third-party-gadgets/todo.xml Fri Apr  1 00:29:22 2011
@@ -0,0 +1,7212 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Module>
+
+	<!-- 
+	 
+	Design & Code: LabPixies
+	All subsequent code and resources used are proprietary of LabPixies unless directly stated otherwise.
+	Copyright (C) 2006 LabPixies.    
+	www.labpixies.com
+
+	This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 2.5 License.
+	To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/2.5/ or
+	send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.
+	-->
+	
+	<ModulePrefs
+	height="350"
+	author="Labpixies"
+	author_email="info@labpixies.com"
+	description="__MSG_desc__"
+	title="__MSG_gTitle__"
+	title_url="http://www.labpixies.com/"
+	screenshot="http://www.labpixies.com/campaigns/todo/images_shared/screenshot_igoogle.jpg"
+	thumbnail="http://www.labpixies.com/campaigns/todo/images_shared/thumbnail.jpg"
+	render_inline="never"
+	directory_title="">
+		
+		<Locale messages="http://www.labpixies.com/campaigns/todo/i19_shared/all_all_igoogle.xml"/>
+		<Locale lang="bg" messages="http://www.labpixies.com/campaigns/todo/i20/bg_all.xml"/>
+  	<Locale lang="ca" messages="http://www.labpixies.com/campaigns/todo/i20/ca_all.xml"/>
+  	<Locale lang="cs" messages="http://www.labpixies.com/campaigns/todo/i20/cs_all.xml"/>
+  	<Locale lang="da" messages="http://www.labpixies.com/campaigns/todo/i20/da_all.xml"/>
+  	<Locale lang="de" messages="http://www.labpixies.com/campaigns/todo/i20/de_all.xml"/>
+  	
+  	<Locale lang="el" messages="http://www.labpixies.com/campaigns/todo/i20/el_all.xml"/>
+  	<Locale lang="es" messages="http://www.labpixies.com/campaigns/todo/i20/es_all.xml"/>
+  	<Locale lang="fi" messages="http://www.labpixies.com/campaigns/todo/i20/fi_all.xml"/>
+  	<Locale lang="fr" messages="http://www.labpixies.com/campaigns/todo/i20/fr_all.xml"/>
+  	
+  	<Locale lang="hi" messages="http://www.labpixies.com/campaigns/todo/i20/hi_all.xml"/>
+  	<Locale lang="hr" messages="http://www.labpixies.com/campaigns/todo/i20/hr_all.xml"/>
+  	<Locale lang="hu" messages="http://www.labpixies.com/campaigns/todo/i20/hu_all.xml"/>
+  	<Locale lang="it" messages="http://www.labpixies.com/campaigns/todo/i20/it_all.xml"/>
+  	<Locale lang="iw" messages="http://www.labpixies.com/campaigns/todo/i20/iw_all.xml"/>
+  	
+  	<Locale lang="ko" messages="http://www.labpixies.com/campaigns/todo/i20/ko_all.xml"/>
+  	<Locale lang="lt" messages="http://www.labpixies.com/campaigns/todo/i20/lt_all.xml"/>
+  	<Locale lang="lv" messages="http://www.labpixies.com/campaigns/todo/i20/lv_all.xml"/>
+  	<Locale lang="ms" messages="http://www.labpixies.com/campaigns/todo/i20/ms_all.xml"/>
+  	<Locale lang="nl" messages="http://www.labpixies.com/campaigns/todo/i20/nl_all.xml"/>
+  	
+  	<Locale lang="no" messages="http://www.labpixies.com/campaigns/todo/i20/no_all.xml"/>
+  	<Locale lang="pl" messages="http://www.labpixies.com/campaigns/todo/i20/pl_all.xml"/>
+  	<Locale lang="pt-BR" messages="http://www.labpixies.com/campaigns/todo/i20/pt_br_all.xml"/>
+  	<Locale lang="pt-PT" messages="http://www.labpixies.com/campaigns/todo/i20/pt_pt_all.xml"/>
+  	<Locale lang="ro" messages="http://www.labpixies.com/campaigns/todo/i20/ro_all.xml"/>
+  	
+  	<Locale lang="ru" messages="http://www.labpixies.com/campaigns/todo/i20/ru_all.xml"/>
+  	<Locale lang="sk" messages="http://www.labpixies.com/campaigns/todo/i20/sk_all.xml"/>
+  	<Locale lang="sl" messages="http://www.labpixies.com/campaigns/todo/i20/sl_all.xml"/>
+  	<Locale lang="sr" messages="http://www.labpixies.com/campaigns/todo/i20/sr_all.xml"/>
+  	<Locale lang="sv" messages="http://www.labpixies.com/campaigns/todo/i20/sv_all.xml"/>
+  	
+  	<Locale lang="th" messages="http://www.labpixies.com/campaigns/todo/i20/th_all.xml"/>
+  	<Locale lang="tl" messages="http://www.labpixies.com/campaigns/todo/i20/tl_all.xml"/>
+  	<Locale lang="tr" messages="http://www.labpixies.com/campaigns/todo/i20/tr_all.xml"/>
+  	<Locale lang="uk" messages="http://www.labpixies.com/campaigns/todo/i20/uk_all.xml"/>
+  	<Locale lang="vi" messages="http://www.labpixies.com/campaigns/todo/i20/vi_all.xml"/>
+  	
+  	<Locale lang="zh-CN" messages="http://www.labpixies.com/campaigns/todo/i20/zh_cn_all.xml"/>
+  	<Locale lang="zh-TW" messages="http://www.labpixies.com/campaigns/todo/i20/zh_tw_all.xml"/>
+    <Locale lang="ja" messages="http://www.labpixies.com/campaigns/todo/i20/ja_all.xml"/>
+    <Locale lang="en" country="US" messages="http://www.labpixies.com/campaigns/todo/i20/en_us.xml"/>
+	  
+	  <Require feature="setprefs" />
+    <Require feature="opensocial-0.8" />
+		<Require feature="analytics" /> 
+<!--		<Require feature="dynamic-height" /> -->
+		<Require feature="views" />
+	</ModulePrefs>
+	
+	<UserPref name="saved_tasks" datatype="hidden" default_value="" />
+	<UserPref name="todos" datatype="hidden" default_value="" />
+	<UserPref name="sd" datatype="hidden" default_value="" />
+	<UserPref name="wasSocial" datatype="hidden" default_value="0" />
+
+<Content type="html" view="home,profile,canvas">
+<![CDATA[
+<title>ToDo</title>
+<style type="text/css">
+body,html,span,div,td,* {
+  font-family: arial;
+}
+
+</style>
+<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
+<script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script>
+<script type="text/javascript" src="gadget-migration.js"></script> 
+
+<style type="text/css"> 
+	 	 
+	 	body, * { 
+	 	  font-family:arial; 
+	 	} 
+	 	.sprite{ 
+	 	 overflow:hidden; 
+	 	} 
+	 	.bottom_buttons{ 
+	 	  font-size:11px; 
+	 	  font-weight:bold; 
+	 	  color:#D3B300; 
+	 	  height:19px;  
+	 	  padding-left:7px;  
+	 	  padding-top:2px; 
+	 	  vertical-align:top; 
+	 	  cursor:pointer; 
+	 	} 
+	 	#list_title_container { 
+	 	  float:left; 
+	 	  margin-left:6px;  
+	 	  margin-right:6px;  
+	 	  height:23px;  
+	 	  line-height:22px;  
+	 	  overflow:hidden; 
+	 	} 
+	 	#full_screen_container{ 
+	 	  float:right; 
+	 	  height:23px;  
+	 	  line-height:22px;  
+	 	} 
+	 	.items{ 
+	 	  float:left; 
+	 	  font-size:11px; 
+	 	  font-weight:bold; 
+	 	  height:23px; 
+	 	  line-height:23px; 
+	 	  margin-left:21px; 
+	 	} 
+	 	.item_icon{ 
+	 	  width:11px;  
+	 	  height:11px;  
+	 	  overflow:hidden;  
+	 	  cursor:pointer; 
+	 	  float:right; 
+	 	  margin-top:5px; 
+	 	  margin-left:4px;
+	 	} 
+	 	.strike{
+	 		background-position:-92px -139px;
+	 	}
+	 	.delete{
+	 		background-position:-114px -139px;
+	 	}
+	 	.color{
+	 		background-position:-70px -139px;
+	 	}
+    .menu_div_title, .menu_div_item, .menu_div_item_selected, .menu_div_item_updated {
+      height:18px; 
+      line-height:18px; 
+      overflow:hidden;
+      padding:0px 4px 0px 4px;
+      font-size:11px;
+      color:#FBF9C4;
+      background-color:#52493D;
+      font-weight:bold;
+      text-align:left;
+
+    }
+    .menu_item{
+    }
+    
+    .menu_div_item_selected, .menu_div_item, .menu_div_item_updated {
+      color:#52493D;
+      background-color:#FFFDBF;
+      border-bottom:1px dashed #dedb95;
+    }
+    
+    .menu_div_item{
+    font-weight:normal;
+    }
+    .menu_div_item_selected {
+        color:#00928F;
+    }
+	 	
+	 	.new_text_style, .new_text_style_no_focus {
+		  font-size:11px; 
+	 	  font-weight:bold;
+		  line-height:12px;
+		  border: 1px solid #13807B;
+		  overflow: hidden;
+		  background-color:#FCFCDB;
+		  word-wrap: break-word;
+		  resize: none;
+		  outline: none;
+		  margin-top:2px;
+		}
+		
+		.new_text_style_no_focus {
+		  border-color:transparent;
+		  background-color:transparent;
+		}
+		#top_balloon_button{
+			background-position:0px -151px;
+			height:24px;
+			line-height:16px;
+			font-size:10px;
+			color: #332C26;
+			padding-left:10px;
+		}
+		.img_inner_bgcolor{
+    	width: 50px; 
+    	height: 50px; 
+    	overflow:hidden;
+    	background-color: #FFFFFF;
+    }
+			 	 
+	 	.menu_div a,.menu_div a:active, .menu_div a:visited {font-size:11px;  color:#352E29; text-decoration:none; } 
+	 	#share_with_link a, #share_with_link a:active, #share_with_link a:visited  {font-family:arial; font-size:11px; color:#00928F; font-weight:bold; text-decoration:none;}
+	 	#popup_list_name a, #popup_list_name a:active, #popup_list_name a:visited {font-size:11px; color:#00928F; font-weight:bold; text-decoration:none;} 
+	 	#view_all_left a, #view_all_left a:active, #view_all_left a:visited {font-size:11px; color:#00918E; text-decoration:none;} 
+	 	#popup_list_name a:hover, #view_all_left a:hover, .menu_div a:hover, #share_with_link a:hover {text-decoration: underline;} 
+	 	#list_title_container a:hover{background-color:#59534C;}
+	  #list_title_container a,#list_title_container a:active, #list_title_container a:visited {font-size:11px; font-weight: bold; color:#D3B300; text-decoration:none;} 
+	 	 
+	 	a.jScrollActiveArrowButton, a.jScrollActiveArrowButton:hover { 
+	 	        background-position: 0 -30px; 
+	 	} 
+	 	.holder { 
+	 	        float: left; 
+	 	} 
+	 	 
+	 	.scroll_pane { 
+	 	        width: 220px; 
+	 	        height: 200px; 
+	 	        overflow: auto; 
+	 	        float: left; 
+	 	} 
+	 	 
+	 	/********* SCROLLING ******************/ 
+	 	.jScrollPaneContainer { 
+	 	        position: relative; 
+	 	        overflow: hidden; 
+	 	        z-index: 1; 
+	 	} 
+	 	 
+	 	.jScrollPaneTrack { 
+	 	        position: absolute; 
+	 	        cursor: pointer; 
+	 	        right: 0; 
+	 	        top: 0; 
+	 	        height: 100%; 
+	 	        background: #FAF7B6; 
+	 	} 
+	 	.jScrollPaneDrag { 
+	 	  position: absolute; 
+	 	        cursor: pointer; 
+	 	        overflow: hidden; 
+	 	} 
+	 	.jScrollPaneDragTop { 
+	 	  position: absolute; 
+	 	  height:0px; 
+	 	        top: 0; 
+	 	        left: 0; 
+	 	        overflow: hidden; 
+	 	} 
+	 	.jScrollPaneDragBottom { 
+	 	  height:0px; 
+	 	  position: absolute; 
+	 	        bottom: 0; 
+	 	        left: 0; 
+	 	        overflow: hidden; 
+	 	} 
+	 	a.jScrollArrowUp { 
+	 	  display: block; 
+	 	        position: absolute; 
+	 	        z-index: 1; 
+	 	        top: 0; 
+	 	        right: 0; 
+	 	        text-indent: -2000px; 
+	 	        overflow: hidden; 
+	 	        height: 10px; 
+	 	} 
+	 	 
+	 	a.jScrollArrowDown { 
+	 	  display: block; 
+	 	        position: absolute; 
+	 	        z-index: 1; 
+	 	        bottom: 0; 
+	 	        right: 0; 
+	 	        text-indent: -2000px; 
+	 	        overflow: hidden; 
+	 	        height: 10px; 
+	 	} 
+	 	a.jScrollActiveArrowButton, a.jScrollActiveArrowButton:hover { 
+	 	        /*background-color: #f00;*/ 
+	 	} 
+	 	
+	 	.td_pr_table_title
+		{	
+			background-repeat: repeat-x;	
+			padding-top:3px;
+			padding-right:3px;
+		}
+
+		.td_pr_top_right_corner
+		{
+			background-color:#ffffff;	
+			width:3px;
+			height:41px;
+		}
+
+		.td_pr_items_table
+		{
+			background-color: #f3f378;
+			width:100%;
+			font-family: Arial;
+			font-weight: bold;
+			font-size: 11px;
+		}
+
+		.td_pr_red
+		{		
+			background-repeat:repeat-y;
+			width:3px;	
+		}
+
+		.td_pr_item_text
+		{
+			text-decoration:none;
+			color: #13807b;
+			font-weight: normal;
+		}
+
+		.td_pr_item_text:hover
+		{	
+			text-decoration:underline;
+		}
+
+		.td_pr_right_cell
+		{	
+			background-repeat:repeat-y;
+			width:3px;	
+		}
+
+		.td_pr_border_bottom
+		{
+			border-bottom: #00c5c2 solid 1px;	
+		}
+
+		.td_pr_bottom_left
+		{	
+			background-repeat:no-repeat;		
+		}
+
+		.td_pr_bottom_right
+		{	
+			background-repeat:repeat-x;
+			background-position:top;	
+		}
+
+		.td_pr_right_blue
+		{
+			width:3px;
+			height:24px;
+		}
+
+		.td_pr_item_link
+		{
+			cursor:pointer;
+		}
+
+		.td_pr_del
+		{
+			cursor:pointer;
+			width:15px;
+			height:15px;
+		}
+
+		.td_pr_ctrl
+		{
+			display: none;
+			line-height:1px;
+			font-size:1px;
+			height:16px;
+		}
+
+		.td_pr_up
+		{
+			cursor:pointer;
+			width:10px;
+			height:6px;
+			line-height:1px;
+			font-size:1px;
+		}
+
+		.td_pr_down
+		{
+			cursor:pointer;
+			width:10px;
+			height:6px;
+			line-height:1px;
+			font-size:1px;
+		}
+
+		.td_pr_top_menu_link
+		{
+			font-family:Arial;
+			font-size: 10px;
+			color: #c5a618;
+			text-decoration:none;
+		}
+
+		.td_pr_top_menu_link:hover
+		{	
+			color: #F3F378;
+			text-decoration:none;
+		}
+
+		.td_pr_top_menu_link:visited
+		{	
+			color: #c5a618;	
+		}
+
+		.td_pr_add_item
+		{
+			text-decoration:none;
+			color: #80795a;	
+			font-weight: bold;
+		}
+
+		.td_pr_add_item:visited
+		{	
+			color: #80795a;	
+		}
+
+		.td_pr_add_item:hover
+		{	
+			text-decoration:underline;
+		}
+
+		.td_pr_edit
+		{
+			font-family: Arial;
+			font-weight: bold;
+			font-size: 11px;
+			border: 1px solid #13807b;
+			line-height: 18px;
+		}
+		
+		.td_pr_btn_main
+			{
+				cursor:pointer;
+				float:right;
+				padding-top:1px;
+			}
+			
+			.td_pr_btn_left
+			{
+				float:left;
+				width:2px;
+				height:15px;
+				overflow:hidden;				
+				background-position: -113px 0px;
+			}
+			
+			.td_pr_btn_middle
+			{
+				float:left;	
+				height:15px;								
+				line-height:15px;		
+				background-position: -115px 0px;
+				font-family:Arial;
+				font-size:11px;
+				font-weight:bold;
+				color:#C5A618;
+				padding-left:3px;
+				padding-right:3px;
+			}
+			
+			.td_pr_btn_right
+			{
+				float:left;
+				width:2px;
+				height:15px;
+				overflow:hidden;			
+				background-position: -261px 0px;
+			}
+			
+			.td_pr_more_opt
+			{
+				font-family:Arial;
+				font-size:11px;
+				font-weight:bold;
+				color:#13807B;
+				line-height:24px;
+				height:24px;
+				float:right;	
+				cursor:pointer;
+			}
+			
+			.td_pr_more_opt_btn
+			{
+				width:11px;
+				height:11px;
+				overflow:hidden;
+				float:left;
+				background-position: -263px 0px;
+				margin-top:6px;
+				margin-right:6px;
+			}
+	 	</style> 
+	 	<!--[if IE 6]>
+		<script type="text/javascript">
+		try {//IE fix, causes it to automatically cache background image
+		document.execCommand("BackgroundImageCache", false, true);
+		}
+		catch(e){
+		}
+		</script>
+		<![endif]-->
+		
+		<!--[if IE 6]>
+    <style>
+    .items{
+      display:inline;
+    }
+    
+    .new_text_style_no_focus {
+      border:none;
+    }
+
+    </style>
+    <![endif]-->
+		<!-- PUT THIS TAG IN THE head SECTION -->
+		<!-- v2 non social -->
+		<script type="text/javascript" src="http://partner.googleadservices.com/gampad/google_service.js">		
+		</script>
+		<script type="text/javascript">
+		  GS_googleAddAdSenseService("ca-pub-8123415297019784");
+		  GS_googleEnableAllServices();
+		</script>
+		<script type="text/javascript">
+		  GA_googleAddSlot("ca-pub-8123415297019784", "todo_txt");
+		</script>
+		<script type="text/javascript">
+		  GA_googleFetchAds();
+		</script>
+		<!-- END OF TAG FOR head SECTION -->
+	 	<script language="JavaScript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>            
+	 	 
+	 	 
+	 	<script type="text/javascript"> 
+	 	   
+	 	  var _gadgetID = 33; 
+	 	  var $lp = jQuery.noConflict(); 
+	 	  var prefs = new _IG_Prefs();
+	 	   
+	 	  mAll = _IG_GetCachedUrl("http://cdn.labpixies.com/infra/jquery/jscrollpane.js",{refreshInterval:21600}); 
+	 	  document.write('<scr'+'ipt type="text/javascript" src="'+mAll+'"></scr'+'ipt>'); 
+	 	   
+	 	  var IMAGES_BASE = "http://cdn.labpixies.com/campaigns/todo/images_shared/gadget/"; 
+			var viewer;
+			var owner;
+			var friends;
+			var friendsWithApp;
+			var ownerData;
+			var currentListId = null;
+		  var APPURL="http://lpsharedlist.appspot.com"
+		  var currentList={};
+		  var currentItems = [];
+		  var myLists = [];
+		  var friendsLists = [];
+		  var modifiedLists = [];
+		  var deletedLists = [];
+		  var lists = [];
+		  var newLists = [];
+		  var textWidth = 0;
+		  var listWidth = 0;
+		  var responseCounter = 0;
+		  var currentEditedId; 
+		  var saved_tasks_v1 = null;
+		  var saved_tasks_v2 = null;
+		  var isNewInputOpen = false;
+		  var isDataError = false;
+		  var eventsSuffix = "";
+		  var SOCIAL_SUFFIX = "social";
+		  var NON_SOCIAL_SUFFIX = "non_social";
+		  var MISSING_ITEM_ERROR = "missing item";
+		  var PERMISSION_DENIED = "permission denied";
+		  var isLoading = true;  		
+  		var requestTimeout = 0;
+  		var TIMEOUT_MILLIS = 15000;
+
+		  var actions = {"add":0, "delete":1, "update": 2, "rename":3, "add_collaborator": 4, "task_completed": 5, "create":6};
+	 	  var colors = ["#000000","#E22974","#DC4A20","#006CB3","#7E9D1E","#ED1C24","#662D91","#F7941D","#737373"];
+	 	  var MAX_OLD_TASK_LEN = 70;
+	 	  var MAX_WIDTH = 300;
+      var MIN_WIDTH = 240;
+      var MAX_PROFILE_ITEMS = 7; 
+      var MAX_FRIENDS_LID_IN_PREFS = 100;
+      var MAX_ITEM_LEN_IN_PREFS = 37; 
+      var NEW_LIST = "new_list";
+		  var NEW_TASK = "new_task";
+		  var EDIT_TASK = "edit";
+		  var SHARE_WITH = "share";
+	 	  
+      /* page tracker for regular reporting*/
+      //var lp_pageTracker = _gat._getTracker("UA-345375-1");
+      //lp_pageTracker._initData();
+      
+      function lp_trackEvent(eventName,eventLable,eventVar) {
+        try {
+          _IG_Analytics("UA-345375-3","ToDo - Profile "+eventsSuffix+"_"+eventName+"_"+eventLable+"_"+eventVar);
+            //lp_pageTracker._trackEvent("ToDo - Profile "+eventsSuffix,eventName,eventLable, eventVar);
+        } catch(ee) {}
+    
+      }
+	 	   
+	 	  _IG_RegisterOnloadHandler(function(){ 
+	 	     //on upload first checing if user has social or not
+	 	    hasSocial();
+	 	  }); 
+	 	  
+	 	  
+	 	function initSocialProfile(){  
+      //if user has social, displaying the social gadget
+  	  eventsSuffix = SOCIAL_SUFFIX;
+  	  try {
+        _IG_Analytics("UA-345375-1","/todo_profile_social");
+      } catch (e){}
+  		document.getElementById("social_container").style.display="";
+ 	    loadImages(); 
+ 	    
+ 	    //setting gadget width since its resizable
+ 	    setWidth(); 
+ 	    displayLoading();
+ 	    setOnClickHandlers(); 
+		 	// check for old todo data, if there is one, it will be import after bringing the social data, will be called from getFriendsWithApp callback                                             
+      saved_tasks_v1 = prefs.getString("saved_tasks");	
+			saved_tasks_v2 = prefs.getString("todos");
+		 	//checking if we need to import old data from v1 or from v2 non social
+			if (saved_tasks_v1.length > 0)	{	
+				checkForV1Data(saved_tasks_v1);
+			}
+			if(saved_tasks_v2.length > 0) {
+	  		checkForV2Data(saved_tasks_v2);
+	  	}	
+	 	  if(saved_tasks_v2.length==0 && saved_tasks_v1.length == 0){
+	 	    loadListsAndDefault();
+	 	  }
+	 	  _IG_AdjustIFrameHeight(); 
+	 	}
+	 	
+	 	function loadNonSocialProfile(){
+	 	  eventsSuffix = NON_SOCIAL_SUFFIX;
+	 	  try {
+        _IG_Analytics("UA-345375-1","/todo_profile_non_social");
+      } catch (e){}
+      
+	 		document.getElementById("non_social_container").style.display="";
+	 		deploy_todo_profile();
+	 	
+	 	}
+	 	  
+	 	  //checking if the user has opensocial
+ 	   function hasSocial() {
+        var u = gadgets.util;
+        //first checking if he has the feature, then trying to see if we can get social data.
+        if (u.hasFeature('opensocial-0.8')) {
+          getSocialData();
+        } else {
+          loadNonSocialProfile();
+        }
+      }
+      
+      
+		  function getSocialData(){		
+  			//creating new request
+  	    var req = opensocial.newDataRequest(); 
+  	    var p = {}; 
+  	    p[opensocial.IdSpec.Field.USER_ID] = "OWNER"; 
+  	    var OwnerIdSpec = opensocial.newIdSpec(p); 
+  	    var OFidspec = opensocial.newIdSpec({ "userId" : "OWNER", "groupId" : "FRIENDS" });
+  	    var params = {}; 
+  	    params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [opensocial.Person.Field.PROFILE_URL]; 
+  	       
+  	    
+  	    var friendsParams = {};
+  	    friendsParams[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [opensocial.Person.Field.PROFILE_URL];
+  	    friendsParams[opensocial.DataRequest.PeopleRequestFields.MAX] = 1000;
+  	    
+  	    var friendsWithAppParams = {};
+  	    friendsWithAppParams[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [opensocial.Person.Field.PROFILE_URL];
+  	    friendsWithAppParams[opensocial.DataRequest.PeopleRequestFields.FILTER] = opensocial.DataRequest.FilterType.HAS_APP;
+  	    friendsWithAppParams[opensocial.DataRequest.PeopleRequestFields.MAX] = 1000;
+  	    
+  	    
+  	    req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER, params), "viewer");
+  	    req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER, params), "owner"); 
+  	    req.add(req.newFetchPersonAppDataRequest(OwnerIdSpec, "*"), "owner_data");   
+  	    req.add(req.newFetchPeopleRequest(OFidspec,friendsParams), "friends");
+  	    req.add(req.newFetchPeopleRequest(OFidspec,friendsWithAppParams), "friends_with_app");
+  	    req.send(handleRequestMyData);
+			}
+			
+			function handleRequestMyData(data){
+		    //if we couldn't get the social data then we will display the non scial gadget
+		    //if we got the social data we will set the "wasSocial" gadget flag to 1 so we will know in case we will go back to non social version     
+        if (data.hadError()){	
+            var ownerField = data.get('owner');
+            var errorCode = ownerField.getErrorCode();
+            var errorMessage = ownerField.getErrorMessage();
+            //SECURITY TOKEN EXPIRED - LOAD OOPS
+            if (errorCode=="unauthorized" && typeof(errorMessage)=="undefined"){
+              document.getElementById("social_container").style.display="";
+              dataError();
+            } 
+            else{
+						  loadNonSocialProfile();
+						}
+        }		
+				else{	
+          var userData = data.get('owner').getData();
+          var id = userData.getId();
+          var displayName = userData.getDisplayName();
+          if((id==null || typeof(id)=="undefined" || id==-1) || (displayName==null || typeof(displayName)=="undefined")){
+  					loadNonSocialProfile();
+  				}
+  				else{
+  				  try{
+        			owner = data.get('owner').getData();
+        			friends = data.get('friends').getData();
+        			viewer = data.get('viewer').getData();
+        			ownerData = data.get('owner_data').getData();
+        			friendsWithApp = data.get('friends_with_app').getData();
+        		}
+        		catch(e){
+        		  document.getElementById("social_container").style.display="";
+  				    dataError();
+  				    return;
+        		}
+      			
+  				  prefs.set("wasSocial",1);
+  					initSocialProfile();	
+  				}
+        }	
+			}
+			
+  	function savePrefsData(){
+   	  var prefsData = {};
+   	  
+   	  prefsData.o = currentList.owner;   //list owner id
+      prefsData.id = currentListId;   //list id
+   	  prefsData.name = currentList.name;  //list name
+   	  prefsData.l = currentItems.length;  //the length of the list
+   	  prefsData.items = [];    //list first 7 items (or less)
+   	  var text, cut;
+   	  for (var i=0; (i<MAX_PROFILE_ITEMS && i<currentItems.length); i++){
+        text = currentItems[i].text;
+        cut = 0;
+        if(text.length>MAX_ITEM_LEN_IN_PREFS){
+          text = text.substring(0,MAX_ITEM_LEN_IN_PREFS);
+          cut = 1;
+        }
+   	    var item = [currentItems[i].id,currentItems[i].text,currentItems[i].color,(currentItems[i].strike)?1:0,cut]; 
+        prefsData.items.push(item);	  
+   	  }
+   	  prefsData.fnum = currentList.users.length-1;   //number of firends in list
+   	  prefsData.fsid = [];          //3 list collaborator users ids (that are also my friends)
+   	  var numAdded = 0;
+   	  for (var i=0; (i<currentList.users.length && prefsData.fsid.length<3); i++){
+   	    var friendId = currentList.users[i];
+        if (isFriend(friends,friendId)){
+          prefsData.fsid.push(friendId);
+        }
+      }
+   	  prefs.set("sd",lpgadgets.lp.utils.jsonStringify(prefsData));
+   	}
+
+
+			//importing data from V1
+			function checkForV1Data(saved_tasks){		
+				var DELIMITER = "_#$LAB_UDI$#_";
+				var EXT_DELIMITER = "_#$LAB_MATAN$#_";
+				var task_arr = saved_tasks.split(EXT_DELIMITER);
+				var itemsArray = [];
+				var curr_task, curr_task_arr, curr_color;
+				//going over all the tasks from v1 and adding them to an array that will be send to add to the new db
+				for(var i=1; i < task_arr.length; i++){
+					curr_color="";
+					curr_task = task_arr[i];
+					curr_task_arr = curr_task.split(DELIMITER);
+
+					for (var j=0; j<colors.length; j++){
+						if (curr_task_arr[2]==colors[j]) {
+							curr_color = j;
+						}
+					}
+					if (curr_color==""){
+						curr_color = 0;
+					}
+	
+					new_item = [curr_task_arr[1].substr(0, MAX_OLD_TASK_LEN),curr_color, false];		
+					itemsArray.push(new_item);					
+				}
+				//setting list name to be 'untitled list 1' and sending to db to add
+				var listName = ((prefs.getMsg("untitled_list")).replace("%NUM%","1"));
+				importList(listName, itemsArray, function(data){
+					if (data.data.success) {
+						prefs.set("saved_tasks", "");
+						//finished importing data, calling to load lists
+	 	  			loadListsAndDefault();
+					}
+					else{
+					  lp_trackEvent("Data Error","Import List");
+						dataError();
+					}
+				});
+			}
+			
+    	function changeBackPosition(id,pos){
+        document.getElementById(id).style.backgroundPosition = pos;
+      }
+      
+      function changeTextColor(id,color){
+        document.getElementById(id).style.color = color;
+      }
+      
+			
+			//displays loading animation till gadget loads
+	 	  function displayLoading(){
+        var position = $lp("#title_container").offset();
+    	  var xPos = position.left+"px";
+    	  var yPos = (position.top)+"px";
+    	  var width = (parseInt(document.getElementById('container').offsetWidth))+"px";
+    	  document.getElementById('loading_notebook').style.top = yPos;
+        document.getElementById('loading_notebook').style.left = xPos;
+        document.getElementById('loading_notebook').style.width = width; 
+        document.getElementById('loading_notebook').style.height = "270px";
+        document.getElementById("loading_notebook").style.display="";
+        isLoading = true;
+      }
+      
+      //hiding gadget's loading animation and displaying buttons
+      function hideLoading(){
+        document.getElementById("loading_notebook").style.display="none";
+        document.getElementById("new_list_container").style.visibility="visible";
+        document.getElementById("full_screen_container").style.visibility="visible";
+        isLoading = false;
+      }
+      
+      
+      //delete the update from lists that I am no longer a memeber in.
+      //this happends when I have an update to a list then the owner delete me as a user.
+      //since I can no longer access the list I will never delete it.
+      //this function delete the update without the need to go into the list.
+      function clearUpdatesOfListThatIAmNotMemeberOf() {
+      
+        var keys = [];
+        for (var i=0; i<modifiedLists.length; i++) {
+          var found = false;
+          var j = 0;
+          while (j<lists.length && !found) {
+            if (modifiedLists[i]==lists[j].id) {
+              found = true;
+            }
+            j++;
+          }
+          if (!found) {
+            keys.push("u_"+modifiedLists[i]);
+            keys.push("n_"+modifiedLists[i]);
+          }
+        }
+        
+        if (keys.length > 0) {
+          var req = opensocial.newDataRequest();
+          req.add(req.newRemovePersonAppDataRequest(opensocial.IdSpec.PersonId.VIEWER, 
+      					  keys
+      					  ));	
+          req.send(function(data){});
+        }
+      }
+      
+      function loadListsFromDS() {
+        loadListsRequest(function(data) {
+           lists = data.data; 
+      		//dividing lists to mines and friend's, also set the isUpdated property of every list
+		  	  divideLists();
+		  	  displaySocialUpdates();  		  	          
+          //first time the gadget loads, user has no lists
+  		  	if (myLists.length==0) {
+  		      createNewList();
+  		      return;
+          }
+  
+          //if we dont know which gadget to load, we will load the first in the owner's list
+  		  	if (currentListId==null || (getListIndex(currentListId))==-1) {
+            currentListId = myLists[0].id;
+          }
+          loadSingleListById(currentListId);
+        });
+      }
+      
+      function loadSingleListById(id) {//loading the list
+  	      loadListDataRequest(id, function(listData){
+           if (listData.data==null || !listData.data.success){
+              dataError();
+              lp_trackEvent("Data error", "loadListsFromDS");
+           }
+           else{
+            //displaying the gadget so remove the loading animation
+             hideLoading();
+             currentListId = id;
+             currentList = listData.data;
+             currentItems = currentList.items;
+             document.getElementById("list_title").innerHTML = gadgets.util.escapeString(cutStringToFit(currentList.name, listWidth,"11px","bold"));
+             showItems();
+             //displaying bottom part (share and last updated details)
+             displayShare();
+             savePrefsData();
+             _IG_AdjustIFrameHeight();
+           }
+          });
+      }
+      
+      function deleteBalloonNotification(listId) {
+      
+        var req = opensocial.newDataRequest(); 
+  	    req.add(req.newRemovePersonAppDataRequest(opensocial.IdSpec.PersonId.VIEWER, 
+							  [("u_"+listId),("n_"+listId)]  
+							  ));	
+        req.send(function(data){});
+    
+      }
+      
+      function checkForDeletedAndUpdated(){
+        //first creating an array of 
+        var keysToDelete = [];
+        var tmpModified = [];
+        var od = ownerData[owner.getId()];
+        //building an arrays of deleted and modified by the keys
+        for (var key in od) {
+          if (key.indexOf("d_") == 0) {
+            deletedLists.push(key.substring(2));
+          }
+          else if (key.indexOf("u_") == 0) {
+            tmpModified.push(key.substring(2));
+          }
+          //here should decide how many updates...
+          if (key.indexOf("n_")==0) {
+            
+            var newList = lpgadgets.lp.utils.jsonParse(lpgadgets.lp.utils.unescapeString(od[key]));
+            //making sure that this is really my friend...
+            if (friendsWithApp.getById(newList.owner)) {
+              newLists.push(newList);
+            }
+            else{
+              keysToDelete.push(key);
+            }
+          }
+        }
+        
+
+        //deleting the modified if they were deleted
+        for (var i=0; i<tmpModified.length; i++){
+          if (!isDeleted(tmpModified[i])){
+            modifiedLists.push(tmpModified[i]);
+          }
+        }
+        //removing all deleted lists records from social data
+        for (var i=0; i<deletedLists.length; i++){
+           keysToDelete.push("u_"+deletedLists[i]);
+           keysToDelete.push("d_"+deletedLists[i]);
+           keysToDelete.push("n_"+deletedLists[i]);
+        }
+        
+        //delete the keys
+        if (keysToDelete.length > 0) {
+          var req = opensocial.newDataRequest();
+          req.add(req.newRemovePersonAppDataRequest(opensocial.IdSpec.PersonId.VIEWER, 
+      					  keysToDelete 
+      					  ));	
+          req.send(function(data){});
+        }
+      }
+      
+      function isDeleted(listId){
+        for (var j=0; j<deletedLists.length; j++){
+          if (listId==deletedLists[j]) {
+            return true;
+          }
+        }
+        return false;
+      }
+      
+  
+      //display the count booble and new list popup
+      function displaySocialUpdates() {
+
+        var numUpdate = modifiedLists.length;
+        displayUpdatesBalloon(numUpdate);
+        displayNewListsPopup(newLists);
+      }
+      
+      
+      
+			function loadListsAndDefault(){
+		    checkForDeletedAndUpdated();
+        var s = prefs.getString("sd");
+        //if we do not have anything in the prefs we create a default list
+        if (s.length==0) {
+          loadListsFromDS();
+          return;
+        }
+        var prefListData = lpgadgets.lp.utils.jsonParse(s);
+        //build the data structure that the gadget knows how to work with
+        if (prefListData) {
+                   
+           currentListId = prefListData.id;
+           //check if the default list needs to get updated from the datastore
+           if (isListUpdated(currentListId) || isDeleted(currentListId)) {
+              loadListsFromDS();
+              return;
+           }
+           
+           currentList = {};
+           currentList.name = prefListData.name;
+           currentList.id = prefListData.id;
+           currentList.owner = prefListData.o;
+           currentList.is_owner = prefListData.o==owner.getId();
+           currentList.users = prefListData.fsid;
+           for (var i=prefListData.fsid.length; i<prefListData.fnum;i++) {
+            currentList.users.push("");
+           }
+           currentList.items = [];
+           for (var i=0; i<prefListData.items.length; i++){
+              var item={};
+              item.id = prefListData.items[i][0];
+              item.text = prefListData.items[i][1];
+              item.color = prefListData.items[i][2];
+              item.strike = prefListData.items[i][3]==1;
+              item.cut = prefListData.items[i][4]==1;
+              currentList.items.push(item);
+           }
+           for (var i=prefListData.items.length; i<prefListData.l;i++) {
+              currentList.items.push({}); 
+           }
+           currentItems = currentList.items;
+
+        
+           //displaying the gadget so remove the loading animation
+           hideLoading();
+           document.getElementById("list_title").innerHTML = gadgets.util.escapeString(cutStringToFit(currentList.name, listWidth,"11px","bold"));    
+           showItems();
+           //displaying bottom part (share and last updated details)
+           displayShare();
+           
+           displaySocialUpdates();
+        }
+		  }
+		  
+		  function handleMissingItem(showAlert) {
+        
+        loadListDataRequest(currentListId, function(listData){
+            if (listData.data==null) {
+              lp_trackEvent("Data error", "handleMissingItem");
+              dataError();
+            }
+            else if (listData.data.success){
+               currentList = listData.data;
+               currentItems = currentList.items;   
+               showItems();
+               savePrefsData();
+               if (showAlert) {
+                  alert(prefs.getMsg("list_wasnt_updated"));
+               }
+            }
+            else if(data.data.error==PERMISSION_DENIED){
+              handlePermissionDenied();
+            }
+            else{
+              lp_trackEvent("Data error", "handleMissingItem_1");
+              dataError();
+            }
+        });
+                
+      }
+      
+      function handlePermissionDenied() {
+        loadListsFromDS();
+        alert(prefs.getMsg("list_not_available"));
+      }
+		  
+		  //deleting an item
+		  function deleteItem(id) {
+		     var itemIndex = getItemIndex(id);
+		     var r=confirm(prefs.getMsg("sure_delete_item"));
+		  		if (r==false){
+		  			return;
+		  		}
+		  		lp_trackEvent("Delete Task","Delete Task button"); 
+		  		//removing the element from the display list
+		      var itemToRemove = currentItems[itemIndex];
+		      
+		      //removing the item from the list and refreshing display
+		      currentItems.splice(itemIndex,1);
+		      showItems();
+		  		responseCounter++;
+
+  	      
+		      //updating database
+		  		removeItemRequest(id,responseCounter, function(data) {
+		  		   if (data.data==null) {
+                lp_trackEvent("Data Error","deleteItem");
+    		        dataError();
+             } else if (data.data.success){
+               //updating list only if this is the last update that was made 
+		           if (data.data.token==responseCounter) {
+		              currentList = data.data.list;
+		              currentItems = currentList.items;
+		              showItems();
+		              savePrefsData();
+		           }
+		         } else {
+                if (data.data.error==MISSING_ITEM_ERROR){
+                  handleMissingItem(false);
+                }
+                else if (data.data.error==PERMISSION_DENIED) {
+                  handlePermissionDenied();
+                }
+                else {
+                  lp_trackEvent("Data Error", "deleteItem_1");
+                  dataError();
+                }
+            }
+		      });
+		  }
+		  
+			//getting the item index in the currentItems array
+		  function getItemIndex(id) {
+		    for (var i=0; i<currentItems.length;i++){
+		      if(currentItems[i].id==id){
+		        return i;
+		      }
+		    }
+		  }
+  
+			//setting the item's strike
+		  function setItemStrike(id){
+		  	 var itemIndex = getItemIndex(id);
+		     var strike;
+		     if(currentItems[itemIndex].strike) {
+		        strike = 0;
+		        lp_trackEvent("Strikethrough","Strikethrough button False");
+		        currentItems[itemIndex].strike=false;
+		        document.getElementById('item_text_'+id).style.textDecoration="none";
+		     }
+		     else{
+		        strike = 1;
+		        lp_trackEvent("Strikethrough","Strikethrough button True");
+		        currentItems[itemIndex].strike=true;
+		        document.getElementById('item_text_'+id).style.textDecoration="line-through";
+		     }
+		     updateStrikeRequest(id,strike,function(data){
+		     
+             if (data.data==null) {
+                lp_trackEvent("Data Error","setItemStrike");
+    		        dataError();
+             }
+             else if (data.data.success){
+                savePrefsData();
+             } else {
+                if (data.data.error==MISSING_ITEM_ERROR){
+                  handleMissingItem(true);
+                }
+                else if (data.data.error==PERMISSION_DENIED) {
+                  handlePermissionDenied();
+                }
+                else {
+                  lp_trackEvent("Data Error", "setItemStrike_1");
+                  dataError();
+                }
+            }
+		     });   
+		  }
+		  
+    	function getCachedImage(src){
+    	  var cachedUrl = _IG_GetCachedUrl(IMAGES_BASE+src); 
+        cachedUrl = cachedUrl.replace("%rewriteMime%", ""); // <-- the fix
+        return cachedUrl;
+        //return _IG_GetImageUrl(IMAGES_BASE+src,{refreshInterval:21600});
+      }
+      
+      //setting menu's position according to todo pad position
+      function setMenuPosition(){
+    	  var element = document.getElementById("scroll_out");
+        var position = $lp('#lists_menu_icon').offset();
+    	  var xPos = position.left;
+    	  var yPos = position.top+$lp('#lists_menu_icon').height()+10;
+        element.style.left = xPos+"px";
+        element.style.top = yPos+"px";
+      }
+      
+      //we need these on order to close the menu
+      function setOnClickHandlers() {
+        document.getElementById("container").onclick = function(e) {
+            document.getElementById("scroll_out").style.display="none";
+            document.getElementById("shadow").style.display="none";
+            uncoverList();
+            document.getElementById("new_lists_popup_container").style.display="none";
+        };
+        document.getElementById("lists_menu_icon").onclick = function(e) {
+            stopEventPropogation(e);
+            toggleMenu();
+        };
+        document.getElementById("top_balloon_button").onclick = function(e) {
+            stopEventPropogation(e);
+            toggleMenu();
+        };
+         document.getElementById("new_lists_popup_container").onclick = function(e) {
+            stopEventPropogation(e);
+        };
+      }
+      
+      function stopEventPropogation(event){
+          //IE      
+          if(!event){           
+            window.event.cancelBubble = true;  
+          }       
+          //OTHER NAVIGATORS      
+          else if (event.stopPropagation) {event.stopPropagation();}
+    	}
+    	
+    	function displayMenu() {
+      
+        populateListsMenu();
+        setMenuPosition();
+        document.getElementById("scroll_out").style.display="";
+        addShadowToElement("scroll_out");
+        //adding the yellow "shadow" at the background
+        coverList(false);
+        $lp('#scroll_holder').jScrollPane({showArrows:true, scrollbarMargin:0, scrollbarWidth: 10, arrowSize: 10});
+        setScrollerImages();
+        
+      }
+	
+	   var semaphore = false;
+	   //open/close the drop down lists menu
+    	function toggleMenu(){
+        
+        
+        if (document.getElementById("scroll_out").style.display=="none") {
+        
+          if (lists.length==0) {
+            
+            if (semaphore)
+              return;
+            semaphore = true;
+            loadListsRequest(function(data) {
+      	       lists = data.data;
+               divideLists();
+      		     displayMenu();
+      		     semaphore = false;
+      		  });
+          } else {
+            displayMenu();
+          }
+        }
+        else{
+          //removing the yellow "shadow" at the background
+          uncoverList();
+          document.getElementById("scroll_out").style.display="none";
+          document.getElementById("shadow").style.display="none";
+        }
+      }
+		  
+		  //function for creating a new list (we need this only to import data from previous version, user can't create a list on profile
+		  function createNewList(){
+
+		    //if a list is created here its only when user didnt have the gadget or previous prefs
+		    var listName = ((prefs.getMsg("untitled_list")).replace("%NUM%","1"));
+		    
+		    //making a new list request, it will return the list id
+		    newListRequest(listName, function(data){
+		      if (data.data==null || !data.data.success) {
+		        lp_trackEvent("Data Error", "New List");
+		        dataError();
+		      }
+		      else{
+		        //updating myLists
+		        var newList={};
+		        newList.id = data.data.id;
+		        newList.name = listName;
+		        newList.is_owner = true;
+		        newList.is_new = false;
+		        myLists.push(newList);
+		        //updating currentList
+		        newList.users = [viewer.getId()];
+		        newList.owner = viewer.getId(); 
+		        newList.items=[];
+		        
+		        if (friendsLists.length>0) {
+		        
+                    loadSingleListById(friendsLists[0].id);
+                    return;
+                }
+                //setting the current list to the new list and saving id to data
+		        currentList = newList;
+		        currentListId = newList.id;
+		        //sorting mylists by ABC
+		        sortListsByModified(myLists);
+		        //clearing and displaying new list
+		        document.getElementById("list_title").innerHTML = gadgets.util.escapeString(cutStringToFit(currentList.name, listWidth,"11px","bold"));
+		        hideLoading();
+                showItems();
+                savePrefsData();
+		        //we know this user is the owner and he dowsnt have any friends yet
+		        document.getElementById('share_container').innerHTML = '<div id="share_with_link" style="float:right;"><a href="javascript:void(0);" onclick="lp_trackEvent(\'Open Canvas\',\'Share with friends\'); switchToCanvas(SHARE_WITH);">+'+prefs.getMsg("share_with_friends")+'</a></div>';
+         
+		      }    
+		    });
+		  }
+
+	 //sorting the given list of lists by ABC - we are not using it in the moment, maybe wil get back to it in the future
+	  function sortListsLexi(lists){
+	    lists.sort(function(a,b) {
+	      var tmpA = a.name.toLowerCase();
+	      var tmpB = b.name.toLowerCase();
+	      if (tmpA > tmpB) return 1;
+	      if (tmpA < tmpB) return -1;
+	      return 0;
+	    });
+	 }
+	 
+	//sorting the given list of lists by last modified
+	  function sortListsByModified(lists){
+	    lists.sort(function(a,b) {
+	      if (a.modified < b.modified) return 1;
+	      if (a.modified > b.modified) return -1;
+	      return 0;
+	    });
+	 }
+		
+		//displaying the top balloon that tells the user how many lists were updated since the last time he visited canvas
+		function displayUpdatesBalloon(numOfUpdated) {
+		  if (numOfUpdated < 1)
+		    return;
+			if (numOfUpdated==1) {
+				document.getElementById("top_balloon_button").innerHTML = prefs.getMsg("list_updated");
+			}
+			else{
+				document.getElementById("top_balloon_button").innerHTML = (prefs.getMsg("lists_updated")).replace("%NUM%",numOfUpdated);
+			}
+			document.getElementById("top_balloon").style.display="";
+			_IG_AdjustIFrameHeight();
+		}
+		
+		/**
+		 *Check if the given list is updated		
+		 */		
+		function isListUpdated(listId) {
+		
+		  for (var i=0;i<modifiedLists.length;i++) {
+        
+        if (listId == modifiedLists[i]) {
+          return true;
+        }
+      }
+      return false;
+    }
+		
+		//dividing the list to myLists and FriendsLists, also setting the isUpdated property for each one of them according to it's "modified" field
+		function divideLists(){
+		  
+		  myLists = [];
+		  friendsLists = [];
+		  
+	    for(var i=0; i<lists.length;i++){
+	     //first setting "isUpdated" to false, will raise the flag later while checking (never set the currentList to true!
+	     	lists[i].isUpdated = false;
+	     	//myLists
+	      if (isListUpdated(lists[i].id)){
+	          lists[i].isUpdated = true;
+	      }
+	      
+        if (lists[i].is_owner) {
+	        myLists.push(lists[i]);
+	      }
+	      else { //friendsLists
+	        //first making sure that this is a friend of mine
+	        if (isFriend(friendsWithApp,lists[i].owner)) {
+  	        friendsLists.push(lists[i]);
+	        }
+	      }
+	    }
+	    //sorting both lists by last modified
+	    sortListsByModified(friendsLists);
+	    sortListsByModified(myLists);
+	    clearUpdatesOfListThatIAmNotMemeberOf();
+	  }
+	  
+  	//setting text area to contain only 500 chars
+    var MAX_ITEM_LENGTH = 500;
+    function checkInputLength(input){
+      if (input.value.length>MAX_ITEM_LENGTH) {
+        input.value = input.value.substring(0,MAX_ITEM_LENGTH);
+      }
+    }
+	  
+	  //function to display the items
+	  function showItems(){
+	  	var itemsCounter=0; 
+	 	    var curItemHTML=[];
+	 	    var curItem;
+	 	    var itemStyle = "";
+	 	    //diaplying all the list items or only the first 7 if there are more
+	 	    for (var i=0; (i<currentItems.length && i<MAX_PROFILE_ITEMS); i++) { 
+	 	    	curItem = currentItems[i];
+	 	    	itemStyle = 'color:'+colors[curItem.color]+';';
+	 	    	if (curItem.strike) {
+	 	    		itemStyle = itemStyle+'text-decoration:line-through;';
+	 	    	}
+	 	    	curItemHTML.push('<div style="float:left; width:10px;">');
+	 	    		curItemHTML.push('<div id="item_'+i+'_bullet" title="'+prefs.getMsg("open_task_tooltip")+'" style="background: url('+getCachedImage('gadget_sprite.png')+') -146px -139px; height:11px; width:5px; overflow:hidden; margin-top:6px; cursor:pointer;"></div>');
+	 	    	curItemHTML.push('</div>');
+	 	    	curItemHTML.push('<input id="item_text_'+curItem.id+'" class="new_text_style_no_focus" style="width:'+textWidth+'px; '+itemStyle+'" onkeypress="if (checkEnter(event)) {this.blur(); return false;}" onfocus="editItem('+curItem.id+','+curItem.cut+');" onblur="saveItemChanges();" onkeyup="checkInputLength(this);" value="'+gadgets.util.escapeString(cutStringToFit(curItem.text, textWidth,"11px", "bold"))+'" />');
+	 	      document.getElementById("item_left_"+i).innerHTML = curItemHTML.join('');
+	 	      curItemHTML=[];
+	 	      curItemHTML.push('<div id="item_'+i+'_delete" title="'+prefs.getMsg("delete_tooltip")+'" class="sprite item_icon delete" style="visibility:hidden;"></div>');
+	 	      curItemHTML.push('<div id="item_'+i+'_color" title="'+prefs.getMsg("color_tooltip")+'" class="sprite item_icon color" style="visibility:hidden;"></div>');
+				  curItemHTML.push('<div id="item_'+i+'_strike" title="'+prefs.getMsg("completed_tooltip")+'" class="sprite item_icon strike" style="visibility:hidden;"></div>');
+				  document.getElementById("item_"+i+"_icons").innerHTML = curItemHTML.join('');
+	 	      curItemHTML=[];
+	 	      setItemEvents("item_"+i,curItem.id); 
+	 	      itemsCounter++; 
+	 	    }
+	 	    //setting icons backgrounds
+        $lp(".delete").css({'background':'url('+getCachedImage('gadget_sprite.png')+') -114px -139px'}); 
+        $lp(".strike").css({'background':'url('+getCachedImage('gadget_sprite.png')+') -92px -139px'}); 
+        $lp(".color").css({'background':'url('+getCachedImage('gadget_sprite.png')+') -70px -139px'});
+        //if there are more than 7 items we need to display the "new task" button  and the view all items link (only from 8)
+	 	    if (currentItems.length>=MAX_PROFILE_ITEMS){ 
+	 	      if (currentItems.length>MAX_PROFILE_ITEMS){
+	 	    	  document.getElementById("view_all_left").innerHTML = "<a id='view_all_text' href='javascript:void(0);' onclick='lp_trackEvent(\"Open Canvas\",\"View all items "+currentItems.length+"\"); switchToCanvas();'>"+prefs.getMsg("view_all_items")+"&nbsp;("+currentItems.length+")</a>";
+	 	      }
+          document.getElementById('new_task').style.display = "";
+        }
+        //setting the empty lines after the items
+	 	    else{
+	 	       //next available line should have the text "add new here" (the input isn't already opened)
+	 	       if (!isNewInputOpen){
+	 	          clearItemEvents("item_"+itemsCounter);
+    	 	      curItemHTML = [];
+    	 	      curItemHTML.push('<div style="float:left; width:10px;">');
+    	 	    	curItemHTML.push('</div>');
+    	 	    	curItemHTML.push('<input id="new_item_'+itemsCounter+'" class="new_text_style_no_focus" style="width:'+textWidth+'px; color:#80795A;" onkeypress="if (checkEnter(event)) {this.blur(); return false;}" onblur="addNew('+itemsCounter+');" onkeyup="checkInputLength(this);" value="'+prefs.getMsg("add_new_here")+'" onfocus="this.className=\'new_text_style\'; this.style.color=\'#000000\'; this.value=\'\'; isNewInputOpen = true;" />');
+    	 	      document.getElementById("item_left_"+itemsCounter).innerHTML = curItemHTML.join('');
+    	 	  }
+    	 	  itemsCounter++;
+    	 	  //clearing empty lines and events
+          for (var i=itemsCounter; i<MAX_PROFILE_ITEMS; i++){
+  		  		document.getElementById("item_left_"+i).innerHTML = "";
+  		  		clearItemEvents("item_"+i);
+  		  	}
+  		  	document.getElementById("view_all_left").innerHTML="";
+  		  	//removing new task
+  		  	document.getElementById('new_task').style.display = "none";
+	 	    }
+	  }
+
+	  
+	    //calculating the time passed since the given date (in millis from 1970), returns a string, for example "5 hours ago"
+  function passedTime(date){
+      //calculating the difference between the given date and now
+  		var diff = ((new Date()).getTime() - date);
+  		if (diff<=0) {
+  		  return prefs.getMsg("less_than_one_min"); 
+  		}
+  		var datePassed = new Date(diff);
+  		//we get in each var the corresponding differnce in years, months etc.
+  		var years = datePassed.getUTCFullYear()-1970;
+  		var months = datePassed.getUTCMonth();
+  		var days = datePassed.getUTCDate()-1;
+  		var hours = datePassed.getUTCHours();
+  		var minutes = datePassed.getUTCMinutes();
+  		//returns the largest difference, from years to minutes.
+  		if (years==1) {
+  		    return prefs.getMsg("year_ago");
+  		}
+      if(years>0){
+  		    return (prefs.getMsg("years_ago")).replace("%NUM%", years);  		
+  		}
+  		if (months==1) {
+  		    return (prefs.getMsg("month_ago"));
+  		}
+  		if(months>0){
+  		    return (prefs.getMsg("months_ago").replace("%NUM%", months));
+  		}
+		  if (days==1) {
+		     return (prefs.getMsg("day_ago"));
+		  }
+		  if(days>0){
+		    return prefs.getMsg("days_ago").replace("%NUM%", days);
+		  }
+		  if (hours==1) {
+		    return prefs.getMsg("hour_ago");
+		  }
+		  if(hours>0){
+		    return (prefs.getMsg("hours_ago")).replace("%NUM%", hours);
+		  }
+		  if (minutes==1) {
+		    return prefs.getMsg("minute_ago");
+		  }
+		  if(minutes>0){
+		    return (prefs.getMsg("minutes_ago").replace("%NUM%", minutes));
+		  }
+  		return prefs.getMsg("less_than_one_min");
+
+  }
+    
+	  
+	  function getTimestamp(){
+	    var date = new Date();
+	    return date.getTime();
+	  } 
+	  
+		
+		
+  	// GOOD SETTING HANDLER
+    function setSoTimeout(cb) {
+      var handler = setTimeout(cb,TIMEOUT_MILLIS);
+      return function() {
+        clearTimeout(handler);
+      };
+    }
+
+		//updating item's strike (complete)      
+		function updateStrikeRequest(itemId,strike,callback) {
+		  var params = {};
+		  var viewerName = getFirstName(viewer.getDisplayName());
+		  params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;
+		  params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;
+		  params["OAUTH_SERVICE_NAME"] = "HMAC";
+		  var f = setSoTimeout(function(){
+		      lp_trackEvent('Data Timeout Error','Update Strike');
+          dataError();});
+	    gadgets.io.makeRequest(APPURL+"/strikeitem?item_id="+itemId+"&strike="+strike+"&username="+escape(viewerName), function(data) {f();callback(data);}, params);
+		}
+	  
+	  //creates a new list with the given name and returns its id
+	  function importList(name, items, callback) {
+
+		  var viewerName = getFirstName(viewer.getDisplayName());
+			var post_str = []; 
+	    post_str.push("items="+encodeURIComponent(lpgadgets.lp.utils.jsonStringify(items)));
+	    post_str.push("name="+encodeURIComponent(name));
+	    post_str.push("username="+encodeURIComponent(viewerName));
+	    post_str = post_str.join("&");
+	    
+	    var params = {}; 
+	    params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON; 
+	    params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED; 
+	    params[gadgets.io.RequestParameters.POST_DATA] = post_str; 
+	    params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST; 
+	    params["OAUTH_SERVICE_NAME"] = "HMAC";
+	    var f = setSoTimeout(function(){
+		      lp_trackEvent('Data Timeout Error','Import List');
+          dataError();});
+	    gadgets.io.makeRequest(APPURL+"/importlist",function (data) {f(); callback(data);}, params);
+	  }
+
+		
+		function addNew(num){
+	    var text = document.getElementById("new_item_"+num).value;
+	    text = trimSpaces(text);
+	    //if user entered text
+	    if (text.length>0 || text==prefs.getMsg("add_new_here")){
+	      lp_trackEvent("Add New Task","Create new task "+(currentItems.length+1));
+	      setLoadingToItem(num); 
+	      //document.getElementById("item_"+num+"_delete").innerHTML = '<img src="'+getCachedImage('item_loader_profile.gif')+'" style="width:12px; height:12px;" />';
+	      //raising the responseCounter and adding the temp item to the displayed list
+	      responseCounter++;
+	      var item = {"id":"temp_"+num,"text":text,"color":0,"strike":false}
+	      currentItems.push(item);
+	      document.getElementById('new_item_'+num).className='new_text_style_no_focus';
+        var nextNum = num+1;
+        if (nextNum>6){
+            //here need to ask design if they want to open canvas or what?
+            isNewInputOpen = false;
+            document.getElementById('new_task').style.display = "";
+        }
+        //openning a new input task
+        else{
+          var curItemHTML = [];
+	 	      curItemHTML.push('<div style="float:left; width:10px;">');
+	 	    	curItemHTML.push('</div>');
+	 	    	curItemHTML.push('<input id="new_item_'+nextNum+'" class="new_text_style" style="width:'+textWidth+'px;" onkeypress="if (checkEnter(event)) {this.blur(); return false;}" onkeyup="checkInputLength(this);" onblur="addNew('+nextNum+');" onfocus="this.className=\'new_text_style\';" />');
+	 	      document.getElementById("item_left_"+nextNum).innerHTML = curItemHTML.join('');
+	 	    	document.getElementById("view_all_left").innerHTML="";
+	 	    	setTimeout(function() {document.getElementById("new_item_"+nextNum).focus()},200);
+        }
+	      
+	      //adding the item to the database with default balck color and with no strike
+	      addNewItemRequest(currentListId,text,0,0,responseCounter, function(data){
+	        if (data.data==null) {
+            lp_trackEvent("Data error", "addNew");
+	          dataError();
+          }
+          else if(data.data.success){
+            //updating list only if this is the last update that was made 
+	          if (data.data.token==responseCounter) {
+	            currentList = data.data.list;
+	            currentItems = currentList.items;
+	            showItems();
+	            savePrefsData();
+	          }
+          } else {
+                if (data.data.error==PERMISSION_DENIED) {
+                  handlePermissionDenied();
+                }
+                else {
+                  lp_trackEvent("Data Error", "addNew_1");
+                  dataError();
+                }
+          }
+	      });
+		}
+		else{
+		    document.getElementById("new_item_"+num).value = prefs.getMsg("add_new_here");
+		    document.getElementById("new_item_"+num).style.color = "#80795A";
+		    document.getElementById("new_item_"+num).className = "new_text_style_no_focus";
+		    isNewInputOpen = false;
+		}
+	}
+	
+	//setting loading animation to item till it fully added to the list
+	function setLoadingToItem(num){
+    document.getElementById("item_"+num+"_icons").innerHTML = '<div style="float:right"><img src='+getCachedImage('item_loader_profile.gif')+' style="width:11px; height:11px; margin-top:5px;" /></div>';
+	}
+	
+		
+		
+		function trimSpaces (str){
+	    return str = str.replace(/^\s*|\s*$/,"");
+	  }
+	  
+	  //importing data from V2
+	  function checkForV2Data(saved_tasks){		
+			var tmp = lpgadgets.lp.utils.jsonParse(lpgadgets.lp.utils.unescapeString(saved_tasks));
+			var itemsArray = [];
+			//we need this in order to set the right colors
+			var colors_on_panel = [];
+			colors_on_panel[0] = ["#000000", "#E22974","#DC4A20"]; 
+			colors_on_panel[1] = ["#006CB3","#7E9D1E","#ED1C24"];
+			colors_on_panel[2] = ["#662D91","#F7941D","#737373"];
+			var text, color, row, col, colorFromId, strike;
+			for(var i=0; i < tmp.items.length; i++){
+				color="";
+				text = tmp.items[i].t;
+				colorFromId = tmp.items[i].a.substr(0,1);
+				row = Math.ceil(colorFromId/3) - 1;
+				col = colorFromId - (row*3) - 1;
+				colorFromId = colors_on_panel[row][col];
+				for (var j=0; j<colors.length; j++){
+					if (colors[j]==colorFromId) {
+						color = j;
+					}
+				}
+				if (color==""){
+					color = 0;
+				}
+				if (tmp.items[i].a.substr(1,1)==1){
+					strike = true;
+				}
+				else{
+					strike = false;
+				}
+
+				new_item = [text.substr(0, MAX_ITEM_LENGTH),color,strike];		
+				itemsArray.push(new_item);					
+			}
+			var listName = (prefs.getMsg("untitled_list")).replace("%NUM%","1");
+			//adding list to db
+		  importList(listName, itemsArray, function(data){
+				  
+          if (data.data.success) {
+   	  			prefs.set("todos", "");
+   	  			loadListsAndDefault();
+  				}
+  				else{
+  				  lp_trackEvent("Data Error","Import List");
+  					dataError();
+  				}
+			});
+	}
+		  
+
+			
+		//getting id and returns the list's data
+	  function loadListDataRequest(id, callback) {
+	  
+	    deleteBalloonNotification(id);
+          
+	    var params = {};
+	    params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;
+	    params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;
+	    params["OAUTH_SERVICE_NAME"] = "HMAC";
+	    var f = setSoTimeout(function(){
+		      lp_trackEvent('Data Timeout Error','Load List');
+          dataError();});
+	    gadgets.io.makeRequest(APPURL+"/getlist?list_id="+id, function (data) {f(); callback(data);}, params);
+	  }
+			
+	
+		//returns the users lists data
+	  function loadListsRequest(callback) {
+	    var params = {};
+	    params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;
+	    params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;
+	    params["OAUTH_SERVICE_NAME"] = "HMAC";
+	    var f = setSoTimeout(function(){
+		      lp_trackEvent('Data Timeout Error','Load Lists');
+          dataError();});
+	    gadgets.io.makeRequest(APPURL+"/getlists", function (data) {f(); callback(data);}, params);
+	  }
+	  
+		//updating an item's text (token is used to identify the response of each request
+	  function updateItemRequest(itemId,resCounter,txt,callback) {
+	  
+	    var post_str = []; 
+	    var viewerName = getFirstName(viewer.getDisplayName());
+	    post_str.push("item_id="+encodeURIComponent(itemId));
+	    post_str.push("username="+encodeURIComponent(viewerName));
+	    post_str.push("text="+encodeURIComponent(txt));
+	    post_str.push("token="+encodeURIComponent(resCounter));
+	    post_str = post_str.join("&");
+	
+	    var params = {}; 
+	    params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON; 
+	    params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED; 
+	    params[gadgets.io.RequestParameters.POST_DATA] = post_str; 
+	    params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST; 
+	    params["OAUTH_SERVICE_NAME"] = "HMAC";
+	    var f = setSoTimeout(function(){
+		      lp_trackEvent('Data Timeout Error','Update Item');
+          dataError();});
+	    gadgets.io.makeRequest(APPURL+"/updateitem",function (data) {f(); callback(data);}, params);
+	    
+	  }
+	  
+		//updating item's color (token is used to identify the response of each request
+	  function updateColorRequest(itemId,color,callback) {
+	    var params = {};
+	    params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;
+	    params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;
+	    params["OAUTH_SERVICE_NAME"] = "HMAC";
+	    var f = setSoTimeout(function(){
+		      lp_trackEvent('Data Timeout Error','Update Color');
+          dataError();});
+	    gadgets.io.makeRequest(APPURL+"/coloritem?item_id="+itemId+"&color="+color, function (data) {f(); callback(data);}, params);
+	  }
+	  
+	  //removing an item from db (token is used to identify the response of each request)
+  function removeItemRequest(itemId, resCounter, callback) {
+    var params = {};
+    var viewerName = getFirstName(viewer.getDisplayName());
+    params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;
+    params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;
+    params["OAUTH_SERVICE_NAME"] = "HMAC";
+    var f = setSoTimeout(function(){
+		      lp_trackEvent('Data Timeout Error','Remove Item');
+          dataError();});
+	  gadgets.io.makeRequest(APPURL+"/deleteitem?item_id="+itemId+"&username="+escape(viewerName)+"&token="+resCounter, function (data) {f(); callback(data);}, params);
+  }
+	  
+	//creates a new list with the given name and returns its id
+  function newListRequest(name, callback) {
+    var params = {};
+    var viewerName = getFirstName(viewer.getDisplayName());
+    params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;
+    params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;
+    params["OAUTH_SERVICE_NAME"] = "HMAC";
+    var f = setSoTimeout(function(){
+		      lp_trackEvent('Data Timeout Error','New List');
+          dataError();});
+    gadgets.io.makeRequest(APPURL+"/newlist?name="+escape(name)+"&username="+escape(viewerName), function (data) {f(); callback(data);}, params);
+  }
+  
+	//creating a new item with the given params (token is used to identify the response of each request
+  function addNewItemRequest(listId,txt,color,strike,resCounter,callback) {
+    var post_str = []; 
+    var viewerName = getFirstName(viewer.getDisplayName());
+    post_str.push("list_id="+encodeURIComponent(listId));
+    post_str.push("username="+encodeURIComponent(viewerName));
+    post_str.push("text="+encodeURIComponent(txt));
+    post_str.push("color="+encodeURIComponent(color));
+    post_str.push("strike="+encodeURIComponent(strike));
+    post_str.push("token="+encodeURIComponent(resCounter));
+    post_str = post_str.join("&");
+    
+    var params = {}; 
+    params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON; 
+    params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED; 
+    params[gadgets.io.RequestParameters.POST_DATA] = post_str; 
+    params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST; 
+    params["OAUTH_SERVICE_NAME"] = "HMAC";
+    var f = setSoTimeout(function(){
+		      lp_trackEvent('Data Timeout Error','Add Item');
+          dataError();});
+	  gadgets.io.makeRequest(APPURL+"/additem",function (data) {f(); callback(data);}, params);
+  }
+
+	  
+	 //saving item updates
+	  function saveItemChanges(){
+	    var newTxt = document.getElementById('item_text_'+currentEditedId).value;
+	    newTxt = trimSpaces(newTxt);
+	    //update only if the text is not empty.
+	    if (newTxt.length>0){
+	      document.getElementById('item_text_'+currentEditedId).value = cutStringToFit(newTxt, textWidth,"11px", "bold");
+				  
+	      //the responseCounter was raised at the moment we moved to editing status
+	      updateItemRequest(currentEditedId,responseCounter,newTxt,function(data){
+	         if (data.data==null) {
+             lp_trackEvent("Data Error", "saveItemChanges");
+	           dataError();
+           } else if (data.data.success){
+	           //updating list only if this is the last update that was made 
+	           if (data.data.token==responseCounter) {
+	              currentList = data.data.list;
+	              currentItems = currentList.items;
+	              showItems();
+	              savePrefsData();
+	           }
+	         } else {
+                if (data.data.error==MISSING_ITEM_ERROR){
+                  handleMissingItem(true);
+                }
+                else if (data.data.error==PERMISSION_DENIED) {
+                  handlePermissionDenied();
+                }
+                else {
+                  lp_trackEvent("Data Error", "saveItemChanges_1");
+                  dataError();
+                }
+           }
+	      });
+	    }
+	    //if the text is empty, setting back the old text
+	    else {
+	      document.getElementById('item_text_'+currentEditedId).value = cutStringToFit(currentEditedOldTxt, textWidth,"11px", "bold");
+	    }
+	    //setting the item back to "not editing" style
+	    document.getElementById('item_text_'+currentEditedId).className='new_text_style_no_focus';
+	    currentEditedOldTxt="";
+	    currentEditedId="";
+	  }
+	  
+	  //when starting to edit an item
+	  function editItem(id, cut){
+	    if (cut){
+	       //display the loading
+         document.getElementById("load_ajax_back").style.backgroundColor="#FAF7AE";
+         displayLoading();
+  	     loadListDataRequest(currentListId,function(listData){
+  	       if (listData.data==null) {
+  	          lp_trackEvent("Data error", "editItem");
+              dataError();
+           } 
+           else if (listData.data.success){
+             currentList = listData.data;
+             currentItems = currentList.items;    
+             showItems();
+             savePrefsData();
+             //hiding loading
+             hideLoading();
+             //if the tiem exists, set the focus on it
+             var itemInput = document.getElementById("item_text_"+id);
+             if (itemInput!=null){
+                //the timeout is an IE fix
+                setTimeout(function(){itemInput.focus();},200);
+             } 
+           } else {
+                if (data.data.error==PERMISSION_DENIED) {
+                  handlePermissionDenied();
+                }
+                else {
+                  lp_trackEvent("Data Error", "editItem_1");
+                  dataError();
+                }
+            }
+  	     });
+  	     return;
+	    }
+	    lp_trackEvent("Edit item text","Edit text");
+	    //raising the response counter in order to prevent refreshing (by previous reponse) while editing
+	    responseCounter++;
+	    //setting the item's style and status to "editing" 
+	    document.getElementById('item_text_'+id).className = 'new_text_style';
+	    document.getElementById('item_text_'+id).value = currentItems[getItemIndex(id)].text;
+	    currentEditedId = id;
+	    currentEditedOldTxt = document.getElementById('item_text_'+id).value;
+	    document.getElementById('item_text_'+id).select();
+	  }
+		  
+	
+	//checking if a user is a friend in some group
+	function isFriend(group,id){
+	   var isFriends = group.getById(""+id);
+	   if (isFriends!=null){
+	     return true;
+	   }
+	   return false;
+	}  
+	  
+	 //getting only the first name of the user
+	  function getFirstName(fullName)	{
+			var tmp = fullName.split(' ');		
+			return tmp[0];		
+		}
+	 	 
+	 	  function loadImages(){ 
+	 	    $lp(".sprite").css('background-image','url('+getCachedImage('gadget_sprite.png')+')'); 
+	 	    document.getElementById("color_pallete").src = getCachedImage("color_pallete.png");
+	 	    document.getElementById("notebook_ajax").src = getCachedImage("loader_profile.gif");
+	 	    var cachedUrl = _IG_GetCachedUrl('http://cdn.labpixies.com/images/transparent.gif'); 
+        cachedUrl = cachedUrl.replace("%rewriteMime%", ""); 
+        document.getElementById("loading_notebook").style.background = "url("+cachedUrl+") repeat";
+	 	  } 
+	 	  
+  	//pre loading images
+    function lp_preLoadImages(){
+      var a = new Image();
+      a.src = getCachedImage("item_loader_profile.gif");
+    }
+	 	   
+	 	  //clearing items and events (we need to verify this when refreshing the lists, if user deletes an item);
+	 	  function clearItemEvents(elmentId){
+        document.getElementById(elmentId+"_icons").innerHTML = "";
+        changeBackPosition(elmentId,"0px -41px");
+        changeBackPosition(elmentId+"_right","right -41px"); 
+        
+				document.getElementById(elmentId).onmouseover = function(){};
+
+				document.getElementById(elmentId).onmouseout = function(){};
+       
+      }
+       
+       
+      //setting the items over,out,onclick events
+	 	  function setItemEvents(elmentId, itemId){ 
+	 	    
+ 	      $lp("#"+elmentId+"_bullet").hover(function(){changeBackPosition(elmentId+"_bullet","-136px -139px");},
+                                  function(){changeBackPosition(elmentId+"_bullet","-141px -139px"); });
+	 	    
+	 	    $lp("#"+elmentId+"_strike").hover(function(){changeBackPosition(elmentId+"_strike","-103px -139px");},
+                                  function(){changeBackPosition(elmentId+"_strike","-92px -139px"); });
+                                  
+        $lp("#"+elmentId+"_delete").hover(function(){changeBackPosition(elmentId+"_delete","-125px -139px");},
+        													function(){changeBackPosition(elmentId+"_delete","-114px -139px"); });
+      
+        $lp("#"+elmentId+"_color").hover(function(){changeBackPosition(elmentId+"_color","-81px -139px");},
+																	function(){changeBackPosition(elmentId+"_color","-70px -139px"); });
+																	
+																	
+				document.getElementById(elmentId+"_strike").onclick = function(){
+					setItemStrike(itemId);
+				}
+				
+				document.getElementById(elmentId+"_delete").onclick = function(){
+					deleteItem(itemId);
+				}
+				
+			 document.getElementById(elmentId+"_color").onclick = function(){
+	       openColorPallete(elmentId,itemId);
+	     }
+				
+				document.getElementById(elmentId).onmouseover = function() {
+		      onMouseOverItem(elmentId);
+		    }
+
+				document.getElementById(elmentId).onmouseout = function(){ 
+	 	      onMouseOutItem(elmentId);
+	 	    }; 
+	 	    
+	 	    document.getElementById(elmentId+"_bullet").onclick = function() { 
+	 	      lp_trackEvent("Open Canvas","Open task (small triangle)");
+	 	      switchToCanvas(EDIT_TASK,itemId);
+	 	    } 
+	 	  }
+	 	  
+	 	  //adding a shadow to a specified element
+	 	  function addShadowToElement(elmentId){
+	 	    var position = $lp("#"+elmentId).offset();
+    	  var xPos = (position.left+3)+"px";
+    	  var yPos = (position.top+3)+"px";
+    	  var width = (parseInt(document.getElementById(elmentId).offsetWidth))+"px";
+    	  var height = (parseInt(document.getElementById(elmentId).offsetHeight))+"px";
+    	  document.getElementById('shadow').style.top = yPos;
+        document.getElementById('shadow').style.left = xPos;
+        document.getElementById('shadow').style.width = width; 
+        document.getElementById('shadow').style.height = height;
+        document.getElementById("shadow").style.display="";
+	 	  }
+	 	  
+	 	  //when user has new shared lists, display a pop up on gadget load
+	 	  function displayNewListsPopup(newLists){
+	 	     
+	 	     //we have new lists to show
+	 	     if (newLists.length == 0) 
+	 	       return;
+	 	       
+	 	       var out = [];
+	 	       out.push('<table border="0" cellpadding="0" cellspacing="0" style="background:#FBF9C4; border:1px solid #52493D;">');
+	 	       out.push('<tr><td style="font-size:1px; width:6px;"></td><td style="width:180px;">');
+	 	       out.push('<table border="0" cellpadding="0" cellspacing="0">');
+	 	       out.push('<tr><td colspan="3" style="font-size:1px; height:6px;"></td></tr>');
+           var listOwner;    
+           var listName = "";
+	 	       for (var i=0; i<newLists.length && i<2; i++){
+	 	         listName = "";
+	 	         //getting the listOwner details
+	 	         listOwner = friends.getById(newLists[i].owner);
+	 	         out.push('<tr>');
+	 	          //image
+              out.push('<td width="38" valign="top">');
+            	out.push('<div style="width:38px; height:38px; background-color: #2A2620; overflow:hidden; padding:0px;">');
+            	out.push('<div class="img_inner_bgcolor" style="margin:1px 0px 0px 1px; width:36px; height:36px;" >');
+            	if (typeof(listOwner.getField(opensocial.Person.Field.PROFILE_URL))!='undefined'){
+  					 	   out.push('<table cellspacing="0" cellpadding="0" border="0"><tr height="36" width="36"><td style="cursor:pointer;" valign="middle" title="'+getFirstName(listOwner.getDisplayName())+'"><img style="width:36px;" src="'+getThumbnail(listOwner)+'" onclick="lp_trackEvent(\'Open friend profile\',\'Shared list pop-up - User icon\'); window.top.location=\''+listOwner.getField(opensocial.Person.Field.PROFILE_URL)+'\';"  /></td></tr></table>');												
+              }else{
+                 out.push('<table cellspacing="0" cellpadding="0" border="0"><tr height="36" width="36"><td valign="middle" title="'+getFirstName(listOwner.getDisplayName())+'"><img style="width:36px;" src="'+getThumbnail(listOwner)+'"  /></td></tr></table>');
+              }
+    				 	//out.push('<table cellspacing="0" cellpadding="0" border="0"><tr height="36" width="36"><td valign="middle"><img style="width:36px;" src="'+getThumbnail(listOwner)+'" /></td></tr></table>');												
+              out.push('</div>');
+              out.push('</div>');
+              out.push('</td>');
+              //text
+              listName = newLists[i].name;
+              out.push('<td style="width:6px; font-size:1px;"></td>');
+              out.push('<td width="136">');
+              if (typeof(listOwner.getField(opensocial.Person.Field.PROFILE_URL))!='undefined'){
+  					 	   out.push('<div style="font-family:arial; font-size:11px; width:130px; color:#3F3631; cursor:pointer; overflow:hidden;">'+(prefs.getMsg("name_shared").replace('%NAME%','<span style="color:#00928F;" onclick="lp_trackEvent(\'Open friend profile\',\'Shared list pop-up - User name\'); window.top.location=\''+listOwner.getField(opensocial.Person.Field.PROFILE_URL)+'\';">'+getFirstName(listOwner.getDisplayName())+'</span>'))+'</div>'); 												
+              }else{
+                 out.push('<div style="font-family:arial; font-size:11px; width:130px; color:#3F3631; overflow:hidden;">'+(prefs.getMsg("name_shared").replace('%NAME%','<font style="color:#00928F;">'+getFirstName(listOwner.getDisplayName())+'</font>'))+'</div>');
+              }
+             // out.push('<div style="font-family:arial; font-size:11px; color:#3F3631;">'+(prefs.getMsg("name_shared").replace('%NAME%','<font style="color:#00928F;">'+getFirstName(listOwner.getDisplayName())+'</font>'))+'</div>');
+              out.push('<div id="popup_list_name" style="width:136px; overflow:hidden;" ><a href="javascript:void(0);" onclick="lp_trackEvent(\'Open canvas\',\'Shared list pop-up - list name clicked\'); switchToCanvas('+newLists[i].id+');">'+listName+'</a></div>');
+              out.push('</td>');
+            out.push('</tr>');
+            out.push('<tr><td colspan="3" style="font-size:1px; height:6px;"></td></tr>');
+	 	       }
+	 	       //more than 2 lists, needs to add the "x more..." text at the bottom
+	 	       if (newLists.length>2){
+	 	         out.push('<tr><td colspan="3" style="font-family:arial; font-size:11px; color:#3F3631;">'+(prefs.getMsg("num_more_lists").replace('%NUM%',(newLists.length-2)))+'</td></tr>');
+	 	         out.push('<tr><td colspan="3" style="font-size:1px; height:4px;"></td></tr>');
+          }
+	 	       out.push('</table>');
+	 	       out.push('</td>');
+	 	       //x button
+	 	       out.push('<td style="font-size:1px; width:14px;" valign="top" align="right" ><div id="close_popup" style="cursor:pointer; background: url('+getCachedImage('gadget_sprite.png')+') -162px -139px no-repeat; width:9px; height:9px; overflow:hidden; margin: 3px 3px 0px 0px;" onmouseover="this.style.backgroundPosition=\'-171px -139px\';" onmouseout="this.style.backgroundPosition=\'-162px -139px\';" ></div></td>');
+	 	       out.push('</tr></table>');
+	 	       
+	 	       document.getElementById("new_lists_popup_container").innerHTML = out.join('');
+	 	       
+	 	       //set pop up position and display
+    	 	    var position = $lp("#title_container").offset();
+    	 	    var width = (parseInt(document.getElementById('container').offsetWidth));
+        	  var xPos = (((width-200)/2)+position.left)+"px";
+        	  var yPos = ((position.top)+80)+"px";
+        	  document.getElementById('new_lists_popup_container').style.top = yPos;
+            document.getElementById('new_lists_popup_container').style.left = xPos;
+            document.getElementById("new_lists_popup_container").style.display="";
+            addShadowToElement("new_lists_popup_container");
+            coverList(true);
+            
+            //adding the close popup event, should set the "popup" property of all new lists to be false
+            $lp("#close_popup").click(function(){
+                
+              var keys = [];
+              for (var i=0; i<newLists.length; i++) {
+                //adding the n_ key to the keys we are going to delete
+                keys.push("n_"+newLists[i].id);
+              }
+              //deleting the "n_" record for these lists
+              var req = opensocial.newDataRequest(); 
+              
+              if (keys.length>0) {
+                req.add(req.newRemovePersonAppDataRequest(opensocial.IdSpec.PersonId.VIEWER, 
+  												  keys 
+  												  ));
+  		          req.send(function(data){});
+  		        }
+		          
+		        
+               //closing popup
+               uncoverList();
+               document.getElementById("new_lists_popup_container").style.display="none";
+               document.getElementById("shadow").style.display="none";
+            });
+	 	  }
+	 	  
+	 	  
+	 	  //display the bottom details below the notebook ("Shared with");
+	 	  function displayShare(){
+	 	    //user is the owner
+	 	    if (currentList.is_owner){
+	 	       document.getElementById('share_container').innerHTML = '<div id="share_with_link" style="float:right;"><a href="javascript:void(0);" onclick="lp_trackEvent(\'Open Canvas\',\'Share with friends\'); switchToCanvas(SHARE_WITH);">+'+prefs.getMsg("share_with_friends")+'</a></div>';
+	 	    }
+	 	    var collaboratorsData = [];
+	 	    var unknowns = 0;
+	 	    //getting all the friends in this list
+    	 	for (var i=0; i<currentList.users.length;i++){
+          if ((currentList.users[i]!=currentList.owner)){
+          	if(isFriend(friends,currentList.users[i])){
+            	collaboratorsData.push(friends.getById(currentList.users[i]));
+            }
+            else{
+              if (currentList.users[i]!=owner.getId()){
+                unknowns++;
+              }
+            }
+          }
+        }
+       //displaying collaborators if have any or if this is a freind's list (then we need to display him for sure)
+       if (collaboratorsData.length>0 || !currentList.is_owner){
+          document.getElementById('shared_with_container').innerHTML = '<div style="float:left; font-family:arial; font-size:10px; color:#26221C; ">'+(prefs.getMsg("shared_with"))+':</div>';
+          var out=[];
+          var numOfDisplayed = 0;
+          var randomeIndex, randomColl;
+          //helps us know if we have more than 3, so we need to display the more message
+          var moreFriends = collaboratorsData.length - 3;
+          out.push('<table border="0" cellpadding="0" cellspacing="0">');
+          out.push('<tr>');
+          //if this user the list owner, putting the owner first
+          if (!currentList.is_owner){
+            var listOwner = friends.getById(currentList.owner);
+            out.push('<td width="38" style="padding-right:10px;">');
+          	out.push('<div style="width:38px; height:38px; background-color: #2A2620; overflow:hidden; padding:0px;">');
+          	out.push('<div class="img_inner_bgcolor" style="margin:1px 0px 0px 1px; width:36px; height:36px;" >');
+          	//taking care of the case that user doesn't have a profile page
+          	if (typeof(listOwner.getField(opensocial.Person.Field.PROFILE_URL))!='undefined'){
+					 	   out.push('<table cellspacing="0" cellpadding="0" border="0"><tr height="36" width="36"><td style="cursor:pointer;" valign="middle" title="'+getFirstName(listOwner.getDisplayName())+'"><img style="width:36px;" src="'+getThumbnail(listOwner)+'" onclick="lp_trackEvent(\'Open friend profile\',\'User icon (shared with) clicked\'); window.top.location=\''+listOwner.getField(opensocial.Person.Field.PROFILE_URL)+'\';"  /></td></tr></table>');												
+            }else{
+               out.push('<table cellspacing="0" cellpadding="0" border="0"><tr height="36" width="36"><td valign="middle" title="'+getFirstName(listOwner.getDisplayName())+'"><img style="width:36px;" src="'+getThumbnail(listOwner)+'"  /></td></tr></table>');
+            }
+            out.push('</div>');
+            out.push('</div>');
+            out.push('</td>');
+            numOfDisplayed++;
+          }
+          //disaplying other collaborators (picking them randomly)
+          while(0<collaboratorsData.length && numOfDisplayed<3){
+            out.push('<td width="38" style="padding-right:10px;">');
+          	out.push('<div style="width:38px; height:38px; background-color: #2A2620; overflow:hidden; padding:0px;">');
+          	out.push('<div class="img_inner_bgcolor" style="margin:1px 0px 0px 1px; width:36px; height:36px;" >');
+            randomIndex = Math.floor(Math.random()*collaboratorsData.length);
+            randomColl = collaboratorsData[randomIndex];
+            if (typeof(randomColl.getField(opensocial.Person.Field.PROFILE_URL))!='undefined'){
+					 	   out.push('<table cellspacing="0" cellpadding="0" border="0"><tr height="36" width="36"><td valign="middle" style="cursor:pointer;" title="'+getFirstName(randomColl.getDisplayName())+'"><img style="width:36px;" src="'+getThumbnail(randomColl)+'" onclick="lp_trackEvent(\'Open friend profile\',\'User icon (shared with) clicked\'); window.top.location=\''+randomColl.getField(opensocial.Person.Field.PROFILE_URL)+'\';"  /></td></tr></table>');												
+            }else{
+               out.push('<table cellspacing="0" cellpadding="0" border="0"><tr height="36" width="36"><td valign="middle" title="'+getFirstName(randomColl.getDisplayName())+'"><img style="width:36px;" src="'+getThumbnail(randomColl)+'"  /></td></tr></table>');
+            }
+            out.push('</div>');
+            out.push('</div>');
+            out.push('</td>');
+            collaboratorsData.splice(randomIndex,1);
+            numOfDisplayed++;
+          }
+          //adding the "x more" text
+          if (unknowns>0){
+            if (moreFriends>0){
+              unknowns = unknowns + moreFriends;
+            }
+            out.push('<td style="font-family:arial; font-size:10px; font-weight: bold; color:#00928F; cursor:pointer;" valign="bottom" onclick="lp_trackEvent(\'Open Canvas\',\'View more firends '+(numOfDisplayed+unknowns)+'\'); switchToCanvas();">+ '+(prefs.getMsg("num_more").replace("%NUM%",(unknowns)))+'&gt; </td>');
+          }
+          else if (moreFriends>0){
+            out.push('<td style="font-family:arial; font-size:10px; font-weight: bold; color:#00928F; cursor:pointer;" valign="bottom" onclick="lp_trackEvent(\'Open Canvas\',\'View more firends '+(numOfDisplayed+moreFriends)+'\'); switchToCanvas();">+ '+(prefs.getMsg("num_more").replace("%NUM%",(moreFriends)))+'&gt; </td>');
+          }
+          out.push('</tr></table>');
+          document.getElementById("collaborators").innerHTML = out.join('');
+          document.getElementById("collaborators").style.display = "";
+          
+       }
+	 	  
+	 	  }
+	 	  
+	 	   //getting friend thumbnail or annonymous thumbnail if null
+       function getThumbnail(person){
+    		var url = person.getField(opensocial.Person.Field.THUMBNAIL_URL);
+    		if (url=="null" || typeof(url) == 'undefined'){
+    			url = getCachedImage("holder_cv.png");
+    		}
+    		return url;
+    	}
+	 	  
+			//open the color pallete for an item (we have only one color palleter and we open it for all items)
+		  function openColorPallete(elmentId,itemId){
+		      //getting the right position
+		      $lp('#color_pallete_container').unbind('click');
+		      var position = $lp('#'+elmentId+'_color').offset();
+		  	  var xPos = position.left;
+		  	  var yPos = position.top;
+		  	  document.getElementById('color_pallete_container').style.top = yPos+"px";
+		      document.getElementById('color_pallete_container').style.left = xPos+"px";
+		      document.getElementById('color_pallete_container').style.display = "";
+		      $lp('#color_pallete_container').click(function(e){
+		        setItemColor(itemId,e.pageX, e.pageY);
+		      });
+					
+		      document.getElementById('color_pallete_container').onmouseover = function(){
+		        onMouseOverItem(elmentId);
+		      };
+		      document.getElementById('color_pallete_container').onmouseout = function(){
+		        this.style.top = "-200px";
+		        this.style.left = "-200px";
+		        this.style.display = "none";
+		        onMouseOutItem(elmentId);
+		      };
+		  }
+		  
+			//setting the color of an item according to the color that was clicked on the color pallete
+		  function setItemColor(item_id, left, top)	{              
+				var color = 0;
+				var panel = $lp('#color_pallete');
+				var click_left, click_top;
+				var i,j;
+				
+			  //getting the posion of the click in order to decide which color the user clicked
+				click_left = left - panel.offset().left;
+				click_top = top - panel.offset().top;
+							   
+				i = Math.floor(click_left / 10);
+				j = Math.floor(click_top / 10);
+			  
+			  color = 3*j + i;
+			  
+		    lp_trackEvent("Change Task Color","Change Color button "+color); 
+		    
+				var colorCode = colors[color];                         
+				currentItems[getItemIndex(item_id)].color = color;
+				
+				// update data
+				updateColorRequest(item_id,color, function(data){
+		       if (data.data==null) {
+              lp_trackEvent("Data Error","setItemColor");
+    		      dataError();
+           } else if (data.data.success){
+                savePrefsData();
+           } else {
+                if (data.data.error==MISSING_ITEM_ERROR){
+                  handleMissingItem(true);
+                }
+                else if (data.data.error==PERMISSION_DENIED) {
+                  handlePermissionDenied();
+                }
+                else {
+                  lp_trackEvent("Data Error", "setItemColor_1");
+                  dataError();
+                }
+           }
+		    });
+					   

[... 4950 lines stripped ...]


Mime
View raw message