
// avoid console errors
if (!window.console || !console.firebug){
    
  var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml","group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
  window.console = {};
  for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {};
  
}


// JSON
var SitesObj = {"cumoneileen.com":{"ps":218,"p":16807,"vs":104,"v":107},"princesscameron.com":{"ps":55,"p":3203,"vs":43,"v":84}};

// Show
console.log(SitesObj);

function getTotal(sites,key){
  var total = 0;
  for(var i=0;i<=sites.length-1;i++){
    if(SitesObj[sites[i]]==undefined){
      continue;
    }
    if(SitesObj[sites[i]][key]==undefined){
      continue;      
    }
    total += SitesObj[sites[i]][key];
  }
  document.write(total);
}
function getPicSets(sites){
  getTotal(sites,'ps');
}
function getVideoSets(sites){
  getTotal(sites,'vs');
}
function getPics(sites){
  getTotal(sites,'p');
}
function getVideos(sites){
  getTotal(sites,'v');
}

