var addBookmarkObj = {
  init:function() {
    if(!document.getElementById || !document.createTextNode) return;
    var cont=document.getElementById('Favourites');
    if(!cont) return;
    var a=document.createElement('a');
    a.href=location.href;
    if(window.opera) {
      a.rel='sidebar';
    } else {
      a.onclick=function() {
        addBookmarkObj.exec(this.href,this.title);
        return false;
      }
    }
    a.title='Add to Favourites';
    a=cont.appendChild(a);
    a.appendChild(document.createTextNode('Add to Favourites'));
  },
  exec:function(url, title) {
    var isKonq=(isLikelyKonqueror3 && isLikelyKonqueror3());
    var isMac=(navigator.userAgent.toLowerCase().indexOf('mac')!=-1);
    var buttonStr = isMac?'Command/Cmd':'CTRL';

    if(window.external && (!document.createTextNode ||
      (typeof(window.external.AddFavorite)=='unknown'))) {
        window.external.AddFavorite(url, title); // IE/Win
    } else if(isKonq) {
      alert('You need to press CTRL + B to bookmark our site.');
    } else if((window.opera && 
        opera.buildNumber && !isNaN(opera.buildNumber()))) {
          void(0);
    } else if(window.opera) {
      alert('You need to press '+buttonStr+' + T to bookmark our site.');
    } else if(window.home) {
      alert('You need to press '+buttonStr+' + D to bookmark our site.');
    } else if(!window.print || isMac) {
      alert('You need to press Command/Cmd + D to bookmark our site.');    
    } else {
      alert('In order to bookmark this site you need to do so manually '+
        'through your browser.');
    }
  }
}

function isLikelyKonqueror3() {
  if(!document.getElementById) return false;
  if(document.defaultCharset || window.opera || !window.print) return false;
  if(window.home) return false;
  if(document.all) return true;
  var likely = 1;
  eval("try{var str=document.all[0].tagName;}catch(err){likely=0;}");
  return likely;
}

function dss_addEvent(el,etype,fn) {
  if(el.addEventListener && (!window.opera || opera.version) &&
  (etype!='load')) {
    el.addEventListener(etype,fn,false);
  } else if(el.attachEvent) {
    el.attachEvent('on'+etype,fn);
  } else {
    if(typeof(fn) != "function") return;
    if(typeof(window.earlyNS4)=='undefined') {
      window.earlyNS4=((navigator.appName.toLowerCase()=='netscape')&&
      (parseFloat(navigator.appVersion)<4.02)&&document.layers);
    }
    if((typeof(el['on'+etype])=="function")&&!window.earlyNS4) {
      var tempFunc = el['on'+etype];
      el['on'+etype]=function(e){
        var a=tempFunc(e),b=fn(e);
        a=(typeof(a)=='undefined')?true:a;
        b=(typeof(b)=='undefined')?true:b;
        return (a&&b);
      }
    } else {
      el['on'+etype]=fn;
    }
  }
}
function 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=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 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 FindObj(n, d) { //v4.01
  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=FindObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function SwapImage() { //v3.0
  var i,j=0,x,a=SwapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=FindObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function ppErrorCheck() {
	var errorMessage = "";
	var minPrice = "";
	var maxPrice = "";
	minPrice = document.forms['sch_form'].elements['sch_minprice'].value
	maxPrice = document.forms['sch_form'].elements['sch_maxprice'].value
	if ((minPrice != "NS")&&(maxPrice != "NS")) {
		minPrice = parseInt(minPrice);
		maxPrice = parseInt(maxPrice);
		if (minPrice > maxPrice) {
			errorMessage = "The minimum price cannot be greater than the maximum price.\r"
		}
	}
	if (errorMessage) {
		errorMessage = errorMessage;
		alert(errorMessage)
		return false;
	} else {
		return true;
		document.forms['sch_form'].submit()
	}
}
function ppLErrorCheck() {
	var errorMessage = "";
	var minPrice = "";
	var maxPrice = "";
	minPrice = document.forms['let_form'].elements['let_minprice'].value
	maxPrice = document.forms['let_form'].elements['let_maxprice'].value
	if ((minPrice != "NS")&&(maxPrice != "NS")) {
		minPrice = parseInt(minPrice);
		maxPrice = parseInt(maxPrice);
		if (minPrice > maxPrice) {
			errorMessage = "The minimum price cannot be greater than the maximum price.\r"
		}
	}
	if (errorMessage) {
		errorMessage = errorMessage;
		alert(errorMessage)
		return false;
	} else {
		return true;
		document.forms['let_form'].submit()
	}
}

dss_addEvent(window,'load',addBookmarkObj.init);
