﻿function hideContentDivs() {

    document.getElementById('Home').style.display = "none";
    document.getElementById('Artwork').style.display = "none";
    document.getElementById('Info').style.display = "none";
}

function setAllNavBack() {
    var HomeLink = document.getElementById('HomeLink');
    var ArtworkLink = document.getElementById('ArtworkLink');
    //var StoreLink = document.getElementById('StoreLink');
    var InfoLink = document.getElementById('InfoLink');
    HomeLink.className = "NavText";
    ArtworkLink.className = "NavText";
    //StoreLink.className = "NavText";
    InfoLink.className = "NavText";
}

function goToStore(){
document.location.href="http://cafepress.com/O2Studios";
}

function NavClick(objectid) {

    //clear all links styles
    setAllNavBack();

    //set active link
    setActiveNav(objectid);
    
    //hide all content
    hideContentDivs();

    //Display correct div
    ShowDiv(objectid);
}

function setActiveNav(objectid) {
    var activeLink = document.getElementById(objectid + "Link");
    activeLink.className = "NavTextActive";


}
function ShowDiv(objectid) {
    document.getElementById(objectid).style.display = "block";
}

//from Lightbox.js

function getpopupTable(ddimageTitle) {
    var arrayText = getPopupTableArray(ddimageTitle);
    var rtnTable = "";
    if (arrayText.length > 1) {
      if (verticalTable(arrayText) == false) {
        rtnTable = getHpopupTable(ddimageTitle);
      }
      else {
        rtnTable = getVpopupTable(ddimageTitle);
      }
    }
    else{
      rtnTable = getDescriptionPopupTable(ddimageTitle)
    }
    return rtnTable;
}


function getDescriptionPopupTable(ddimageTitle) {

  var rtnTable = getTable(true, 430,14);
  //top spacer row
  rtnTable = rtnTable + getSpacerRow();
  rtnTable = rtnTable + getSpacerRow();
  
  rtnTable = rtnTable + getTableOpenRow(true);
  rtnTable = rtnTable + getTableCell("Popupvaluejust", getDecriptionByDDimageTitle(ddimageTitle));
  rtnTable = rtnTable + getTableOpenRow(false);

  rtnTable = rtnTable + getSpacerRow();
  rtnTable = rtnTable + getTable(false, 0,0);

  return rtnTable;

}

function getDecriptionByDDimageTitle(ddimageTitle) {

  var rtnString = "&nbsp&nbsp;&nbsp;";
  switch (ddimageTitle) {
    case ("The Making of 'Smooth Sailing'"):
      rtnString += "I was looking for a new set of pin-up photos and contacted Kean of " + handleLinkCellText('shotzlink') + ". He posted a casting call on ModelMayhem and OneModelPlace. After reviewing dozens of responses, we picked two models (" + handleLinkCellText('hannaheart')  + " and " + handleLinkCellText('elkielink') + "). With our van full of props and clothing, we headed to Kean’s studio for a shoot in Jan of 2009.  Kean shot from sunup to sundown with his (seemingly) unending energy. Hanna donned one of two sailor outfits and Kean snapped away. We ended up with over 1000 photos by the end of the day.";
      break;
    case ("LPJ2"):
      rtnString += "While browsing through the myriad of photos, this one struck me. It was so easy to envision this classic pose on the deck of a vintage yacht. The pose has so many beautiful lines and the lighting is perfect for simulated outdoor sunlight.";
      break;
    case ("LPJ3"):
      rtnString += "I chose the Les Paul Junior because I thought it had a great vintage look, plus lots of space for a pin-up. Although the picture was beautiful right out of the camera, I wanted to make it look more in line with the vintage look of the guitar. A little Photoshoping helped this effort out and I arranged it (digitally) on an image of the guitar for layout. I added a few graphic references to sell the sailor theme.";
      break;
    case ("LPJ4"):
      rtnString += "I ordered a brand new Les Paul Junior and had it delivered to Bills Music house in Catonsville. It was delivered in white with a nitrocellulose lacquer finish.";
      break;
    case ("LPJ5"):
      rtnString += "I stripped the whole guitar down to the wood. At this point I’m thinking, I just ruined a perfectly good Les Paul.";
      break;
    case ("LPJ6"):
      rtnString += "I primed the guitar (body and neck) using a latex primer to seal the wood. I then sanded it flat to get it ready for the airbrush.";
      break;
    case ("LPJ7"):
      rtnString += "I mixed the two base coat colors and taped the areas off. I frisketed the pin-up and the preserver, then used a larger airbrush to paint the base colors.";
      break;
    case ("LPJ8"):
      rtnString += "Next I painted the preserver and the legs using an extra fine airbrush";
      break;
    case ("LPJ9"):
      rtnString += "I then moved on to the arms, dress, and face.";
      break;
    case ("LPJ10"):
      rtnString += "I then finished the face and dress. One of the most challenging aspects of this project was working on such a small scale. The face is about the size of a quarter.";
      break;
    case ("LPJ11"):
      rtnString += "After finishing the hair and hat, I added the gold rail line all around the guitar body. I also added the preserver and leg shadows that support the wall effect. The shadows were also added to even out the stark contrast between the black knobs and pick guard, and the lighter pin-up colors.";
      break;
    case ("LPJ12"):
      rtnString += "After putting some final (balancing) touches on the painting, it was just about ready for the clear coat shop. I did have to correct the headstock base coat which was ruined by some old tape I used while masking.  The top picture shows the damage, while the bottom picture shows me in the middle of masking off the tiny letters for a new coat of black. Needless to say I drew the line at the extra tiny word “MODEL” that appears under the “L” in Paul and it didn’t make it into final product.";
      break;
    case ("LPJ13"):
      rtnString += "I contacted Chris Bavaria, a clear cost specialist, through Phil Jacoby of the " + handleLinkCellText('philtone') + ") in Baltimore. I delivered the guitar to Chris and he gave an estimate of about 3 weeks for completion. I was surprised when he called me after a week and a half with a message to come by and pick it up. He had done a really great job with the clear coat and even fixed a couple of my mistakes around the fret ends!";
      break;       
    default:
      alert("missed case in getDecriptionByDDimageTitle");
      break;
  }
  return rtnString;

}


