
function openSampleWin(reportType)	{

	var theReport="../newmember/sampleReportWindow.php?type=" + reportType ;

	//window.open(sampleLink,"kighge","left=13,top=235,height=420,width=600,resizable=1");

	if (top.consoleRef !=null){
			if(!top.consoleRef.closed){
			top.consoleRef.close()
		}
	}

	top.consoleRef=window.open(theReport,"kighge","left=13,top=235,height=420,width=600,resizable=1");

}

function openMoreInfoWin(whichSection)
{
	if (top.consoleRef !=null){
			if(!top.consoleRef.closed){
			top.consoleRef.close()
		}
	}
	top.consoleRef=window.open("moreInfo.php#" + whichSection,"kighge","left=13,top=235,height=420,width=577,resizable=1,scrollbars=1");
}

function Trim(s) 
{
  // Remove leading spaces and carriage returns
  
  while((s.substring(0,1)== ' ')||(s.substring(0,1) == '\n')||(s.substring(0,1) == '\r'))
  {
    s = s.substring(1,s.length);
  }

  // Remove trailing spaces and carriage returns

  while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r'))
  {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function MDM_openWindow(theURL,winName,features) 
{   
  var _W=window.open(theURL,winName,features);
	  _W.focus();
      _W.moveTo(50,50); 
} 
function checkNum(s)
{
	var cnt=0;
	if(s.length<=0)
	{
		return false;
	}
	else
	{
		var i=0;
	}
	
	for(i;i<s.length;i++)
	{
		var c=s.charAt(i);
		if((c>="0"&&c<="9"))
		{
			continue;
		}
		else if(c==".")
		{	
		   if(cnt>1)
		   return false;

		   cnt++;
		}
		else
		{
			return false;
		}	
	}
	
	 return true;
	
}
function checkInt(s)
{
	if(s.length<=0)
	{
		return false;
	}
	else
	{
	 var i=0;
	}
	
	for(i;i<s.length;i++)
	{
		var c=s.charAt(i);
		if((c>="0"&&c<="9"))
		{}
		else
		{
		 return false;
		}
	}
	
  return true;
	
}
function chkBlank(s)
{
	if(s.length<=0)
	{
		return false;
	}
	else
	{
		var i=0;

	}
	j=0;
	for(i=0;i<=s.length;i++)
	{
		var c=s.charAt(i);
		if(c==" ")
		{
			j++;

		}
	}
	if(s.length==j)
		return false
		
	return true;
	
}
function parcelNo(s)
{
	var i=0;

	if(!chkBlank(s))
	{
		return false;
	}
	for(i=0;i<s.length;i++)
	{
		var c=s.charAt(i);
		if((c>="a"&&c<="z")||(c>="A"&&c<="Z")||(c>="0"&&c<="9")||(c=="/")||(c=="\\"))
		{
			
		}
		else
		{
			return false;
		}
	}
	
	if(s.length<=0)
	{
		return false;
	}
	else
	{
	 return true;
	}
}

//function for validation in site description information

function validatePropertyInfo(theForm)
{	
	if(theForm.pro_type.selectedIndex==0)
	{
		
		alert("Please Select \"Property Type\".");
		theForm.pro_type.focus();
		return false;
	}
	theForm.zoning.value=Trim(theForm.zoning.value);
 /*if(theForm.zoning.value=="")
	{
		
		alert("Please enter value for the \"Zoning\".");
		theForm.zoning.focus();
		return false;
	}*///commented because mandetory fields are cancelled
	


	if(!isAlphanumeric(theForm.zoning.value))
	{
		
		alert("Please enter valid value for \"Zoning\".");
		theForm.zoning.focus();
		theForm.zoning.value="";
		return false;
	}
	
theForm.area_val.value=Trim(theForm.area_val.value);
//Check Land Area is null or not
/*if(theForm.area_val.value=="")
{
	alert("Please enter value for the \"Land Area\" field.");
	theForm.area_val.focus();
	return (false);
}*/
//Check Land Area is numeric or not
if (!isFloat(theForm.area_val.value))
 {
    alert("Please enter only numbers in this field.  (No $ sign, commas or symbols.)");
    theForm.area_val.focus();
	theForm.area_val.value="";
    return (false);
  }
  //validation for no of floors
	if (!isInteger(Trim(theForm.noStories.value)))
	{
			alert("Please enter only numbers in this field.  (No $ sign, commas or symbols.)");
			theForm.noStories.focus();
			theForm.noStories.value="";
			return (false);
	 }
		
	/*if(theForm.noStories.value=="")
	{
		alert("Please enter value for the \"Number Of Floors\" ");
		theForm.noStories.focus();
		 return (false);
	}*/
if( parseInt(theForm.noStories.value)<=0||parseInt(theForm.noStories.value)>125)
{
	alert("'Number Of Floors' should be between 1 to 125");
    theForm.noStories.focus();
	theForm.noStories.value="";
	 return (false);

}
  theForm.noStories.value=Trim(theForm.noStories.value);

 theForm.par_space.value=Trim(theForm.par_space.value);//Remove Lerading & Trailing Blank Space  

//Check Parking Space  is null or not
/*if(theForm.par_space.value=="")
{	
	alert("Please enter value for the \"Parking Spaces\".");
    theForm.par_space.focus();
	return (false);
}*/


 //Check Parking Space  is Integer or not
  if(!isInteger(theForm.par_space.value)||parseInt(theForm.par_space.value)<=0)
  {
    alert("Please enter only numbers in this field.  (No $ sign, commas or symbols.)");
    theForm.par_space.focus();
	theForm.par_space.value="";
    return (false);
  }
 // theForm.par_space.value=Trim(theForm.par_space.value);//Remove Lerading & Trailing Blank Space  



  //Check Construction type is null or not 
  theForm.construction.value=Trim(theForm.construction.value);

/*if(theForm.construction.value=="")
{
	 alert("Please enter value for \"Construction Type\" field.");
    theForm.construction.focus();
    return (false);
}*/

  //Check Construction type is Alphanumeric or not 
  if(!isAlphanumeric(theForm.construction.value,true,false))
  {
    alert("Please enter a 'ALPHANUMERIC' value for \"Construction Type\" field.");
    theForm.construction.focus();
	theForm.construction.value="";
    return (false);
  }

 //Check Power Services is null or not 	   
 theForm.power_val.value=Trim(theForm.power_val.value);
/*if(theForm.power_val.value=="")
{
	 alert("Please enter value for \"Power Service\" field.");
    theForm.power_val.focus();
    return (false);
}*/
//Check Power Services is Alphanumeric or not 	   
 if(!isAlphanumeric(Trim(theForm.power_val.value),true,false))
  {
    alert("Please enter a 'ALPHANUMERIC' value for \"Power Service\" field.");
    theForm.power_val.focus();
	theForm.power_val.value="";
    return (false);
  }
  //Check Roofing is null or not 
  theForm.roofing.value=Trim(theForm.roofing.value);
 /*if(theForm.roofing.value=="")
 {
	alert("Please enter value the \"Roofing\" field.");
    theForm.roofing.focus();
    return (false);
  }*/
//Check Roofing is Alphanumeric or not 
  if(!isAlphanumeric(theForm.roofing.value,true,false))
  {
    alert("Please enter a 'ALPHANUMERIC' value the \"Roofing\" field.");
    theForm.roofing.focus();
	theForm.roofing.value="";
    return (false);
  }
  
//Check Lot Field is Empty or Not  
theForm.lot.value=Trim(theForm.lot.value);
  if(theForm.lot.value!= "")
  {
	 if(!isFloat(theForm.lot.value)||parseFloat(theForm.lot.value)==0||theForm.lot.value=="")
	 {
		alert("Please enter only numbers in this field.  (No $ sign, commas or symbols.)");
		theForm.lot.focus();
		theForm.lot.value="";
		return (false);
	 }
  if (theForm.lot.value.length > 6)
  {
    alert("Please enter at most 6 characters in the \"Lot\" field.");
    theForm.lot.focus();
	theForm.lot.value="";
    return (false);
  }
}

//Check Block Field is Empty or Not   
theForm.block.value=Trim(theForm.block.value);
if(theForm.block.value!="")
{
  if(!isAlphanumeric(Trim(theForm.block.value),true,false)||parseInt(theForm.block.value)==0)
  {
    alert("Please enter a 'ALPHANUMERIC' value for the \"Block\" field.");
    theForm.block.focus();
	theForm.block.value="";
    return (false);
  }

 }


//Check Rent Area is float or not
theForm.rent_area.value=Trim(theForm.rent_area.value);
  if(theForm.rent_area.value!="")
  {

		  if (!isFloat(theForm.rent_area.value))
		  {
			alert("Please enter only numbers in this field.  (No $ sign, commas or symbols.)");
			theForm.rent_area.focus();
			theForm.rent_area.value="";
			return (false);
			//if(!isFloat
		  }

		 
  }


 theForm.yearBuilt.value= Trim(theForm.yearBuilt.value);
 //Check yearBuilt is null or not 
/* if(theForm.yearBuilt.value=="")
{
	alert("Please enter 'Year' in \"Year Built\"");
    theForm.yearBuilt.focus();
	return (false);
  }	*/
//Check yearBuilt is  or Integer not 
if(theForm.yearBuilt.value!="")
{
  if(theForm.yearBuilt.value.length<4||!isInteger(theForm.yearBuilt.value))
  {
    alert("Please enter 'Year' value in \"Year Built\".\ne.g:- 1978");
    theForm.yearBuilt.focus();
	theForm.yearBuilt.value="";
    return (false);
  }
} 
//Check yearBuilt is <1900 not 
  if(parseInt(theForm.yearBuilt.value)<1900 || parseInt(theForm.yearBuilt.value)>2155)
  {
    alert("\"Year Built\" should be between 1900 to 2155.");
    theForm.yearBuilt.focus();
	theForm.yearBuilt.value="";
    return (false);
  }
  
  return (true);

}



function validatePropertyInfo_list(theForm)
{	
	
	theForm.zoning.value=Trim(theForm.zoning.value);
 	

if(theForm.zoning.value!="")
{
	if(!isAlphanumeric(theForm.zoning.value))
	{
		
		alert("Please enter valid value for \"Zoning\".");
		theForm.zoning.focus();
		theForm.zoning.value="";
		return false;
	}
}
	
theForm.area_val.value=Trim(theForm.area_val.value);
//Check Land Area is null or not
//Check Land Area is numeric or not
if(theForm.area_val.value!="")
{
	if (!isInteger(theForm.area_val.value))
	 {
		alert("Please enter only numbers in this field.  (No $ sign, commas or symbols.)");
		theForm.area_val.focus();
		theForm.area_val.value="";
		return (false);
	  }
}
  //validation for no of floors
theForm.noStories.value=Trim(theForm.noStories.value);
if(theForm.noStories.value!="")
{
	if (!isInteger(Trim(theForm.noStories.value)))
	{
			alert("Please enter only numbers in this field.  (No $ sign, commas or symbols.)");
			theForm.noStories.focus();
			theForm.noStories.value="";
			return (false);
	 }

		


	if(parseInt(theForm.noStories.value)<=0||parseInt(theForm.noStories.value)>125)
	{
		alert("Please 'Number Of Floors' should be between 1 to 125");
		theForm.noStories.focus();
		theForm.noStories.value="";
		 return (false);

	}
}
 

 theForm.par_space.value=Trim(theForm.par_space.value);//Remove Lerading & Trailing Blank Space  

//Check Parking Space  is null or not

if(theForm.par_space.value!="")
{	
	
 //Check Parking Space  is Integer or not
  if(!isInteger(theForm.par_space.value)||parseInt(theForm.par_space.value)<=0)
  {
    alert("Please enter only numbers in this field.  (No $ sign, commas or symbols.)");
    theForm.par_space.focus();
	theForm.par_space.value="";
    return (false);
  }
}
 // theForm.par_space.value=Trim(theForm.par_space.value);//Remove Lerading & Trailing Blank Space  



  //Check Construction type is null or not 
  theForm.construction.value=Trim(theForm.construction.value);

if(theForm.construction.value!="")
{
  //Check Construction type is Alphanumeric or not 
  if(!isAlphanumeric(theForm.construction.value,true,false))
  {
    alert("Please enter 'ALPHANUMERIC' value for \"Construction Type\" field.");
    theForm.construction.focus();
	theForm.construction.value="";
    return (false);
  }
}

 //Check Power Services is null or not 	   
 theForm.power_val.value=Trim(theForm.power_val.value);

if(theForm.power_val.value!="")
{
	
//Check Power Services is Alphanumeric or not 	   
 if(!isAlphanumeric(Trim(theForm.power_val.value),true,false))
  {
    alert("Please enter 'ALPHANUMERIC' value for \"Power Service\" field.");
    theForm.power_val.focus();
	theForm.power_val.value="";
    return (false);
  }
}
  //Check Roofing is null or not 
  theForm.roofing.value=Trim(theForm.roofing.value);
if(theForm.roofing.value!="")
{
	
	//Check Roofing is Alphanumeric or not 
	  if(!isAlphanumeric(theForm.roofing.value,true,false))
	  {
		alert("Please enter a 'ALPHANUMERIC' value the \"Roofing\" field.");
		theForm.roofing.focus();
		theForm.roofing.value="";
		return (false);
	  }
 }
  
//Check Lot Field is Empty or Not  
theForm.lot.value=Trim(theForm.lot.value);
  if(theForm.lot.value!= "")
  {
	 if(!isFloat(theForm.lot.value)||parseFloat(theForm.lot.value)==0||theForm.lot.value=="")
	 {
		alert("Please enter only numbers in this field.  (No $ sign, commas or symbols.)");
		theForm.lot.focus();
		theForm.lot.value="";
		return (false);
	 }
  if (theForm.lot.value.length > 6)
  {
    alert("Please enter at most 6 characters in the \"Lot\" field.");
    theForm.lot.focus();
	theForm.lot.value="";
    return (false);
  }
}

//Check Block Field is Empty or Not   
theForm.block.value=Trim(theForm.block.value);
if(theForm.block.value!="")
{
  if(!isAlphanumeric(Trim(theForm.block.value),true,false)||parseInt(theForm.block.value)==0)
  {
    alert("Please enter a 'ALPHANUMERIC' value for the \"Block\" field.");
    theForm.block.focus();
	theForm.block.value="";
    return (false);
  }

 }


//Check Rent Area is float or not
theForm.rent_area.value=Trim(theForm.rent_area.value);
  if(theForm.rent_area.value!="")
  {

		  if (!isFloat(theForm.rent_area.value))
		  {
			alert("Please enter only numbers in this field.  (No $ sign, commas or symbols.)");
			theForm.rent_area.focus();
			theForm.rent_area.value="";
			return (false);
			//if(!isFloat
		  }

		 
  }


 theForm.yearBuilt.value= Trim(theForm.yearBuilt.value);
 //Check yearBuilt is null or not 
 if(theForm.yearBuilt.value!="")
{
	
//Check yearBuilt is  or Integer not 
  if (theForm.yearBuilt.value.length<4||!isInteger(theForm.yearBuilt.value))
  {
    alert("Please enter 'Year'  value in \"Year Built\".\ne.g:- 1978");
    theForm.yearBuilt.focus();
	theForm.yearBuilt.value="";
    return (false);
  }
 
//Check yearBuilt is <1900 not 
  if(parseInt(theForm.yearBuilt.value)<1900 || parseInt(theForm.yearBuilt.value)>2155)
  {
    alert("Please \"Year Built\" should be between 1900 to 2155.");
    theForm.yearBuilt.focus();
	theForm.yearBuilt.value="";
    return (false);
  }
  
}
  return (true);

}

/*
function validatePropertyInfo1(val)
{
	var x=document.property;
	

	if(x.pro_type.selectedIndex==0)
	{
		
		alert("Please Select Property Type");
		x.pro_type.focus();
		return false;
	}
	x.area.value=Trim(x.area.value);
	if(!checkNum(x.area.value))
	{
		
		alert("Enter valid value in Land Area Box");
		x.area.focus();
		return false;
	}
	
	
	if(x.yearBuilt.value=="")
	{
		alert("Please Enter Year Built !");
		x.yearBuilt.focus();
		return false;
	}
	x.noStories.value=Trim(x.noStories.value);
	if((x.noStories.value==0)||(x.noStories.value>125))
	{
		alert("Enter valid value in No. Of Floors Box");
		x.noStories.focus();
		return false;
	}
	x.par_space.value=Trim(x.par_space.value);
	if(x.par_space.value=="")
	{
		alert("Please Enter Parking Space !");
		x.par_space.focus();
		return false;
	}
	
	if(x.parcelNo.value!="")
	{
			if(!parcelNo(x.parcelNo.value))
			{
				alert("Enter valid value in Lot & Block");
				x.parcelNo.focus();
				x.parcelNo.value="";
				return false;
			}
      }
	 x.zoning.value=Trim(x.zoning.value);
	  if(x.zoning.value=="")
	{
		
		alert("Please Enter Zoining");
		x.zoning.focus();
		return false;
	}
	x.roofing.value=Trim(x.roofing.value);
	if(x.roofing.value=="")
	{
		
		alert("Please Enter Roofing");
		x.roofing.focus();
		return false;
	}
	
	x.construction.value=Trim(x.construction.value);
		if(x.construction.value=="")
	{
		
		alert("Please Enter Construction Type");
		x.construction.focus();
		return false;
	}

	x.power_val.value=Trim(x.power_val.value);
if(x.power_val.value==0)
	{
		
		alert("Please Select Power Service");
		x.power_val.focus();
		return false;
	}
	if(x.zoning.value!="")
	{
		if(!chkBlank(x.zoning.value))
		{
			alert("Please select Zoining value");
			x.zoning.focus();
			x.zoning.value="";
			return false;

		}
	}
	if(x.roofing.value!="")
	{
		if(!chkBlank(x.roofing.value))
		{
			alert("Please select Roofing value");
			x.roofing.focus();
			x.roofing.value="";
			return false;
		}
	}
	
	
	
	if(x.yearBuilt.value=="")
	{
		alert("Please Enter Year Built !");
		x.yearBuilt.focus();
		return false;
	}
	
obj=x.act.value=val;		
//document.property.submit();
	return true;
}
*/
function openNewWindow(str,win)
{
window.open(str,win,"toolbar=yes,location=yes,directories=no,status=no, menubar=yes, scrollbars=yes, resizable=yes, copyhistory=yes, width=700, height=600");
}
