
var setArticleId=0;var setLeadArticleId=0;var setArticleHtml='';var setLeadArticleHtml='';var setArticleCellId=0;var setArticleForm='';var setLeadArticleForm='';function LoadHomepageEvents(){setArticleForm=$("#shareArticle").html();setLeadArticleForm=$("#shareTopStory").html();$("#shareArticle").html('');$("#shareTopStory").html('');$(".module").hover
(function(){$(this).children('.article').children('.overlay').hide();if($.browser.msie){$(this).children('.article').css({opacity:"0.16"});}
else{$(this).children('.article').fadeTo(1,0.16,function(){$(this).parent('.module').children('.module-select').fadeIn(200);$(this).parent('.module').children('.module-select').css({opacity:"1"});});}
$(this).children('.module-select').show();},function(){if($.browser.msie){$(this).children('.article').css({opacity:"1.0"});}
else{$(this).children('.module-select').fadeOut(1,function(){$(this).parent('.module').children('.article').fadeTo(50,1.0);$(this).parent('.module').children('.module-select').css({opacity:"0"});});}
$(this).children('.article').children('.overlay').show();$(this).children('.module-select').hide();});}
function InsertAd(){var adUnitHtml=document.getElementById('temp-ad-unit').innerHTML;document.getElementById('temp-ad-unit').innerHTML="";document.getElementById('ad-unit').innerHTML=adUnitHtml;}
function SetShareArticle(articleId,cellId)
{CancelShare();setArticleId=articleId;setArticleCellId=cellId;setArticleHtml=$("#place-"+cellId).html();$("#place-"+cellId).html(setArticleForm);}
function SetShareLeadArticle(leadArticleId){setLeadArticleId=leadArticleId;setLeadArticleHtml=$("#top-story").html();$("#top-story").html(setLeadArticleForm);}
function ShareArticle(){SendArticle(setArticleId,"ToEmail","FromEmail","ShareComment");CancelShare();}
function ShareLeadArticle(articleId){SendArticle(setLeadArticleId,"ToEmailLead","FromEmailLead","ShareCommentLead");CancelLeadShare();}
function SendArticle(articleId,toEmailId,fromEmailId,commentId)
{if($("#"+toEmailId).val().length>6&&$("#"+fromEmailId).val().length>6){sUrl="/services.asmx/EmailArticle";var jsonpostdata="{";jsonpostdata+="HomepageItemId:'"+articleId+"', ";jsonpostdata+="ToEmail:'"+$("#"+toEmailId).val()+"', ";jsonpostdata+="FromEmail:'"+$("#"+fromEmailId).val()+"', ";jsonpostdata+="Comment:'"+EscapeString($("#"+commentId).val())+"'";jsonpostdata+="}";$.ajax({url:sUrl,type:'POST',data:jsonpostdata,contentType:"application/json; charset=utf-8",dataType:"json",timeout:20000,error:function(){},success:function(json){}});}
else{alert('Please enter a To Email and From Email before submitting.');}}
function EscapeString(OriginalString){if(OriginalString.length>0){return OriginalString.replace(/'/g,"&#39");}
return OriginalString;}
function CancelShare(){if(setArticleCellId>0){$("#place-"+setArticleCellId).html(setArticleHtml);setArticleHtml='';setArticleId=0;setArticleCellId=0;}}
function CancelLeadShare(){$("#top-story").html(setLeadArticleHtml);}
function HpClick(id,position)
{$.ajax
({type:"POST",url:"/ajax/hpClick.ashx",data:"id="+id+"&pos="+position});}