function getVpopupTable(ddimageTitle) {

    var arrayText = getPopupTableArray(ddimageTitle);

    var rtnTable = getTable(true,250,0);
     //top spacer row
     rtnTable = rtnTable + getSpacerRow();
     
     rtnTable = rtnTable + getTableOpenRow(true);
     rtnTable = rtnTable + getTableCell("PopupHeading",arrayText[0]);
     rtnTable = rtnTable + getTableCell("Popupvalue", arrayText[1]);
     rtnTable = rtnTable + getTableOpenRow(false);
     
     rtnTable = rtnTable + getTableOpenRow(true);
     rtnTable = rtnTable + getTableCell("PopupHeading", arrayText[2]);
     rtnTable = rtnTable + getTableCell("Popupvalue", arrayText[3]);
     rtnTable = rtnTable + getTableOpenRow(false);
    
     rtnTable = rtnTable + getTableOpenRow(true);
     rtnTable = rtnTable + getTableCell("PopupHeading", arrayText[4]);
     rtnTable = rtnTable + getTableCell("Popupvalue", arrayText[5]);
     rtnTable = rtnTable + getTableOpenRow(false);
     
     rtnTable = rtnTable + getTableOpenRow(true);
     rtnTable = rtnTable + getTableCell("PopupHeading", arrayText[6]);
     rtnTable = rtnTable + getTableCell("Popupvalue", arrayText[7]);
     rtnTable = rtnTable + getTableOpenRow(false);
     
     rtnTable = rtnTable + getTableOpenRow(true);
     rtnTable = rtnTable + getTableCell("PopupHeading", arrayText[8]);
     rtnTable = rtnTable + getTableCell("Popupvalue", arrayText[9]);
     rtnTable = rtnTable + getTableOpenRow(false);


     rtnTable = rtnTable + getTableOpenRow(true);
     rtnTable = rtnTable + getTableCell("PopupHeading", arrayText[10]);
     rtnTable = rtnTable + getTableCell("Popupvalue", arrayText[11]);
     rtnTable = rtnTable + getTableOpenRow(false);

     rtnTable = rtnTable + getTable(false,0,0);

     return rtnTable;
 

}

function getPopupTableArray(ddimageTitle){
 return ddimageTitle.split("-");
}

