<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="SEOmoz - Beyond the Blog" directory_title="SEOmoz - Beyond the Blog" title_url="http://www.seomoz.org" description="SEOmoz Videos and Resources." author="Gadzi" author_email="gadgets@gadzi.com" author_location="Honolulu, Hawaii" author_photo="http://hosting.gmodules.com/ig/gadgets/file/104462838893004134091/profile.jpg" author_aboutme="My name is Patrick Sexton I am a consultant for gadget strategies for brand promotion. I discuss Google gadgets at SEOish.com" author_link="http://www.seoish.com" author_quote="Flying is learning how to throw yourself at the ground and miss. - Douglas Adams" screenshot="http://hosting.gmodules.com/ig/gadgets/file/104462838893004134091/seomoz-beyond-the-blog.png" thumbnail="http://hosting.gmodules.com/ig/gadgets/file/104462838893004134091/seomoz-beyond-the-blog-tn.png" width="300" height="290">
<Require feature="flash"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
<script type="text/javascript">

var playlistId = "FE6456A74EDA008D";
var playlistUserQsId = "B79CD7FC8670497D";
var allVideoIds = [];
var currVideoIdx = 0;
var allUserQVideoIds = [];
var currUserQVideoIdx = 0;
var allNewsItems = [];

var kYouChooseMode = 0;
var kUserQsMode = 1;
var kNewsMode = 2;
var kSubmitMode = 3;

function gadgetInit()
{

_IG_FetchXmlContent("http://www.youtube.com/api2_rest?method=youtube%2Evideos%2Elist%5Fby%5Fplaylist&id=" + playlistId, function (response)
{
if (response == null || typeof(response) != "object" || response.firstChild == null)
return;

var videoIds = response.getElementsByTagName("id");

if(videoIds.length == 0)
return;

for(var i = 0; i < videoIds.length; i++)
allVideoIds.push(videoIds[i].firstChild.nodeValue);

fisherYates(allVideoIds);

currVideoIdx = 0;
switchToMode(kYouChooseMode);
});


_IG_FetchXmlContent("http://feeds.feedburner.com/youmoz", function (response)
{
if (response == null || typeof(response) != "object" || response.firstChild == null)
return;

var newsItems = response.getElementsByTagName('item');

for(var i = 0; i < newsItems.length; i++)
{
var link = newsItems[i].getElementsByTagName('link')[0].firstChild.nodeValue;
var title = newsItems[i].getElementsByTagName('title')[0].firstChild.nodeValue;
var description = newsItems[i].getElementsByTagName('description')[0].firstChild.nodeValue;

allNewsItems.push({link:link,title:title,description:description});
}

showNews();
});


_IG_FetchXmlContent("http://www.youtube.com/api2_rest?method=youtube%2Evideos%2Elist%5Fby%5Fplaylist&id=" + playlistUserQsId, function (response)
{
if (response == null || typeof(response) != "object" || response.firstChild == null)
return;

var videoIds = response.getElementsByTagName("id");

if(videoIds.length == 0)
return;

for(var i = 0; i < videoIds.length; i++)
allUserQVideoIds.push(videoIds[i].firstChild.nodeValue);

fisherYates(allUserQVideoIds);

currUserQVideoIdx = 0;
});

_gel("topCellImg0").src = _IG_GetImageUrl("http://hosting.gmodules.com/ig/gadgets/file/104462838893004134091/title1.png");
_gel("topCellImg1").src = _IG_GetImageUrl("http://hosting.gmodules.com/ig/gadgets/file/104462838893004134091/title2.png");
_gel("topCellImg2").src = _IG_GetImageUrl("http://hosting.gmodules.com/ig/gadgets/file/104462838893004134091/title3.png");
_gel("topCellImg3").src = _IG_GetImageUrl("http://hosting.gmodules.com/ig/gadgets/file/104462838893004134091/title4.png");


_gel("imgLogo").src = _IG_GetImageUrl("http://hosting.gmodules.com/ig/gadgets/file/104462838893004134091/logo.png");
fixPNG(_gel('imgLogo'));

_gel("gradientBgDiv").style.backgroundImage = "url(" + _IG_GetImageUrl("http://hosting.gmodules.com/ig/gadgets/file/104462838893004134091/gradient.png") + ")";
}

function fisherYates ( myArray ) {
var i = myArray.length;
if ( i == 0 ) return false;
while ( --i ) {
var j = Math.floor( Math.random() * ( i + 1 ) );
var tempi = myArray[i];
var tempj = myArray[j];
myArray[i] = tempj;
myArray[j] = tempi;
}
}

