function openGallery(){
newwin = window.open('gallery.asp','edit','resizable=yes,location,status,scrollbars,width=400,height=300');
newwin.focus();
}

function borderit(which,color){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
which.style.borderColor=color
}
}

function FormatText(command, option, fieldtohit){
	//alert(fieldtohit);
  	fieldtohit.document.execCommand(command, true, option);

	fieldtohit.focus();
}

function existingUser(form)
{
email = document.auth.email.value
password = document.auth.password.value
showerr1 = false;
errorMSG = "Form Error:\n\n";
	
if (password.length < 6)
 	{
		showerr1 = true;
		errorMSG +=" -Please enter a password of at least 6 characters\n";
	} 
if ((email.indexOf('@')==-1) || (email.indexOf('.')==-1)) 
	{
 		showerr1 = true;
 		errorMSG +=" -Please enter a valid email\n";
	}
	
if (showerr1 == true)
	{
	alert(errorMSG);
	return false;
	}
else
	{
	return true;
	}
}


function addUser()
{
//alert(document.reg.adpassword.value);
email = document.reg.ademail.value
password = document.reg.adpassword.value
showerr1 = false;
errorMSG = "Form Error:\n\n";

if (password.length < 6)
 	{
		showerr1 = true;
		errorMSG +=" -Please enter a password of at least 6 characters\n";
	} 
if ((email.indexOf('@')==-1) || (email.indexOf('.')==-1)) 
	{
 		showerr1 = true;
 		errorMSG +=" -Please enter a valid email\n";
	}

if (showerr1 == true)
	{
	alert(errorMSG);
	return false;
	}
else
	{
	return true;
	}
}

function adPosting()
{
	adTitle = document.adPost.adTitle.value;
	dhtmlBrowser = document.adPost.dhtmlBrowser.value;
	adPrice = document.adPost.adPrice.value;
	showerr1 = false;
	errorMSG = "Form Error:\n\n";
if (adTitle.length < 6)
 	{
	showerr1 = true;
	errorMSG +=" -Please enter a title of at least 6 characters\n";
	} 
if (dhtmlBrowser=="True")
	{
	document.adPost.adDescription.value = frames.adDescription.document.body.innerHTML;
	}
if (adPrice.length < 1)
 	{
	showerr1 = true;
	errorMSG +=" -Please enter a price\n";
	} 
if (document.adPost.adDescription.value.length < 50)
 	{
		showerr1 = true;
		errorMSG +=" -Please enter a description of at least 50 characters\n";
	} 
if (document.adPost.adDescription.value.length > 12000)
 	{
		showerr1 = true;
		errorMSG +=" -Your description exceeds the 12000 character limit. Please amend\n";
	} 
if (showerr1 == true)
	{
	errorMSG +="\nThank you";
	alert(errorMSG);
	return false;
	}
else
	{
	return true;
	}
}

function delPosting(adID)
{
nextAction = confirm('Are you sure you want to delete this post?');

if (nextAction == true)
	{
	window.location.href="delPost.asp?adID=" + adID
	}

}

function savePost()
{
nextAction = confirm('Have you begun your posting?\n\nAny data already entered will be lost.\n\nYou can edit your contact details after posting.\n\n Do you wish to continue?.');

if (nextAction == true)
	{
	window.location.href="edit_user_details.asp"
	}

}


function openSendPWD()
{
URLName =  "library/sendpwd.asp"
		pwdWin = window.open('','pwd','scrollbars=no,resizeable=no,width=450,height=175,top=100,left=100');
    	pwdWin.location.href = URLName;
		pwdWin.focus();
}
