<!-- window.status='PropertyAuctionZone.com Web Site.'; -->

var message="Function Disabled!";

function FormEdit(alertname, descri, tenure, tenancy, resi, com, aucperiod, street, town, postcode, county, region, auctioneer, soldstatus, income, repossess, active, format)
{
	for (var i=1;i<=tenure.length;i++){
		if (tenure.substr(i-1,1)=='1'){
			box = eval("this.DForm.Tenure" + i);
			box.checked = true;
		}
	}	

	for (var i=1;i<=tenancy.length;i++){
		if (tenancy.substr(i-1,1)=='1'){
			box = eval("this.DForm.Tenancy" + i);
			box.checked = true;
		}
	}	

	for (var i=1;i<=resi.length;i++){
		if (resi.substr(i-1,1)=='1'){
			box = eval("this.DForm.Resi" + i);
			box.checked = true;
		}
	}	

	for (var i=1;i<=com.length;i++){
		if (com.substr(i-1,1)=='1'){
			box = eval("this.DForm.Com" + i);
			box.checked = true;
		}
	}
	
	if (alertname != "") document.DForm.EAlertName.value= alertname; else document.DForm.EAlertName.value= "";
	if (descri != "") document.DForm.Description.value= descri; else document.DForm.Description.value= "";
	
	chk = eval("this.DForm.Active");
	if (active=="1") chk.checked=true; else chk[1].checked=true;

	chk = eval("this.DForm.Format");
	if (format=="Html") chk.checked=true; else chk[1].checked=true;
}


function clickIE()
{
	if (document.all)
	{
 	 alert(message);
	 return false;
	}
}

function clickNS(e)
{
	if (document.layers||(document.getElementById&&!document.all))
	{
		if (e.which==2||e.which==3)
		{
			alert(message);
			return false;
		}
	}
}
	
	if (document.layers)
	{
		document.captureEvents(Event.MOUSEDOWN);
		document.onmousedown=clickNS;
	}
	else
	{
		document.onmouseup=clickNS;
		document.oncontextmenu=clickIE;
	}

document.oncontextmenu=new Function("return false")


function dc()
{
    window.clipboardData.clearData();
    event.returnValue = false;
}

function dkp()
{
  if(event.ctrlKey)
    {
    if((event.keyCode == 67) || (event.keyCode == 99))
      {
        event.returnValue = false;
      }
    else
      {
     event.returnValue = true;
      }
    }
  else
    {
      if (event.keyCode == 91)
        {
          event.returnValue = false;
        }
    }
}


function dd()
  {
  var strMoveType = window.event.dataTransfer;
  strMoveType.effectAllowed = "none";
  event.returnValue = false;
  strMoveType.clearData();
  event.returnValue = false;
  window.clipboardData.clearData();
  event.returnValue = false;
  }

function all(group,index)
  {
    var m_frm = document.Form1;
    for (var i=0; i<index; i++)
    {
      m_frm[group+i].checked = true;
    }
  }

function none(group,index)
  { 
    var m_frm = document.Form1; 
    for (var i=0; i<index; i++) 
    { 
      m_frm[group+i].checked = false; 
    } 
  } 

function AllNone(group,index) 
  { 
    var m_frm = document.Form1; 
    if (m_frm[group].checked) 
    {
      all(group,index); 
    }
    else 
    { 
      none(group,index);
    } 
  } 

function uncheck(boxname)
  {
    var m_frm = document.Form1; 
    m_frm[boxname].checked = false;
  }

function movecontrol(ctlname)
  {
    var m_frm = document.Form1;
    m_frm[ctlname].focus();
  }


function lookup(sField, sData)
{
  if (sData == "") 
  {
    alert('Please specify at least the first few characters of the name to search on.')
  } 
  else 
  {
    window.open('subscribers/wordlookup65cc.html?Field=' + sField + '&Data=' + sData, 'Search', 'width=300,height=320');
  }
}

