function prepBookmarkLink() {
    if (window.sidebar && window.opera && window.print) {
        var bkmkLink = document.getElementById('bookmarkLink');
//        bkmkLink.rel = 'sidebar';
//        bkmkLink.href = location.href;
//        bkmkLink.title = document.title;
//        bkmkLink.setAttribute('href',document.URL);
//        bkmkLink.setAttribute('title',document.title);
//        bkmkLink.setAttribute('rel','sidebar');
//        bkmkLink.click();
    }
}


function bookmark(){
    var title = document.title;
    var url= document.URL;
    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.sidebar){

	window.sidebar.addPanel(title,url,"");
	}
	
	else if(window.opera && window.print) {
	prepBookmarkLink();

//   (document.write('<a href ="javascript:bookmark()");">Add Bookmark</a>'));
//		var elem = document.createElement('a');
//		elem.setAttribute('href',url);
//		elem.setAttribute('title',title);
//		elem.setAttribute('rel','sidebar');
//		elem.click();
       var a=document.createElement('a');
       a.href=location.href;
//       
document.write('<a href = "'+url+'" title="'+title+'" rel="sidebar"></a>');


//       
    a.rel='sidebar'; // this makes it work in Opera 7+
        a.click();  

    
     
    
//    a.title=document.title;
//   
//	//   


	
       	
		// alert('test');
}		

  else 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) {
     alert("dfsdf");
      void(0); // do nothing here (Opera 7+)
//return true;
    } 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.');
    }
  }
