// Rollover  v2.0.1
// documentation: http://www.dithered.com/javascript/rollover/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)


function isDefined(property) {
  return (typeof property != 'undefined');
}

var rolloverInitialized = false;
function rolloverInit() {
   if (!rolloverInitialized && isDefined(document.images)) {
      
      // get all images (including all <input type="image">s)
      // use getElementsByTagName() if supported
      var images = new Array();
      if (isDefined(document.getElementsByTagName)) {
         images = document.getElementsByTagName('img');
         var inputs = document.getElementsByTagName('input');
         for (var i = 0; i < inputs.length; i++) {
            if (inputs[i].type == 'image') {
               images[images.length] = inputs[i];
            }
         }
      }
      
      // otherwise, use document.images and document.forms collections
      // remove if not supporting IE4, Opera 4-5
      else {
         images = document.images;
         inputs = new Array();
         for (var formIndex = 0; formIndex < document.forms.length; formIndex++) {
            for (var elementIndex = 0; elementIndex < document.forms.elements.length; elementIndex++) {
               if (isDefined(document.forms.elements[i].src)) {
                  inputs[inputs.length] = document.forms.elements[i];
               }
            }
         }
      }
      
      // get all images with '_off.' in src value
      for (var i = 0; i < images.length; i++) {
         if (images[i].src.indexOf('_off.') != -1) {
            var image = images[i];
            
            // store the off state filename in a property of the image object
            image.offImage = new Image();
            image.offImage.src = image.src;
            
            // store the on state filename in a property of the image object
            // (also preloads the on state image)
            image.onImage = new Image();
            image.onImage.imageElement = image;
            
            // add onmouseover and onmouseout event handlers once the on state image has loaded
            // Safari's onload is screwed up for off-screen images; temporary fix
            if (navigator.userAgent.toLowerCase().indexOf('safari') != - 1) {
               image.onmouseover = function() {
                  this.src = this.onImage.src;
               };
               image.onmouseout = function() {
                  this.src = this.offImage.src;
               };
            }
            else {
               image.onImage.onload = function() {
                  this.imageElement.onmouseover = function() {
                     this.src = this.onImage.src;
                  };
                  this.imageElement.onmouseout = function() {
                     this.src = this.offImage.src;
                  };
               };
            }
            
            // set src of on state image after defining onload event handler
            // so cached images (that load instantly in IE) will trigger onload
            image.onImage.src = image.src.replace(/_off\./, '_on.');
         }
      }
   }
   rolloverInitialized = true;
}

// call rolloverInit when document finishes loading
if (isDefined(window.addEventListener)) {
   window.addEventListener('load', rolloverInit, false);
}
else if (isDefined(window.attachEvent)) {
   window.attachEvent('onload', rolloverInit);
}


//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////


// Rollover (Central Image Variant)  v1.0
// http://www.dithered.com/javascript/rollover_central/index.html
// code by Chris Nott (chris@NOSPAMdithered.com - remove NOSPAM)

// body handler - rolloverCentralInit();"
// link handler - <a href="#" onmouseover="rolloverCentralOn(0);"><img src="images/cbs_frame_1_tn.jpg" width="72" height="57" border="0"></a>

var rolloverCentralImageOn = new Array();
var rolloverCentralImageOff = null;


// Preload rollover images
function rolloverCentralInit() {
	if (document.images) {
		
		// for each rollover, preload both states and put filename in an associative array
		for (var i = 0; i < rolloverCentralImageOnFiles.length; i++) {
			rolloverCentralImageOn[i] = new Image();
			rolloverCentralImageOn[i].src = rolloverImageDirectory + rolloverCentralImageOnFiles[i];
		}
		
		rolloverCentralImageOff = new Image();
		rolloverCentralImageOff.src = rolloverImageDirectory + rolloverCentralImageOffFile;
	}
}


// On state activation
function rolloverCentralOn(num) {
	if (document.images && rolloverCentralImageOn[num]) {
		
		// rollovers in layers in NS4 require a different image reference
		if (rolloverCentralImageLayerName != '' && document.layers) {
			document.layers[rolloverCentralImageLayerName].document.images[rolloverCentralImageTagName].src = rolloverCentralImageOn[num].src;
		}
		
		// non-layer rollovers in NS4 and all rollovers in other browsers
		else if (document.images[rolloverCentralImageTagName]) {
			document.images[rolloverCentralImageTagName].src = rolloverCentralImageOn[num].src;
		}
	}
}

// On state activation
function rolloverCentralOn2(num,cimg) {
	if (document.images && rolloverCentralImageOn[num]) {
		
		// rollovers in layers in NS4 require a different image reference
		mainimg = rolloverCentralImageTagName[cimg];
		document.images[mainimg].src = rolloverCentralImageOn[num].src;

	}
}


// Off state activation
function rolloverCentralOff() {
	if (document.images && rolloverCentralImageOff) {

		// rollovers in layers in NS4 require a different image reference
		if (rolloverCentralImageLayerName != '' && document.layers) {
			document.layers[rolloverCentralImageLayerName].document.images[rolloverCentralImageTagName].src = rolloverCentralImageOff.src;
		}
		
		// non-layer rollovers in NS4 and all rollovers in other browsers
		else if (document.images[rolloverCentralImageTagName]) {
			document.images[rolloverCentralImageTagName].src = rolloverCentralImageOff.src;
		}
	}
}


// Rollover with state function (not used in standard rollovers; included for flexability)
function rolloverCentralSetCurrent(num) {
	rolloverCentralImageOff.src = rolloverCentralImageOn[num].src;
}



//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////



function winOpen(theURL, w, h) {
    var window_width = w;
    var window_height = h;
    var newfeatures= 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0';
    var window_top = (screen.height-window_height)/2;
    var window_left = (screen.width-window_width)/2;
    newWindow=window.open(''+ theURL + '','slideShow','width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ',features=' + newfeatures + '');
    newWindow.focus();
}

function show(num){
   
   //set all display to "none"
   document.getElementById('desc1').style.display="none";
   document.getElementById('desc2').style.display="none";
   document.getElementById('desc3').style.display="none";
   document.getElementById('desc4').style.display="none";
   document.getElementById('desc5').style.display="none";
   document.getElementById('desc6').style.display="none";
   document.getElementById('desc7').style.display="none";
   document.getElementById('desc8').style.display="none";
  
   
   
   //set the chosen display to ''
   if(num==1)  document.getElementById('desc1').style.display="";
   if(num==2)  document.getElementById('desc2').style.display="";
   if(num==3)  document.getElementById('desc3').style.display="";
   if(num==4)  document.getElementById('desc4').style.display="";
   if(num==5)  document.getElementById('desc5').style.display="";
   if(num==6)  document.getElementById('desc6').style.display="";
   if(num==7)  document.getElementById('desc7').style.display="";
   if(num==8)  document.getElementById('desc8').style.display="";
   
   
}