function setAll(fff, control, mlength, State)
  {
  var m_frm = fff ;
    for(var loop=1;loop<=mlength;loop++)
    {
     m_frm[control + loop].checked=State;
    }
  }

function isChecked(control, mlength)
  {
    var value;
    var m_frm = document.DForm;
    value = 0;
 
    for (var loop=1;loop<=mlength;loop++)
    {
      value += m_frm[control + loop].checked;
    }
  
    return value;
  }

function OpenTip(tipname)
  {
    window.open('subscribers/Help2c89.html?Tip=' + tipname,'_TipName','width=400,height=350,scrollbars=yes');
  }

function isCompleted(radioControl,textControl)
  {
    return true;
  }


function validatealert()
{
	if (validate()==true)
	{
		if (document.DForm.EAlertName.value == "")
		{
			alert('E-Alert Name not valid or Empty.')
			return false;
		}
		else
		{
			if (document.DForm.Description.value == "")
			{
				alert('E-Alert Description not valid or Empty.')
				return false
			}
			else
				return true;			
		}
			
	}
	else
		return false
}


function validate()
{
    if (((isChecked('Com',19) != 0) | (isChecked('Resi',8) != 0)) & (isChecked('Tenure',2) != 0) & (isChecked('Tenancy',3) != 0))
    {
      if((isCompleted(document.DForm.AucPeriod,document.DForm.FromDate) == true) & (isCompleted(document.DForm.ToType,document.DForm.ToDate) == true))
      {
        return true;
        alert('true')
      }
      else
      {
        alert('You have not entered a search date.')
        return false;
      }
    }
    else
    {
      if((isChecked('Com',19) == 0) & (isChecked('Resi',8) == 0))
      {
        alert('You must select a commercial or residential property type.')
        return false;
      }
      else
      {
        if(isChecked('Tenure',2) == 0)
        {
          alert('You must select a Tenure option.')
          return false;
        }
        else
        {
          if(isChecked('Tenancy',3) == 0)
        {
          alert('You must select a Tenancy option.')
          return false;
        }
      }
    }
  }
}

function changeState(control)
{
  if(control.checked == True)
    {
      control.checked = false;
    }
  else
    {
      control.checked = true;
    }
}

function details()
{
  if (optionSelected(document.Results.LotID) == 0)
    {
      alert('You have not selected a lot');
    }
  else
    {
      document.Results.submit();
    }
}

function movePage(nPn)
{
    document.Results.PageNo.value = nPn;
    document.Results.action = 'subscribers/searchresults.html';
    document.Results.submit();
}

function movePage2(nPn)
{
    document.Results.PageNo.value = nPn;
    document.Results.action = 'public/searchresults.html';
    document.Results.submit();
}
  
function movePageDetails(nPn)
{
    document.Results.PageNo.value = nPn;
    document.Results.PF.value = 1;
    document.Results.action = 'subscribers/searchresults.html';
    document.Results.submit();
}

function movePageNormal(nPn)
{
    document.Results.PageNo.value = nPn;
    document.Results.PF.value = 0;
    document.Results.action = 'subscribers/searchresults.html';
    document.Results.submit();
}

function viewAbbrev()
{
    window.open('Abbrev.html', 'Abbrev', 'width=300,height=270,scrollbars=yes');
}

function calculator(salePrice, income)
{
    window.open('subscribers/Calculatora356.html?SalePrice=' + salePrice + '&Income=' + income, 'ycalc' , 'Width=300,Height=380,scrollbars=no');
}

function optionSelected(options)
{
    if (typeof(options.length)!='number')
    {
      if (options.checked)
      {
        return options.value
      } 
      else 
      {
        return 0
      }
    } 
    else 
    {
      for (var optionNo=0; optionNo < options.length; optionNo++)
      {
        if (options.item(optionNo).checked)
          return options.item(optionNo).value;
      }
      return 0
    }
}

