function doClear(theText) 
{
     if (theText.value == theText.defaultValue)
 {
         theText.value = ""
     }
 }
function onTextFieldLostFocus(){
document.form2.searchsite.value = "Keyword";
}
function closeWindow() {
	parent.window.opener.window.focus();
	parent.window.close();
}
function addBookMark(){
	if (document.all){
	window.external.AddFavorite(location.href,document.title);
	}
}
function sendEmail(){
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;
	
	winWidth = 440;
	winHeight = 400;
	
	sLeft = (sWidth - winWidth) / 2;
	sTop = (sHeight - winHeight) / 2;

	window.open("php/showMailList.php","photoCategory","width=" + winWidth + ",height=" + winHeight + ",top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=0,status=0,scrollbars=1,resizable=0");
}
function printWindow() {
	parent.mainFrame.focus();
	window.print(parent.mainFrame);
}
function checkGuestBook() {  
	document.forms[0].visitorName.value = trimSpaces(document.forms[0].visitorName.value);
	if(document.forms[0].visitorName.value.length <= 0) {
		alert("Please enter your name");
		document.forms[0].visitorName.focus();
		return false;
	}
	document.forms[0].emailAddress.value = trimSpaces(document.forms[0].emailAddress.value);
	if(document.forms[0].emailAddress.value.length <= 0) {
		alert("Please enter your email address");
		document.forms[0].emailAddress.focus();
		return false;
	}
	if(!checkEmail(document.forms[0].emailAddress.value)) {
		document.forms[0].emailAddress.focus();
		document.forms[0].emailAddress.select();
		return false;
	}
	document.forms[0].visitorComments.value = trimSpaces(document.forms[0].visitorComments.value);
	if(document.forms[0].visitorComments.value.length <= 0) {
		alert("Please enter your Comments");
		document.forms[0].visitorComments.focus();
		return false;
	}


	document.forms[0].frmAction.value = "update";
}
function checkFeedBack() {  
	document.forms[0].lastName.value = trimSpaces(document.forms[0].lastName.value);
	if(document.forms[0].lastName.value.length <= 0) {
		alert("Please enter your Last name");
		document.forms[0].lastName.focus();
		return false;
	}
	document.forms[0].firstName.value = trimSpaces(document.forms[0].firstName.value);
	if(document.forms[0].firstName.value.length <= 0) {
		alert("Please enter your First Name");
		document.forms[0].firstName.focus();
		return false;
	}

	document.forms[0].email.value = trimSpaces(document.forms[0].email.value);
	if(document.forms[0].email.value.length <= 0) {
		alert("Please enter your email address");
		document.forms[0].email.focus();
		return false;
	}
	if(!checkEmail(document.forms[0].email.value)) {
		document.forms[0].email.focus();
		document.forms[0].email.select();
		return false;
	}
	document.forms[0].frmAction.value = "update";
}
function checktellus() { 
	senderName = trimSpaces(document.forms[0].uname.value);
	senderEmail = trimSpaces(document.forms[0].umail.value);
	receiverEmail = trimSpaces(document.forms[0].rmail.value);
	receiverName = trimSpaces(document.forms[0].rname.value);
	
	if(senderName.length <= 0) {
		alert("You have to enter your name.");
		document.forms[0].uname.focus();
		return false;
	}
	if(senderEmail.length <= 0) {
		alert("You have to enter your email address.");
		document.forms[0].umail.focus();
		return false;
	}
	if(!checkEmail(senderEmail)) {
		document.forms[0].umail.focus();
		return false;
	}
	
	if(receiverName.length <= 0) {
		alert("You have to enter your friend's name.");
		document.forms[0].rname.focus();
		return false;
	}
	
	if(receiverEmail.length <= 0) {
		alert("You have to enter your friend's email address.");
		document.forms[0].rmail.focus();
		return false;
	}
	if(!checkEmail(receiverEmail)) {
		document.forms[0].rmail.focus();
		return false;
	}
	
	document.forms[0].frmAction.value = "yes";
	document.forms[0].submit();
}

