SM.PhotoBar.config.position = 'bottom';

function hasPath(sPath){
     re = new RegExp("\/" + sPath + "(\/|$)");
     return re.test(window.location);
}

function delHover() {
    oLst = YD.getElementsBy(function(el) {return (YD.hasClass(el,'imgBorder') || YD.hasClass(el,'imgBorderOn'))},'img');
    for (i=0; i < oLst.length ; i++) {
        if (oLst[i].title && oLst[i].title != '') oLst[i].title = '';
        if (oLst[i].alt && oLst[i].alt != '') oLst[i].alt = '';
    }
}

YE.onContentReady('bodyWrapper', function() {if (!YD.hasClass(document.body, 'smugmug_ajax')) delHover()});

onPhotoShow.subscribe(function(){YE.onAvailable('mainImage', delHover)});

var vanityTable = {
     stylishgallery : "http://www.thirdspacephoto.com/gallery/3742899",
     portraitsgallery : "http://www.thirdspacephoto.com/gallery/3751257",
     outaboutgallery: "http://www.thirdspacephoto.com/gallery/3744691",
     thingsgallery: "http://www.thirdspacephoto.com/gallery/3751250",
     landscapesgallery: "http://www.thirdspacephoto.com/gallery/3751230",
     contact: "http://www.thirdspacephoto.com/gallery/3744674",
     about: "http://www.thirdspacephoto.com/gallery/3742696",
     jav_katie: "http://www.thirdspacephoto.com/gallery/3763114",
     katzman_workshop: "http://www.thirdspacephoto.com/gallery/3845244",
     ffts_nov07: "http://www.thirdspacephoto.com/gallery/3861929",
     art: "http://www.thirdspacephoto.com/gallery/3562504",
     jav_katie2: "http://www.thirdspacephoto.com/gallery/3929568",
     aaron_kel: "http://www.thirdspacephoto.com/gallery/3965705",
     jackson_smith: "http://www.thirdspacephoto.com/gallery/4004836",
     moyer_cycles: "http://www.thirdspacephoto.com/gallery/3872088",
     jav_katie_wedding: "http://www.thirdspacephoto.com/gallery/6513151_qYJrk",
     lavoie_family: "http://www.thirdspacephoto.com/gallery/6766464_q9mQe"
};

function IsHomePage(){
     return(YD.hasClass(document.body, 'homepage'));
}
 
function CheckRedirects(){
     document.title = "Thirdspace Photography";
     if (IsHomePage())    // only run this code on the home page
     {
         // get the path from the current URL, 
         // convert it to lowercase and remove the leading slash
         var path = window.location.pathname.toLowerCase().substr(1);
         
         var newURL = vanityTable[path];        // look it up in our table
       
         // if we found it in the table && newURL is different than where we are
         if (newURL && (newURL != window.location))
         {
             window.location.replace(newURL);        // go to the new URL
         }
     }
}

function RemoveClasses(){
     $('albumNav_top').removeClassName('bottom_border');
     $('albumNav_top').removeClassName('top_border');
     $('caption_bottom').removeClassName('bottom_border');
     $('caption_top').removeClassName('bottom_border');
     $('editCaption_top').removeClassName('bottom_border');
     $('editCaption_bottom').removeClassName('bottom_border');
     $('photoBy').removeClassName('bottom_border');
     $('fileNameBox').removeClassName('bottom_border');
     $('mainImageLink').removeClassName('imgBorder');
     $('albumNav_bottom').removeClassName('top_border');
     $('displayPhoto').removeClassName('left_border');
     $('comment').removeClassName('top_border');
     $('pageNavigation_top').removeClassName('leftColumn');
     
     var array = $('cartButtonsWrapper').ancestors();
     array[0].setAttribute('id', 'photoNavWrapper');
     $('photoNavWrapper').removeClassName('left_border');
     $('photoNavWrapper').removeClassName('rightColumn');
 
}

function AddClasses(){
     var elem = document.getElementById('pageNavigation_top');
     var aelem = elem.getElementsByTagName('a');
     for (var i=0, len=aelem.length; i<len; ++i ){
       aelem[i].className='pages_top';
     }
}

window.onload=function(){
     RemoveClasses();
     AddClasses();
}

