
function CheckNS4() {
	var ver=navigator.appVersion;
	var urlString ="t1.html";
	
	if ( ver.indexOf("MSIE")>-1 ) { //document.writeln(ver);	
		return false;
	}
	if (parseFloat(ver) < 5 ) {
		//window.open("t1.html","c1","Height=300,Width=600,toolbar=1,location=1,directories=1,status=1,menubar=1, scrollbars=1,resizable=1");
		//opener.document.location="http://www.cnn.com";	
		//opener.document.location.reload();
		parent.location = urlString;
		//opener.location.reload();
		//window.close();
		 return true;
	}
}

		function f_enterNewCommunity()
		{
			mapWindow = window.open('enterNewCommunity.asp','mapWin','toolbar=no,location=no, scrollbar=no,width=400,height=300');
	
		}
		function updateparent()
		{
			opener.document.location = 'contributor.asp'
		    window.close();
		}
		function replacePicture(pictureId)
		{

			var destinacion;
			destinacion = 'replacePicture.asp?pictureid='+pictureId;
			mapWindow = window.open(destinacion,'mapWin','toolbar=no,location=no, scrollbar=no,width=400,height=100');
		
		}
		
		function refreshParent()
		{
			opener.document.location.reload();
			window.close();		
		}
		
				
		function refreshWindow()
		{
			window.document.location.reload();
		}
		
		function redirectParentPage(url)
		{
			opener.document.location=url;
		}		
		
		function refreshPage(url)
		{
			document.location=url;
		}
		
		function deleteRecord(recordNumber)
		{
			var confirmat;
			confirmat=confirm("are you sure that you want to delete this record?");
			if (confirmat)
				{
					document.location = "index.asp?id_to_delete="+recordNumber;
				}
		}
		
		function SelectDate(frmDoc,dateIndex)
		{
			frmDoc.date[dateIndex].checked = true;
		}
		
		function popUp(url,myWidth,myHeight)
		{
			
			mapWindow = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0, scrollbars=1,resizable=1,width='+myWidth+',height='+myHeight+'');
		}
		
		function popUp2(url,myWidth,myHeight)
		{
			
			mapWindow = window.open(url,"win2",'toolbar=0,location=0,directories=0,status=0,menubar=0, scrollbars=1,resizable=1,width='+myWidth+',height='+myHeight+'');
		}
		
		
		function noApproveAndSubmit(frmDoc)
		{
			frmDoc.approved.value = 'F';
			frmDoc.submit();
		}
		
function winClose() {
     window.close()
}



function checkEditorForm()
{
	var userNameField;
	var passwordField;
	var valid;
	
	userNameField = document.editorForm.editorUsername.value;
	passwordField = document.editorForm.editorPassword.value;
	valid = "abcdefghijklmnopqrstuvwxyz0123456789_-";
	
	boolReturn = true;
	
	for (var i=0; i<userNameField.length; i++) {
		temp = "" + userNameField.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") {
			boolReturn = false;
			alert("The username can only consist of letters, numbers, hyphens and underscores.");
			document.editorForm.editorUsername.focus();
			break;
		}
	}

		
	if(passwordField.length < 3 && boolReturn)
	{
		alert("The password must be at least 3 characters in length.");
		document.editorForm.editorPassword.focus();
		boolReturn = false;
	}
	
	return boolReturn;
	
}

function checkTextArea() {
	var myLength;
	myLength = document.itemForm.itemLargeDesc.value;

	if(myLength.length == 0)
	{
		alert("you must enter some words as the detailed description.");
		document.itemForm.itemLargeDesc.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function checkEmailAddress()
{
	var emailField;
	var valid;
	
	emailField = document.emailForm.emailListEmail.value;
	valid = "abcdefghijklmnopqrstuvwxyz0123456789_@-.";
	
	boolReturn = true;
	
	for (var i=0; i<emailField.length; i++) {
		temp = "" + emailField.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") {
			boolReturn = false;
			alert("The email address can only consist of the @, letters, numbers, hyphens, underscores and dots.");
			document.emailForm.emailListEmail.focus();
			break;
		}
	}

	return boolReturn;
}

function checkMail(obj)
{
	var x = obj.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(x)) {alert('NO! Incorrect email address');return false;} else { return true;};
	obj.focus();
}

function comparePassword()
{
	var x = document.frm_publicForm.publicForm_user_password.value;
	var y = document.frm_publicForm.publicForm_user_confirmPassword.value;
	if (x != y) {alert('Your password entries did not match!');return false;} else { return true;};
	document.frm_publicForm.publicForm_user_password.focus();
}


function switch_search(div)
{

var option=['div_priceRange_1','div_priceRange_2'];

for(var i=0; i<option.length; i++) 
{ obj=document.getElementById(option[i]);
obj.style.display="block"; }

for(var i=0; i<option.length; i++) 
{ obj=document.getElementById(option[i]);
obj.style.display=(option[i]==div)? "block" : "none"; }

}