function prevVideo()
{
if((currVideoIdx = currVideoIdx - 1) < 0)
currVideoIdx = allVideoIds.length - 1;

loadVideo(currVideoIdx, true);
}

function nextVideo()
{
if((currVideoIdx = 1 + currVideoIdx) == allVideoIds.length)
currVideoIdx = 0;

loadVideo(currVideoIdx, true);
}

function embedFlash(youtubeId, divId, playNow)
{
_gel(divId).innerHTML = "";

_IG_EmbedFlash('http://www.youtube.com/v/' + youtubeId, divId,
{
swf_version: 6,
id: "flashmovie",
width: 317,
height: 180,
flashvars: ((playNow)? 'autoplay=true':'')
});
}

function writeSelectingArrows(videoIdx, videoTotal, prevVideoFunc, nextVideoFunc)
{
var out = "<center><table border=0 cellspacing=0 cellpadding=0><tr>";
out += "<td valign=middle width=16><a href='javascript:void(0)' onClick='"+ prevVideoFunc +"()'>";
out += "<img id=leftArrowImg width=16 height=16 src='"+ _IG_GetImageUrl("http://www.gadzi.com/gadgets/happyslip/left-arrow.png") +"' border=0></img></a></td>";
out += "<td valign=middle width=40 align=center><span style='font-size:9px'> "+(1 + videoIdx)+" OF "+ videoTotal +" </span></td>";
out += "<td valign=middle width=16><a href='javascript:void(0)' onClick='"+ nextVideoFunc +"()'>";
out += "<img id=rightArrowImg height=16 width=16 src='"+ _IG_GetImageUrl("http://www.gadzi.com/gadgets/happyslip/right-arrow.png") +"' border=0></img></a></td>";
out += "</tr></table></center>";

_gel('selectingArrowsDiv').innerHTML = out;
_gel('selectingArrowsDiv').style.display = "block";

fixPNG(_gel('leftArrowImg'));
fixPNG(_gel('rightArrowImg'));
}

function loadVideo(videoIdx, playNow)
{
if(allVideoIds.length <= videoIdx)
return;

currVideoIdx = videoIdx;

embedFlash(allVideoIds[videoIdx], 'youChooseDiv', playNow);

writeSelectingArrows(currVideoIdx, allVideoIds.length, 'prevVideo', 'nextVideo');
}

function prevUserVideo()
{
if((currUserQVideoIdx = currUserQVideoIdx - 1) < 0)
currUserQVideoIdx = allUserQVideoIds.length - 1;

loadUserVideo(currUserQVideoIdx, true);
}

function nextUserVideo()
{
if((currUserQVideoIdx = 1 + currUserQVideoIdx) == allUserQVideoIds.length)
currUserQVideoIdx = 0;

loadUserVideo(currUserQVideoIdx, true);
}

function loadUserVideo(videoIdx, playNow)
{
if(allUserQVideoIds.length <= videoIdx)
return;

currUserQVideoIdx = videoIdx;

embedFlash(allUserQVideoIds[videoIdx], 'userQsDiv', playNow);

writeSelectingArrows(currUserQVideoIdx, allUserQVideoIds.length, 'prevUserVideo', 'nextUserVideo');
}


function showNews()
{
var out = "<div class=newsHead>YouMoz</div><div class=newsSubHead>Articles from SEOmoz members</div>";

for(var i = 0; i < Math.min(allNewsItems.length, 5); i++)
{
out += "<div style='margin-top:8px'><a class=newsArticleTitle href='"+allNewsItems[i].link+"' target=_blank>"+allNewsItems[i].title+"</a></div>";
out += "<div class=newsArticle>"+allNewsItems[i].description+"</span></div>";
}

_gel('newsDiv').innerHTML = out;
}

function switchToMode(mode)
{
var modeName = '';

switch(mode)
{
case kYouChooseMode: modeName = "youChoose"; break;
case kUserQsMode: modeName = "userQs"; break;
case kNewsMode: modeName = "news"; break;
case kSubmitMode: modeName = "submit"; break;
}



var modeDivs = ['youChooseDiv', 'userQsDiv', 'newsDiv', 'submitDiv'];
var modeCells = ['youChooseCell', 'userQsCell', 'newsCell', 'submitCell'];

for(var i = 0; i < modeDivs.length; i++)
{
if(mode == i)
{
_gel(modeDivs[i]).style.display = "block";
_gel(modeCells[i]).style.borderBottom = "0px";
}
else
{
_gel(modeDivs[i]).style.display = "none";
_gel(modeCells[i]).style.borderBottom = "1px solid #d9d9d9";
}
}

if(mode == kYouChooseMode)
loadVideo(currVideoIdx, false);
else
_gel('youChooseDiv').innerHTML = "";

if(mode == kUserQsMode)
loadUserVideo(currUserQVideoIdx, false);
else
_gel('userQsDiv').innerHTML = "";

if(mode != kYouChooseMode && mode != kUserQsMode)
_gel('selectingArrowsDiv').style.display = "none";
}


