


// Non-Obtrusive Image Swap Script V1.1 by Hesido.com 
// Attribution required on all accounts.
// Do not delete these comments. 
// http://www.hesido.com/web.php?page=imageswapping

function prepareImageSwap(elem,mouseOver,mouseOutRestore,mouseDown,mouseUpRestore,mouseOut,mouseUp) { 
	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;};

// Usage:
// <BODY onload="prepareImageSwap(document.body)">
// <img src="images/whatever_nm.jpg">, where the rollover image is whatever_hv.jpg <<<THATS IT!>>>



//NAVIGATION SUBWHATEVER
function rollOverScript() {
	if (!document.getElementById) return
	var imgOriginSrc;
	var imgTemp = new Array();
	var imgarr = document.getElementsByTagName('img');
	for (var i = 0; i < imgarr.length; i++) {
		if (imgarr[i].getAttribute('hsrc')) {
				imgTemp[i] = new Image();
				imgTemp[i].src = imgarr[i].getAttribute('hsrc');
				imgarr[i].onmouseover = function() {
						imgOriginSrc = this.getAttribute('src');
						this.setAttribute('src',this.getAttribute('hsrc'))
				}
				imgarr[i].onmouseout = function() {
						this.setAttribute('src',imgOriginSrc)
				}
		}
	}
}



//POPUP SCRIPTS

function popup(item){
	popwin = window.open(item,"flash","width=750,height=500,toolbar=no,menubar=no,location=no,resize=no,noresize");
	popwin.focus();
}

function popupPage(item){
	popwin = window.open(item,"flash","width=650,height=550");
	popwin.focus();
}

function popupSquare(item){
	popwin = window.open(item,"flash","width=542,height=542,toolbar=no,menubar=no,location=no,resize=no,noresize");
	popwin.focus();
}

function fullscreen(item){
	popwin = window.open(item,"flash_FS","width=800,height=500,fullscreen,toolbar=no,menubar=no,location=no,resize=no,noresize");
	popwin.focus();
}

function shrink(){
	//self.moveTo(screen.availWidth/2,screen.availHeight/2);
	//self.resizeTo(450,450);
	window.blur();
}
