
function SubmitForm(fuseaction)
{
document.propertysearchform.fuseaction.value = fuseaction;
document.propertysearchform.submit();
}

function ChangeFormmode(formmode)
{
document.propertysearchform.fuseaction.value = "form";
document.propertysearchform.formmode.value = formmode;
document.propertysearchform.submit();
}

function Navigationlink(URL,Fuseaction)
{
if (typeof(document.propertysearchform) != "undefined" ) {
	document.propertysearchform.action = URL;
	ChangeSearchType(Fuseaction);
   } 
else {
   (document.location.href=URL+'?propsearchtype='+Fuseaction)
   }
}

function ChangeShowSub(ShowSub)
{
document.propertysearchform.fuseaction.value = "form";
document.propertysearchform.action += "#propertyTypes";
document.propertysearchform.showSub.value = ShowSub;
document.propertysearchform.submit();
}

function CheckCouncilArea(ulacode)
{
var checkBoxName = "URNID";
var formlength = propertysearchform[checkBoxName].length

for(i=0;i<formlength;i++)
if (document.propertysearchform.URNID[i].value == ulacode)
	{
	if (document.propertysearchform.URNID[i].checked == false)
		{document.propertysearchform.URNID[i].checked = true}
	else
		{document.propertysearchform.URNID[i].checked = false}
	}
}


function ChangeShowCouncils(ShowCouncils)
{
document.propertysearchform.fuseaction.value = "form";
document.propertysearchform.action += "#council";
document.propertysearchform.showCouncils.value = ShowCouncils;
document.propertysearchform.submit();
}

function ChangeShowLEC(ShowLEC)
{
document.propertysearchform.fuseaction.value = "form";
document.propertysearchform.action += "#LEC";
document.propertysearchform.showLEC.value = ShowLEC;
document.propertysearchform.submit();
}

function ChangeShowLEDC(ShowLEDC)
{
document.propertysearchform.action += "#LEDC";
document.propertysearchform.showLEDC.value = ShowLEDC;
document.propertysearchform.submit();
}

function ChangeSearchType(SearchType)
{
document.propertysearchform.propsearchtype.value = SearchType;
document.propertysearchform.fuseaction.value = "form";
document.propertysearchform.submit();
}



function SubmitMapForm (fuseaction,ulacode)
{
document.mapform.fuseaction.value = fuseaction; 
document.mapform.add_ulacode.value = ulacode;
document.mapform.submit(); 
}

function RemoveULAcode (fuseaction,ulacode)
{
document.mapform.fuseaction.value = fuseaction; 
document.mapform.remove_ulacode.value = ulacode;
document.mapform.submit(); 
}

function NewWindow( windowURL, windowName, windowFeatures ) 
	{  newwin = window.open( windowURL, windowName, windowFeatures ) ; 
	newwin.focus();
	} 

function LookupWindow	(windowURL, variablename, windowName, windowFeatures)
	{
			fullwindowurl= windowURL + variablename;
			newwin = window.open( fullwindowurl, windowName, windowFeatures ) ; 
			newwin.focus();
			
	
	/*alert("Variable Name = " + variablename +
	"\rFullwindowURL = " + fullwindowurl );*/
	} 
	
function NewFullSizeWindow(windowURL, windowName) 
{ 
    var str = "left=0,screenX=0,top=0,screenY=0,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes";
    if (window.screen) {
      var ah = screen.availHeight - 30;
      var aw = screen.availWidth - 10;
      str += ",height=" + ah;
      str += ",innerHeight=" + ah;
      str += ",width=" + aw;
      str += ",innerWidth=" + aw;
	   }
    newwin = window.open(windowURL, windowName, str);
	newwin.focus();
} 

	function BookmarkSPN() {
    window.external.AddFavorite('http://www.scottishproperty.com/',
                                'Scottish Property Network'); }

function closeme()
	{
	
	if(opener.focus)
	{
	window.close();
	opener.focus();
	}
	else
	{document.location.href="/";}
	}		

function HideRow(rowid)
{
rowid.style.display='none';
}

function DisplayRow(rowid)
{
rowid.style.display='block';
}

function ToggleRow(showrow,hiderow)
{
showrow.style.display='block';
hiderow.style.display='none'; 
}

function CallDetailedWindows( windowURL, windowName, windowFeatures ) 
	{ return window.open( windowURL, windowName, windowFeatures ) ; }

function NewWindow( windowURL, windowName, windowFeatures ) 
	{  newwin = window.open( windowURL, windowName, windowFeatures ) ; 
	newwin.focus();
	}	
	
