/* *********************************************************
** GENERAL.JS
** ==================================================
** This file contains data for the intercept of the click
** of the right mouse button. Please maintain this header!
** ENJOY! But please contact us regarding use of this script.
**
** Author                Ver  Date     Comments
** ======                ===  ====     ========
**            Copyright © 2002/2007, BluePrint Web Designs
**     MouseOver functions Copyright © 2002, Macromedia Corporation
**                   All rights reserved.
** Contact: BluePrint Web Designs on (Australia) 0404-850840.
**              or via 'http://blueprint.web.com'
********************************************************* */
n = (document.layers) ? 1:0
ie = (document.all) ? 1:0
document.onmousedown = klick;
   if (n) document.captureEvents(Event.MOUSEDOWN)      

function msgNA() {
  alert('This function is not yet available.  Please check back shortly.')
}

function goLocation(site) {
 if (site==0) {alert('Please select a location ...'); exit;}
 var destination='locations.htm#' + site;
 document.location=destination;
}
function klick(e){
  var answer=false
  if (ie && (event.button==2||event.button==6)) { 
    answer=confirm('This work is for the purpose of displaying website for\n Hastings Conveyancing Centre only.\n\nPlease observe the copyright request. \n\nPress OK to view or CANCEL to return to the page.'); 
    if (answer){document.location='site.php#copyright'}
    }

  if (n){if (e.which==3) return false;}
}

document.onmousedown = klick;
   if (n) document.captureEvents(Event.MOUSEDOWN)      


function clearStatus(){
  window.status='';return true;
}

/* *** MOUSE-OVER FUNCTIONS ****** */
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function breadCrumbs(base,delStr,defp,cStyle,tStyle,dStyle,nl) { 
loc=window.location.toString();subs=loc.substr(loc.indexOf(base)+base.length+1).split("/");
 document.write('<a href="'+getLoc(subs.length-1)+defp+'" class="'+cStyle+'">Home</a>  '+'<span class="'+dStyle+'">'+delStr+'</span> ');
 a=(loc.indexOf(defp)==-1)?1:2;for (i=0;i<(subs.length-a);i++) { subs[i]=makeCaps(unescape(subs[i]));
 document.write('<a href="'+getLoc(subs.length-i-2)+defp+'" class="'+cStyle+'">'+subs[i]+'</a>  '+'<span class="'+dStyle+'">'+delStr+'</span> ');}
 if (nl==1) document.write("<br>");document.write('<span class="'+tStyle+'">'+document.title+'</span>');
}

/* *** POP-WINDOW FUNCTIONS ****** */
function pwinOpen(tPageName,tWidth,tHeight,tDetails)
{
if (tWidth == 0 || tHeight == 0)
 {
  tWidth=640;
  tHeight=480;
 }
var tURL = tPageName + '.htm';
var tDim = 'width=' + tWidth + ', height=' + tHeight + ', status=no, resizeable=no';
window.open(tURL,tDetails,tDim);   //,tDim
/* window.focus(tPageName); */
}

function pwinClose()
  {
   window.close();
   window.parent.focus();
   /* window.opener.focus(); */
   }

function goPage(tPage){document.location=tPage;}

/* ** PRINT CONTENT ************************** */
function printContent()
  {
  window.top.focus;
  document.print();
  }

/* ** SEARCH CONTENT ************************** */
function siteSearch(){alert('This function is not yet available.  Please try again later.');}

/* ** FEEDBACK FORM ************************** */
// global variables
var ie=document.all;
var ns6=document.getElementById && !document.all;

function showFeedback()
{
  if (ns6||ie)
  {
    feedback.style.visibility="visible";
    setOpacity(getObj("feedback"), 92);
  }
}

function hideFeedback()
{
  if (ns6||ie)
  {
    setOpacity(getObj("feedback"), 10);
    feedback.style.visibility="hidden";
  }
}

function setOpacity(obj, opacity)
{
	if (obj != null)
	{
		opacity = (opacity == 100)?99.999:opacity;
 
		// IE/Win
		obj.style.filter = "alpha(opacity:"+opacity+")";
 
		// Safari<1.2, Konqueror
		obj.style.KHTMLOpacity = opacity/100;
 
		// Older Mozilla and Firefox
		obj.style.MozOpacity = opacity/100;
 
		// Safari 1.2, newer Firefox and Mozilla, CSS3
		obj.style.opacity = opacity/100;
	}
}

function getObj(name)
{
  if (document.getElementById)
    return document.getElementById(name);
  else if (document.all)
    return document.all[name];
  else if (document.layers)
    return document.layers[name];
}

function fadeOut(objId,opacity)
{
	imgObj = getObj("image" + objId);
	adObj = getObj("ad" + objId);
	if (imgObj != null && adObj != null )
	{
		if (opacity > -1)
		{
			setOpacity(imgObj, opacity);
			opacity -= 10;
			window.setTimeout("fadeOut('"+objId+"',"+opacity+")", 100);
		}
		else
		{
			adObj.style.visibility = "hidden";
			adObj.style.zIndex = 1;
		}
	}
}

function fadeIn(objId,opacity)
{
	imgObj = getObj("image" + objId);
	adObj = getObj("ad" + objId);
	if (imgObj != null && adObj != null )
	{
		if (opacity <= 99.999)
		{
			adObj.style.visibility = "visible";
			adObj.style.zIndex = 2;
			setOpacity(imgObj, opacity);
			opacity += 10;
			window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
		}
	}
}


