var locURL=document.location+'';var baseURL='http://'+document.domain;function loadPage(url){if(document.getElementById('wrapper_Overlay')){document.getElementById('wrapper_Overlay').style.display='block';}
if(window.XMLHttpRequest){req=new XMLHttpRequest();req.onreadystatechange=loadNewAnimation;req.open("GET",baseURL+"/content/"+url.toLowerCase()+'.xml',true);req.send(null);}else if(window.ActiveXObject){isIE=true;req=new ActiveXObject("Microsoft.XMLHTTP");if(req){req.onreadystatechange=loadNewAnimation;req.open("GET",baseURL+"/content/"+url.toLowerCase()+'.xml',true);req.send();}}
setCurrentNav(url.toLowerCase());createCookie('defaultPage',url.toLowerCase(),1);if(window.location.href.indexOf('blogspot')<1){document.getElementById('prtfl_Nav').innerHTML='<div id="prtfl_NavBg"></div>';document.getElementById('prtfl_Main').className=url.toLowerCase();}}
function loadPortfolio(url){if(window.XMLHttpRequest){req=new XMLHttpRequest();req.onreadystatechange=loadNewPortfolio;req.open("GET",baseURL+"/portfolio/"+url.toLowerCase()+'.xml',true);req.send(null);}else if(window.ActiveXObject){isIE=true;req=new ActiveXObject("Microsoft.XMLHTTP");if(req){req.onreadystatechange=loadNewPortfolio;req.open("GET",baseURL+"/portfolio/"+url.toLowerCase()+'.xml',true);req.send();}}}
function loadRSS(url,rssType){if(window.XMLHttpRequest){req=new XMLHttpRequest();req.onreadystatechange=function(){loadRSSFeed(rssType)};req.open("GET",url,true);req.send(null);}else if(window.ActiveXObject){isIE=true;req=new ActiveXObject("Microsoft.XMLHTTP");if(req){req.onreadystatechange=function(){loadRSSFeed(rssType)};req.open("GET",url,true);req.send();}}}
function loadRSSFeed(rssType){if(req.readyState==4){document.getElementById('rss_'+rssType).innerHTML=req.responseText;}else{document.getElementById('rss_'+rssType).innerHTML='<img src="/images/working.gif" border="0" align="middle" />&nbsp;Feed loading...'}}
function loadNewAnimation(){var pageName,codeopen,content
if(req.readyState==4){pageName=req.responseXML.getElementsByTagName("wrapperContent")[0].getElementsByTagName("pageTitle")[0].firstChild.nodeValue;codeopen=req.responseXML.getElementsByTagName("wrapperContent")[0].getElementsByTagName("slogan")[0].firstChild.nodeValue;content=req.responseXML.getElementsByTagName("wrapperContent")[0].getElementsByTagName("content")[0].firstChild.nodeValue;if(pageName=='Introduction'){loadNewContent(pageName,codeopen,content);setTimeout("collapse1.slidedown();",300);}else{collapse1.slideup();if(document.getElementById('content_Main')){document.getElementById('content_Main').className='loading';}
setTimeout(function(){loadNewContent(pageName,codeopen,content);},500);setTimeout("collapse1.slidedown();",600);}}}
function loadNewPortfolio(){if(req.readyState==4){portfolioNav=req.responseXML.getElementsByTagName("wrapperContent")[0].getElementsByTagName("portfolioNav")[0].firstChild.nodeValue;document.getElementById('prtfl_Nav').innerHTML=portfolioNav+'<div id="prtfl_NavBg"></div>'}}
function loadNewContent(page,codeopen,content){document.getElementById('print_PageTitle').innerHTML=page;document.getElementById('codeopen').innerHTML=codeopen;if(document.getElementById('content_Main')){setTimeout(function(){document.getElementById('content_Main').className='';},400);setTimeout(function(){document.getElementById('wrapper_Overlay').style.display='none';},800);}
if(document.getElementById('content_Main')){document.getElementById('content_Main').innerHTML=content;}
if(document.getElementById('btn_BackStage').className=='draft'){updatePortfolioLinks('inline');}else{updatePortfolioLinks('none');}}
function setCurrentNav(url){var allNavArray=getElementsByClassName('open');for(var i=0;i<allNavArray.length;i++){allNavArray[i].className='';}
if(url!='index'){document.getElementById('btn'+url).className='open';}}
var browserName=navigator.appName;var browserAgent=navigator.userAgent;var browserVersion=navigator.appVersion;var currentfileName=window.location.href+'';currentfileName=currentfileName.substr(currentfileName.lastIndexOf('/')+1,currentfileName.lastIndexOf('.'))
currentfileName=currentfileName.substr(0,currentfileName.indexOf('.'))
window.onload=function(){var pageLoad=window.location.search.substring(1);var cookieVar=readCookie('defaultPage');if(pageLoad!=''&&window.location.href.lastIndexOf('/')<26&&window.location.href.lastIndexOf('_archive')<1&&window.location.href.indexOf('blogspot')<1){pageLoad=pageLoad.substring(pageLoad.indexOf('=')+1,pageLoad.length);loadPage(pageLoad);createCookie('defaultPage',pageLoad,1);}
else if(currentfileName!=''&&window.location.href.indexOf('blogspot')<1){loadPage(currentfileName);createCookie('defaultPage',currentfileName,1);}
else if(cookieVar!=''&&cookieVar!=null&&window.location.href.lastIndexOf('/')<26&&window.location.href.lastIndexOf('_archive')<1){if(window.location.href.indexOf('blogspot')<1){setTimeout(function(){loadPage(cookieVar);},100);}}
else if(window.location.href.indexOf('blogspot')<1){loadPage('index');createCookie('defaultPage','index',1);}}
function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else var expires="";document.cookie=name+"="+value+expires+"; path=/";}
function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}
function eraseCookie(name){createCookie(name,"",-1);}
function portfolioShow(ul,subNode){var ulType
ulType='portfolio_'
if(document.getElementById(ulType+ul).style.display=='none'||!document.getElementById(ulType+ul).style.display){document.getElementById(ulType+ul).style.display='block';if(subNode){document.getElementById('node_'+ul).src='images/nodeup.gif';}else{document.getElementById('node_'+ul).src='images/nodeopen.gif';}}else{document.getElementById(ulType+ul).style.display='none';if(subNode){document.getElementById('node_'+ul).src='images/nodedown.gif';}else{document.getElementById('node_'+ul).src='images/nodeclosed.gif';}}}
function rssShow(ul){var ulType
ulType='rss_'
if(document.getElementById(ulType+ul).style.display=='none'||!document.getElementById(ulType+ul).style.display){if(ul=='mk'){loadRSS('http://www.dotslashmk.com/php/rss2html.php?XMLFILE=http://feeds.feedburner.com/mkleiman&TEMPLATE=feedwdate.html&MAXITEMS=5',ul);}
if(ul=='local'){loadRSS('http://www.dotslashmk.com/php/rss2html.php?XMLFILE=http://www.thestar.com/rss/216357?searchMode=Lineup&TEMPLATE=feed.html&MAXITEMS=5',ul);}
if(ul=='design'){loadRSS('http://www.dotslashmk.com/php/rss2html.php?XMLFILE=http://www.cssbeauty.com/rss/news/&TEMPLATE=feed.html&MAXITEMS=5',ul);}
if(ul=='humor'){loadRSS('http://www.dotslashmk.com/php/rss2html.php?XMLFILE=http://feeds.theonion.com/theonion/daily&TEMPLATE=feed.html&MAXITEMS=5',ul);}
if(ul=='celebs'){loadRSS('http://www.dotslashmk.com/php/rss2html.php?XMLFILE=http://www.wwtdd.com/?mode=atom&TEMPLATE=feed.html&MAXITEMS=5',ul);}
if(ul=='xbox'){loadRSS('http://www.dotslashmk.com/php/rss2html.php?XMLFILE=http://duncanmackenzie.net/services/GetXboxInfo.aspx%3fGamerTag=dotslashmk&TEMPLATE=feed.html&MAXITEMS=5')}
document.getElementById(ulType+ul).style.display='block';}else{document.getElementById(ulType+ul).style.display='none';}}
function portfolioShowAll(classNm,showSub,isSub){var subArray=getElementsByClassName(classNm)
if(document.getElementById('node_all').src.indexOf('images/nodeclosed.gif')>0||isSub&&document.getElementById('node_allsub').src.indexOf('images/nodedown.gif')>0)
{for(var i=subArray.length-1;i>=0;--i)
{subArray[i].style.display='block';if(isSub){document.getElementById('showaction_sub').innerHTML='Hide';document.getElementById('node_allsub').src='images/nodeup.gif';document.getElementById(subArray[i].id.replace('portfolio','node')).src='images/nodeup.gif';}
else{document.getElementById('showaction').innerHTML='Hide';document.getElementById('node_all').src='images/nodeopen.gif';document.getElementById(subArray[i].id.replace('portfolio','node')).src='images/nodeopen.gif';}
if(showSub){document.getElementById('showsubs').style.display='block';}}}
else
{for(var i=subArray.length-1;i>=0;--i)
{subArray[i].style.display='none';if(isSub){document.getElementById('showaction_sub').innerHTML='Show';document.getElementById('node_allsub').src='images/nodedown.gif';document.getElementById(subArray[i].id.replace('portfolio','node')).src='images/nodedown.gif';}
else{document.getElementById('showaction').innerHTML='Show';document.getElementById('node_all').src='images/nodeclosed.gif';document.getElementById(subArray[i].id.replace('portfolio','node')).src='images/nodeclosed.gif';}
if(showSub){document.getElementById('showsubs').style.display='none';}}}}
function getElementsByClassName(classname,node){if(!node)node=document.getElementsByTagName("body")[0];var a=[];var re=new RegExp('\\b'+classname+'\\b');var els=node.getElementsByTagName("*");for(var i=0,j=els.length;i<j;i++)
if(re.test(els[i].className))a.push(els[i]);return a;}
function preview(page,w,h)
{window.open('preview/'+page,'Preview','scrollbars=yes,resizable=yes,width='+w+',height='+h+'');}
function highlightSwitch(classTitle){var subArray=getElementsByClassName(classTitle)
for(var i=subArray.length-1;i>=0;--i)
{if(subArray[i].style.display=='block'){subArray[i].style.display='none';if(classTitle=='hghltmain'){document.getElementById('hghlt_Btn').className=''}}else{subArray[i].style.display='block';if(classTitle=='hghltmain'){document.getElementById('hghlt_Btn').className='hghlt_open'}}}}
function swapPic(main,subpic){var subArray=getElementsByClassName('prton')
for(var i=subArray.length-1;i>=0;--i)
{subArray[i].className='prtoff';}
collapse2.slideup();setTimeout(function(){swapInPic(main,subpic);},1000);setTimeout("collapse2.slidedown();",1200);document.getElementById('prtflnav_'+subpic).className='prton';}
function swapInPic(main,subpic){document.getElementById('prtfl_Main').className=main+'_'+subpic}
function viewPortfolio(xmlNav,startPic){loadPortfolio(xmlNav);document.getElementById('prtfl_Main').className=startPic+'_one';}
function addBookmark(){if(document.all){window.external.AddFavorite(window.location.href,'EmailElements - Blogging all about HTML Email Standards, CSS and XHTML');}else{window.sidebar.addPanel('EmailElements - Blogging all about HTML Email Standards, CSS and XHTML',window.location.href,"");}}
function printPage(){window.print();}
function siteSwitch(site){var draftArray=new Array("sitebody","masthead","wrapper_Nav","codeopen","rssFeed","hghlt_Btn","btn_FinalDraft","btn_BackStage","bkmrk_Btn","prnt_Btn","hghlt_Btn","hghlt_MainRuler","prtfl","hghlt_MainPostIt","hghlt_MainPostItRss","hghlt_MainRuler","hghlt_MainMenu","hghlt_MainPortfolio","hghlt_MainAjax")
if(site){updatePortfolioLinks('none');for(var i=draftArray.length-1;i>=0;--i)
{document.getElementById(draftArray[i]).className='';}}else{updatePortfolioLinks('inline');for(var i=draftArray.length-1;i>=0;--i)
{document.getElementById(draftArray[i]).className='draft';}}}
function updatePortfolioLinks(state){var subArray=getElementsByClassName('backstage_PortfolioLink')
for(var i=subArray.length-1;i>=0;--i)
{subArray[i].style.display=state;}}