﻿function LoadStylesheet() {
  var link = document.createElement('link');
  document.getElementsByTagName('head')[0].appendChild(link);
  link.setAttribute('type', 'text/css');
  link.setAttribute('rel', 'stylesheet');
  if (screen.width >= 1280) {
    link.setAttribute('href', '1280.css');
    screenWidth = 1280;
  }
  else {
    if (screen.width >= 1024) {
      link.setAttribute('href', '1024.css');
      screenWidth = 1024;
    }
    else {
      link.setAttribute('href', '800.css'); ;
      screenWidth = 800;
    }
  }
}

function loadImage(image) {
  srcPath = image.src.replace('1024', screenWidth);
  image.src = srcPath;
}

function loadImages() {
  for (index = 0; index < document.images.length; index++) {
    loadImage(document.images[index])
  }
}
