
function CreateBookmarkLink() {
title =  document.title;
var l=location.href;
url = "http://"+l;
if (window.sidebar) {
// Mozilla Firefox Bookmark

window.sidebar.addPanel(title, url,"");
} else if( window.external ) {
// IE Favorite

window.external.AddFavorite( url, title);
}
else if(window.opera && window.print) {
// Opera Hotlist
 }
}

var addBookmarkObj = {
  linkText:'Bookmark This Page',
  addTextLink:function(parId){

    var a=addBookmarkObj.makeLink(parId);
    if(!a) return;
    a.appendChild(document.createTextNode(addBookmarkObj.linkText));
  },
  addImageLink:function(parId,imgPath){
	  imgPath="/images/bookmark1.gif";
    if(!imgPath || isEmpty(imgPath)) return;
    var a=addBookmarkObj.makeLink(parId);
    if(!a) return;
    var img = document.createElement('img');
    img.title = img.alt = addBookmarkObj.linkText;
    img.src = imgPath;
    a.appendChild(img);
  },
  makeLink:function(parId) {
    if(!document.getElementById || !document.createTextNode) return null;
    parId=((typeof(parId)=='string')&&!isEmpty(parId))
      ?parId:'addBookmarkContainer';
    var cont=document.getElementById(parId);
    if(!cont) return null;
    var a=document.createElement('a');
    a.href=location.href;
	
    if(window.opera) {
      a.rel='sidebar'; // this makes it work in Opera 7+
    } else {
      // this doesn't work in Opera 7+ if the link has an onclick handler,
      // so we only add it if the browser isn't Opera.
      a.onclick=function() {
		  
        addBookmarkObj.exec(this.href,this.title);
        return false;
      }
    }
    a.title=document.title;
	
    return cont.appendChild(a);
  },
  exec:function(url, title) {
    // user agent sniffing is bad in general, but this is one of the times 
    // when it's really necessary
    var ua=navigator.userAgent.toLowerCase();
    var isKonq=(ua.indexOf('konqueror')!=-1);
    var isSafari=(ua.indexOf('webkit')!=-1);
    var isMac=(ua.indexOf('mac')!=-1);
    var buttonStr=isMac?'Command/Cmd':'CTRL';

    if(window.external && (!document.createTextNode ||
      (typeof(window.external.AddFavorite)=='unknown'))) {
        // IE4/Win generates an error when you
        // execute "typeof(window.external.AddFavorite)"
        // In IE7 the page must be from a web server, not directly from a local 
        // file system, otherwise, you will get a permission denied error.
        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) {
      void(0); // do nothing here (Opera 7+)
    } else if(window.home || isSafari) { // Firefox, Netscape, Safari, iCab
      alert('You need to press '+buttonStr+' + D to bookmark our site.');
    } else if(!window.print || isMac) { // IE5/Mac and Safari 1.0
      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 isEmpty(s){return ((s=='')||/^\s*$/.test(s));}

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') {
      // to prevent this function from crashing Netscape versions before 4.02
      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;
    }
  }
}

dss_addEvent(window,'load',addBookmarkObj.addImageLink);



function fnbookmark()
{
	if(navigator.userAgent.indexOf("Opera")!=-1)
	{
		document.write('<div id="addBookmarkContainer"></div>');

	}
	else
	{
		document.write('<a href="javascript:CreateBookmarkLink();" ><img src="/images/bookmark1.gif" alt="bookmark" /></a>');
	}
}

function loadInput()
{
	var myTextField = document.getElementById('linktxt1');
	myTextField.value = "<a href="+location.href+">"+document.title+"</a>";
}

function setBookmark(bk)
{

	var url="";

	if(bk == "su")
	{
		url = "http://www.stumbleupon.com/submit?url="+location.href+"&title="+document.title;
	}

	if(bk == "rd")
	{
		url = "http://reddit.com/submit?url="+location.href+"&title="+document.title;
	}

	if(bk == "th")
	{
		url = "http://technorati.com/signup/?f=favorites";
	}

	if(bk == "fc")
	{
		url = "http://www.facebook.com/sharer.php?u="+location.href+"&t="+document.title;
	}

	if(bk == "dg")
	{
		url = "http://digg.com/submit?phase=2&url="+location.href+"&title="+document.title;
	}

	if(bk == "dl")
	{
		url = "http://del.icio.us/post?url="+location.href+"&title="+document.title;
	}

	if(bk == "Y!")
	{
		url = "http://myweb2.search.yahoo.com/myresults/bookmarklet?u="+location.href+"&t="+document.title;
	}
	

	window.open(url, "Bookmark", 'width=700,height=400,scrollbars=yes');

}

function handlePrdLnk1(_31,_32,_33,_34){
_31=getPageLink(_31);
if(_32>0){
_31+="~PG-"+_32;
}else{
_31=checkBeforeSbs(_31);
}
if(_31==-1){
displayPopup("/pop/sbs_oops","","sbs_oopsArea",_34,350,230);
}else{
document.location.href="http://www.dealtime.co.uk/"+_31;
}
}


function findPosX12(id)
  {
	objelid = document.getElementById(id);
    var curleft = 0;
    if(objelid.offsetParent)
        while(1) 
        {
          curleft += objelid.offsetLeft;
          if(!objelid.offsetParent)
            break;
          objelid = objelid.offsetParent;
        }
    else if(objelid.x)
        curleft += objelid.x;
    return curleft;
  }
function findPosY12(id)
  {
	objelid = document.getElementById(id);
    var curtop = 0;
    if(objelid.offsetParent)
        while(1)
        {
          curtop += objelid.offsetTop;
          if(!objelid.offsetParent)
            break;
          objelid = objelid.offsetParent;
        }
    else if(objelid.y)
        curtop += objelid.y;
    return curtop;
  }