/*
Site Design
Kevin Douglas :: Satarah Studios
kdouglas@satarah.com [satarah.com]
*/


var imgsPath = 'logo_nav_imgs/';
var isIE = ( /MSIE (5\.5|[6-9])/.test( navigator.userAgent ) && !/Opera/.test( navigator.userAgent ) ) ? true : false;



window.onload = function () {

  if ( typeof fixPing != 'undefined' && navigator.platform == 'Win32' && isIE ) fixPing ();
  if ( typeof preloadImgs != 'undefined' ) preloadImgs ();
  if ( typeof pepperLinks != 'undefined' ) pepperLinks ();
}


var imagelist = new Array (
  'print1.png',
  'art1.png',
  'photos1.png',
  'books1.png',
  'childs1.png',
  'maps1.png',
  'mags1.png',
  'cards1.png',
  'other1.png',
  'non1.png',
  'buy1.png',
  'tips1.png',
  'defs1.png',
  'order1.png',
  'about1.png',
  'logo_alone.jpg'  
);


function preloadImgs () {

  if ( typeof imagelist != 'undefined' && imagelist.length > 0 ) {

    if ( document.images ) {

      if ( !document.imageset ) document.imageset = new Array();

      for ( var i=0; i<imagelist.length; i++ ) {

        document.imageset[ document.imageset.length ] = new Image();
        document.imageset[ document.imageset.length -1 ].src = imgsPath + imagelist[i];

      }
    }
  }
}


function pepperLinks () {

  var links = document.getElementsByTagName('a');

  for ( var i=0; i<links.length; i++ ) {

    if ( links.item(i).parentNode.parentNode.id == 'homeMenu' || links.item(i).parentNode.id == 'topMenu' ) {

      links.item(i).onmouseover = function () {

        var img = this.firstChild;
        var swap = this.firstChild.src.match( /\/(\w+)0\.png$/ )[1] + '1.png';
        img.src = imgsPath + swap;

      }
      links.item(i).onmouseout = function () {

        var img = this.firstChild;
        var swap = this.firstChild.src.match( /\/(\w+)1\.png$/)[1] + '0.png';
        img.src = imgsPath + swap;

      }
    }
  }
}


function fixPing () {

  for ( var img, i = 0; i<document.images.length; i++ ) {

    if ( /\.png$/.test( (img = document.images[i]).src ) && img.id == 'header' ) { 

      img.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader( src="' + img.src + '", sizingMethod="scale" );';
      img.src = imgsPath + 'pixit.gif';

    }
  }
}





