function _confirm_delete_tab() {
  var title_html = "\x3cdiv class\x3d\x22popup_title\x22\x3eTAB_NAME\x3c/div\x3e\x3cdiv class\x3d\x22popup_title_buttons\x22\x3e\x3ca class\x3d\x22delbox\x22 href\x3d\x22javascript:void(0)\x22 title\x3d\x22Close\x22 onclick\x3d\x22_IG_PU_hide(_DI_button_type.Close);;\x22\x3e\x3c/a\x3e\x3c/div\x3e\x3cdiv class\x3d\x22c\x22\x3e\x3c/div\x3e";var body_html = "\x3cdiv class\x3d\x22popup_body thickpadding\x22\x3eAre you sure you want to delete the \x26quot;TAB_NAME\x26quot; tab and all of its contents?\x3c/div\x3e";var tab_name =_striptags(_gel("tab0_view_title").innerHTML);title_html = title_html.replace('TAB_NAME', tab_name);body_html = body_html.replace('TAB_NAME', tab_name);var buttons_html = ["<button onclick=\"" +"_dlsetp(\x27dt\x3d0\x27);\">" +"Delete this tab</button>","<button>Cancel</button>"];
  _IG_PU_open(title_html, body_html, buttons_html);}
function _share_tab() {
  var tab_name =_striptags(_gel("tab0_view_title").innerHTML);
  var basic_title_html = '\x3cdiv class\x3d\x22popup_title\x22\x3eSend \x26quot;TAB_NAME\x26quot; tab to a friend\x3c/div\x3e\x3cdiv class\x3d\x22popup_title_buttons\x22\x3e\x3ca class\x3d\x22delbox\x22 href\x3d\x22javascript:void(0)\x22 title\x3d\x22Close\x22 onclick\x3d\x22_IG_PU_hide(_DI_button_type.Close);;\x22\x3e\x3c/a\x3e\x3c/div\x3e\x3cdiv class\x3d\x22c\x22\x3e\x3c/div\x3e';
  basic_title_html = [basic_title_html.replace('TAB_NAME', tab_name)];
  _share_tab_with_gadget_checkboxes(basic_title_html,'http://www.google.com/ig/mailtab?hl\x3den\x26tid\x3d0','- show all gadgets -','Send my settings for these gadgets','Choose this option if you want the gadgets to work exactly as they do for you. Otherwise, they\x27ll work the way they did when you first got them. Be careful: settings can include private data.','Send','Cancel');
  }

//var tab_menu_items = [];
//tab_menu_items.push(["Edit this tab", "http://www.google.com/ig/settings?hl\x3den",""]);
//tab_menu_items.push(["Share this tab","#","_share_tab();return false;"]);
//tab_menu_items.push(["Delete this tab", "javascript:void(0);","_confirm_delete_tab();"]);
//if (tab_menu_items.length > 0) {_IG_DD_create("tab_0", tab_menu_items);}

_magic_tabs_url="/home/filltab";