_IG_RegisterOnloadHandler(gadgetInit);

function fixPNG(img)
{
if (!(/MSIE (5\.5|6).+Win/.test(navigator.userAgent)))
return;

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

if ((version >= 5.5) && (document.body.filters))
{
var imgName = img.src.toUpperCase()
if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
{
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + img.src + "\');\"></span>"
img.outerHTML = strNewHTML
}
}
}


</script>
<style type="text/css">
* { font-family: times }
.bluehead { color:#183387; font-size: 14px }
.redhead { color:#b82e27; font-size: 14px }
.videoIdx { color: gray; font-size: 10px }
.loading { color: gray; font-size: 18px }
.submitSub { color: gray; font-size:12px }
.newsHead { color: black; font-size:14px; font-weight:bold; border-bottom:1px solid gray }
.newsSubHead { color: gray; font-size:10px; }
.newsArticle { margin-top: 7px }
.newsArticleTitle { font-size:12px;font-weight:bold }
.feedflare { display: none }

.newsArticle { font-size:11px }
</style>

<div style='padding:0px;margin:0px;overflow:hidden'>

<div style='margin:0px;'>
<div id=gradientBgDiv style='margin:0px;background-color:#fff;background-repeat-y:no-repeat;background-position:0px -22px;padding:8px;padding-left:13px;'>
<img src='' id=imgLogo width=144 height=31>
</div>

<div style='margin-left:10px;'>
<table border=0 cellspacing=0 cellpadding=0 width="100%">
<tr>
<td style='border-bottom:1px solid #d9d9d9' width=20>&nbsp;</td>
<td valign=bottom align=right width=77 id=youChooseCell><a href="javascript:void(0)" onClick="switchToMode(kYouChooseMode)"><img id=topCellImg0 border=0 src=""></a></td>
<td valign=bottom align=right width=56 id=userQsCell><a href="javascript:void(0)" onClick="switchToMode(kUserQsMode)"><img id=topCellImg1 border=0 src=""></a></td>
<td valign=bottom align=right width=62 id=newsCell><a href="javascript:void(0)" onClick="switchToMode(kNewsMode)"><img id=topCellImg2 border=0 src=""></a></td>
<td valign=bottom align=right width=74 id=submitCell><a href="javascript:void(0)" onClick="switchToMode(kSubmitMode)"><img id=topCellImg3 border=0 src=""/></a></td>
<td style='border-bottom:1px solid #d9d9d9'>&nbsp;</td>
</td></tr>
</table>
</div>
</div>

<div id='youChooseDiv' style='margin-left:10px;margin-top:5px;text-align:center;height:182px;'>
<p style='margin-top:80px' class=loading>Loading...</span>
</div>

<div id='userQsDiv' style='margin-left:10px;margin-top:5px;text-align:center;height:182px;'>
<p style='margin-top:80px' class=loading>Loading...</span>
</div>

<div id='selectingArrowsDiv' style='text-align:center;background:#ddd;display:none'></div>

<div style='margin-left:10px;margin-top:5px;display:none;height:190px;overflow:auto' id='newsDiv'>
<center><p style='margin-top:80px' class=loading>Loading...</span></center>
</div>

<div style='margin-left:10px;margin-top:15px;display:none' id='submitDiv'>
<span class=bluehead>SEOmoz Resources </span> <span class=redhead>beyond the blog.</span></p>

<span class=submitSub>
<a href="http://www.seomoz.org/articles" class="youtube" target="_blank">SEOmoz Articles</a><br><br>
<a href="http://www.seomoz.org/tools" target="_blank">SEOmoz SEO Tools</a><br><br>
<a href="http://www.seomoz.org/users/premium" target="_blank">SEOmoz Premium Membership Benefits</a><br><br>
<a href="http://www.seomoz.org/dp/about" class="itunes" target="_blank">About SEOmoz</a><br><br>
<a href="http://www.seomoz.org/dp/contact" class="store" target="_blank">Contact SEOmoz</a>

</span><br/><br/>

</div>

</div>

]]>
</Content>
</Module>
