
// Validate Email Address


function validateEmail(formName,inputName) {
	
// Validate email address

	var inputObject = document.forms[formName].elements[inputName];
	var atSign = inputObject.value.indexOf('@');
	var dot = inputObject.value.lastIndexOf('.');
	var space = inputObject.value.indexOf(' ');
	var emailLength = inputObject.value.length - 1;

	if ((atSign < 1) || (space != -1) || (dot <= atSign + 1) || (dot == emailLength)) { 
 		alert('Please enter a valid email address');
		inputObject.focus();
		return false;
	}
	return true;
}


//------------------------------------------------------------------------------------------------------


// Swap Image



function swapimage(name,image){
		
	document[name].src = "images/" + image + ".gif";
}


//------------------------------------------------------------------------------------------------------


// Admin Login 


function admin(){
	
var winTop = (screen.height / 2) - 250;
var winLeft = (screen.width / 2) - 180;
windowFeatures = "width=350, height=190,";
windowFeatures = windowFeatures + "left=" + winLeft + ",";
windowFeatures = windowFeatures + "top=" + winTop + ",";
windowFeatures = windowFeatures + "toolbar=no, location=no, resizable=no, scrollbars=no, status=no";

	 msgWindow=open('admin.cfm', 'window2',windowFeatures);
    if (msgWindow.opener == null) msgWindow.opener = self;
	}

//------------------------------------------------------------------------------------------------------


// Listing Comments Window 


function comments(apt){
	
var winTop = (screen.height / 2) - 250;
var winLeft = (screen.width / 2) - 180;
windowFeatures = "width=500, height=275,";
windowFeatures = windowFeatures + "left=" + winLeft + ",";
windowFeatures = windowFeatures + "top=" + winTop + ",";
windowFeatures = windowFeatures + "toolbar=no, location=no, resizable=no, scrollbars=no, status=no";

var page = "comments.cfm?apt=" + apt;

	 msgWindow=open(page, 'window3',windowFeatures);
    if (msgWindow.opener == null) msgWindow.opener = self;
	}

//------------------------------------------------------------------------------------------------------

function newWindow(file,width,height,window,toolbar,resize,scroll,status){

var wintopval = (height/2) + 50;
var winleftval = (width/2) + 10;
	
var winTop = (screen.height / 2) - wintopval;
var winLeft = (screen.width / 2) - winleftval;

windowFeatures = "width= " + width + ", height= " + height + ",";
windowFeatures = windowFeatures + "left=" + winLeft + ",";
windowFeatures = windowFeatures + "top=" + winTop + ",";

windowFeatures = windowFeatures + "toolbar= " + toolbar + ", location=no, resizable= " + resize + ", scrollbars= " + scroll + ", status= " + status;

	 msgWindow=open(file, window, windowFeatures);
    if (msgWindow.opener == null) msgWindow.opener = self;
	}