function validatesize()
// by multiplying the value by 1 javascript then sees
// it as an integer for comparison purposes
{
        var minsize = document.propsearchform.minsize.value * 1
        var maxsize = document.propsearchform.maxsize.value * 1
        if (minsize > maxsize)
        {       alert("The Minimum size must be less than the Maximum size")    }
        if (minsize == '')
        {alert("You must enter both a minimum and a maximise size")}
}

function validatetown()
{	top.picksearch.location.href="index.cfm?fuseaction=townvalidate&town=" + escape(document.propsearchform.townname.value)}


function goback()
        {       history.go(-1)  }

        function callphotos(recordno)
	{	top.location.href='index.cfm?fuseaction=images&pserial='+ recordno	}
	
	function callmaps(pcode)
	{	top.location.href='http://uk.multimap.com/p/browse.cgi?pc=' + pcode		}
	
	function callmap(pserial)
	{mapwindow= window.open('index.cfm?fuseaction=maps&pserial='+ pserial,'Mapwin','top=5,left=20,height=600,width=600,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1');
mapwindow.focus()
}

function gotosearch(url)
	{document.location.href= url}



/* This function opens a new window */
function openWin( windowURL, windowName, windowFeatures ) { 
		return window.open( windowURL, windowName, windowFeatures ) ; 

	} 


/* This script calls a new window to the top */
function calllocation(windowURL)
	{
	top.location=windowURL;
	return true
	}

/* This script calls a new window to the same frame */
function calllocation1(windowURL)
	{
	document.location=windowURL;
	return true
	}



/* The above script woudl not work with setTimeout function so I have had to define it separately */

function gototop()
	{
	top.location.href='./'
	return true
	}

/* This function is used in the live control panel to call other frames */
function jumpPage(formnum,menunum) {
i=document.forms[formnum].elements[menunum].selectedIndex;
top.location=document.forms[formnum].elements[menunum].options[i].value;
}

function formatPostCode(){
		form = document.propertysearchform
		if (!isNaN(form.postcode.value.charAt(form.postcode.value.length - 1))){
			var spaceFound = false;
			for(i = 0; i < form.postcode.value.length; i++){
				if(form.postcode.value.charAt(i) == " "){
					var spaceFound = true
					break;
				}
			}

			if (!spaceFound){
				form.postcode.value += " ";
			}
		}
	}
	


	
	function disableapprovaldates()
	{
	form = document.propertysearchform;

				
	if (form.ByPassApprovalDates.checked)
	{
	form.DateofConsentMonthFrom.disabled = false;
	form.DateofConsentYearFrom.disabled = false;
	form.DateofConsentMonthto.disabled = false;
	form.DateofConsentYearto.disabled = false;	
	
	}
	else
	{
	form.DateofConsentMonthFrom.disabled = true;
	form.DateofConsentYearFrom.disabled = true;
	form.DateofConsentMonthto.disabled = true;
	form.DateofConsentYearto.disabled = true;
	

	}
	}
	
	function checkFuseactionSelects(){
		document.forms[0].dateGroup.disabled = true;
		document.forms[0].searchGroupBy.disabled = true;
		if (document.forms[0].fuseaction[3].checked){
			document.forms[0].dateGroup.disabled = false;
		} else if (document.forms[0].fuseaction[4].checked){
			document.forms[0].searchGroupBy.disabled = false;
		}
	} 
	
		function changeSelectBox(checkbox){
		if (checkbox.checked){
			checkbox.form.comp_ref.disabled = false;
		} else {
			checkbox.form.comp_ref.disabled = true;
		}
	}
	
	function hideAdditionalRequirements(){
		<!--- AdditionalRequirments1.style.display='none'; --->
		AdditionalRequirments2.style.display='none';
		AdditionalRequirments3.style.display='none';
		AdditionalRequirments4.style.display='none';
		AdditionalRequirments5.style.display='none';
		AdditionalRequirments6.style.display='none';
		AdditionalRequirments7.style.display='block';
		document.propertysearchform.showAdvancedSearchForm.value = false;
	}
	
	function showAdditionalRequirements(){
		<!--- AdditionalRequirments1.style.display='block'; --->
		AdditionalRequirments2.style.display='block';
		AdditionalRequirments3.style.display='block';
		AdditionalRequirments4.style.display='block';
		AdditionalRequirments5.style.display='block';
		AdditionalRequirments6.style.display='block';
		AdditionalRequirments7.style.display='none';
		document.propertysearchform.showAdvancedSearchForm.value = true;
	}
	
	function assistedAreaCheck(currentSelection){
						if(currentSelection.checked){
							currentSelection.form.assistanceLevel.disabled = false;
						} else {
							currentSelection.form.assistanceLevel.disabled = true;
						}
					}
					
	function printpage() {
	window.print();  
	}
	
	
	
	
				
