<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs
height="500"
title="Facebook"
directory_title="Facebook - v6 with working notifications"
description="Facebook Gadget for iGoogle: Your essential miniaturized Facebook connection. Recently updated with new features and bugfixes.  View your news feed, make comments, post status updates and stay connected to all your facebook friends directly from your iGoogle page. Just click on the maximize button in the upper right hand corner to access the larger canvas view. Using Facebook's newest API, this gadget provides secure, convenient access to your account."
title_url="http://www.gingagadgets.com/hub.php?caller=facebook"
screenshot="http://hosting.gmodules.com/ig/gadgets/file/100080069921643878012/screenshot_facebook.jpg"
thumbnail="http://hosting.gmodules.com/ig/gadgets/file/100080069921643878012/thumbnail_facebook.png"
singleton="false" author="Ginga"
author_email="ginga.gadgets@gmail.com" author_location="USA"
author_photo="http://ginga.gadgets.googlepages.com/authorphoto.png"
author_aboutme="Restless"
author_quote="less is more"
author_link="http://gingagadgets.com"
author_affiliation="ginga gadgets" category="funandgames" category2="lifestyle">
<Require feature="minimessage"/>
<Require feature="analytics" /> 
<Require feature="dynamic-height"/> 
<Require feature="views"/> 
<!-- SJP MOD START -->
<Require feature="setprefs"/>
<!-- SJP MOD END -->

</ModulePrefs>

<!-- SJP MOD START -->
<UserPref name="useNewFB_p" display_name="Use new version" datatype="bool" default_value="true" />
<UserPref name="showPopUp2_p" datatype="hidden" default_value="true" />
  

<Content type="html" view="home,profile,default"><![CDATA[
<script type="text/javascript">
function goToView(dest) {
 var supported_views = gadgets.views.getSupportedViews();
 gadgets.views.requestNavigateTo(supported_views[dest]);
};
</script>




   <!-- Anchor everything -->
<div id="msg_div">




<div id="pre_link_bar_div" style="display:none;">
 Fully-Featured Facebook: your essential miniaturized facebook connection. View your news feed, inbox, photos and stay connected to all your facebook friends 
</div> 




<script type="text/javascript"> 
var subvert_mini_msg = 50;
var syndication = gadgets.util.getUrlParameters()["synd"];

if (syndication != "open" && Math.floor(Math.random()*101) < subvert_mini_msg) {
 // put out the ad
 google_ad_client = "pub-8565751766874039";
 // minimsg equivilant for facebook 468x15, created 1/13/09 
 google_ad_slot = "7007160358";
 google_ad_width = 468;
 google_ad_height = 15;
 document.write(unescape("%3Cscript src='http://pagead2.googlesyndication.com/pagead/show_ads.js' type='text/javascript'%3E%3C/script%3E"));




 // close the div
 document.write(unescape("%3C/div%3E"));
 } else {
 // close the div
 document.write(unescape("%3C/div%3E"));

 // CONTEXTUALIZE:  
var params = {};
params["CONTENT_TYPE"] = gadgets.io.ContentType.TEXT;
 gadgets.io.makeRequest('http://www.gingagadgets.com/lib/message_center.php?caller=facebook&platform=', function (responseText) {
     
     // check responseText for crap
     if (responseText.data != "") {
       if ( /Service Temporarily Unavailable/.test(responseText.data) ) { 
   // if found do default msg
   responseText.data = '<span style="font-size:9px;"><a target="_blank" href="http://gingagadgets.com" onClick="_IG_Analytics(\'UA-2621463-1\',\'/minimsg_refer/spike/DIRECTED_USER_TO_GINGA_ERROR\');">Many more gadgets at GingaGadgets.com</a></span>';
       } 

       document.getElementById("msg_div").innerHTML = responseText.data.replace("float:right;", "") ;
       gadgets.window.adjustHeight();
     }
   },params);

 
 function onCloseMini() {
 _IG_Analytics("UA-2621463-1", "/clicked/mini-X/facebook");
 resize();
 }

 }


 


</script> 




<!-- <div style="float:right"> -->
<script type="text/javascript">
var syndication = gadgets.util.getUrlParameters()["synd"];
if (typeof syndication != "undefined") {
 if(syndication == "ig") {
 // iGoogle homepage
 // Removing this to see if it has an effect
 // document.write('<a href="javascript:goToView(\'canvas\')">Maximize View</a>');
 }
 else if(syndication == "open") {
 // gadget in a webpage
 document.write('<span style="font-size:9px"><a target="_blank" href="http://www.google.com/ig/adde?moduleurl=hosting.gmodules.com/ig/gadgets/file/100080069921643878012/facebook.xml" >Add to iGoogle</a></span>');
 }
} 
</script>












<div id="content_div" align="center"></div>




<!-- Dynamic content -->
<script type="text/javascript">




_IG_Analytics("UA-2621463-1", "/facebook");




// Run onload
gadgets.util.registerOnLoadHandler(init);




// Called on startup !
function init() {
 display();
}




   function resize() {
   gadgets.window.adjustHeight();
   }

// <!-- SJP MOD START -->
function processPopUp(whichCase) {
  var prefs = new gadgets.Prefs();

  switch(whichCase) {
  case 3:
   prefs.set('showPopUp2_p', 'false');
   display(false);
   break;
  case 2:
   display(false); 
   break;
  case 1:
  default:
    prefs.set('useNewFB_p', 'true');
   display();
  break;
  }
 }

function display(popup_p) {
  var prefs = new gadgets.Prefs(), destination_url;

  if (prefs.getBool('useNewFB_p') == true) {
    destination_url = 'http://ampatico.com/Facebook/iGoogle/6fromSVN/index';
  } else {

    // POTENTIALLY SHOW POP-UP
    if (prefs.getBool('showPopUp2_p') == true && popup_p != false) {
      // Show the pop-up
      
      var html = '<h3>Updated Facebook Gadget!</h3>';
      html += '<span style="font-size:medium;"> Would you like the new version: <br /> <button onclick="processPopUp(1);" style="font-weight:bold;vertical-align:middle;">YES</button> (recommended) </span> <div style="text-align:left;font-size:small;"> <p style="font-size:small;"> or would you like to stick with the legacy version: <button onclick="processPopUp(2);" style="font-size:smaller;vertical-align:middle;" >use legacy</button> (broken on some platforms)</p> <p /> If you want to change your selection can always switch later using the <em>Edit Settings</em> menu option. </div> <p />  <span onclick="processPopUp(3);" style="font-size:xx-small;cursor:pointer;text-align:center;">do not show this message again </span> ';

      document.getElementById('content_div').innerHTML = html;
      resize();
      return;
    } else {
      // Show them the old facebook
      destination_url = 'http://m.facebook.com';
      if(navigator.userAgent) {
  if ( navigator.userAgent.indexOf("MSIE") >=0 ) {
    destination_url = 'http://m.facebook.com';
  }
      }
    }
  }


 // <!-- SJP MOD END -->





   var html = '<iframe name="mobilefacebook" border="0" src="' + destination_url + '" height="400" width="100%" frameborder="0" marginwidth="0" marginheight="0"></iframe>';
   //var html = '<iframe name="mobilefacebook" border="0" src="https://login.facebook.com/login.php?iphone&next=http%3A%2F%2Fiphone.facebook.com%2F" height="400" width="100%" frameborder="0" marginwidth="0" marginheight="0"></iframe>';




   
   document.getElementById('content_div').innerHTML = html;
   
   resize();
   }




   </script>




]]></Content>




