var images=new Array();
images[0] = "";
var w3cdom = false;

if( document.getElementById && document.childNodes && document.createElement ) { w3cdom = true;	}

function initImages(images) {
	for (var i=1;i< images.length;i++) {
		img = new Image();
		img.src = images[i];
	}
}
function showImage(n, top, left, w, h) {
	var img = images[n];
	var dTag = document.getElementById("imageText");
	dTag.src = img;
	dTag.style.top = top+"px";
	dTag.style.left = left+"px";
	dTag.style.position = "relative";
	dTag.style.width = w+"px";
	dTag.style.height = h+"px";	
	return false;
}

function hideImage() {
	var dTag = document.getElementById("imageText");
	dTag.src = "images/blank.png";	
	dTag.style.width = 0;
	dTag.style.height = 0;	
}
function showVideo(fn, w, h) {
	var vplayer = new SWFObject("videos/player.swf","loader",w,h,"9","#2d211e");
	vplayer.useExpressInstall('videos/expressinstall.swf');
	vplayer.addParam("allowfullscreen","true");
	vplayer.addParam("autosize", "true");
	vplayer.addParam("allowScriptAccess","sameDomain");
	vplayer.addParam("flashvars","file=../videos/"+fn+"&autostart=true");
	vplayer.write("sampleFile");
	return false;
}
function playQuicktime(fn) {
	var theMov = QT_GenerateOBJECTText_XHTML("videos/"+fn, '480', '360', '','scale','tofit','bgcolor', '#2d211e');
	var masterPlayer = document.getElementById('sampleFile');
	masterPlayer.innerHTML=theMov;
}

function prepareImageSwap(elem,mouseOver,mouseOutRestore,mouseDown,mouseUpRestore,mouseOut,mouseUp) { 
//Do not delete these comments. 
//Non-Obtrusive Image Swap Script V1.1 by Hesido.com 
//Attribution required on all accounts 
    if (typeof(elem) == 'string') { elem = document.getElementById(elem);  }
    if (elem == null) { return; }
    var regg = /(.*)(_nm\.)([^\.]{3,4})$/ ;
    var prel = new Array(), img, imgList, imgsrc, mtchd; 
    imgList = elem.getElementsByTagName('img'); 
    for (var i=0; img = imgList[i]; i++) { 
        if (!img.rolloverSet && img.src.match(regg)) { 
            mtchd = img.src.match(regg); 
            img.hoverSRC = mtchd[1]+'_hv.'+ mtchd[3]; 
            img.outSRC = img.src; 
            if (typeof(mouseOver) != 'undefined') { 
                img.hoverSRC = (mouseOver) ? mtchd[1]+'_hv.'+ mtchd[3] : false; 
                img.outSRC = (mouseOut) ? mtchd[1]+'_ou.'+ mtchd[3] : (mouseOver && mouseOutRestore) ? img.src : false; 
                img.mdownSRC = (mouseDown) ? mtchd[1]+'_md.' + mtchd[3] : false; 
                img.mupSRC = (mouseUp) ? mtchd[1]+'_mu.' + mtchd[3] : (mouseOver && mouseDown && mouseUpRestore) ? img.hoverSRC : (mouseDown && mouseUpRestore) ? img.src : false; 
                } 
            if (img.hoverSRC) {preLoadImg(img.hoverSRC); img.onmouseover = imgHoverSwap;} 
            if (img.outSRC) {preLoadImg(img.outSRC); img.onmouseout = imgOutSwap;} 
            if (img.mdownSRC) {preLoadImg(img.mdownSRC); img.onmousedown = imgMouseDownSwap;} 
            if (img.mupSRC) {preLoadImg(img.mupSRC); img.onmouseup = imgMouseUpSwap;} 
            img.rolloverSet = true; 
        } 
    } 
    function preLoadImg(imgSrc) { 
        prel[prel.length] = new Image(); prel[prel.length-1].src = imgSrc; 
    } 
} 
function imgHoverSwap() {this.src = this.hoverSRC;} 
function imgOutSwap() {this.src = this.outSRC;} 
function imgMouseDownSwap() {this.src = this.mdownSRC;} 
function imgMouseUpSwap() {this.src = this.mupSRC;}
function setPagerSwaps() {
	prepareImageSwap('pager');
}
function setMenuSwaps() {
	prepareImageSwap('menuItems');
}
function initClientImages() {
	initImages(images); 
}
function initSamples() {
	initImages(images); 
	prepareImageSwap('pager');
}
function addLoadListener(fn) { 
 if (typeof window.addEventListener != 'undefined') { 
   window.addEventListener('load', fn, false); 
 } 
 else if (typeof document.addEventListener != 'undefined') { 
   document.addEventListener('load', fn, false); 
 }
 else if (typeof window.attachEvent != 'undefined') { 
   window.attachEvent('onload', fn); 
 } 
 else { 
   var oldfn = window.onload; 
   if (typeof window.onload != 'function') { 
     window.onload = fn; 
   } 
   else { 
     window.onload = function() { 
       oldfn(); 
       fn(); 
     }; 
   } 
 } 
}

addLoadListener(setMenuSwaps); 