function setVariables() 
{
    imgwidth=235;  // logo width, in pixels
    imgheight=19;  // logo height, in pixels
    if (navigator.appName == "Netscape") 
    {
      imgwidth=window.innerWidth / 2
      imgheight=window.innerHeight - 25
      horz=".left";
      vert=".top";
      docStyle="document.";
      styleDoc="";
      innerW="window.innerWidth";
      innerH="window.innerHeight";
      offsetX="window.pageXOffset";
      offsetY="window.pageYOffset";
    }
    else 
    {
      imgwidth=document.body.clientWidth /2
      imgheight=document.body.clientHeight - 25
      horz=".pixelLeft";
      vert=".pixelTop";
      docStyle="";
      styleDoc=".style";
      innerW="document.body.clientWidth";
      innerH="document.body.clientHeight";
      offsetX="document.body.scrollLeft";
      offsetY="document.body.scrollTop";
    }
}

function checkLocation() 
{
    objectXY="branding";
    var availableX=eval(innerW);
    var availableY=eval(innerH);
    var currentX=eval(offsetX);
    var currentY=eval(offsetY);
    x=availableX-(imgwidth+30)+currentX;
    y=availableY-(imgheight+20)+currentY;
    evalMove();
    setTimeout("checkLocation()",10);
}

function evalMove() 
{
    eval(docStyle + objectXY + styleDoc + horz + "=" + x);
    eval(docStyle + objectXY + styleDoc + vert + "=" + y);
}

function PopupWindow(UserID)
{
    if (UserID > 0)
      {
        window.open('subscribers/comments.html','CommentsPopup','width=450,height=450,resizable=yes');
      }

}

function OpenMap()
{
    window.open('locationmap.html','Map','width=600,height=500');
}

function OpenGuides(AuctionID)
{
    window.open('subscribers/guideprices8bf6.html?AuctionID=' + AuctionID, ''+AuctionID , 'Width=700,Height=500,scrollbars=yes,resizable=yes');
}

function OpenResults(AuctionID)
{
    window.open('subscribers/results8bf6.html?AuctionID=' + AuctionID, ''+AuctionID , 'Width=700,Height=500,scrollbars=yes,resizable=yes');
}

function OpenLiveLink(AuctionID)
{
    window.open('subscribers/livelinkinformation8bf6.html?AuctionID=' + AuctionID, 'Results' , 'Width=400,Height=200,scrollbars=no,resizable=yes');
}
  
function OpenTrendAnalysis(LotID)
{
    window.open('subscribers/trendanalysis4da6.html?LotID='+LotID, 'Analysis' , 'Width=400,Height=550,scrollbars=no,resizable=yes');
}  

function OpenLandReg(PostCode)
{
    window.open('http://www.landreg.gov.uk/propertyprice/interactive/ppr_ualbs.asp?curpage=1&rq=1&dataregion='+PostCode+'&dataset=ewpc&datayear=38', 'LandReg' , 'Width=600,Height=500,scrollbars=yes,resizable=yes');
    
}  

function OpenHomeCheck(PostCode)
{
    window.open('http://www.homecheck.co.uk/result.asp?page=result&howhear=EssentialInformationGroup&Postcode='+PostCode+'','HomeCheck','Width=600,Height=450,scrollbars=yes,resizable=yes');
}

function OpenHomeTrack(PostCode)
{
    window.open('http://www.hometrack.co.uk/index.cfm?fuseaction=report.viewhtml&postcode='+PostCode+'','HomeTrack','Width=600,Height=450,scrollbars=yes,resizable=yes');
}

function OpenLocationMap(PostCode)
{
    window.open('http://www.multimap.com/p/browse.cgi?pc='+PostCode,'MapWindow','resizable=yes,scrollbars=yes');
}
  
function OpenAerialMap(PostCode)
{
    window.open('http://www.multimap.com/map/photo.cgi?scale=5000&mapsize=big&pc='+PostCode,'AerialWindow','resizable=yes,scrollbars=yes');
}

