function NewWindow(mypage,myname,w,h,scroll,pos)
{
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);
}

function test(field)
{
if(field.value.length > 0) return(true)
alert("ATTENTION!\n\nYou have not entered information in the " + field.id + " field.\n\nPlease do so before proceeding.");
field.focus();
field.select();
return(false);
}

function validateEmail(email)
{
if(window.RegExp)
{
var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
var reg1 = new RegExp(reg1str);
var reg2 = new RegExp(reg2str);
if(!reg1.test(email.value) && reg2.test(email.value)) return(true);
alert("ATTENTION!\n\nYour email address seems incorrect.\n\nPlease make make sure you have entered a valid email address.");
email.focus();
email.select();
return(false);
}
else
{
if(email.value.indexOf("@") >= 0) return(true);
alert("ATTENTION!\n\nYour email address seems incorrect.\n\nPlease make make sure you have entered a valid email address.");
email.focus();
email.select();
return(false);
}
}

function bookmark(url, description)
{
netscape="Netscape User's hit CTRL+D to add a bookmark to this site."
if (navigator.appName=='Microsoft Internet Explorer')
{
window.external.AddFavorite(url, description);
}
else if (navigator.appName=='Netscape')
{
alert(netscape);
}
}

function removeSpaces(string) {
	var tstring = "";
	string = '' + string;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
	tstring += splitstring[i];
	return tstring;
}

function removeCommas(string) {
	var tstring = "";
	string = '' + string;
	splitstring = string.split(",");
	for(i = 0; i < splitstring.length; i++)
	tstring += splitstring[i];
	return tstring;
}

function removeDecimal(string) {
	var tstring = "";
	string = '' + string;
	splitstring = string.split(".");
	for(i = 0; i < splitstring.length; i++)
	tstring += splitstring[i];
	return tstring;
}

function validateNumber(field){ 
	if(isNan(field.value)) { 
		alert("ATTENTION!\n\n" + field.id + " field must be numeric.\n\nPlease do so before proceeding.");
		field.focus();
		field.select();
		return(false);
	} else {
		return true;
	  } 
}

function checkForOther(obj) { 
 if (!document.layers) { 
 var txt = document.getElementById("OtherTitle"); 
 if (obj.value == "13-13") { 
 txt.style.display = "inline"; 
 // gives the text field the name of the drop-down, for easy processing 
 //txt.name = "OtherCategory"; 
 //obj.name = ""; 
 } else { 
 txt.style.display = "none"; 
 //txt.name = ""; 
 //obj.name = "OtherCategory"; 
 } 
 } 
} 

function checkForm(post) { 
	var check;
	check = test(post.Title) && test(post.file1) && test(post.Category);
}

function checkRegistration(post) { 
	var check;
	check = test(post.Name) && test(post.UName) && test(post.PWord) && test(post.PWord2) && test(post.Email) && validateEmail(post.Email);
	return check;
}

function checkAdminLogin(post){ 
	var check;
	check = test(post.UName) && test(post.PWord);
	return check;
}

function checkEditForm(post){ 
	var check;
	check = test(post.UName) && test(post.PWord) && test(post.PWord2);
	return check;
}

function checkUserLogin(post){ 
	var check;
	check = test(post.UName) && test(post.PWord);
	return check;
}

function checkUploaderAddForm(post){ 
	var check;
	check = test(post.GName) && test(post.UName) && test(post.PWord) && test(post.Email) && validateEmail(post.Email);
	return check;
}

function checkImageType(post){ 
	var check;
	check = test(post.IWidth) && test(post.IHeight);
	return check;
}

function checkEditImageDetails(post){ 
	var check;
	check = test(post.ImageTitle);
	return check;
}

function checkCategoryForm(post){ 
	var check;
	check = test(post.CategoryName);
	return check;
}

function checkDefineForm(post){ 
	var check;
	check = test(post.CName) && test(post.CValue);
	return check;
}

function FooterLink(post){ 
	var check;
	check = test(post.FooterName) && test(post.FooterLink);
	return check;
}

function checkSponsors(post){ 
	var check;
	check = test(post.SponsorName) && test(post.SponsorLink);
	return check;
}