function _join_csv_line(parts) {for (var i = 0; i < parts.length; ++i) {if ((/[,"]/).test(parts[i])) {parts[i] = '"' + parts[i].replace(/"/g, '""') + '"';}}return parts.join(',');}
function _mtabs_send() {
  var base_url = _magic_tabs_url || "/home/filltab";
  var url = base_url + "?et=DogRnJX_&igtab=";
  var tab_name = _gel("mtab").value;
  var is_magic_tab = _gel("mfill").checked;
  is_magic_tab = false;
  var content_type = is_magic_tab ? "3" :"1";
  var tab_info = [tab_name, content_type, tab_name];
  url += _esc(_join_csv_line(tab_info));url += "&filltab=";
  if (is_magic_tab) {url += "1";} else {url += "0";}
  url += "&url=" + _esc(_removeTabParam(document.location.href));
  document.location = url;return false;}

function _replace_div(name) {
  var oldDiv = _gel(name);var newDiv = _gel("replace");
  if (!newDiv) {newDiv = document.createElement("div");
  newDiv.id = "replace";newDiv.style.display = "none";oldDiv.parentNode.appendChild(newDiv);}
  newDiv.style.width = "" + oldDiv.clientWidth + "px";newDiv.style.height = "" + Math.max(oldDiv.offsetHeight,oldDiv.scrollHeight) + "px";newDiv.style.backgroundColor = "#fff";
  _toggle(oldDiv);_toggle(newDiv);}
function _close_mtabs_dialog() {_toggle(_gel("replace"));_toggle(_gel("modules"));}
function continuation(button_num) {if (button_num == 0) {_mtabs_send();} 
  else {_close_mtabs_dialog();}}
function setup_ac() { //if (!window.google.ac) {_sendx("/ig/ac.js", function(response){eval(response);window.google.kHL="en";setTimeout('window.google.ac.i(_gel("mtabform"), _gel("mtab"))', 200);});} else {setTimeout('window.google.ac.i(_gel("mtabform"), _gel("mtab"))', 200);}}
                    }
function _open_mtabs_dialog(should_replace_div){
  if (should_replace_div) {_replace_div("modules");}
  setup_ac();
  var titleHtml = "\x3cdiv class\x3d\x22popup_title\x22\x3eAdd a tab\x3c/div\x3e\x3cdiv class\x3d\x22popup_title_buttons\x22\x3e\x3ca class\x3d\x22delbox\x22 href\x3d\x22javascript:void(0)\x22 title\x3d\x22Close\x22 onclick\x3d\x22_IG_PU_hide(_DI_button_type.Close);\x22\x3e\x3c/a\x3e\x3c/div\x3e\x3cdiv class\x3d\x22c\x22\x3e\x3c/div\x3e";var bodyHtml = "\x3cdiv id\x3d\x22mtabs_body\x22 class\x3d\x22thickpadding popup_body\x22\x3e\x3cdiv class\x3d\x22lf\x22 style\x3d\x22padding:5px 12px 0px 0px;\x22\x3eTab name:\x3c/div\x3e\x3cdiv class\x3d\x22lf tinymessage\x22\x3e\x3cform onsubmit\x3d\x22_mtabs_send(); return false;\x22 id\x3d\x22mtabform\x22\x3e\x3cinput id\x3d\x22mtab\x22 type\x3d\x22text\x22 name\x3d\x22tab\x22 autocomplete\x3d\x22off\x22 size\x3d\x2240\x22 /\x3e\x3c/form\x3e\x3cbr /\x3ee.g. News, Songs, Sports\x3c/div\x3e\x3cdiv style\x3d\x22clear:both; padding-top:12px;\x22\x3e\x3cinput name\x3d\x22fill\x22 id\x3d\x22mfill\x22 type\x3d\x22checkbox\x22 checked /\x3e\x3clabel for\x3d\x22mfill\x22\x3eI\x26#39;m feeling lucky. Automatically add stuff based on the tab name.\x3c/label\x3e\x3c/div\x3e\x3c/div\x3e";
  var buttonsHtml = ['<button style="font-weight:bold;width:100px">OK</button>','<button style="width:100px">Cancel</button>' ];
  _IG_PU_open(titleHtml, bodyHtml, buttonsHtml, continuation);
  _gel("mtab").focus();setup_ac();}
  
function chgTT(n) 
{
  var tipText = ["Minimize","Restore","Maximize"];
  var tipTextMap = {"maxbox":0,"minbox":1,"shrinkbox":2,"enlargebox":1 };
  var title = tipText[tipTextMap[n.className]];
  n.setAttribute('title', title);
  if (n.hasChildNodes()) 
  {var span = n.childNodes[0];
  if (span && span.hasChildNodes()) 
  {span.replaceChild(document.createTextNode(title), span.childNodes[0]);}}}

function _del(a,b,c){_xsetp("m_"+a+"_enab=0&m_"+a+"_t="+b);var d=_gel("undel_msg");if(d){_gel("undel_title").innerHTML="&quot;"+_get_module_title(a)+"&quot; ";d.style.display="block";var e=_gel("undo_msg");if(e)e.style.display="none";e=_gel("undo_restore_msg");if(e)e.style.display="none"}var f=_gel("m_"+
a);if(f)f.style.display="none";ig_d=a;ig_e=c;var g=_gel(c);if(g)g.style.display="";_mod=true;ig_q("delete","m_"+a);return false}

function _undel(){if(ig_d==null)return;var a="m_"+ig_d,b=_gel(a);if(b){b.style.display="block";_xsetp("undel")}var c=_gel("undel_msg");if(c)c.style.display="none";if(ig_e!=null){var d=_gel(ig_e);if(d)d.style.display="none"}ig_d=null;ig_e=null;ig_q("undelete",a)}

function _zm(a,b,c)
{var d=_gel("m_"+a+"_b");
  if(d){
    var e=d.style.display!="none";d.style.display=e?"none":"block";
    var f=_gel("m_"+a+"_zippy");
    if(f)
      f.className=e?f.className.replace(/minbox/,"maxbox"):f.className.replace(/maxbox/,"minbox");
    var g=d.nextSibling;if(g&&g.className)g.className=e?"rnd_modboxin_zipped":"rnd_modboxin";
    var h=_gel("m_"+a+"_maximize");if(h)h.style.display=e?"none":"";
    var j=c?"mmz":"mz";_xsetp(j+"="+a+":"+(e?"1":"0")+"&t="+b);
    ig_q(e?"zip":"unzip",a);
  }
  return false
}

function ig_a(a,b){var c=function(){};c.prototype=a.prototype;b.prototype=new c}
function _gel(a)
{return document.getElementById?document.getElementById(a):null}
function _gelstn(a){if(a=="*"&&document.all)return document.all;return document.getElementsByTagName?document.getElementsByTagName(a):[]}
function _gelsbyregex(a,b){var c=_gelstn(a),d=[];for(var e=0;e<c.length;e++)if(b.test(c[e].id))d.push(c[e]);return d}
function _gelsbyregex(a,b){var c=_gelstn(a),d=[];for(var e=0;e<c.length;e++)if(b.test(c[e].id))d.push(c[e]);return d}
function _uc(a){return a.toUpperCase()}
function _trim(a){return a.replace(/^\s*|\s*$/g,
"")}
function _esc(a){return window.encodeURIComponent?encodeURIComponent(a):escape(a)}

var ig_b=function(a){return window.decodeURIComponent?decodeURIComponent(a):unescape(a)},_unesc=ig_b;function _toggle(a){if(!a)return;if(a.style.display==""||a.style.display=="block")a.style.display="none";else if(a.style.display=="none")a.style.display="block"}function _hesc(a){a=a.replace(/</g,"&lt;").replace(/>/g,"&gt;");a=a.replace(/"/g,"&quot;").replace(/'/g,"&#39;");return a}

function _striptags(a){return a.replace(/<\/?[^>]+>/gi,"")}


var ig_aa=0;


function _uid(){return"obj"+ig_aa++}
function _min(a,b){return a<b?a:b}
function _max(a,b){return a>b?a:b}
function _IG_LoadScript(a,b){_sendx(a,function(c){window.eval(c);eval(b)},false,null)}
function _IG_LoadScriptXDomain(a,b,c){var d=document.createElement("script");d.src=a;document.getElementsByTagName("head")[0].appendChild(d);
  function e(f,g){if(eval(f))g();else setTimeout(function(){e(f,g)},100)}e(b,c)}
  function _IG_LoadCss(a){var b=document.getElementsByTagName("head")[0];if(!b)throw new Error("Document is missing <head> element. Failed to load CSS.");
  var c=document.createElement("style");c.type="text/css";if(c.styleSheet)c.styleSheet.cssText=a;else c.appendChild(document.createTextNode(a));b.insertBefore(c,b.firstChild)}

function _log(a){var b="/ig/log?msg="+_esc(a);_sendx(b,null,null,null)}
function _sendx(a,b,c,d){
  var e=ig_c();e.open(d?"POST":"GET",a,true);
  if(b)e.onreadystatechange=function(){if(e.readyState==4)b(c&&e.responseXML?e.responseXML:e.responseText)};e.send(d)}
function _uhc(a,b,c){var d="m_"+a+"_"+b,e=_gel(d);if(!e){e=document.createElement("INPUT");e.type="hidden";e.disabled=true;e.name=d;_gel("m_"+a+"_form").appendChild(e)}e.value=c;e.disabled=false}
function ig_c(){var a=null;if(window.ActiveXObject){a=new ActiveXObject("Msxml2.XMLHTTP");if(!a)a=new ActiveXObject("Microsoft.XMLHTTP")}else if(window.XMLHttpRequest)a=new XMLHttpRequest;return a}

var _et="",_brand="",_bmod="",_source="",_ae="",_pid="",_authpath="",_prefid="",_setp_url="/home/stab",_old_html=true,_use_old_feed_styles=true,ig_d=null,ig_e=null;

function ig_f(a,b,c){var d=document.createElement("input");d.type="hidden";d.name=b;d.value=c;a.appendChild(d)}
function ig_g(a){var b=a||document.location.href,c,d=b.indexOf("?"),e=b.indexOf("#");c=e==-1?b.substr(d+1):b.substr(d+1,e-d-1)+"&"+b.substr(e+1);return c.split("&")}
function _argsUrl(a){var b={},c=ig_g(a);for(var d=0;d<c.length;d++){var e=c[d].indexOf("=");if(e==-1)continue;var f=c[d].substring(0,e),g=c[d].substring(e+1);g=g.replace(/\+/g," ");b[f]=_unesc(g)}return b}
function _args(){return _argsUrl(document.location.href)}
function _IG_isIE(){var a=navigator.userAgent.toLowerCase();return a.indexOf("msie")!=-1}
function ig_h(a){var b={pid:1,host:1,gl:1,hl:1},c=a||_args(),d="?";for(var e in c)if(b[e])d+=e+"="+_esc(c[e])+"&";return d}
function ig_i(a){var b={url:document.location,et:_et,brand:_brand,bmod:_bmod,source:_source,ae:_ae,pid:_pid,ap:_authpath,prefid:_prefid};for(var c in b)ig_f(a,c,b[c])}
function _submit_form(a,b){a.action=_setp_url+ig_h()+b;a.method="get";ig_i(a);a.submit()}
function _fsetp(a,b,c){a.action=_setp_url;a.method="get";ig_i(a);
ig_f(a,"m_"+b+"_t",c);var d=_args(),e=d.host,f=d.hl;if(typeof e!="undefined")ig_f(a,"host",e);if(typeof f!="undefined")ig_f(a,"hl",f);return true}

var ig_j=[],ig_k=false;

function ig_ba(a){var b=[];for(var c=0;c<a.length;++c){if(a[c].length!=2)continue;var d=a[c][0],e=a[c][1];if(e!=null&&e!="")b.push(d+"="+e)}return b.join("&")}
function ig_l(){return ig_ba([["et",_et],["pid",_pid],["ap",_authpath],["brand",_brand],["bmod",_bmod],["source",_source],["ae",_ae],["prefid",_prefid]])}
function ig_m(){if(ig_j.length==
0){ig_k=false;return}ig_k=true;var a=_setp_url+ig_h()+ig_l(),b=ig_j.shift(),c=a.length+b.length>=1800;if(c)_sendx(a,ig_n,false,b);else{a+="&"+b;_sendx(a,ig_n,false,null)}}
function ig_n(){_IG_TriggerDelayedEvent("xsetpdone");ig_m()}
function _xsetp(a){ig_j.push(a);if(!ig_k)ig_m()}
//link for tab
function _dlsetp(a,b){
  //from
  if(!b)b=_esc(document.location);
  document.location=_setp_url+ig_h()+ig_l()+"&url="+b+"&"+a}
function _removeTabParam(a){return a.replace(/(\?.*\b)(t\=[^&#]*[&#]?)/g,"$1")}
function _select_tab(a,b){var c=b||"/ig";window.location.href=c+ig_h()+"t="+a}
function _select_tab_and_log(a,b){_sendx("/ig/ui?xp=v2&action=selectTab&t="+a,null,false,null);_select_tab(a,b)}
function _select_gadget_and_log(a,b){_sendx("/ig/ui?xp=v2&action=maximizeMod&from=selectMod&mid="+b,null,false,null);window.location.href="/ig"+ig_h()+"t="+a+"&g="+b}
function _ssbc(a,b,c){var d=_gelstn("*");for(var e=0;e<d.length;e++)if(d[e].className==a)d[e].style[b]=c}
function ig_ca(a){var b=_gelstn("*");for(var c=0;c<b.length;c++)for(var d=
0;d<a.length;d++)if(b[c].className==a[d][0])b[c].style[a[d][1]]=a[d][2]}
function _findPos(a){var b=0,c=0;while(a!=null){b+=a.offsetLeft;c+=a.offsetTop;a=a.offsetParent}return[b,c]}
function _getGadgetContainer(a){var b=_gel("m_"+a+"_b");if(!b){b=_gel("remote_"+a);if(!b)b=document.body}return b}
function _appendMaxAgeParameter(a,b){var c=/[?&]$/.test(a);return a+(c?"":"&")+"max_age="+b+(c?"&":"")}(function(){function a(d){var e=window;if(d!=""){var f=d.split(".");while(f.length){var g=f.shift();if(typeof e[g]!=
"object")e[g]={};e=e[g]}}return e}
function b(d,e){var f=a(d);for(var g=0;g<e.length;g+=2)f[e[g]]=e[g+1]}

function c(d,e,f,g,h)
{if(g)for(var j=0;j<g.length;j+=2)f.prototype[g[j]]=g[j+1];
 if(h)for(var j=0;j<h.length;j+=2)f[h[j]]=h[j+1];
 b(d,[e,f])
}


b("",["_exportSymbols",b]);
b("",["_exportClass",c]);
b("google.gadgets.Util",["args",_args])})();


function _get_module_title(a) {
  if(typeof a=="object")a=a.id.replace("m_","");else if(typeof a=="string")a=a.replace("m_","");
  var b=_gel("m_"+a+"_title");return b?_striptags(b.innerHTML):""}
function _get_all_modules(){var a=ig_da(),b=[],c=/^m_[0-9]+$/;for(var d=0;d<a.length;d++){b[d]=
[];var e=b[d];for(var f=0;f<a[d].childNodes.length-1;f++){var g=a[d].childNodes[f];if(g.tagName=="DIV"&&g.style.display!="none"&&g.id&&c.test(g.id))e.push(g)}}return b}

function ig_q(a,b)
{switch(a){case "delete":case "undelete":case "edit":case "canceledit":case "zip":case "unzip":case "mazimize":case "unmaximize":
_IG_TriggerDelayedModuleEvent(b,a);_IG_TriggerDelayedEvent("module"+a,b);break}}

function ig_x(a){
  if(!a)a=document.body;return a.scrollHeight>a.offsetHeight?a.scrollHeight:a.offsetHeight}
function _setHomepage(a,b){var c=_gel("hp_url").innerHTML;a.style.behavior="url(#default#homepage)";a.setHomePage(c);_sendx("/ig/ui?action=sethomepage&url="+_esc(c)+"&type="+b+"&confirmed="+(_IGoogleIsHomepage()?
1:0),null,false,null)}

function _IG_Callback(a){
var b=arguments;
return function(){var c=[];for(var d=0;d<arguments.length;d++)c[c.length]=arguments[d];for(var d=1;d<b.length;d++)c[c.length]=b[d];a.apply(null,c)}};var ig_ja={domload:1,xsetpdone:1,moduledragstart:1,moduledragend:1,moduletitleclick:1,moduleedit:1,modulecanceledit:1,moduledelete:1,moduleundelete:1,modulezip:1,moduleunzip:1,modulemaximize:1,moduleunmaximize:1,load:1,unload:1,resize:1},ig_ka={dragstart:1,dragend:1,titleclick:1,edit:1,canceledit:1,"delete":1,undelete:1,zip:1,unzip:1,maximize:1,unmaximize:1};

function ig_la(a){var b="ig_event_hashcode_";if(a.hasOwnProperty&&a.hasOwnProperty(b))return a[b];if(!a[b])a[b]=++ig_y.Ob;return a[b]}
function ig_ma(a){return"builtin_"+a}
function ig_ma(a){return"builtin_"+a}
function ig_na(a,b){if(a.indexOf&&a.indexOf("m_")==0)a=a.substring(2);return"builtin_m"+a+"_"+b}
function ig_oa(a,b){return"builtin_"+ig_y.Kb(a)+"_"+b}
function ig_pa(a){return"custom_"+a}
function ig_qa(){for(var a in ig_y.c){for(var b=0;b<ig_y.c[a].length;b++)ig_y.c[a][b]=null;if(a in ig_y.M){var c=ig_y.M[a],d=c[0],e=c[1],f=c[2];if(d.removeEventListener)d.removeEventListener(e,f,false);else if(d.detachEvent)d.detachEvent("on"+e,f);ig_y.M[a]=null}}}
function ig_ra(a,b,c){for(var d=c;d<b.length;d++)a[a.length]=
b[d];return a}
function ig_sa(a,b){if(a in ig_y.c)for(var c=0;c<ig_y.c[a].length;c++)if(ig_y.c[a][c]===b){ig_y.c[a][c]=null;return true}return false}
function ig_ta(a){if(a in ig_y.c)for(var b=0;b<ig_y.c[a].length;b++)if(ig_y.c[a][b]){var c=[];for(var d=1;d<arguments.length;d++)c[c.length]=arguments[d];ig_y.c[a][b].apply(this,c)}}
function ig_ua(a,b){if(!(a in ig_y.Zb))throw Error("Unsupported event type: "+a);var c=ig_y.aa(a);if(!(c in ig_y.c))ig_y.c[c]=[];ig_y.c[c][ig_y.c[c].length]=b}
function ig_va(a,b,c){if(!(b in ig_y.$b))throw Error("Unsupported module event type: "+b);var d=ig_y.ba(a,b);if(!(d in ig_y.c))ig_y.c[d]=[];ig_y.c[d][ig_y.c[d].length]=c}
function ig_wa(a,b,c){var d=ig_y.Va(a,b);if(!(d in ig_y.c)){ig_y.c[d]=[];var e=function(g){if(!g)g=window.event;ig_y.V.apply(a,[d,g])};if(a.addEventListener)a.addEventListener(b,e,false);else if(a.attachEvent)a.attachEvent("on"+b,e);else throw Error("Object {"+a+"} does not support DOM events.");ig_y.M[d]=[a,b,e]}var f=ig_y.c[d].length;if(a===window&&
b=="unload"&&f>0){ig_y.c[d][f]=ig_y.c[d][f-1];ig_y.c[d][f-1]=c}else ig_y.c[d][f]=c}
function ig_xa(a,b){var c=ig_y.$(a);if(!(c in ig_y.c))ig_y.c[c]=[];ig_y.c[c][ig_y.c[c].length]=b}
function ig_ya(a,b){var c=ig_y.aa(a);return ig_y.T(c,b)}
function ig_za(a,b,c){var d=ig_y.ba(a,b);return ig_y.T(d,c)}
function ig_Aa(a,b,c){var d=ig_y.Va(a,b);return ig_y.T(d,c)}
function ig_Ba(a,b){var c=ig_y.$(a);return ig_y.T(c,b)}
function ig_Ca(a){var b=ig_y.F([ig_y.aa(a)],arguments,1);ig_y.V.apply(window,b)}
function ig_Da(){var a=ig_y.F([],arguments,0);setTimeout(function(){ig_y.triggerEvent.apply(window,a)},0)}
function ig_Ea(a,b){var c=ig_y.F([ig_y.ba(a,b)],arguments,2);ig_y.V.apply(window,c)}

function ig_Fa()
{
var a=ig_y.F([],arguments,0);
setTimeout(function(){ig_y.triggerModuleEvent.apply(window,a)},0)
}
function ig_Ga(a){var b=ig_y.F([ig_y.$(a)],arguments,1);ig_y.V.apply(window,b)}
function ig_Ha(){
  var a=ig_y.F([],arguments,0);
  setTimeout(function(){ig_y.triggerCustomEvent.apply(window,a)},0)}

var ig_y={Ob:0,c:{},M:{},Zb:ig_ja,$b:ig_ka,Kb:ig_la,aa:ig_ma,ba:ig_na,Va:ig_oa,$:ig_pa,Cb:ig_qa,F:ig_ra,T:ig_sa,V:ig_ta,addEventHandler:ig_ua,addModuleEventHandler:ig_va,addDOMEventHandler:ig_wa,addCustomEventHandler:ig_xa,removeEventHandler:ig_ya,removeModuleEventHandler:ig_za,removeDOMEventHandler:ig_Aa,removeCustomEventHandler:ig_Ba,triggerEvent:ig_Ca,triggerModuleEvent:ig_Ea,triggerCustomEvent:ig_Ga,triggerDelayedEvent:ig_Da,triggerDelayedModuleEvent:ig_Fa,triggerDelayedCustomEvent:ig_Ha},_IG_AddEventHandler=ig_y.addEventHandler,
_IG_AddModuleEventHandler=ig_y.addModuleEventHandler,_IG_AddGadgetEventHandler=ig_y.addModuleEventHandler,_IG_AddDOMEventHandler=ig_y.addDOMEventHandler,_IG_AddCustomEventHandler=ig_y.addCustomEventHandler,_IG_RemoveEventHandler=ig_y.removeEventHandler,_IG_RemoveModuleEventHandler=ig_y.removeModuleEventHandler,_IG_RemoveGadgetEventHandler=ig_y.removeModuleEventHandler,_IG_RemoveDOMEventHandler=ig_y.removeDOMEventHandler,_IG_RemoveCustomEventHandler=ig_y.removeCustomEventHandler,_IG_TriggerEvent=ig_y.triggerEvent,
_IG_TriggerModuleEvent=ig_y.triggerModuleEvent,_IG_TriggerGadgetEvent=ig_y.triggerModuleEvent,_IG_TriggerCustomEvent=ig_y.triggerCustomEvent,_IG_TriggerDelayedEvent=ig_y.triggerDelayedEvent,_IG_TriggerDelayedModuleEvent=ig_y.triggerDelayedModuleEvent,_IG_TriggerDelayedGadgetEvent=ig_y.triggerDelayedModuleEvent,_IG_TriggerDelayedCustomEvent=ig_y.triggerDelayedCustomEvent;
_IG_AddDOMEventHandler(window,"unload",ig_y.Cb);_IG_AddDOMEventHandler(window,"load",function(){_IG_TriggerEvent("load")});_IG_AddDOMEventHandler(window,"unload",function(){_IG_TriggerEvent("unload")});_IG_AddDOMEventHandler(window,"resize",function(){_IG_TriggerEvent("resize")});
function _IG_RegisterOnloadHandler(a){_IG_AddEventHandler("domload",a)}
function _IG_LoadLibraryDeferred(a,b){_IG_RegisterOnloadHandler(function(){_IG_LoadScript(a,b)})}

_exportSymbols("google.gadgets.Events",["addHandler",_IG_AddEventHandler,"removeHandler",_IG_RemoveEventHandler,"addOnloadHandler",_IG_RegisterOnloadHandler]);

function _IG_RegisterMaximizeHandler(a,b){
 _IG_AddModuleEventHandler(a,"unmaximize",function(){b(false)});
  _IG_AddModuleEventHandler(a,"maximize",function(){b(true)})};
  
//var _currentLayout,_layoutData,_IG_Layouts={savedModulePositions:null};
//_IG_Layouts._selectLayout=function(a){var b=_gel("edit_this_tab_form").edit_this_tab_selected_layout;for(var c=0;c<b.length;c++){var d=b[c].value,e=_gel("edit_this_tab_layoutimg_"+d);if(d!=a){b[c].checked=false;if(e.src.indexOf("_highlight")!=-1)e.src=e.src.substring(0,e.src.indexOf("_highlight"))+".gif"}else{b[c].checked=true;if(e.src.indexOf("_highlight")==-1)e.src=e.src.substring(0,e.src.indexOf(".gif"))+"_highlight.gif"}}};
//_IG_Layouts._renderLayout=function(a){if(!_IG_Layouts.isLayoutValid(a))return false;var b=_IG_Layouts.getColumnsInOrder(),c=_layoutData[a],d=false;for(var e=0;e<b.length;e++){b[e].style.width=c.sizes[e];if(b[e].style.display!=c.display[e]){b[e].style.display=c.display[e];d=true}}if((a==_currentLayout||d)&&!_IG_Layouts.rearrangeModules(a))return false;return true};_IG_Layouts.rearrangeModules=function(a){if(!_IG_Layouts.isLayoutValid(a))return false;var b=_IG_Layouts.getColumnsInOrder(),c=_gel("lc_opt"),
//d=b[_layoutData[a].visibleColumns-1];d.insertBefore(c,d.firstChild);if(_IG_Layouts.savedModulePositions!=null&&a==_currentLayout){for(var e=0;e<b.length;e++){var f=_IG_Layouts.savedModulePositions[e];for(var g=0;g<f.length;g++){var h=_gel(f[g]);if(h!=null)b[e].insertBefore(h,b[e].lastChild)}}return true}var j=[],l=[];for(var e=0;e<b.length;e++)l.push(b[e].firstChild);var i=false;do{i=false;for(var e=0;e<l.length;e++){while(l[e]!=null&&l[e].id.indexOf("m_")==-1)l[e]=l[e].nextSibling;if(l[e]!=null&&l[e].id.indexOf("m_")!=-1){j.push(l[e].id);i=true;l[e]=l[e].nextSibling}}}while(i);var k=0;for(var g=0;g<j.length;g++){b[k].insertBefore(_gel(j[g]),b[k].lastChild);do{k++;if(k>=b.length)k=0}while(b[k].style.display=="none")}return true};_IG_Layouts._saveModulePositions=function(){var a=_IG_Layouts.getColumnsInOrder();_IG_Layouts.savedModulePositions=[];for(var b=0;b<a.length;b++){_IG_Layouts.savedModulePositions[b]=[];var c=_IG_Layouts.savedModulePositions[b];for(var d=0;d<a[b].childNodes.length-1;d++){var e=a[b].childNodes[d];if(e.tagName=="DIV"&&e.id.indexOf("m_")!=-1)c.push(e.id)}}};_IG_Layouts._editTabSettingsSubmit=function(a){var b=_gel("edit_this_tab_form").edit_this_tab_selected_layout,c=-1;for(var d=0;d<b.length;d++)if(b[d].checked==true)c=b[d].value;var e="",f=_gel("edit_this_tab_name").value;if(_gel("tab"+a+"_view_title").innerHTML!=f&&f!=""){e+="rt_"+a+"="+_esc(f);_gel("tab"+a+"_view_title").innerHTML=_hesc(f);_gel("tab"+a+"_title").value=_hesc(f);var g=_gel("tip_tabtitle");if(g!=
//null)g.innerHTML=_hesc(f)}if(c!=_currentLayout){e+=e==""?"":"&";e+="lt_"+a+"="+c;_currentLayout=c;var h=_IG_Layouts.getColumnsInOrder(),j="";for(var l=0;l<h.length;l++)for(var i=0;i<h[l].childNodes.length-1;i++){var k=h[l].childNodes[i];if(k.tagName=="DIV"&&k.id.indexOf("m_")!=-1){j+=j==""?"":":";j+=k.id.substring(2)+"_"+(l+1)}}e+="&mp="+_esc(j)}if(e!="")_xsetp(e);_IG_Layouts.savedModulePositions=null};_IG_Layouts._editTabSettingsCancel=function(){_IG_Layouts._renderLayout(_currentLayout);_IG_Layouts.savedModulePositions=
//null};_IG_Layouts.getColumnsInOrder=function(){var a=4,b=[];for(var c=1;c<=a;c++){var d=_gel("c_"+c);if(d==null)break;b.push(d)}return b};_IG_Layouts.isLayoutValid=function(a){if(a<0||a>_layoutData.length-1)return false;return true};

var _IG_time=(function(){
            function a(){return(new Date).getTime()}
               var b=window._IG_time_epoch||a(),c={},d={},e={set_epoch:function(f){b=f},start:function(f){c[f]=a();
               e.start_callback(f)},since:function(f){var g=c[f]||b;return a()-g},stop:function(f){d[f]=e.since(f);
               e.stop_callback(f)},get:function(f){return d[f]},print:function(f){document.write("<div style='color:#999999;font-size:75%'>"+f+" : "+e.get(f)+"ms</div>")},stop_and_print:function(f){e.stop(f);e.print(f)},start_callback:function(){},stop_callback:function(){}};
return e})();
//function ig_z(){this.value=null;this.datatype=null;this.publish=false;this.listen=false;this.onChange=null;this.group=null}function _IG_Prefs(a){var b=a;if(typeof remote_modules!=="object"){var c=_args().mid;b=c?c:0;_IG_Prefs._parseURL(b);_IG_Prefs.Q[b]=false}else{if(!b)throw new Error("Module ID is required as first argument to _IG_Prefs() for inlined modules");_IG_Prefs.Q[b]=true}if(!_IG_Prefs.d[_IG_Prefs.p+b])_IG_Prefs.d[_IG_Prefs.p+b]={};this.d=_IG_Prefs.d[_IG_Prefs.p+b];this.b=b;this.ec=/(.*)(\<ph.*?\>\s*(\<ex\>(.*?)\<\/ex\>)?\s*%1\s*\<\/ph\>)(.*)/}
//_IG_Prefs.prototype.r=function(a,b){if(b==undefined)b=null;var c=this.d[a];if(c==undefined)return b;var d=c.value;return d!=undefined?d:b};_IG_Prefs.prototype.O=function(a,b){return this.r(_IG_Prefs.f+a,b)};_IG_Prefs.prototype.C=function(a){var b="",c=this.O(a,b);return c!=null?c+"":b};_IG_Prefs.prototype.ma=function(a){var b=0,c=parseInt(this.O(a,b),10);return isNaN(c)?b:c};_IG_Prefs.prototype.ka=function(a){var b=this.C(a);return b==="true"||!!parseInt(b,10)};_IG_Prefs.prototype.ja=function(a){return _IG_Prefs._strToArray(this.O(a,
//""))};_IG_Prefs.prototype.Ea=function(a,b){this.set(a,_IG_Prefs._arrayToStr(b))};_IG_Prefs.prototype.la=function(){return this.C(".country")};_IG_Prefs.prototype.na=function(){return this.C(".lang")};_IG_Prefs.prototype.oa=function(a){return this.r(_IG_Prefs.Ja+a,"")+""};_IG_Prefs.prototype.set=function(){var a=Math.floor(arguments.length/2);if(a==0)return;var b=[],c=[];for(var d=0;d<a;++d){var e=arguments[d*2],f=_IG_Prefs.f+arguments[d*2],g=arguments[d*2+1];if(this.eb(f,g)){b.push(f,g);c.push(e,
//g)}}if(b.length==0)return;if(arguments.length%2===1)b.push(arguments[arguments.length-1]);this.ib(b);if(_IG_Prefs.Q[this.b])_IG_Prefs._setP(this.b,c);else _IFPC_SetPref(c)};_IG_Prefs.prototype.qa=function(){var a=["__module_id__="+this.b];for(var b in this.d)a.push(encodeURIComponent(b)+"="+encodeURIComponent(this.d[b].value));return a.join("&")};_IG_Prefs.prototype.dump=function(){document.write("<pre>");for(var a in this.d)document.writeln(a+" = "+this.r(a,null));document.write("</pre>")};_IG_Prefs.prototype.Ua=
//function(a,b){var c=a;switch(b){case "list":c=_IG_Prefs._arrayToStr(a);break;case "location":c=[];c.push(a.location);c.push(a["long"]);c.push(a.lat);break;case "bool":c=a?"1":"0";break;case "string":break;case "enum":break;case "hidden":break;default:break}return c};_IG_Prefs.prototype.ra=function(a){var b=this.d[a];if(b==undefined)return null;var c=b.value,d=b.datatype;switch(d){case "list":c=_IG_Prefs._strToArray(c);break;case "location":c={};c.location=b.value;c["long"]=this.r(a+".long");c.lat=
//this.r(a+".lat");break;case "bool":c=c==="true"||!!parseInt(c,10);break;case "string":break;case "enum":break;case "hidden":break;default:break}return c};_IG_Prefs.prototype.fb=function(a){var b=Math.floor(a.length/2);if(b===0)return;var c={};for(var d=0;d<b;++d){var e=a[d*2],f=this.d[e];if(f&&f.onChange){var g=f.group?f.group:e;g+="_"+f.onChange;c[g]=window[f.onChange]}}for(var e in c)if(typeof c[e]==="function")c[e]()};_IG_Prefs.prototype.ib=function(a){this.fb(a);if(a.length%2===0||a[a.length-
//1]===true)this.hb(a)};_IG_Prefs.prototype.hb=function(a){var b=Math.floor(a.length/2),c=[],d=[];for(var e=0;e<b;++e){var f=a[e*2],g=this.d[f],h=f.substring(_IG_Prefs.f.length);if(g.publish){if(_IG_Prefs.Qa(d,h)===-1){d.push(h);c.push(h,this.ra(f))}if(g.group)for(var j in this.d){var l=this.d[j],i=j.substring(_IG_Prefs.f.length);if(i!=h&&l.publish&&l.group&&l.group===g.group)if(_IG_Prefs.Qa(c,j)===-1){d.push(i);c.push(i,this.ra(j))}}}}if(typeof _IG_PubSub!=="undefined"&&c.length>0)(new _IG_PubSub(this.b)).publishMultiple(c)};
//_IG_Prefs.prototype.eb=function(a,b){var c=this.d[a];if(c&&c.value===b)return false;if(c)c.value=b;else{c=new ig_z;c.value=b;this.d[a]=c}return true};_IG_Prefs.Q={};_IG_Prefs.d={};_IG_Prefs.cc="h";_IG_Prefs.dc="w";_IG_Prefs.p="m_";_IG_Prefs.f="up_";_IG_Prefs.Na="upp_";_IG_Prefs.Ma="upl_";_IG_Prefs.pb="upg_";_IG_Prefs.qb="upo_";_IG_Prefs.ob="upt_";_IG_Prefs.rb="up_";_IG_Prefs.Ja="msg_";_IG_Prefs.q={};_IG_Prefs.q[_IG_Prefs.Na]="publish";_IG_Prefs.q[_IG_Prefs.Ma]="listen";_IG_Prefs.q[_IG_Prefs.pb]="group";
//_IG_Prefs.q[_IG_Prefs.qb]="onChange";_IG_Prefs.q[_IG_Prefs.ob]="datatype";_IG_Prefs.q[_IG_Prefs.rb]="value";_IG_Prefs.Qa=function(a,b){if(a.indexOf)return a.indexOf(b);else{for(var c=0;c<a.length;++c)if(a[c]===b)return c;return-1}};_IG_Prefs._parseURL=function(a){_IG_Prefs.Q[a]=false;var b={},c=ig_g();for(var d=0;d<c.length;++d){var e=c[d].indexOf("=");if(e>=0){var f=c[d].substring(0,e);f=f.replace(/\+/g," ");var g=c[d].substring(e+1);g=g.replace(/\+/g," ");g=_unesc(g);var h=false;for(var j in _IG_Prefs.q)if(f.indexOf(j)===
//0){h=true;f=f.substring(j.length);f=_IG_Prefs.f+f;b[f]=b[f]?b[f]:new ig_z;if(j===_IG_Prefs.Na||j===_IG_Prefs.Ma)g=g=="true";b[f][_IG_Prefs.q[j]]=g;break}if(!h)if(f.indexOf(_IG_Prefs.Ja)===0)_IG_Prefs._add(a,f,g);else if(f===".lang"||f===".country")_IG_Prefs._add(a,_IG_Prefs.f+f,g)}}if(window.IDIModule){var b=window.IDIModule.getPrefs();for(var d in b)_IG_Prefs._add(a,d,b[d])}else for(var f in b)_IG_Prefs._add(a,f,b[f].value,b[f])};_IG_Prefs._add=function(a,b,c,d){var e=_IG_Prefs.p+a;if(typeof _IG_Prefs.d[e]!==
//"object")_IG_Prefs.d[e]={};if(typeof _IG_Prefs.d[e][b]!=="object")_IG_Prefs.d[e][b]=new ig_z;else return;var f=_IG_Prefs.d[e][b];f.value=c;f.datatype="string";f.publish=false;f.listen=false;f.onChange="";f.group="";if(d){f.datatype=d.datatype?d.datatype:"string";f.publish=d.publish?d.publish:false;f.listen=d.listen?d.listen:false;f.onChange=d.onChange?d.onChange:"";f.group=d.group?d.group:"";if(d.listen)_IG_Prefs._subscribePrefs(a,b)}};_IG_Prefs.Yb=function(a,b,c){var d=_IG_Prefs.p+a;if(typeof _IG_Prefs.d[d]!==
//"object")_IG_Prefs._add(a,b,c);else if(typeof _IG_Prefs.d[d][b]!=="object")_IG_Prefs.d[d][b]=new ig_z;var e=_IG_Prefs.d[d][b];e.value=c};_IG_Prefs._addAll=function(a,b){for(var c=0;c<b.length;++c)_IG_Prefs._add(a,b[c][0],b[c][1],b[c][2])};_IG_Prefs._subscribePrefs=function(a,b){var c=_IG_Prefs.p+a,d=_IG_Prefs.d[c][b];if(typeof _IG_PubSub==="undefined")return;var e=new _IG_PubSub(a),f=[b.substring(_IG_Prefs.f.length)];if(d.group){var g=_IG_Prefs.d[c],h=[];for(var j in g)if(g[j].group&&g[j].listen&&
//g[j].group==d.group&&j!=b)h.push(j.substring(_IG_Prefs.f.length));if(h.length>0){e.unsubscribeMultiple(h);f=f.concat(h)}}var l=function(k,m){var o=new _IG_Prefs(a),q=[];for(var r=0;r<k.length;++r){var n=o.d[_IG_Prefs.f+m[r]],p=n.datatype,s=m[r],u=k[r],t=o.Ua(u,p);if(p=="location"){q.push(s+".long",t[1]);q.push(s+".lat",t[2]);q.push(s,t[0])}else q.push(s,t)}q.push(false);o.set.apply(o,q)},i={};i.triggerOn="any";i.shouldReceiveLocalEvents=false;e.subscribeMultiple(f,l,i)};_IG_Prefs._arrayToStr=function(a){var b=
//a.length&&a.join;if(b){var c=[];for(var d=0;d<a.length;++d)c.push(a[d].replace(/\|/g,"%7C"));return c.join("|")}else return new String(a)};_IG_Prefs._strToArray=function(a){var b=a.length>0?a.split("|"):[];for(var c=0;c<b.length;++c)b[c]=b[c].replace(/%7C/g,"|");return b};_IG_Prefs._updatePrefsInUrl=function(a,b){var c=_IG_Prefs.p+a,d=_IG_Prefs.d[c];if(d==null)return b;var e=b.split("&");for(var f=0;f<e.length;++f)if(e[f].indexOf(_IG_Prefs.f)===0)e.splice(f--,1);for(var g in d){if(g.indexOf(_IG_Prefs.f)!==
//0||g.indexOf(_IG_Prefs.f+".lang")===0||g.indexOf(_IG_Prefs.f+".country")===0||g.indexOf(_IG_Prefs.f+"synd")===0)continue;e.push(_esc(g)+"="+_esc(d[g].value))}return e.join("&")};_IG_Prefs._setPrefs=function(a,b){var c=Math.floor(b.length/2);for(var d=0;d<c;++d){var e=_IG_Prefs.f+b[d*2],f=b[d*2+1];_IG_Prefs.Yb(a,e,f)}};_IG_Prefs._setP=function(a,b){if(_args().synd==="open")return;var c=Math.floor(b.length/2),d=[];for(var e=0;e<c;++e){var f=_IG_Prefs.f+b[e*2],g=b[e*2+1];d.push(_IG_Prefs.p+a+"_"+f+"="+
//_esc(g))}if(d.length===0)return;_xsetp(d.join("&"))};_exportClass("google.gadgets","Prefs",_IG_Prefs,["getString",_IG_Prefs.prototype.C,"getInt",_IG_Prefs.prototype.ma,"getBool",_IG_Prefs.prototype.ka,"getArray",_IG_Prefs.prototype.ja,"setArray",_IG_Prefs.prototype.Ea,"getLang",_IG_Prefs.prototype.na,"getCountry",_IG_Prefs.prototype.la,"getMsg",_IG_Prefs.prototype.oa,"getPreloadedString",_IG_Prefs.prototype.qa,"set",_IG_Prefs.prototype.set,"dump",_IG_Prefs.prototype.dump]);function _IG_FR_toggle(a,b,c,d){c=c||"";d=d||"";var e=_gel("ft_"+a+"_"+b),f=_gel("fb_"+a+"_"+b),g=_gel("ftl_"+a+"_"+b);if(f.style.display=="block")ig_A(e,f,g,c);else{var h=eval("FEED"+a);if(!h.has_entries&&!h.is_fetching){h.is_fetching=true;_IG_FetchFeedAsJSON(h.url,_IG_Callback(ig_Ia,a,b,c,d),h.num_items+15,true)}else{for(var j=0;j<eval("FEED"+a).num_items;j++){var l=_gel("ftl_"+a+"_"+j);if(l)ig_A(_gel("ft_"+a+"_"+j),_gel("fb_"+a+"_"+j),l,c)}ig_Ja(e,f,g,d);if(f.style.maxHeight&&parseInt(f.style.maxHeight,
//10)<ig_Ka(g.offsetWidth,f))f.style.height=f.style.maxHeight}}}

//function ig_Ia(a,b,c,d,e){var f=eval("FEED"+b);f.is_fetching=false;if(a&&a.Entry){for(var g=0;g<a.Entry.length;g++)if(a.Entry[g].ID!="no_id"){var h=_gel("fb_"+b+"_"+a.Entry[g].ID);if(h)h.innerHTML=a.Entry[g].Summary}eval("FEED"+b).has_entries=true;_IG_FR_toggle(b,c,d,e)}}function ig_B(a){return a.className.match("reverse_directionality$")=="reverse_directionality"}function ig_A(a,b,c,d){a.className=ig_B(a)?"fmaxbox_reverse_directionality":
//"fmaxbox";a.title=d;if(_old_html||_use_old_feed_styles)a.className="fbox fmaxbox";b.style.display="none";b.style.maxHeight="";c.className=ig_B(a)?"uftl_reverse_directionality":"uftl"}function ig_Ja(a,b,c,d){a.className=ig_B(a)?"fminbox_reverse_directionality":"fminbox";a.title=d;if(_old_html||_use_old_feed_styles)a.className="fbox fminbox";b.style.display="block";b.style.maxHeight=b.offsetWidth*1.5+"px";c.className=ig_B(a)?"sftl_reverse_directionality":"sftl"}

//function ig_Ka(a,b){
//  var c=document.createElement("div");
//  c.style.left=-screen.width;c.style.top=-screen.height;c.style.width=a;c.innerHTML=b.innerHTML;document.body.appendChild(c);
//  var d=c.clientHeight;document.body.removeChild(c);return d}

//function _IG_RegisterContainerScrollHandler(a){if(navigator.userAgent.indexOf("Firefox")>=0)window.addEventListener("scroll",a,false);else window.onscroll=a}
//function _IG_GetContainerVisibleHeight(){return document.documentElement.clientHeight}
//function _IG_GetContainerTotalHeight(){return document.body.scrollHeight}
//function _IG_GetContainerScrollTop(){return document.documentElement.scrollTop}
//function ig_C(a){return"/reader/ig/feed/"+_esc(eval("FEED"+a).url)}function ig_D(a,b){if(window._max_strategies){var c=ig_C(a)+(b?"?i="+b:"");window._max_strategies[a]._updateIframeSrc(c)}}function _IG_FR_maxModule(a,b,c){ig_D(a,b);window._IG_maximize_view(a,"feed",c)}function _IG_FR_init(a){window._max_strategies[a]=new window._IG_inlinedTransitionStrategy(a,ig_C(a),null,_IG_isIE());_IG_AddModuleEventHandler(a,"unmaximize",function(){ig_D(a)})};


var ig_E='<table class="dialog" id="IG_PU_dlg" cellspacing="0" cellpadding="0"><tr><td>',
    ig_F="</td></tr></table>",ig_G,_DI_button_type={Close:-1,OK:0,Cancel:1},
    ig_H=true;

function _IG_PU_init(){var a=_gel("IG_PU_box");if(!a){document.write('<iframe id="IG_PU_iframe_cover" style="display:none;"></iframe>');document.write('<div id="IG_PU_box" style="display:none;"></div>')}
      var b=_gel("IG_PU_bg");if(!b)document.write('<div id="IG_PU_bg" style="display:none;"></div>')
      }

function _IG_PU_open(a,b,c,d){ig_H=
  typeof b=="string";var e=_gel("IG_PU_box");
  if(e&&e.style.display=="none"){if(!c)c=[_IG_PU_MakeDialogButton("Save"),_IG_PU_MakeDialogButton("Cancel")];var f=[ig_E,'<div class="outerborder"><div class="border titlebar">',a,"</div>"];f.push('<div class="border body" id="',"dialogcontent",'">');if(ig_H)f.push(b);f.push(ig_I(c));f.push("</div>");f.push(ig_F);ig_J(f.join(""),d,ig_H?null:b)}}

function ig_I(a,b){var c=['<div id="buttons" class="button_background'];if(b)c.push(" "+b);c.push('"><table class="buttontable" cellspacing="0" cols=');
c.push(a.length,"><tr>");for(var d=0;d<a.length;++d){c.push("<td align=center>");c.push('<span id="button_',d,'" ');c.push('onclick="_IG_PU_hide(',d,')">');c.push(a[d]);c.push("</span>");c.push("</td>")}c.push("</tr></table></div></div>");return c.join("")}

// Menu drop down Window

function ig_J(a,b,c){
  if(b){if(typeof b!="function")b=_IG_PU_IGNORE;ig_G=b}else ig_G=_IG_PU_IGNORE;
  var d=_gel("IG_PU_bg");d.style.zIndex=3000;d.style.background="#000";
  set_opacity(d,true);d.style.position="absolute";d.onclick=_IG_PU_IGNORE;d.style.display=
  "none";d.style.left="0px";d.style.top="0px";
  var e=_gel("IG_PU_box"),f=_gel("IG_PU_iframe_cover");
  //put popup_iframe in IG_PU_box
  e.innerHTML=a;
  // no use in _IG_PU_openURL
  if(!ig_H&&c){var g=document.createElement("div");g.id="popup_box_placeholder";g.style.display="none";
  c.parentNode.insertBefore(g,c);_gel("dialogcontent").insertBefore(c,_gel("dialogcontent").firstChild)}
  e.style.position="absolute";e.style.zIndex=3001;f.style.position="absolute";e.style.visibility="hidden";e.style.display="block";
  set_IG_PU_xx_size();e.style.visibility="visible";f.style.display="";d.style.display="block";
  if(_gel("popup_iframe"))_IG_AddEventHandler("resize",_ResizeIframeHeight);else _IG_AddEventHandler("resize",set_IG_PU_xx_size);window.onscroll=set_IG_PU_xx_size;
  var h=_gel("IG_PU_dlg");h.onkeydown=_IG_PU_limitFocus;var j=_IG_PU_findFocusable(e,true,true);if(j)j.focus()}

// update_IG_PU_xx(innerhtml,b)=ig_J(a,b,null)
function update_IG_PU_xx(innerhtml,b){
  if(b){if(typeof b!="function")b=_IG_PU_IGNORE;ig_G=b}else ig_G=_IG_PU_IGNORE;
  var d=_gel("IG_PU_bg");d.style.zIndex=3000;d.style.background="#000";
  set_opacity(d,true);d.style.position="absolute";d.onclick=_IG_PU_IGNORE;d.style.display=
  "none";d.style.left="0px";d.style.top="0px";
  var e=_gel("IG_PU_box"),f=_gel("IG_PU_iframe_cover");
  //put popup_iframe in IG_PU_box
  // call source in _IG_PU_openURL
  e.innerHTML=innerhtml;
  e.style.position="absolute";e.style.zIndex=3001;
  f.style.position="absolute";e.style.visibility="hidden";e.style.display="block";
  set_IG_PU_xx_size();
  // Show up PU_xx
  e.style.visibility="visible";f.style.display="";d.style.display="block";
  if(_gel("popup_iframe"))_IG_AddEventHandler("resize",_ResizeIframeHeight);
  else _IG_AddEventHandler("resize",set_IG_PU_xx_size);
  window.onscroll=set_IG_PU_xx_size;
  var h=_gel("IG_PU_dlg");h.onkeydown=_IG_PU_limitFocus;

  var j=_IG_PU_findFocusable(e,true,true);if(j)j.focus()}

function _IG_PU_openURL(a,b,source,width,e,f){
  var g=[ig_E,'<div class="outerborder">'];g.push('<div class="border titlebar">');
  g.push(_IG_PU_createSimpleTitle(a));g.push(b);g.push("</div>");g.push('<div class="border body url">');
  g.push('<iframe id="popup_iframe" style="width:',
  width,';height:0px;"',' src="',source,'" onload="_ResizeIframeHeight();"',' scrolling="no" frameborder="0"></iframe>');g.push('<div class="c"></div>');if(e)g.push(ig_I(e,"colored_background"));g.push("</div></div>");g.push(ig_F);
  update_IG_PU_xx(g.join(""),f)
  }

//set_IG_PU_xx_size() == ig_L()
function set_IG_PU_xx_size(){
  var a=_gel("IG_PU_box"),b=_gel("IG_PU_iframe_cover"),c=_gel("IG_PU_bg"),
  d=document.body.clientWidth,e=window.innerHeight;
  if(!e)e=document.documentElement.offsetHeight;
  var f=a.offsetHeight<e;if(a){
     var g=(d-a.offsetWidth)/2,h=Math.max((e-a.offsetHeight)/2+(self.pageYOffset?self.pageYOffset:document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop),0);
  if(!f&&a.style.top)h=parseInt(a.style.top,10);a.style.left=g+"px";a.style.top=h+"px";b.style.left=g+"px";b.style.top=h+"px";b.style.width=a.offsetWidth+"px";b.style.height=a.offsetHeight+"px"}
  if(c){var j=parseInt(a.style.top,10)+a.offsetHeight,l=Math.max(ig_x(),e,j);c.style.height=l+"px";c.style.width=document.body.clientWidth+"px"}}

function _ResizeIframeHeight(){
if(_gel("popup_iframe")){_gel("popup_iframe").style.height=
ig_x(_gel("popup_iframe").contentWindow.document.body)+"px";
_gel("popup_iframe").style.display="block";_gel("popup_iframe").style.display=""}
set_IG_PU_xx_size()}

function _IG_PU_hide(a){var b=_gel("button_"+a);if(b&&b.firstChild&&b.firstChild.disabled)return;var c=_gel("IG_PU_box"),d=_gel("IG_PU_iframe_cover"),e=_gel("IG_PU_bg");if(c){c.style.display="none";d.style.display="none"}if(e){e.onclick="";e.style.height="";e.style.width=""}if(!ig_H){var f=_gel("dialogcontent").firstChild;if(a!=_DI_button_type.OK&&f.nodeName==
"FORM")f.reset();setTimeout("_IG_PU_move_DOM()",1000)}if(_gel("popup_iframe"))_IG_RemoveEventHandler("resize",_ResizeIframeHeight);else _IG_RemoveEventHandler("resize",set_IG_PU_xx_size);window.onscroll=null;ig_G(a)}function _IG_PU_move_DOM(){var a=_gel("popup_box_placeholder"),b=_gel("dialogcontent").firstChild;a.parentNode.insertBefore(b,a);a.parentNode.removeChild(a)}

function _IG_PU_IGNORE(){}
//set_opacity(a,b)=ig_K(a,b)
function set_opacity(a,b){
  if("opacity"in a.style)a.style.opacity=b?0.5:1;
  else if("MozOpacity"in a.style)a.style.MozOpacity=b?0.5:1;
  else if("filter"in a.style)a.style.filter=b?"alpha(opacity=50)":"alpha(opacity=100)"}
function _IG_PU_MakeDialogButton(a,b,c,d){var e=['<input type="button"'];if(b)e.push(' id="'+b+'"');if(c)e.push(' class="'+c+'"');if(d)e.push(' onclick="'+d+'"');e.push(' value="',a,'"></input>');return e.join("")}
function _IG_PU_disable_hide_for_button(a){var b=_gel("button_"+a);if(b)b.onclick=function(){}}
function _IG_PU_createSimpleTitle(a){
  var b=[];b.push('<div class="popup_title">',a,"</div>");
   b.push('<div class="popup_title_buttons">');
   b.push('<a onclick="_IG_PU_hide(_DI_button_type.Close);"');b.push(' class="delbox" href="javascript:void(0)">');b.push("</a>");b.push("</div>");b.push('<div class="c"></div>');
   return b.join("")}

function _IG_PU_createSimpleInputBox(a,b,c){var d=[];d.push('<div class="popup_body thinpadding">');d.push('<form onsubmit="_IG_PU_hide(_DI_button_type.OK); return false;">');d.push('<table cellspacing="0" cellpadding="0" border="0"><tr>');d.push('<td class="sidepadding">',_hesc(b),"</td>");d.push('<td class="sidepadding">');
d.push('<input id="',_hesc(a),'" name="',_hesc(a),'" ');d.push('type="text" size="45" value="'+_hesc(c)+'">');d.push("</td>");d.push("</tr></table></form></div>");return d.join("")}

function _IG_PU_hasAttr(a,b){if(a.getAttributeNode){var c=a.getAttributeNode(b);return c?c.specified:false}return a.getAttribute(b)!=null}function _IG_PU_findFocusable(a,b,c){if(!a.disabled){if(a.nodeName.toLowerCase()=="input")return a;if(a.nodeName.toLowerCase()=="button")return a;if(!c){if(a.nodeName.toLowerCase()==
"a"&&_IG_PU_hasAttr(a,"href"))return a;if(a.nodeType==1&&_IG_PU_hasAttr(a,"tabindex")&&a.tabIndex!=-1)return a}}if(!a.hasChildNodes())return null;var d=a.childNodes;for(var e=b?0:d.length-1,f;f=d[e];b?e++:e--){var g=_IG_PU_findFocusable(f,b,c);if(g)return g}return null}function _IG_PU_limitFocus(a){if(!a)a=window.event;var b=a.target?a.target:a.srcElement,c=a.keyCode||a.charCode||a.which;if(c==9){var d=_IG_PU_findFocusable(this,true,false);if(!d)return true;var e=_IG_PU_findFocusable(this,false,false);
if(b==d&&a.shiftKey&&!(a.ctrlKey|a.altKey)){e.focus();return false}else if(b==e&&!(a.shiftKey|a.ctrlKey|a.altKey)){d.focus();return false}}return true};


var ig_M,ig_N,ig_O={};
function _IG_AddDropDownEventHandler(a,b){ig_O[a]=b}
function _IG_DD_init(){document.write('<iframe id="IG_DD_iframe_cover" class="dd_iframe_cover" style="display:none;"></iframe>');document.write('<div id="IG_DD_div" class="dd_layer_hidden" onclick="_IG_DD_hide();return true;"></div>')}
function _IG_DD_create(a,b){var c=document.createElement("div");c.setAttribute("id","DD_"+a);c.className="dd dd_border";c.style.display="none";c.onkeydown=_IG_DD_keys;for(var d=0,e;e=b[d];d++){if(e[3])c.appendChild(ig_La(e[3]));
c.appendChild(_IG_DD_add(e[0],e[1],e[2],d))}_gel("IG_DD_div").appendChild(c)}
function _IG_DD_add(a,b,c,d){b=b||"javascript:void(0)";var e=document.createElement("div"),f="";if(typeof c=="string"&&c!="")f=' onclick="'+c+'"';e.innerHTML='<a href="'+b+'"'+f+">"+a+"</a>";var g=e.firstChild;if(typeof c=="string"&&c!="")c=g.onclick;if(c)g.onclick=function(h){c(h);_IG_DD_hide();return false};g.className=d==0?"dd_item dd_item_first":"dd_item";g.onblur=function(){ig_N=false;return true};g.onmouseover=function(){return _IG_DD_select(this)};
return g}
function ig_La(a){var b=document.createElement("div");b.className=a;b.innerHTML='<div class="topline"></div><div class="bottomline"></div>';return b}
function _IG_DD_open(a,b) {
  var c=_gel("DD_"+b);
  if(c.style.display=="none") {
    ig_M=b;
    var d=_gel("IG_DD_div");
    d.className="dd_layer";
    _IG_AddEventHandler("resize",_IG_DD_position);
    _IG_DD_position();
    ig_N=false;
    if(c.hasChildNodes()) {
      var e=c.firstChild;if(e.tagName!="A")e=e.nextSibling;
      _IG_DD_select(e)
    }
    var f=_gel("DD_tg_"+b);f.className+=" ddbox_sel";
    var g=ig_O[ig_M];if(g)g(true)}}

function _IG_DD_position(){
  var a=_gel("DD_"+ig_M),b=_gel("DD_tg_"+ig_M),c=_gel("IG_DD_div");
  a.style.display="block";
  var d=_findPos(b),e=a.offsetWidth,f=d[0]+b.offsetWidth-e,g=document.body.clientWidth+document.body.scrollLeft;
  if(f<5)f=5;else if(f+e>g-5)f=g-5-e;a.style.left=f+"px";a.style.top=d[1]+b.offsetHeight+"px";
  var h=_gel("IG_DD_iframe_cover");h.style.left=a.style.left;h.style.top=a.style.top;h.style.width=a.offsetWidth+"px";h.style.height=a.offsetHeight+"px";h.style.display=
  "block";c.style.height=ig_x()+"px";c.style.width=document.body.clientWidth+"px"}
function _IG_DD_hide(){
  var a=_gel("IG_DD_div");
  if(a.className=="dd_layer"){_IG_RemoveEventHandler("resize",_IG_DD_position);
    if(ig_M){var b=_gel("DD_"+ig_M);b.style.display="none";
      _gel("IG_DD_iframe_cover").style.display="none";var c=_gel("DD_tg_"+ig_M);
      c.className=c.className.replace(/ ddbox_sel/,"");var d=ig_O[ig_M];
      if(d)d(false);if(ig_N){var e=_gel("DD_tg_"+ig_M);if(e)e.focus()}ig_N=false;ig_M=null}
      a.className="dd_layer_hidden"}
      _IG_DD_select(null)}      
function _IG_DD_gcn(a,b,c){var d=new RegExp("(^| )"+c+"( |$)"),
  e=a.getElementsByTagName(b),f=[];
  for(var g=0,h;h=e[g];g++)if(d.test(h.className))f.push(h);return f}
function _IG_DD_select(a){
  var b=_IG_DD_gcn(_gel("IG_DD_div"),"a","dd_sel");
  if(b!=null)for(var c=0,d;d=b[c];c++)d.className=d.className.replace(/ dd_sel/g,"");
  if(a){try{a.focus()}
    catch(e){
    if(!(e.message=="Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus."))
    throw e;}
  a.className=a.className+" dd_sel"}}
function _IG_DD_keys(a){function b(g,h){var j=g;do{j=h?j.nextSibling:j.previousSibling;if(!j){var l=g.parentNode;j=h?l.firstChild:l.lastChild}}while(j!=g&&j.tagName!="A");return j}var c=true,d=_IG_DD_gcn(_gel("IG_DD_div"),"a","dd_sel");if(d==null||d.length!=1)return true;var e=d[0];if(!a)a=window.event;var f=a.keyCode||a.charCode||a.which;switch(f){case 13:ig_N=true;break;case 38:_IG_DD_select(b(e,false));c=false;break;case 40:_IG_DD_select(b(e,true));c=false;break;case 27:case 9:ig_N=
  true;c=ig_M==null&&f==9;_IG_DD_hide();break}return c};




function _hide_sent_content_messages(){
  _gel("sent_content_msg").className="hidden_msg";
  _gel("sent_tab_box").className="hidden_msg_box";
  _gel("send_tab_error_box").className="hidden_msg_box";
  _gel("sent_gadget_box").className="hidden_msg_box"}


var ig_W=null;


function _share_gadget(a,b,c,d,e,f,g,h){if(d){_hide_sent_content_messages();if(!ig_W)ig_W=_gel("sent_gadget_box").innerHTML;_gel("sent_gadget_box").innerHTML=ig_W.replace("GADGET_NAME",_get_module_title(d))}if(g)var j="_gel('popup_iframe').contentWindow.prepareEmail(_gel('share_userprefs') ? _gel('share_userprefs').checked : false)";
else var j="_gel('popup_iframe').contentWindow.prepareEmail();";var l=['<input type="button" id="send_btn" disabled="true" onclick="'+j+'" value="'+e+'"></input>',_IG_PU_MakeDialogButton(f)],i="titlebar userprefs userprefs_border",k=_get_userprefs_checkbox_html(g,h,i);_IG_PU_openURL(a,k,b,c,l,d?_finish_sharing_gadget:null);_IG_PU_disable_hide_for_button(0)}

  
function _share_this_gadget(popup_title,b,module_id){
  if(module_id){_hide_sent_content_messages();
    if(!ig_W)ig_W=_gel("sent_gadget_box").innerHTML;_gel("sent_gadget_box").innerHTML=
    ig_W.replace("GADGET_NAME",_get_module_title(module_id));}
  _IG_PU_openURL('<img src="http://www.netvibez.com/static/v1/img/share.gif"> '+popup_title,null,b,"565px",null,module_id?_finish_sharing_gadget:null);
  _IG_PU_disable_hide_for_button(0)}

function _save_this_gadget(popup_title,b,module_id, width){
  // width=565px
  if(module_id){_hide_sent_content_messages();
    if(!ig_W)ig_W=_gel("sent_gadget_box").innerHTML;_gel("sent_gadget_box").innerHTML=
    ig_W.replace("GADGET_NAME",_get_module_title(module_id));}    
  _IG_PU_openURL('<img src="http://www.netvibez.com/static/v1/img/share.gif"> '+popup_title,null,b,width,null,module_id?_finish_sharing_gadget:null);
  _IG_PU_disable_hide_for_button(0)}

function _finish_sharing_gadget(a){if(a==_DI_button_type.OK){_gel("sent_content_msg").className="msg";_gel("sent_tab_box").className="hidden_msg_box";
_gel("send_tab_error_box").className="hidden_msg_box";
_gel("sent_gadget_box").className="msg_box"}}
function _finish_sharing_tab(a){_gel("sent_content_msg").className="msg";
  _gel("sent_gadget_box").className="hidden_msg_box";
  if(a){_gel("sent_tab_box").className="msg_box";_gel("send_tab_error_box").className="hidden_msg_box"}else{_gel("send_tab_error_box").className="msg_box";_gel("sent_tab_box").className="hidden_msg_box"}
  };

function _popup_message(popup_title, popup_content, module_id) {
  if(module_id){_hide_sent_content_messages();
	if(!ig_W)ig_W=_gel("sent_gadget_box").innerHTML;
	_gel("sent_gadget_box").innerHTML=
    ig_W.replace("GADGET_NAME",_get_module_title(module_id));}
  ig_E = '<table class="dialog" id="IG_PU_dlg" cellspacing="0" cellpadding="0"><tr><td>'
  var g=[ig_E,'<div class="outerborder">'];g.push('<div class="border titlebar">');
  g.push(_IG_PU_createSimpleTitle('<img src="http://www.google.com/ig/images/sharegadget.gif">'+ popup_title));
  g.push("</div>");g.push('<div class="border body url">');
  g.push(popup_content);g.push('<div class="c"></div>');g.push(ig_I("Copy code above to your blogs","colored_background"));g.push("</div></div>");g.push(ig_F);
  update_IG_PU_xx(g.join(''),_finish_sharing_gadget)
}

var ig_X;
if(!this.JSON)ig_X=(function(){
  function a(l){return l<10?"0"+l:l}
  Date.prototype.o=function(){return this.getUTCFullYear()+"-"+a(this.getUTCMonth()+1)+"-"+a(this.getUTCDate())+"T"+a(this.getUTCHours())+":"+
    a(this.getUTCMinutes())+":"+a(this.getUTCSeconds())+"Z"};
  String.prototype.o=Number.prototype.o=Boolean.prototype.o=function()
  {return this.valueOf()};
  var b=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,c=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
  d,e,f={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"
  },g;
  function h(l){c.lastIndex=0;return c.test(l)?'"'+l.replace(c,function(i){var k=f[i];if(typeof k==="string")return k;return"\\u"+
  ("0000"+(+i.charCodeAt(0)).toString(16)).slice(-4)})+'"':'"'+l+'"'}
  function j(l,i){var k,m,o,q,r=d,n,p=i[l];if(p&&typeof p==="object"&&typeof p.o==="function")p=p.o(l);if(typeof g==="function")p=g.call(i,l,p);switch(typeof p){case "string":return h(p);case "number":return isFinite(p)?
    String(p):"null";case "boolean":case "null":return String(p);case "object":if(!p)return"null";d+=e;n=[];if(typeof p.length==="number"&&!p.propertyIsEnumerable("length"))
    {q=p.length;for(k=0;k<q;k+=1)n[k]=j(k,p)||"null";o=n.length===0?"[]":d?"[\n"+d+n.join(",\n"+d)+"\n"+r+"]":"["+n.join(",")+"]";d=r;
    return o}
    if(g&&typeof g==="object"){q=g.length;for(k=0;k<q;k+=1){m=g[k];if(typeof m==="string"){o=j(m,p);if(o)n.push(h(m)+(d?": ":":")+o)
    }}}else for(m in p)if(Object.hasOwnProperty.call(p,m)){o=j(m,p);if(o)n.push(h(m)+
    (d?": ":":")+o)}o=n.length===0?"{}":d?"{\n"+d+n.join(",\n"+d)+"\n"+r+"}":"{"+n.join(",")+"}";d=r;return o
  }}
  return{stringify:function(l,i,k){var m=i,o=k,q;d="";e="";
  if(typeof o==="number")for(q=0;q<o;q+=1)e+=" ";else if(typeof o==="string")e=o;g=m;if(m&&typeof m!=="function"&&(typeof m!=="object"||typeof m.length!=="number"))throw new Error("JSON.stringify");return j("",{"":l})},parse:function(l,i){var k=i,m;function o(q,r){var n,p,s=q[r];if(s&&typeof s==="object")for(n in s)if(Object.hasOwnProperty.call(s,
  n)){p=o(s,n);if(p!==undefined)s[n]=p;else delete s[n]}return k.call(q,r,s)}b.lastIndex=0;if(b.test(l))l=l.replace(b,function(q){return"\\u"+("0000"+(+q.charCodeAt(0)).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(l.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){m=eval("("+l+")");return typeof k==="function"?o({"":m},""):m}throw new Error("JSON.parse");}
  }})();
  
ig_X.parse=(function(){var a=ig_X.parse;return function(b,c)
  {try{return a(b,c)}catch(d){return false}}})();

function ig_Ta(a){var b=document.createElement("DIV");b.innerHTML="<iframe onload='this.pool_locked=false'></iframe>";var c=b.getElementsByTagName("IFRAME")[0];c.style.visibility="hidden";c.style.width=c.style.height="0px";c.style.border="0px";c.style.position="absolute";c.pool_locked=a;this.g[this.g.length]=c;b.removeChild(c);b=null;
  return c}
  
  
  
// There are two objects defined in this file:
// "slide" - contains all the information for a single slide
// "slideshow" - consists of multiple slide objects and runs the slideshow

//==================================================
// slide object
//==================================================
//James Liu: type added
function slide(type,src,link,id,text,target,attr) {
  // This is the constructor function for the slide object.
  // It is called automatically when you create a new slide object.
  // For example:
  // s = new slide();

  // Slide type: img, flickr, youtube, metacafe ...
  this.type = type;
  
  // Image URL
  this.src = src;

  // Link URL
  this.link = link;
  
  // Video id
  this.id = id;

  // Text to display
  this.text = text;

  // Name of the target window ("_blank")
  this.target = target;

  // Custom duration for the slide, in milliseconds.
  // This is an optional parameter.
  // this.timeout = 3000

  // Attributes for the target window:
  // width=n,height=n,resizable=yes or no,scrollbars=yes or no,
  // toolbar=yes or no,location=yes or no,directories=yes or no,
  // status=yes or no,menubar=yes or no,copyhistory=yes or no
  // Example: "width=200,height=300"
  this.attr = attr;

  // Create an image object for the slide
  if (document.images) {
    this.image = new Image();
  }

  // Flag to tell when load() has already been called
  this.loaded = false;

  //--------------------------------------------------
  this.load = function() {
    // This method loads the image for the slide

    if (!document.images) { return; }

    if (!this.loaded) {
      this.image.src = this.src;
      this.loaded = true;
    }
  }

  //--------------------------------------------------
  this.hotlink = function() {
    // This method jumps to the slide's link.
    // If a window was specified for the slide, then it opens a new window.

    var mywindow;

    // If this slide does not have a link, do nothing
    if (!this.link) return;

    // Open the link in a separate window?
    if (this.target) {

      // If window attributes are specified,
      // use them to open the new window
      if (this.attr) {
        mywindow = window.open(this.link, this.target, this.attr);
  
      } else {
        // If window attributes are not specified, do not use them
        // (this will copy the attributes from the originating window)
        mywindow = window.open(this.link, this.target);
      }

      // Pop the window to the front
      if (mywindow && mywindow.focus) mywindow.focus();

    } else {
      // Open the link in the current window
      location.href = this.link;
    }
  }
}

//==================================================
// slideshow object
//==================================================
function slideshow( slideshowname ) {
  // This is the constructor function for the slideshow object.
  // It is called automatically when you create a new object.
  // For example:
  // ss = new slideshow("ss");

  // Name of this object
  // (required if you want your slideshow to auto-play)
  // For example, "SLIDES1"
  this.name = slideshowname;

  // When we reach the last slide, should we loop around to start the
  // slideshow again?
  this.repeat = true;

  // Number of images to pre-fetch.
  // -1 = preload all images.
  //  0 = load each image is it is used.
  //  n = pre-fetch n images ahead of the current image.
  // I recommend preloading all images unless you have large
  // images, or a large amount of images.
  this.prefetch = -1;

  // If slide.type == 'youtube' || 'metacafe' slide.medium = video
  // this.medium = video 
  // image|video|music
  this.medium = null;
  
  // IMAGE element on your HTML page.
  // For example, document.images.SLIDES1IMG
  this.image;
  
  this.img_loc;
  this.img_status;
  
  // Video element on your HTML page.
  this.load_youtube_player;
  this.load_metacafe_player;
  // Video location
  this.video_loc;
  // Video player itself
  this.video;
  // Video related information
  this.video_status;

  this.nzvideo_loc;
  this.nzvideo;
  this.nzvideo_status;
  

  // ID of a DIV element on your HTML page that will contain the text.
  // For example, "slides2text"
  // Note: after you set this variable, you should call
  // the update() method to update the slideshow display.
  this.textid;

  // TEXTAREA element on your HTML page.
  // For example, document.SLIDES1FORM.SLIDES1TEXT
  // This is a depracated method for displaying the text,
  // but you might want to supply it for older browsers.
  this.textarea;

  // Milliseconds to pause between slides.
  // Individual slides can override this.
  this.timeout = 3000;

  // Hook functions to be called before and after updating the slide
  // this.pre_update_hook = function() { }
  // this.post_update_hook = function() { }

  // These are private variables
  this.slides = new Array();
  this.current = 0;
  this.timeoutid = 0;

  //--------------------------------------------------
  // Public methods
  //--------------------------------------------------
  this.add_slide = function(slide) {
    // Add a slide to the slideshow.
    // For example:
    // SLIDES1.add_slide(new slide("s1.jpg", "link.html"))
  
    var i = this.slides.length;
    
     // James Liu
	if ( slide.type == 'youtube') {
	  if (this.medium == null)
	    this.medium = 'video'; 
	  else if (this.medium != 'video') {
	    alert("Failed to add an item! video can't be added into " +
	          this.medium + " playlist");   
	    return; 
	  }
	  this.load_youtube_player = true;
	}
	// James Liu
	if ( slide.type == 'metacafe') {
	  if (this.medium == null)
	    this.medium = 'video'; 
	  else if (this.medium != 'video') {
	    alert("Failed to add an item! video can't be added into " +
	          this.medium + " playlist");   
	    return; 	    
	  }
	  this.load_metacafe_player = true;
	}
    
    if ( slide.type == 'flickr' || slide.type == 'img' ) {     
      if (this.medium == null)
	    this.medium = 'image'; 
	  else if (this.medium != 'image') {
	    alert("Failed to add an item! image can't be added into " +
	          this.medium + " playlist");   
	    return; 	    
	  }
      // Prefetch the slide image if necessary
      if (this.prefetch == -1) {
        slide.load();
      }	
	}
	
    this.slides[i] = slide;
  }
  
  //--------------------------------------------------
  this.play = function(timeout) {
    // This method implements the automatically running slideshow.
    // If you specify the "timeout" argument, then a new default
    // timeout will be set for the slideshow.

    // James Liu
    // Video next play by call-back function, skip timeout function
    if (this.slides[ this.current ].type == 'youtube')
       return;
    if (this.slides[ this.current ].type == 'metacafe')
       return;
  
    // Make sure we're not already playing images
    this.pause();

    // If the timeout argument was specified (optional)
    // then make it the new default
    if (timeout) {
      this.timeout = timeout;
    }
    // If the current slide has a custom timeout, use it;
    // otherwise use the default timeout
    if (typeof this.slides[ this.current ].timeout != 'undefined') {
      timeout = this.slides[ this.current ].timeout;
    } else {
      timeout = this.timeout;
    }
    // After the timeout, call this.loop()
    this.timeoutid = setTimeout( this.name + ".loop()", timeout);
  }

  //--------------------------------------------------
  this.pause = function() {
    // This method stops the slideshow if it is automatically running.
    var slide = this.slides[ this.current ];
	if (slide.type == 'flickr'|| slide.type == 'img') {
      if (this.timeoutid != 0) {
        clearTimeout(this.timeoutid);
        this.timeoutid = 0;
      }
    } else if(slide.type == 'youtube') {
      pause();
    } else if (slide.type == 'metacafe') {
      nzpause();
    }
  }

  //James Liu
  this.update2 = function(autostart) {
  	// Convenience variable for the current slide
    var slide = this.slides[ this.current ];
	if (slide.type == 'flickr'|| slide.type == 'img') {
	   this.update_flickr();	
	} else if (slide.type == 'youtube') {
	   this.update_youtube(autostart);
	} else if (slide.type == 'metacafe') {
	   this.update_metacafe(autostart);
	}
  }
  
  this.update_metacafe = function(autostart) {
  	// Call the pre-update hook function if one was specified
    if (typeof this.pre_update_hook == 'function') {
      this.pre_update_hook();
    }

    // Convenience variable for the current slide
    var slide = this.slides[ this.current ];

    // Update the text
    this.display_text();

   
	// The first time
	if (this.load_metacafe_player == true) {	  
	   loadMCPlayer('/bin/nzplayer.swf', slide.src, this.nzvideo, autostart);
	   //Only load once
	   this.load_metacafe_player = false;
	// After first time
	} else {
	  // clear();
	  // ytplayer.loadVideoById(slide.id);
	    mcplayer.playSrc(slide.src);

	}    

    this.image.style.visibility = 'hidden';
    document.getElementById(this.img_loc).style.visibility='hidden';
	document.getElementById(this.img_loc).style.display='none';
    document.getElementById(this.img_loc).style.height='0px';
    document.getElementById(this.img_loc).style.width='0px';
    document.getElementById(this.img_status).style.visibility='hidden';

    //*** Firefox DO NOT use DISPLAY='none'; it will cause Flash to reload ....
    //** IE don't take width=0 and height=0 work...
    // visibility='hidden' only make things disappear
    if (navigator.appName == "Microsoft Internet Explorer") {
      document.getElementById(this.video_loc).style.display='none';
    } else {
      //document.getElementById(this.video_loc).style.visibility='hidden';
      //document.getElementById(this.video_loc).style.height='0px';
      //document.getElementById(this.video_loc).style.width='0px';
	  document.getElementById(this.video_loc).className="hidden";
	  if (typeof ytplayer != "undefined")
        ytplayer.className="hidden";
    }
	//*** Becasue audio is still in the background, we have to pause
	stop();
    document.getElementById(this.video_status).style.visibility='hidden';
  
    //***  Firefox DO NOT use DISPLAY='none'; it will cause Flash to reload ....
    if (navigator.appName == "Microsoft Internet Explorer") {
      document.getElementById(this.nzvideo_loc).style.display = 'block';      
    }
    else {  
      if (typeof mcplayer != "undefined")
        mcplayer.className="";
      document.getElementById(this.nzvideo_loc).className="";
    }    
    //document.getElementById(this.nzvideo_loc).style.visibility = '';
    //document.getElementById(this.nzvideo_loc).style.height = '';
    //document.getElementById(this.nzvideo_loc).style.width = '';
 	document.getElementById(this.nzvideo_status).style.visibility = '';
	

 	//var oldDiv = document.getElementById("myytplayer");
    //var newElement = document.createElement("img");
    //newElement.setAttribute("id","skinimage");
    //newElement.setAttribute("src","honesttv.png");
    //newElement.setAttribute("style", "position: absolute; top: 0px; left:
    //300px; z-index: 20;");
    //document.body.insertBefore(newElement, oldDiv); 
    // Call the post-update hook function if one was specified
    if (typeof this.post_update_hook == 'function') {
      this.post_update_hook();
    }
  }
  
  
  this.update_youtube = function(autostart) {
  	// Call the pre-update hook function if one was specified
    if (typeof this.pre_update_hook == 'function') {
      this.pre_update_hook();
    }

    // Convenience variable for the current slide
    var slide = this.slides[ this.current ];

    // Update the text
    this.display_text();
  	
	
	// The first time
	if (this.load_youtube_player == true) {
	   vid = slide.id;	  
	   loadYTPlayer(this.video, autostart);
	   //Only load once
	   this.load_youtube_player = false;
	// After first time
	} else {
	   clear();
	   ytplayer.loadVideoById(slide.id);
	   startYTEvents();
	}    

    this.image.style.visibility = 'hidden';
    document.getElementById(this.img_loc).style.visibility='hidden';
	document.getElementById(this.img_loc).style.display='none';
    document.getElementById(this.img_loc).style.height='0px';
    document.getElementById(this.img_loc).style.width='0px';
    document.getElementById(this.img_status).style.visibility='hidden';
  
  
    //Firefox DO NOT use DISPLAY='none'; it will cause Flash to reload ....
    // IE don't care width=0 and height=0
    if (navigator.appName == "Microsoft Internet Explorer") {
      document.getElementById(this.nzvideo_loc).style.display='none';
//      document.getElementById(this.nzvideo_loc).style.visibility = 'hidden';
    }
    else {
      if (typeof mcplayer != "undefined")
        mcplayer.className="hidden";
      //document.getElementById(this.nzvideo_loc).style.height='0px';
     // document.getElementById(this.nzvideo_loc).style.width='0px';
      document.getElementById(this.nzvideo_loc).className="hidden";
    }  
    document.getElementById(this.nzvideo_status).style.visibility='hidden';
    //*** Becasue audio is still in the background, we have to pause
    stopNZVideo();
    
    //Firefox DO NOT use DISPLAY='none'; it will cause Flash to reload ....
    // then ytplayer or mcplayer may be undefined when reloading
    if (navigator.appName == "Microsoft Internet Explorer") {
      document.getElementById(this.video_loc).style.display = 'block';
//      document.getElementById(this.video_loc).style.visibility = '';
    }
    else {
    //document.getElementById(this.video_loc).style.visibility = '';
      
      document.getElementById(this.video_loc).className="";
       if (typeof ytplayer != "undefined")
        ytplayer.className="";
    }
    //document.getElementById(this.video_loc).style.height = '';
    //document.getElementById(this.video_loc).style.width = '';
 	document.getElementById(this.video_status).style.visibility = '';
	
     	
 	//var oldDiv = document.getElementById("myytplayer");
    //var newElement = document.createElement("img");
    //newElement.setAttribute("id","skinimage");
    //newElement.setAttribute("src","honesttv.png");
    //newElement.setAttribute("style", "position: absolute; top: 0px; left:
    //300px; z-index: 20;");
    //document.body.insertBefore(newElement, oldDiv); 
    // Call the post-update hook function if one was specified
    if (typeof this.post_update_hook == 'function') {
      this.post_update_hook();
    }
  }
  
  // Only for image
  //--------------------------------------------------
  this.update_flickr = function() {
 
    // This method updates the slideshow image on the page

    // Make sure the slideshow has been initialized correctly
    if (! this.valid_image()) { return; }

    // Call the pre-update hook function if one was specified
    if (typeof this.pre_update_hook == 'function') {
      this.pre_update_hook();
    }

    // Convenience variable for the current slide
    var slide = this.slides[ this.current ];
  
    // Determine if the browser supports filters
    var dofilter = false;
    if (this.image &&
        typeof this.image.filters != 'undefined' &&
        typeof this.image.filters[0] != 'undefined') {

      dofilter = true;

    }

    // Load the slide image if necessary
    slide.load();
  
    // Apply the filters for the image transition
    if (dofilter) {

      // If the user has specified a custom filter for this slide,
      // then set it now
      if (slide.filter &&
          this.image.style &&
          this.image.style.filter) {

        this.image.style.filter = slide.filter;

      }
      this.image.filters[0].Apply();
    }

    // Update the image.
    this.image.src = slide.image.src;
	//James Liu: if previous slide is video
	if (load_by_request) {
	  // Youtube only???
	  clear();
	  stop();
	}
	document.getElementById(this.video_loc).style.visibility = 'hidden';
	document.getElementById(this.video_loc).style.height = '0px';
 	document.getElementById(this.video_loc).style.width = '0px';
 	document.getElementById(this.video_status).style.visibility = 'hidden';

    document.getElementById(this.nzvideo_loc).style.visibility = 'hidden';
	document.getElementById(this.nzvideo_loc).style.height = '0px';
 	document.getElementById(this.nzvideo_loc).style.width = '0px';
 	document.getElementById(this.nzvideo_status).style.visibility = 'hidden';

	this.image.style.visibility = '';
	document.getElementById(this.img_status).style.visibility='';
	document.getElementById(this.img_loc).style.display='';
	document.getElementById(this.img_loc).style.visibility='';
	document.getElementById(this.img_loc).style.height='';
	document.getElementById(this.img_loc).style.width='';

    // Play the image transition filters
    if (dofilter) {
      this.image.filters[0].Play();
    }

    // Update the text
    this.display_text();

    // Call the post-update hook function if one was specified
    if (typeof this.post_update_hook == 'function') {
      this.post_update_hook();
    }

    // Do we need to pre-fetch images?
    if (this.prefetch > 0) {

      var next, prev, count;

      // Pre-fetch the next slide image(s)
      next = this.current;
      prev = this.current;
      count = 0;
      do {

        // Get the next and previous slide number
        // Loop past the ends of the slideshow if necessary
        if (++next >= this.slides.length) next = 0;
        if (--prev < 0) prev = this.slides.length - 1;

        // Preload the slide image
        this.slides[next].load();
        this.slides[prev].load();

        // Keep going until we have fetched
        // the designated number of slides

      } while (++count < this.prefetch);
    }
  }

  //--------------------------------------------------
  this.goto_slide = function(n) {
    // This method jumpts to the slide number you specify.
    // If you use slide number -1, then it jumps to the last slide.
    // You can use this to make links that go to a specific slide,
    // or to go to the beginning or end of the slideshow.
    // Examples:
    // onClick="myslides.goto_slide(0)"
    // onClick="myslides.goto_slide(-1)"
    // onClick="myslides.goto_slide(5)"
  
    if (n == -1) {
      n = this.slides.length - 1;
    }
  
    if (n < this.slides.length && n >= 0) {
      this.current = n;
    }
  
    this.update2();
  }


  //--------------------------------------------------
  this.goto_random_slide = function(include_current) {
    // Picks a random slide (other than the current slide) and
    // displays it.
    // If the include_current parameter is true,
    // then 
    // See also: shuffle()

    var i;

    // Make sure there is more than one slide
    if (this.slides.length > 1) {

      // Generate a random slide number,
      // but make sure it is not the current slide
      do {
        i = Math.floor(Math.random()*this.slides.length);
      } while (i == this.current);
 
      // Display the slide
      this.goto_slide(i);
    }
  }


  //--------------------------------------------------
  this.next = function() {
    // This method advances to the next slide.
    // Increment the image number
    if (this.current < this.slides.length - 1) {
      this.current++;
    } else if (this.repeat) {
      this.current = 0;
    } 
    this.update2();
  }

  // For restarting after pause
  //--------------------------------------------------
  this.next2 = function() {
    var slide = this.slides[ this.current ];
    if (slide.type == 'flickr'|| slide.type == 'img') {
      // This method advances to the next slide.
      // Increment the image number
      if (this.current < this.slides.length - 1) {
        this.current++;
      } else if (this.repeat) {
        this.current = 0;
      } 
      this.update2();
    } else if (slide.type == 'youtube') {
      play();
    } else if (slide.type == 'metacafe') {
      nzplay();
    }
  }

  //--------------------------------------------------
  this.previous = function() {
    // This method goes to the previous slide.
  
    // Decrement the image number
    if (this.current > 0) {
      this.current--;
    } else if (this.repeat) {
      this.current = this.slides.length - 1;
    }
  
    this.update2();
  }


  //--------------------------------------------------
  this.shuffle = function() {
    // This method randomly shuffles the order of the slides.

    var i, i2, slides_copy, slides_randomized;

    // Create a copy of the array containing the slides
    // in sequential order
    slides_copy = new Array();
    for (i = 0; i < this.slides.length; i++) {
      slides_copy[i] = this.slides[i];
    }

    // Create a new array to contain the slides in random order
    slides_randomized = new Array();

    // To populate the new array of slides in random order,
    // loop through the existing slides, picking a random
    // slide, removing it from the ordered list and adding it to
    // the random list.

    do {

      // Pick a random slide from those that remain
      i = Math.floor(Math.random()*slides_copy.length);

      // Add the slide to the end of the randomized array
      slides_randomized[ slides_randomized.length ] =
        slides_copy[i];

      // Remove the slide from the sequential array,
      // so it cannot be chosen again
      for (i2 = i + 1; i2 < slides_copy.length; i2++) {
        slides_copy[i2 - 1] = slides_copy[i2];
      }
      slides_copy.length--;

      // Keep going until we have removed all the slides

    } while (slides_copy.length);

    // Now set the slides to the randomized array
    this.slides = slides_randomized;
  }


  //--------------------------------------------------
  this.get_text = function() {
    // This method returns the text of the current slide
  
    return(this.slides[ this.current ].text);
  }


  //--------------------------------------------------
  this.get_all_text = function(before_slide, after_slide) {
    // Return the text for all of the slides.
    // For the text of each slide, add "before_slide" in front of the
    // text, and "after_slide" after the text.
    // For example:
    // document.write("<ul>");
    // document.write(s.get_all_text("<li>","\n"));
    // document.write("<\/ul>");
  
    all_text = "";
  
    // Loop through all the slides in the slideshow
    for (i=0; i < this.slides.length; i++) {
  
      slide = this.slides[i];
    
      if (slide.text) {
        all_text += before_slide + slide.text + after_slide;
      }
  
    }
  
    return(all_text);
  }


  //--------------------------------------------------
  this.display_text = function(text) {
    // Display the text for the current slide
  
    // If the "text" arg was not supplied (usually it isn't),
    // get the text from the slideshow
    if (!text) {
      text = this.slides[ this.current ].text;
    }
  
    // If a textarea has been specified,
    // then change the text displayed in it
    if (this.textarea && typeof this.textarea.value != 'undefined') {
      this.textarea.value = text;
    }

    // If a text id has been specified,
    // then change the contents of the HTML element
    if (this.textid) {

      r = this.getElementById(this.textid);
      if (!r) { return false; }
      if (typeof r.innerHTML == 'undefined') { return false; }

      // Update the text
      r.innerHTML = text;
    }
  }


  //--------------------------------------------------
  this.hotlink = function() {
    // This method calls the hotlink() method for the current slide.
  
    this.slides[ this.current ].hotlink();
  }

  // Added by James Liu
  //--------------------------------------------------
  this.cursrc = function() {
    // This method gets the src for the current slide.
    return this.slides[ this.current ].src;
  }
  
  this.curtype = function() {
    // This method gets the type for the current slide.  
    return this.slides[ this.current ].type;
  }

  //--------------------------------------------------
  this.save_position = function(cookiename) {
    // Saves the position of the slideshow in a cookie,
    // so when you return to this page, the position in the slideshow
    // won't be lost.
  
    if (!cookiename) {
      cookiename = this.name + '_slideshow';
    }
  
    document.cookie = cookiename + '=' + this.current;
  }


  //--------------------------------------------------
  this.restore_position = function(cookiename) {
  // If you previously called slideshow_save_position(),
  // returns the slideshow to the previous state.
  
    //Get cookie code by Shelley Powers
  
    if (!cookiename) {
      cookiename = this.name + '_slideshow';
    }
  
    var search = cookiename + "=";
  
    if (document.cookie.length > 0) {
      offset = document.cookie.indexOf(search);
      // if cookie exists
      if (offset != -1) { 
        offset += search.length;
        // set index of beginning of value
        end = document.cookie.indexOf(";", offset);
        // set index of end of cookie value
        if (end == -1) end = document.cookie.length;
        this.current = parseInt(unescape(document.cookie.substring(offset, end)));
        }
     }
  }


  //--------------------------------------------------
  this.noscript = function() {
    // This method is not for use as part of your slideshow,
    // but you can call it to get a plain HTML version of the slideshow
    // images and text.
    // You should copy the HTML and put it within a NOSCRIPT element, to
    // give non-javascript browsers access to your slideshow information.
    // This also ensures that your slideshow text and images are indexed
    // by search engines.
  
    $html = "\n";
  
    // Loop through all the slides in the slideshow
    for (i=0; i < this.slides.length; i++) {
  
      slide = this.slides[i];
  
      $html += '<P>';
  
      if (slide.link) {
        $html += '<a href="' + slide.link + '">';
      }
  
      $html += '<img src="' + slide.src + '" ALT="slideshow image">';
  
      if (slide.link) {
        $html += "<\/a>";
      }
  
      if (slide.text) {
        $html += "<BR>\n" + slide.text;
      }
  
      $html += "<\/P>" + "\n\n";
    }
  
    // Make the HTML browser-safe
    $html = $html.replace(/\&/g, "&amp;" );
    $html = $html.replace(/</g, "&lt;" );
    $html = $html.replace(/>/g, "&gt;" );
  
    return('<pre>' + $html + '</pre>');
  }


  //==================================================
  // Private methods
  //==================================================

  //--------------------------------------------------
  this.loop = function() {
    // This method is for internal use only.
    // This method gets called automatically by a JavaScript timeout.
    // It advances to the next slide, then sets the next timeout.
    // If the next slide image has not completed loading yet,
    // then do not advance to the next slide yet.

    // Make sure the next slide image has finished loading
    if (this.current < this.slides.length - 1) {
      next_slide = this.slides[this.current + 1];
      if (next_slide.image.complete == null || next_slide.image.complete) {
        this.next();
      }
    } else { // we're at the last slide
      this.next();
    }
    
    // Keep playing the slideshow
    this.play( );
  }


  //--------------------------------------------------
  this.valid_image = function() {
    // Returns 1 if a valid image has been set for the slideshow
  
    if (!this.image)
    {
      return false;
    }
    else {
      return true;
    }
  }

  //--------------------------------------------------
  this.getElementById = function(element_id) {
    // This method returns the element corresponding to the id

    if (document.getElementById) {
      return document.getElementById(element_id);
    }
    else if (document.all) {
      return document.all[element_id];
    }
    else if (document.layers) {
      return document.layers[element_id];
    } else {
      return undefined;
    }
  }
  

  //==================================================
  // Deprecated methods
  // I don't recommend the use of the following methods,
  // but they are included for backward compatibility.
  // You can delete them if you don't need them.
  //==================================================

  //--------------------------------------------------
  this.set_image = function(imageobject) {
    // This method is deprecated; you should use
    // the following code instead:
    // s.image = document.images.myimagename;
    // s.update();

    if (!document.images)
      return;
    this.image = imageobject;
  }

  //--------------------------------------------------
  this.set_textarea = function(textareaobject) {
    // This method is deprecated; you should use
    // the following code instead:
    // s.textarea = document.form.textareaname;
    // s.update();

    this.textarea = textareaobject;
    this.display_text();
  }

  //--------------------------------------------------
  this.set_textid = function(textidstr) {
    // This method is deprecated; you should use
    // the following code instead:
    // s.textid = "mytextid";
    // s.update();

    this.textid = textidstr;
    this.display_text();
  }
}
/*! SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/

var swfobject = function() {
	
	var UNDEF = "undefined",
		OBJECT = "object",
		SHOCKWAVE_FLASH = "Shockwave Flash",
		SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
		FLASH_MIME_TYPE = "application/x-shockwave-flash",
		EXPRESS_INSTALL_ID = "SWFObjectExprInst",
		
		win = window,
		doc = document,
		nav = navigator,
		
		domLoadFnArr = [],
		regObjArr = [],
		objIdArr = [],
		listenersArr = [],
		script,
		timer = null,
		storedAltContent = null,
		storedAltContentId = null,
		isDomLoaded = false,
		isExpressInstallActive = false;
	
	/* Centralized function for browser feature detection
		- Proprietary feature detection (conditional compiling) is used to detect Internet Explorer's features
		- User agent string detection is only used when no alternative is possible
		- Is executed directly for optimal performance
	*/	
	var ua = function() {
		var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
			playerVersion = [0,0,0],
			d = null;
		if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
			d = nav.plugins[SHOCKWAVE_FLASH].description;
			if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
				d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
				playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
				playerVersion[2] = /r/.test(d) ? parseInt(d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
			}
		}
		else if (typeof win.ActiveXObject != UNDEF) {
			var a = null, fp6Crash = false;
			try {
				a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7");
			}
			catch(e) {
				try { 
					a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".6");
					playerVersion = [6,0,21];
					a.AllowScriptAccess = "always";	 // Introduced in fp6.0.47
				}
				catch(e) {
					if (playerVersion[0] == 6) {
						fp6Crash = true;
					}
				}
				if (!fp6Crash) {
					try {
						a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
					}
					catch(e) {}
				}
			}
			if (!fp6Crash && a) { // a will return null when ActiveX is disabled
				try {
					d = a.GetVariable("$version");	// Will crash fp6.0.21/23/29
					if (d) {
						d = d.split(" ")[1].split(",");
						playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
					}
				}
				catch(e) {}
			}
		}
		var u = nav.userAgent.toLowerCase(),
			p = nav.platform.toLowerCase(),
			webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
			ie = false,
			windows = p ? /win/.test(p) : /win/.test(u),
			mac = p ? /mac/.test(p) : /mac/.test(u);
		/*@cc_on
			ie = true;
			@if (@_win32)
				windows = true;
			@elif (@_mac)
				mac = true;
			@end
		@*/
		return { w3cdom:w3cdom, pv:playerVersion, webkit:webkit, ie:ie, win:windows, mac:mac };
	}();

	/* Cross-browser onDomLoad
		- Based on Dean Edwards' solution: http://dean.edwards.name/weblog/2006/06/again/
		- Will fire an event as soon as the DOM of a page is loaded (supported by Gecko based browsers - like Firefox -, IE, Opera9+, Safari)
	*/ 
	var onDomLoad = function() {
		if (!ua.w3cdom) {
			return;
		}
		addDomLoadEvent(main);
		if (ua.ie && ua.win) {
			try {	 // Avoid a possible Operation Aborted error
				doc.write("<scr" + "ipt id=__ie_ondomload defer=true src=//:></scr" + "ipt>"); // String is split into pieces to avoid Norton AV to add code that can cause errors 
				script = getElementById("__ie_ondomload");
				if (script) {
					addListener(script, "onreadystatechange", checkReadyState);
				}
			}
			catch(e) {}
		}
		if (ua.webkit && typeof doc.readyState != UNDEF) {
			timer = setInterval(function() { if (/loaded|complete/.test(doc.readyState)) { callDomLoadFunctions(); }}, 10);
		}
		if (typeof doc.addEventListener != UNDEF) {
			doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, null);
		}
		addLoadEvent(callDomLoadFunctions);
	}();
	
	function checkReadyState() {
		if (script.readyState == "complete") {
			script.parentNode.removeChild(script);
			callDomLoadFunctions();
		}
	}
	
	function callDomLoadFunctions() {
		if (isDomLoaded) {
			return;
		}
		if (ua.ie && ua.win) { // Test if we can really add elements to the DOM; we don't want to fire it too early
			var s = createElement("span");
			try { // Avoid a possible Operation Aborted error
				var t = doc.getElementsByTagName("body")[0].appendChild(s);
				t.parentNode.removeChild(t);
			}
			catch (e) {
				return;
			}
		}
		isDomLoaded = true;
		if (timer) {
			clearInterval(timer);
			timer = null;
		}
		var dl = domLoadFnArr.length;
		for (var i = 0; i < dl; i++) {
			domLoadFnArr[i]();
		}
	}
	
	function addDomLoadEvent(fn) {
		if (isDomLoaded) {
			fn();
		}
		else { 
			domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
		}
	}
	
	/* Cross-browser onload
		- Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
		- Will fire an event as soon as a web page including all of its assets are loaded 
	 */
	function addLoadEvent(fn) {
		if (typeof win.addEventListener != UNDEF) {
			win.addEventListener("load", fn, false);
		}
		else if (typeof doc.addEventListener != UNDEF) {
			doc.addEventListener("load", fn, false);
		}
		else if (typeof win.attachEvent != UNDEF) {
			addListener(win, "onload", fn);
		}
		else if (typeof win.onload == "function") {
			var fnOld = win.onload;
			win.onload = function() {
				fnOld();
				fn();
			};
		}
		else {
			win.onload = fn;
		}
	}
	
	/* Main function
		- Will preferably execute onDomLoad, otherwise onload (as a fallback)
	*/
	function main() { // Static publishing only
		var rl = regObjArr.length;
		for (var i = 0; i < rl; i++) { // For each registered object element
			var id = regObjArr[i].id;
			if (ua.pv[0] > 0) {
				var obj = getElementById(id);
				if (obj) {
					regObjArr[i].width = obj.getAttribute("width") ? obj.getAttribute("width") : "0";
					regObjArr[i].height = obj.getAttribute("height") ? obj.getAttribute("height") : "0";
					if (hasPlayerVersion(regObjArr[i].swfVersion)) { // Flash plug-in version >= Flash content version: Houston, we have a match!
						if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements
							fixParams(obj);
						}
						setVisibility(id, true);
					}
					else if (regObjArr[i].expressInstall && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) { // Show the Adobe Express Install dialog if set by the web page author and if supported (fp6.0.65+ on Win/Mac OS only)
						showExpressInstall(regObjArr[i]);
					}
					else { // Flash plug-in and Flash content version mismatch: display alternative content instead of Flash content
						displayAltContent(obj);
					}
				}
			}
			else {	// If no fp is installed, we let the object element do its job (show alternative content)
				setVisibility(id, true);
			}
		}
	}
	
	/* Fix nested param elements, which are ignored by older webkit engines
		- This includes Safari up to and including version 1.2.2 on Mac OS 10.3
		- Fall back to the proprietary embed element
	*/
	function fixParams(obj) {
		var nestedObj = obj.getElementsByTagName(OBJECT)[0];
		if (nestedObj) {
			var e = createElement("embed"), a = nestedObj.attributes;
			if (a) {
				var al = a.length;
				for (var i = 0; i < al; i++) {
					if (a[i].nodeName == "DATA") {
						e.setAttribute("src", a[i].nodeValue);
					}
					else {
						e.setAttribute(a[i].nodeName, a[i].nodeValue);
					}
				}
			}
			var c = nestedObj.childNodes;
			if (c) {
				var cl = c.length;
				for (var j = 0; j < cl; j++) {
					if (c[j].nodeType == 1 && c[j].nodeName == "PARAM") {
						e.setAttribute(c[j].getAttribute("name"), c[j].getAttribute("value"));
					}
				}
			}
			obj.parentNode.replaceChild(e, obj);
		}
	}
	
	/* Show the Adobe Express Install dialog
		- Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
	*/
	function showExpressInstall(regObj) {
		isExpressInstallActive = true;
		var obj = getElementById(regObj.id);
		if (obj) {
			if (regObj.altContentId) {
				var ac = getElementById(regObj.altContentId);
				if (ac) {
					storedAltContent = ac;
					storedAltContentId = regObj.altContentId;
				}
			}
			else {
				storedAltContent = abstractAltContent(obj);
			}
			if (!(/%$/.test(regObj.width)) && parseInt(regObj.width, 10) < 310) {
				regObj.width = "310";
			}
			if (!(/%$/.test(regObj.height)) && parseInt(regObj.height, 10) < 137) {
				regObj.height = "137";
			}
			doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
			var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
				dt = doc.title,
				fv = "MMredirectURL=" + win.location + "&MMplayerType=" + pt + "&MMdoctitle=" + dt,
				replaceId = regObj.id;
			// For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
			// In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
			if (ua.ie && ua.win && obj.readyState != 4) {
				var newObj = createElement("div");
				replaceId += "SWFObjectNew";
				newObj.setAttribute("id", replaceId);
				obj.parentNode.insertBefore(newObj, obj); // Insert placeholder div that will be replaced by the object element that loads expressinstall.swf
				obj.style.display = "none";
				var fn = function() {
					obj.parentNode.removeChild(obj);
				};
				addListener(win, "onload", fn);
			}
			createSWF({ data:regObj.expressInstall, id:EXPRESS_INSTALL_ID, width:regObj.width, height:regObj.height }, { flashvars:fv }, replaceId);
		}
	}
	
	/* Functions to abstract and display alternative content
	*/
	function displayAltContent(obj) {
		if (ua.ie && ua.win && obj.readyState != 4) {
			// For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
			// In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
			var el = createElement("div");
			obj.parentNode.insertBefore(el, obj); // Insert placeholder div that will be replaced by the alternative content
			el.parentNode.replaceChild(abstractAltContent(obj), el);
			obj.style.display = "none";
			var fn = function() {
				obj.parentNode.removeChild(obj);
			};
			addListener(win, "onload", fn);
		}
		else {
			obj.parentNode.replaceChild(abstractAltContent(obj), obj);
		}
	} 

	function abstractAltContent(obj) {
		var ac = createElement("div");
		if (ua.win && ua.ie) {
			ac.innerHTML = obj.innerHTML;
		}
		else {
			var nestedObj = obj.getElementsByTagName(OBJECT)[0];
			if (nestedObj) {
				var c = nestedObj.childNodes;
				if (c) {
					var cl = c.length;
					for (var i = 0; i < cl; i++) {
						if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
							ac.appendChild(c[i].cloneNode(true));
						}
					}
				}
			}
		}
		return ac;
	}
	
	/* Cross-browser dynamic SWF creation
	*/
	function createSWF(attObj, parObj, id) {
		var r, el = getElementById(id);
		if (el) {
			if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
				attObj.id = id;
			}
			if (ua.ie && ua.win) { // IE, the object element and W3C DOM methods do not combine: fall back to outerHTML
				var att = "";
				for (var i in attObj) {
					if (attObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries, like Object.prototype.toJSONString = function() {}
						if (i.toLowerCase() == "data") {
							parObj.movie = attObj[i];
						}
						else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
							att += ' class="' + attObj[i] + '"';
						}
						else if (i.toLowerCase() != "classid") {
							att += ' ' + i + '="' + attObj[i] + '"';
						}
					}
				}
				var par = "";
				for (var j in parObj) {
					if (parObj[j] != Object.prototype[j]) { // Filter out prototype additions from other potential libraries
						par += '<param name="' + j + '" value="' + parObj[j] + '" />';
					}
				}
				el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
				objIdArr[objIdArr.length] = attObj.id; // Stored to fix object 'leaks' on unload (dynamic publishing only)
				r = getElementById(attObj.id);	
			}
			else if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements: fall back to the proprietary embed element
				var e = createElement("embed");
				e.setAttribute("type", FLASH_MIME_TYPE);
				for (var k in attObj) {
					if (attObj[k] != Object.prototype[k]) { // Filter out prototype additions from other potential libraries
						if (k.toLowerCase() == "data") {
							e.setAttribute("src", attObj[k]);
						}
						else if (k.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
							e.setAttribute("class", attObj[k]);
						}
						else if (k.toLowerCase() != "classid") { // Filter out IE specific attribute
							e.setAttribute(k, attObj[k]);
						}
					}
				}
				for (var l in parObj) {
					if (parObj[l] != Object.prototype[l]) { // Filter out prototype additions from other potential libraries
						if (l.toLowerCase() != "movie") { // Filter out IE specific param element
							e.setAttribute(l, parObj[l]);
						}
					}
				}
				el.parentNode.replaceChild(e, el);
				r = e;
			}
			else { // Well-behaving browsers
				var o = createElement(OBJECT);
				o.setAttribute("type", FLASH_MIME_TYPE);
				for (var m in attObj) {
					if (attObj[m] != Object.prototype[m]) { // Filter out prototype additions from other potential libraries
						if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
							o.setAttribute("class", attObj[m]);
						}
						else if (m.toLowerCase() != "classid") { // Filter out IE specific attribute
							o.setAttribute(m, attObj[m]);
						}
					}
				}
				for (var n in parObj) {
					if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // Filter out prototype additions from other potential libraries and IE specific param element
						createObjParam(o, n, parObj[n]);
					}
				}
				el.parentNode.replaceChild(o, el);
				r = o;
			}
		}
		return r;
	}
	
	function createObjParam(el, pName, pValue) {
		var p = createElement("param");
		p.setAttribute("name", pName);	
		p.setAttribute("value", pValue);
		el.appendChild(p);
	}
	
	/* Cross-browser SWF removal
		- Especially needed to safely and completely remove a SWF in Internet Explorer
	*/
	function removeSWF(id) {
		var obj = getElementById(id);
		if (obj && (obj.nodeName == "OBJECT" || obj.nodeName == "EMBED")) {
			if (ua.ie && ua.win) {
				if (obj.readyState == 4) {
					removeObjectInIE(id);
				}
				else {
					win.attachEvent("onload", function() {
						removeObjectInIE(id);
					});
				}
			}
			else {
				obj.parentNode.removeChild(obj);
			}
		}
	}
	
	function removeObjectInIE(id) {
		var obj = getElementById(id);
		if (obj) {
			for (var i in obj) {
				if (typeof obj[i] == "function") {
					obj[i] = null;
				}
			}
			obj.parentNode.removeChild(obj);
		}
	}
	
	/* Functions to optimize JavaScript compression
	*/
	function getElementById(id) {
		var el = null;
		try {
			el = doc.getElementById(id);
		}
		catch (e) {}
		return el;
	}
	
	function createElement(el) {
		return doc.createElement(el);
	}
	
	/* Updated attachEvent function for Internet Explorer
		- Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
	*/	
	function addListener(target, eventType, fn) {
		target.attachEvent(eventType, fn);
		listenersArr[listenersArr.length] = [target, eventType, fn];
	}
	
	/* Flash Player and SWF content version matching
	*/
	function hasPlayerVersion(rv) {
		var pv = ua.pv, v = rv.split(".");
		v[0] = parseInt(v[0], 10);
		v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
		v[2] = parseInt(v[2], 10) || 0;
		return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
	}
	
	/* Cross-browser dynamic CSS creation
		- Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
	*/	
	function createCSS(sel, decl) {
		if (ua.ie && ua.mac) {
			return;
		}
		var h = doc.getElementsByTagName("head")[0], s = createElement("style");
		s.setAttribute("type", "text/css");
		s.setAttribute("media", "screen");
		if (!(ua.ie && ua.win) && typeof doc.createTextNode != UNDEF) {
			s.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
		}
		h.appendChild(s);
		if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
			var ls = doc.styleSheets[doc.styleSheets.length - 1];
			if (typeof ls.addRule == OBJECT) {
				ls.addRule(sel, decl);
			}
		}
	}
	
	function setVisibility(id, isVisible) {
		var v = isVisible ? "visible" : "hidden";
		if (isDomLoaded && getElementById(id)) {
			getElementById(id).style.visibility = v;
		}
		else {
			createCSS("#" + id, "visibility:" + v);
		}
	}

	/* Filter to avoid XSS attacks 
	*/
	function urlEncodeIfNecessary(s) {
		var regex = /[\\\"<>\.;]/;
		var hasBadChars = regex.exec(s) != null;
		return hasBadChars ? encodeURIComponent(s) : s;
	}
	
	/* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
	*/
	var cleanup = function() {
		if (ua.ie && ua.win) {
			window.attachEvent("onunload", function() {
				// remove listeners to avoid memory leaks
				var ll = listenersArr.length;
				for (var i = 0; i < ll; i++) {
					listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
				}
				// cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
				var il = objIdArr.length;
				for (var j = 0; j < il; j++) {
					removeSWF(objIdArr[j]);
				}
				// cleanup library's main closures to avoid memory leaks
				for (var k in ua) {
					ua[k] = null;
				}
				ua = null;
				for (var l in swfobject) {
					swfobject[l] = null;
				}
				swfobject = null;
			});
		}
	}();
	
	
	return {
		/* Public API
			- Reference: http://code.google.com/p/swfobject/wiki/SWFObject_2_0_documentation
		*/ 
		registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr) {
			if (!ua.w3cdom || !objectIdStr || !swfVersionStr) {
				return;
			}
			var regObj = {};
			regObj.id = objectIdStr;
			regObj.swfVersion = swfVersionStr;
			regObj.expressInstall = xiSwfUrlStr ? xiSwfUrlStr : false;
			regObjArr[regObjArr.length] = regObj;
			setVisibility(objectIdStr, false);
		},
		
		getObjectById: function(objectIdStr) {
			var r = null;
			if (ua.w3cdom) {
				var o = getElementById(objectIdStr);
				if (o) {
					var n = o.getElementsByTagName(OBJECT)[0];
					if (!n || (n && typeof o.SetVariable != UNDEF)) {
							r = o;
					}
					else if (typeof n.SetVariable != UNDEF) {
						r = n;
					}
				}
			}
			return r;
		},
		
		embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj) {
			if (!ua.w3cdom || !swfUrlStr || !replaceElemIdStr || !widthStr || !heightStr || !swfVersionStr) {
				return;
			}
			widthStr += ""; // Auto-convert to string
			heightStr += "";
			if (hasPlayerVersion(swfVersionStr)) {
				setVisibility(replaceElemIdStr, false);
				var att = {};
				if (attObj && typeof attObj === OBJECT) {
					for (var i in attObj) {
						if (attObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries
							att[i] = attObj[i];
						}
					}
				}
				att.data = swfUrlStr;
				att.width = widthStr;
				att.height = heightStr;
				var par = {}; 
				if (parObj && typeof parObj === OBJECT) {
					for (var j in parObj) {
						if (parObj[j] != Object.prototype[j]) { // Filter out prototype additions from other potential libraries
							par[j] = parObj[j];
						}
					}
				}
				if (flashvarsObj && typeof flashvarsObj === OBJECT) {
					for (var k in flashvarsObj) {
						if (flashvarsObj[k] != Object.prototype[k]) { // Filter out prototype additions from other potential libraries
							if (typeof par.flashvars != UNDEF) {
								par.flashvars += "&" + k + "=" + flashvarsObj[k];
							}
							else {
								par.flashvars = k + "=" + flashvarsObj[k];
							}
						}
					}
				}
				addDomLoadEvent(function() {
					createSWF(att, par, replaceElemIdStr);
					if (att.id == replaceElemIdStr) {
						setVisibility(replaceElemIdStr, true);
					}
				});
			}
			else if (xiSwfUrlStr && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) {
				isExpressInstallActive = true; // deferred execution
				setVisibility(replaceElemIdStr, false);
				addDomLoadEvent(function() {
					var regObj = {};
					regObj.id = regObj.altContentId = replaceElemIdStr;
					regObj.width = widthStr;
					regObj.height = heightStr;
					regObj.expressInstall = xiSwfUrlStr;
					showExpressInstall(regObj);
				});
			}
		},
		
		getFlashPlayerVersion: function() {
			return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
		},
		
		hasFlashPlayerVersion: hasPlayerVersion,
		
		createSWF: function(attObj, parObj, replaceElemIdStr) {
			if (ua.w3cdom) {
				return createSWF(attObj, parObj, replaceElemIdStr);
			}
			else {
				return undefined;
			}
		},
		
		removeSWF: function(objElemIdStr) {
			if (ua.w3cdom) {
				removeSWF(objElemIdStr);
			}
		},
		
		createCSS: function(sel, decl) {
			if (ua.w3cdom) {
				createCSS(sel, decl);
			}
		},
		
		addDomLoadEvent: addDomLoadEvent,
		
		addLoadEvent: addLoadEvent,
		
		getQueryParamValue: function(param) {
			var q = doc.location.search || doc.location.hash;
			if (param == null) {
				return urlEncodeIfNecessary(q);
			}
			if (q) {
				var pairs = q.substring(1).split("&");
				for (var i = 0; i < pairs.length; i++) {
					if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
						return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
					}
				}
			}
			return "";
		},
		
		// For internal usage only
		expressInstallCallback: function() {
			if (isExpressInstallActive && storedAltContent) {
				var obj = getElementById(EXPRESS_INSTALL_ID);
				if (obj) {
					obj.parentNode.replaceChild(storedAltContent, obj);
					if (storedAltContentId) {
						setVisibility(storedAltContentId, true);
						if (ua.ie && ua.win) {
							storedAltContent.style.display = "block";
						}
					}
					storedAltContent = null;
					storedAltContentId = null;
					isExpressInstallActive = false;
				}
			} 
		}
	};
}();
// grabi  
var nurl;
nurl = 1;