function OpenAuctioneer(AuctioneerID)
{
    window.open('subscribers/auctioneerdetailsb586.html?AuctioneerID='+AuctioneerID,''+AuctioneerID,'width=450,height=500,scrollbars=no,resizable=yes');
}

function OpenLot(PNO,Qty)
{
    window.open('showphoto.php?PNo='+PNO+'&Qty='+Qty,'View_Enlarged_Photo','width=300,height=350,scrollbars=yes,resizable=yes');
}

function OpenLotPhoto(iurl)
{
    window.open('showphoto.php?iurl="'+iurl+'"View_Enlarged_Photo','width=300,height=350,scrollbars=yes,resizable=yes');
}


function OpenLotDetails(PNO,OP)
{
    window.open('openlotdet.php?PNO='+PNO+'&OP='+OP,'Lot_Details','width=696,height=500,scrollbars=yes,resizable=yes');
}

function opencat(CTNO,OP)
{
    window.open('opencat.php?CTNO='+CTNO+'&OP='+OP,'Catalogue_Details','width=696,height=350,scrollbars=yes,resizable=yes');
}


function OpenLotPub(AuctionID, LotNumber)
{
    window.open('public/lot7613.html?LotNumber='+LotNumber+'&AuctionID='+AuctionID,AuctionID+LotNumber,'width=500,height=600,scrollbars=yes,resizable=yes');
}
 
function OpenPortfolioNote(PortfolioID,LotID)
{
    window.open('subscribers/portfolionotes0d3b.html?PortfolioID='+PortfolioID+'&LotID='+LotID+'','PortNote','width=500,height=400,scrollbars=yes,resizable=yes');
}

function DeletePortfolioLot(PortfolioID,LotID)
{
    window.open('subscribers/deleteportfoliolot0d3b.html?PortfolioID='+PortfolioID+'&LotID='+LotID+'','Portdelete','width=500,height=400,scrollbars=yes,resizable=yes');
}

 
function OpenFullDetails(AuctionID)
{
    window.open('subscribers/auctiondetailsf0e3.html?auctionid='+AuctionID,'FullDetails'+AuctionID,'width='+(screen.width/1.5)+',scrollbars=yes,resizable=yes');
}
  
function ViewFullScreen()
{
    window.open(this.location.href+'?FullScreen=1','FullMode','fullscreen=yes');
}
  
function ViewNormalScreen()
{
    this.location.href='windowcloser.html';
}
  
function OpenRegions(RegionID)
{
  window.open('mapregionsf952.html?RegionID='+RegionID,RegionID,'width=200,height='+screen.height/2+',scrollbars=yes');
}
  
function OpenDescriptionCodes()
{
  window.open('subscribers/descriptioncodes.html','DescriptionCodes','width=450,height=550,scrollbars=yes,resizable=yes');
}

function OpenConverter()
{
  window.open('subscribers/postcodeconverter.html','PostDist','scrollbars=yes,width=400,height=450');
}

function OpenPortfolio(PNo)
{
  window.open('adproptoport.php?PNo='+PNo,'Addproperty','width=696,height=350,scrollbars=yes,resizable=no');
}
  
function OpenMortgageQuote(QAmount)
{
  window.open('public/mortgages88ea.html?mnu=0','MortQuot','width=400,height=400,scrollbars=yes,resizable=yes');
}

function OpenPDF(strPath,LotID)
{
  window.open(strPath,LotID,'width=600,height=500,scrollbars=yes,resizable=yes');
}

function shwlot(lotpath)
{
  window.open(lotpath,'LotInfo','width=650,height=550,scrollbars=yes,resizable=yes');
}

function GotoPage(View,Sender,totalRecs,TotAuctnr){
	paging = document.getElementById(Sender);
	pagingId = paging.selectedIndex;
	pnav = paging[pagingId].value;
	document.location = 'qsrch.php?nav=' + ((pnav * 7)-6) + '&SC=1&Vw=' + View + '&tr=' + totalRecs + '&tr1=' + TotAuctnr + '&pg=' + pnav;
}
