/*
	Standards Compliant Rollover Script
	Author : Daniel Nolan
	http://www.bleedingego.co.uk/webdev.php
*/


// ROLLOVERS

function initRollovers() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'imgover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_o'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

window.onload = initRollovers;


function MM_openBrWindow(theURL,winName,features) {
	mywindow = window.open(theURL,winName,features);
	mywindow.location.href = theURL;
	if (mywindow. opener == null) mywindow.opener = self; 
}





// Check for email address: look for [@] and [.] 
function isEmail(elm) {
    if (elm.value.indexOf("@") + "" != "-1" &&
        elm.value.indexOf(".") + "" != "-1" &&
        elm.value != "") 
    return true;
    else return false;
}

// Check for null and for empty
function isFilled(elm) {
    if (elm.value == "" ||
        elm.value == null) 
    return false;
    else return true;
}

function isReady(form) {

    if (isFilled(form.name) == false) {
    alert("Please enter your name.");
    form.name.focus();
    return false;
    }
    
    if (isEmail(form.email) == false) { 
    alert("Please enter your email address.");
    form.email.focus();
    return false;
    }

    if (isFilled(form.message) == false) {
    alert("Please enter your message.");
    form.message.focus();
    return false;
    }

return true;
}


openWin = function(url,name,width,height,xpos,ypos,chrome,scroll) {
	var x, y, w, h, moveX=0, moveY=0, features="";
	chrome = chrome ? "yes" : "no";
	scroll = scroll ? "yes" : "no";
	features += "toolbar="+chrome+",location="+chrome+",status="+chrome+",menubar="+chrome;
	features += ",scrollbars="+scroll+",resizable="+scroll;
	if(width) features += ",width="+width;
	if(height) features += ",height="+height;
	if(xpos && window.screen){
		w = window.screen.availWidth;
		width = parseInt(width);
		switch(xpos){
			case "left": x = 0; break;
			case "center": x = (w-width)/2; break;
			case "right": x = w-width; break;
			default: x = xpos;
			}
		features += ",screenX="+x+",left="+x;
		var moveX = x;
		}
	if(ypos && window.screen){
		h = window.screen.availHeight;
		height = parseInt(height);
		switch(ypos){
			case "top": y = 0; break;
			case "middle": y = (h-height)/2; break;
			case "bottom": y = h-height; break;
			default: y = ypos;
			}
		features += ",screenY="+y+",top="+y;
		var moveY = y;
		}
	openWinReference = window.open(url,name,features);
	if(moveX || moveY){
		// position the window for browsers that don't recognize screenX, screenY
		openWinReference.moveTo(moveX,moveY);
		}
	}

openScroll = function(url,name,width,height){
	openWin(url,name,width,height,false,false,false,"scroll");
	}

openCenter = function(url,name,width,height){
	openWin(url,name,width,height,"center","middle");
	}

openCenterScroll = function(url,name,width,height){
	openWin(url,name,width,height,"center","middle",false,"scroll");
	}

openFull = function(url,name){
	openWin(url,name,false,false,false,false,"chrome","scroll");
	}
	