function more_urls() {
  var urls;
  var i;
  urls = new Array();
  //if (nmaxalert !== null && nurl > nmaxalert - nalert) {
  //if (confirm('You have exceeded the maximum number of alerts you are ' +
  //'allowed to set. Would you like to learn how to increase ' +
  //'this limit?') == true) location = '/help';
  //return;
  // }

  for (i = 0; i < nurl; i++) urls.push(document.getElementById('url' + i).value);
  s = '';
  for (i = 0; i < nurl + 1; i++) {
  s += ('<input type="text" id="url' + i + '" name="urls[]" style="color: #000000; width: 100%; margin-top: 3">' +
  '<br>');
  }
  document.getElementById('urlsarea').innerHTML += ('<br>' +
  '<input type="text" id="url' + nurl + '" name="urls[]" style="color: #000000; width: 100%; margin-top: 3">');
  for (i = 0; i < nurl; i++) document.getElementById('url' + i).value = urls[i];
  nurl++;
}

function is_urls_empty() {
  var urls;
  var i;
  for (i = 0; i < nurl; i++) { 
    if (document.getElementById('url' + i).value =='') {
      alert("Empty URL! Please input!");
	  return true;
	}
  }
  return false;
}    function loadYTPlayer(location, autostart) {
       para = { allowScriptAccess: "always", allowFullScreen:"true", play: "true", loop: "true"};
       atts = { id: "myytplayer", wmode: "opaque", width:"780", height:"400", zIndex:"200" };
       ytautostart = autostart;
       swfobject.embedSWF("http://www.youtube.com/apiplayer?enablejsapi=1&playerapiid=myytplayer", 
                       location, "425", "356", "9.0.0", null, null, para, atts);
            
    }
        function updateHTML(elmId, value) {
          document.getElementById(elmId).innerHTML = value;
        }

        function setytplayerState(newState) {
          updateHTML("playerstate", newState);
          if (document.getElementById('hookstate')== undefined) {
             // Play right away
             if (newState == 5)
               play();
             // Replay after stop
             //if (newState == 0)
             //   play();
          } else {
            hookplayerState(newState);
            
           }
        }

        function onYouTubePlayerReady(playerId) {
          ytplayer = document.getElementById(playerId);
          if (document.getElementById('swfhidden')!= undefined)
            ytplayer.style.visibility = 'hidden';
          ytInfoEvent = setInterval(updateytplayerInfo, 3000);
          updateytplayerInfo();
		  if (document.getElementById('detectend')!= undefined) 
		    ytDetectEndEvent = setInterval(detectytplayer, 2000);
          ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
          ytplayer.addEventListener("onError", "onPlayerError"); 
		  if (document.getElementById('playerload')!= undefined) { 
			 if (ytautostart != false)
			   ytplayer.loadVideoById(vid);
			 else
			   ytplayer.cueVideoById(vid);   
	      }
		}
		
		function startYTEvents() {
		   if (typeof ytplayer != 'undefined') {
		     ytInfoEvent = setInterval(updateytplayerInfo, 3000);
		     if (document.getElementById('detectend')!= undefined) 
		        ytDetectEndEvent = setInterval(detectytplayer, 2000);  
		   }
		}
		               
        function stopYTEvents() {
		   if (typeof ytInfoEvent != 'undefined' && ytInfoEvent != 0) {
		     clearInterval(ytInfoEvent);
			 ytInfoEvent = 0;
		   }
		   if (typeof ytDetectEndEvent != 'undefined' && ytDetectEvent != 0) {
		     clearInterval(ytDetectEndEvent);
			 ytDetectEndEvent = 0;
		   }
			
		}
		
        function onytplayerStateChange(newState) {
          setytplayerState(newState);
        }

        function onPlayerError(errorCode) {
          
		   if (document.getElementById('hookerror')== undefined) {
           
             alert("An error occurred: "+ errorCode);
		  } else {
            hookplayerError(errorCode);
            
           }
        }

        function updateytplayerInfo() {
          updateHTML("bytesloaded", getBytesLoaded());
          updateHTML("bytestotal", getBytesTotal());
          updateHTML("videoduration", getDuration());
          updateHTML("videotime", getCurrentTime());
          updateHTML("startbytes", getStartBytes());
        }

        // functions for the api calls
        function play() {
          if (typeof ytplayer != 'undefined') {           
          //  if (document.getElementById('playerload')!= undefined) { 
			//    ytplayer.loadVideoById(vid, nextStartSeconds); 
	       // } else {
				ytplayer.playVideo();
			//}
		  }
        }

        function pause() {
          if (typeof ytplayer != 'undefined') {
            if (document.getElementById('playerload')!= undefined) {                
			   nextStartSeconds = ytplayer.getCurrentTime();  	          
	        }
			ytplayer.pauseVideo();	
          }
        }

        function stop() {
          if (typeof ytplayer != 'undefined') {
            ytplayer.stopVideo();
          }
        }

        function clear() {
          if (typeof ytplayer != 'undefined' ) {
            ytplayer.clearVideo();
          }
        }
		
        function getPlayerState() {
          if (typeof ytplayer != 'undefined') {
            return ytplayer.getState();
          }
        }

        function seekTo(seconds) {
          if (typeof ytplayer != 'undefined') {
            ytplayer.seekTo(seconds, true);
          }
        }

        function getBytesLoaded() {
          if (typeof ytplayer != 'undefined') {
            return ytplayer.getVideoBytesLoaded();
          }
        }

        function getBytesTotal() {
          if (typeof ytplayer != 'undefined') {
            return ytplayer.getVideoBytesTotal();
          }
        }

        function getCurrentTime() {
          if (typeof ytplayer != 'undefined') {
            return ytplayer.getCurrentTime();
          }
        }

        function getDuration() {
          if (typeof ytplayer != 'undefined') {
            return ytplayer.getDuration();
          }
        }

        function getStartBytes() {
          if (typeof ytplayer != 'undefined') {
            return ytplayer.getVideoStartBytes();
          }
        }

        function mute() {
          if (typeof ytplayer != 'undefined') {
            ytplayer.mute();
          }
        }

        function unMute() {
          if (typeof ytplayer != 'undefined') {
            ytplayer.unMute();
          }
        }
	function loadMCPlayer(player, src, location, autoStart) { 
  //"playerVars=showStats=no|autoPlay=yes|videoTitle="
  // However, swfobject will generate showStats=no&autoPlay=yes&videoTitle="
  //var flashvars = {playerVars:"showStats=no", autoPlay: "yes", videoTitle:""};
  if (autoStart != false)
    var flashvars = {autoPlay: "yes", file: src, autoStart: "true"};
  else 
    var flashvars = {autoPlay: "yes", file: src, autoStart: "false"};
  var para = {allowScriptAccess: "always", allowFullScreen:"true", wmode: "opaque", width:"780", height:"400", play: "true", loop: "true"};
  var atts = { id: "mymcplayer", name: "mcplaylist", autoPlay: "yes"};
      // swfobject.embedSWF("http://www.youtube.com/apiplayer?enablejsapi=1&playerapiid=myytplayer", 
      //                 location, "425", "356", "9.0.0", null, null, para, atts);
     //var so = new SWFObject("http://www.metacafe.com/fplayer/", "mymcplayer", "700", "550", "7", "#FFFFFF"); 
  // var so = new SWFObject(src, "mymcplayer", "700", "550", "7", "#FFFFFF"); 

    // Can't auto play
	swfobject.embedSWF(player,location, "425", "356", "9.0.0", "http://www.macromedia.com/go/getflashplayer", flashvars, para, atts);
	//This won't work. The mcplayer won't be ready. It may be better to use body onload=
	// However, the safest way is to call form AS to Javascript. E.g. ExternalInterface.call("onMCPlayerReady");
	//swfobject.addLoadEvent(onMCPlayerLoad);
	// Not always auto play 
	//document.getElementById(location).innerHTML = '<div style="background:#000000;width:400px;height:348px"><embed flashVars="playerVars=showStats=no|autoPlay=yes|videoTitle="  src="' + src + '" width="400" height="348" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"> </embed></div>';
	
}