<Content type="html" view="canvas"><![CDATA[
<!-- Facebook. Keep in touch with friends and family. Facebook users can choose to join up by city, workplace, school, and region. connect with friends, giving them access to their friends profiles. Share your interests and hobbies -->

<script type="text/javascript">

google_ad_client = "ca-pub-8565751766874039";
// 160x600, Facebook 
google_ad_slot = "1949625439";
google_ad_width = 160;
google_ad_height = 600;

   gadgets.util.registerOnLoadHandler(draw_page);

  function draw_page(){

    var prefs = new gadgets.Prefs(), html;
    
  if (prefs.getBool('useNewFB_p') == true) {
      // GO THE NEW WAY 
    document.getElementById("iframed_iframe_id").setAttribute('src','http://ampatico.com/Facebook/iGoogle/6fromSVN/index');
      _IG_Analytics("UA-2621463-1", "/canvas_view/facebook_new");
    } else {
      // GO THE OLD WAY
    document.getElementById("iframed_iframe_id").setAttribute('src','http://www.facebook.com/home.php');
    _IG_Analytics("UA-2621463-1", "/canvas_view/facebook");
    }  // end main if
  
  gadgets.window.adjustHeight();
  
  } // end draw_page

</script>

<div>
  <table width="100%" height="4000" cellpadding="0" cellspacing="0" margin="0" border="0">
    <tr>
    <td valign="top">
      <iframe name="iframed_iframe" id="iframed_iframe_id" border="0" src="" height="100%" width="100%" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
    </td>
    <td width="160" valign="top">
        <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script>
    </td>
  </tr>
  </table>
</div>


]]></Content>
</Module>


