function AddFavorite() {
	var name = navigator.appName;
	var useragent = navigator.userAgent;
	var version = parseInt(navigator.appVersion);
	if ( useragent.indexOf("MSIE") != -1) {
		var index = navigator.userAgent.indexOf("MSIE ");
		if ( index != -1 ) {
			version = parseInt(navigator.userAgent.substring(index+5,index+6));
		}
		if ( version > 4) {
			window.external.AddFavorite('http://www.v2b.ru/news','Налоговые новости - Daily');
		}
	}
}

function docTitle(title) {
	dtitle = '';
	if (title.length > 0) {dtitle=title + ' - ';}
	dtitle += 'Налоговые новости - Daily';
	window.document.title = dtitle;
}

function initList(){
	var articles = document.getElementsByTagName('SPAN')
	for (i=0; i<articles.length; i++) {
		if (articles.item(i).id.indexOf('block') == 0) 	{
			articles.item(i).style.display = 'none';
		}
		if (articles.item(i).id.indexOf('title') == 0) 	{
			var articleTitle = articles.item(i).innerHTML;
			articleTitle = articleTitle.replace('<B>', '').replace('</B>', '').replace('<b>', '').replace('</b>', '');
			articles.item(i).innerHTML = articleTitle;
		}
	}
	var pTitle = document.getElementsByTagName('DIV')
	for (i=0; i<pTitle.length; i++) {
		if (pTitle.item(i).id.indexOf('ptitle') == 0) 	{
			pTitle.item(i).style.paddingTop = "0px";
			pTitle.item(i).style.paddingBottom = "0px";
			pTitle.item(i).style.marginBottom = "0px";
			pTitle.item(i).style.backgroundColor = "#FFFFFF";
			/*
			if (navigator.appName == 'Microsoft Internet Explorer') {
				document.styleSheets(0).href='http://www.v2b.ru/news/css/screen.css';
			}
			*/
		}
	}
}

function visibility(id){
	var isCurrent=false;
	if (document.getElementById(id).style.display=='none') {
		isCurrent=false;
		}
		else {
		isCurrent=true;
		}
	initList();
	if (isCurrent) {
		document.getElementById(id).style.display='none';}
		else {
		/*
		if (navigator.appName == 'Microsoft Internet Explorer') {
			document.styleSheets(0).href='http://www.v2b.ru/news/css/screen2.css';
		}
		*/
		document.getElementById(id).style.display='block';
		var strID = 'title' + id.replace('block', '');
		var PstrID = 'ptitle' + id.replace('block', '');
		var articleTitle = document.getElementById(strID).innerHTML;
		articleTitle = articleTitle.bold();
		document.getElementById(strID).innerHTML = articleTitle;
		document.getElementById(PstrID).style.paddingTop = "5px";
		document.getElementById(PstrID).style.paddingBottom = "2px";
		document.getElementById(PstrID).style.marginBottom = "5px";
		document.getElementById(PstrID).style.backgroundColor = "#F3F3F3";
		document.getElementById(strID).scrollIntoView(true);
		}
	}

function getPar(name)
	{
		paramStr = unescape(window.location.search);
		begin = paramStr.indexOf(name) + name.length+1;
		end = paramStr.indexOf('&', begin);
		if(end == -1) end = paramStr.length;
		return unescape(paramStr.substring(begin, end));
	}

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 = 'http://www.v2b.ru/news/';//window.document.location;
 var title = 'Налоговые новости - Daily';//'Журнал «Время Бухгалтера»';//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;
}

