﻿/* 
*  Copyright 2006-2007 Dynamic Site Solutions.
*  Free use of this script is permitted for non-commercial applications,
*  subject to the requirement that this comment block be kept and not be
*  altered.  The data and executable parts of the script may be changed
*  as needed.  Dynamic Site Solutions makes no warranty regarding fitness
*  of use or correct function of the script.  Terms for use of this script
*  in commercial applications may be negotiated; for this, or for other
*  questions, contact "license-info@dynamicsitesolutions.com".
*
*  Script by: Dynamic Site Solutions -- http://www.dynamicsitesolutions.com/
*  Last Updated: 2007-06-17
*/

//IE5+/Win, Firefox, Netscape 6+, Opera 7+, Safari, Konqueror 3, IE5/Mac, iCab 3

function getBrowserInfo() {
	var t,v = undefined;
	
	if (window.opera) t = 'Opera';
	else
		if (document.all) {
			t = 'IE';
			var nv = navigator.appVersion;
			var s = nv.indexOf('MSIE')+5;
			v = nv.substring(s,s+1);
		} else
			if (navigator.appName) t = 'Netscape';
			
	return {type:t,version:v};
}

function bookmark(a){
	var url = window.document.location;
	var title = window.document.title;
	var b = getBrowserInfo();
	
	if (b.type == 'IE' && 7 > b.version && b.version >= 4) window.external.AddFavorite(url,title);
	else
		if (b.type == 'Opera') {
			a.href = url;
			a.rel = "sidebar";
			a.title = url+','+title;
			return true;
		} else
			if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
			else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
	
	return false;
}