function onMCPlayerReady() {
  mcplayer = document.getElementById("mymcplayer");
  //mcplayer = document.getElementById(playerid);
  if (mcplayer != null && mcplayer != undefined) { 
    mcplayer.addEventHash("onComplete", "onmcplayerComplete");
    mcplayer.addEventHash("onStateChange", "onmcplayerStateChange");  
    //mcplayer.playSrc(ss.cursrc());
  } else {
    alert("Player is not ready!");
  }
  //simulateClick();
}

function stopNZVideo() {
  if (typeof mcplayer != "undefined")
    mcplayer.stopit();
}

function closeNZVideo() {
  if (typeof mcplayer != "undefined")
    mcplayer.closeit();
}

function cleanNZVideo() {
  if (typeof mcplayer != "undefined")
    mcplayer.cleanit();
}

function nzpause() {
  if (typeof mcplayer != "undefined")
    mcplayer.pauseit();
}

function nzplay() {
  if (typeof mcplayer != "undefined")
    mcplayer.playit();
}


function onmcplayerStateChange(newState) {
  //alert(newState); 
}

function onmcplayerComplete() {
  if (typeof ss != "undefined") {
    a_next_slide();     
  }
}

function simulateClick() {
  var evt = document.createEvent("MouseEvents");
 // evt.initMouseEvent("click", true, true, window,
 //   1, 367, 444, 367, 280, false, false, false, false, 0, null);
 evt.initMouseEvent("mousedown", true, true, window,
    1, 367, 444, 367, 280, false, false, false, false, 0, null);
  var cb = document.getElementById("mymcplayer"); 
  var canceled = !cb.dispatchEvent(evt);
  if(canceled) {
    // A handler called preventDefault
    //alert("canceled");
  } else {
    // None of the handlers called preventDefault
    //alert("not canceled");
  }
}function pslide(etype, eid, title, url, src) {
  s = new slide(); 
  s.type = etype;
  s.src =  url;
  s.id =  eid;
  //s.link = url;
  if (s.type == 'flickr') {
    s.link = "/image/details?id=" + eid + "&layout=basic-layout";
  } else if (s.type == 'youtube') {
    s.link = "/video/details?id=" + eid;
  } else if (s.type == 'metacafe') {
    s.src = src 
    s.link = "/video/details?id=" + eid;
  } else if (s.type == 'img') {
  s.link = url
  }

  s.title = title;
  s.text = "";

  //s.target = "";
  //s.attr = "";
  //s.filter = "";
  //s.timeout = "";
  return s;
}

    function initialize_slides(autostart) {      
       load_by_request = false; 
       ss.update2(autostart);
       if (autostart != false)
         ss.play();
    }
    
    function restart_slides() {      
       var start_stop = document.getElementById('ss_ss')      
       //ss.update2();
       ss.next2();
       ss.play();
       start_stop.innerHTML = '<SPAN ID="ss_ss_value" >Pause</SPAN>';
       start_stop.href = 'javascript:stop_slides();';
    }
    
    function stop_slides() {
       var start_stop = document.getElementById('ss_ss')
       ss.pause();
       start_stop.innerHTML = '<SPAN ID="ss_ss_value" >Start</SPAN>';
       start_stop.href = 'javascript:restart_slides();';
    }
    
    //Avoid next_slide conflict in slideshow.js
    function t_next_slide() {
       load_by_request = true;
       //Turn off youtube events:Click next by switching from youtube to metacafe 
       if (ss.curtype() == 'youtube') {       
         //stop();
         stopYTEvents();
       }
       if (ss.curtype() == 'metacafe') {
         //stopNZplayer();  
       }
       var start_stop = document.getElementById('ss_ss')
       start_stop.innerHTML = '<SPAN ID="ss_ss_value" >Pause</SPAN>';
       start_stop.href = 'javascript:stop_slides();';
       ss.next();
       ss.play();
    }
    
    //Automatic go to next slide while finish because of callback function from video player
    function a_next_slide() {
       load_by_request = false;
       ss.next();
       ss.play();
    }
	
	function goto_slide(i) {
       load_by_request = true;
       ss.goto_slide(i);
    }
    
    function random_slide() {
       load_by_request = true;
       ss.goto_random_slide();
       ss.play();
    }
    
    function previous_slide() {
       load_by_request = true;
       ss.previous();
       ss.play();
    }
    
    function shuffle_slides() {      
       load_by_request = true;
       ss.shuffle(); 
       config_ss_select();
       ss.update2();
       ss.play();
    }
    
    // Video hookup
    function hookplayerError(errorCode) {
	  //alert("An error occurred: "+ errorCode + " Click next to play!");	
	  alert("Can't be played! Embedding disabled by YouTube! Please click next!")
	}
	
	//unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).	
    function hookplayerState(newState) {
       // Start of video
       if (newState == 5) {	   	            
       }
       // End of video
       if (newState == 0) {
          stopYTEvents();
          if (load_by_request != true) {
            a_next_slide();
          }
          load_by_request = false;         
       }
    };