function getHpopupTable(ddimageTitle) {

    var arrayText = getPopupTableArray(ddimageTitle);

    var rtnTable = getTable(true,400,0);
     //top spacer row
     rtnTable = rtnTable + getSpacerRow();
     
     rtnTable = rtnTable + getTableOpenRow(true);
     rtnTable = rtnTable + getTableCell("PopupHeading",arrayText[0]);
     rtnTable = rtnTable + getTableCell("Popupvalue", arrayText[1]);
     rtnTable = rtnTable + getTableCell("PopupHeading", arrayText[6]);
     rtnTable = rtnTable + getTableCell("Popupvalue", arrayText[7]);
     rtnTable = rtnTable + getTableOpenRow(false);

     rtnTable = rtnTable + getTableOpenRow(true);
     rtnTable = rtnTable + getTableCell("PopupHeading", arrayText[2]);
     rtnTable = rtnTable + getTableCell("Popupvalue", arrayText[3]);
     rtnTable = rtnTable + getTableCell("PopupHeading", arrayText[8]);
     rtnTable = rtnTable + getTableCell("Popupvalue", arrayText[9]);
     rtnTable = rtnTable + getTableOpenRow(false);

     rtnTable = rtnTable + getTableOpenRow(true);
     rtnTable = rtnTable + getTableCell("PopupHeading", arrayText[4]);
     rtnTable = rtnTable + getTableCell("Popupvalue", arrayText[5]);
     rtnTable = rtnTable + getTableCell("PopupHeading", arrayText[10]);
     rtnTable = rtnTable + getTableCell("Popupvalue", arrayText[11]);
     rtnTable = rtnTable + getTableOpenRow(false);

     rtnTable = rtnTable + getTable(false,0,0);

     return rtnTable;
 

}

function verticalTable(arrayText) {
//do we have something
    if (arrayText[12] == "V") {
        return true;
    }
    else {

        return false;
    }

}

function getSpacerRow() {

 var rtnrow = getTableOpenRow(true)
 rtnrow = rtnrow + "<td clospan=4>&nbsp;</td>";
 rtnrow = rtnrow + getTableOpenRow(false)
 
 return rtnrow;
}

function getTableCell(className,celltext) {

    var linkedCellText = handleLinkCellText(celltext);
    return "<td class='" + className + "'>" + linkedCellText + "</td>";
}

function getAhrefPopupLink(URL,celltext){

    return "<a class='PopupLink' title='Visit the site' href='" + URL + "' target=_blank>" + celltext + "</a>";
}

function handleLinkCellText(celltext) {
    switch (celltext)
    {
        case "jennylink":
            return getAhrefPopupLink("http://www.modelmayhem.com/315248", "Jenny");
            break;
        case "shotzlink":
            return getAhrefPopupLink("http://dougshotz.smugmug.com", "Shotz Photography");
            break;
        case "ragenlink":
            return getAhrefPopupLink("http://www.modelmayhem.com/360974", "Ragen Powel");
            break;
        case "heidilink":
            return getAhrefPopupLink("http://www.heidivanhorne.com", "Heidi Van Horne");
            break;
        case "candacelink":
            return getAhrefPopupLink("http://www.candacenirvana.com", "Candace Smith");
            break;
        case "ragenlinkjennylink":
            var rtnlink = getAhrefPopupLink("http://www.modelmayhem.com/360974", "Ragen Powel");
            rtnlink = rtnlink + ", " + getAhrefPopupLink("http://www.modelmayhem.com/315248", "Jenny");
            return rtnlink;
        case "elkielink":
            return getAhrefPopupLink("http://www.modelmayhem.com/821240", "Elkie Cooper");
            break;
          case "hannaheart":
            return getAhrefPopupLink("http://www.onemodelplace.com/member.cfm?ID=352328", "Hanna Heart");
            break;   
        case "philtone":
            return getAhrefPopupLink("http://www.philtone.com/", "Philtone Guitar Company");
            break;
    default:
    return celltext;
    
    }




}

function getTable(openTag,width,left){
    if (openTag==true)
      {
        if (left != 0) {
          return "<table cellpadding='0' cellspacing='0' border='0' style='padding-left:" + left + "px;' width='" + width + "'>";
        }
        else {
          return "<table cellpadding='0' cellspacing='0' border='0' width='" + width + "'>";
        }
      }
    else
      {
        return "</table>";
      }
}

function getTableOpenRow(openTag) {
    if (openTag==true)
      {
        return "<tr>";
      }
    else
      {
        return "</tr>";
      }
}

function getArgs() { 
var args = new Object(); 
var query = location.search.substring(1); 
var pairs = query.split("&"); 
for(var i = 0; i < pairs.length; i++) { 
var pos = pairs[i].indexOf('='); 
if (pos == -1) continue; 
var argname = pairs[i].substring(0,pos); 
var value = pairs[i].substring(pos+1); 
args[argname] = unescape(value); 
} 
return args; 
} 

function loaddiv(){

var args = getArgs();
 if (args.div){
  div = parseFloat(args.div); 
  NavClick(args.div);
 }
}
