function ShowContacts()
{
	var height=240;width=515;
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35) / 2);
	var lightboxLeft = ((arrayPageSize[0] - 20) / 2);
	document.getElementById('contacts').style.top=lightboxTop-120+'px';
	document.getElementById('contacts').style.left=lightboxLeft-260+'px';	
	document.getElementById("contacts").style.display='block';
	document.getElementById('baccontacts').style.height=arrayPageSize[1]+'px';
	document.getElementById('baccontacts').style.width=arrayPageSize[0]-30+'px';
	document.getElementById("baccontacts").style.display='block';
}
function HideContacts()
{
	document.getElementById("contacts").style.display='none';
	document.getElementById("baccontacts").style.display='none';
}
function DisActivBut()
{
document.getElementById('closebut').src='/img/close1.jpg';
}
function setvalue(div,value)
{
	if(document.getElementById(div)!=null)
	document.getElementById(div).value=value;
}
function ShowDivCenter(div)
{
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	var obj=document.getElementById(div);
	if (obj) {
		obj.style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 400) / 2) + 'px');
		obj.style.left = (((arrayPageSize[0] - 20 - 300) / 2) + 'px');
		obj.style.display = 'block';		
	}
	else alert('no');
}
function ActivBut()
{
document.getElementById('closebut').src='/img/close.jpg';
}
function ShowContacts1()
{
	var height=240;width=515;
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35) / 2);
	var lightboxLeft = ((arrayPageSize[0] - 20) / 2);
	document.getElementById('contacts1').style.top=lightboxTop-120+'px';
	document.getElementById('contacts1').style.left=lightboxLeft-260+'px';	
	document.getElementById("contacts1").style.display='block';
	document.getElementById('baccontacts1').style.height=arrayPageSize[1]+'px';
	document.getElementById('baccontacts1').style.width=arrayPageSize[0]-30+'px';
	document.getElementById("baccontacts1").style.display='block';
}
function HideContacts1()
{
	document.getElementById("contacts1").style.display='none';
	document.getElementById("baccontacts1").style.display='none';
}
function DisActivBut1()
{
document.getElementById('closebut1').src='/img/close1.jpg';
}
function ActivBut1()
{
document.getElementById('closebut1').src='/img/close.jpg';
}

function ShowDiv(div)
{
if(document.getElementById(div)!=null)
document.getElementById(div).style.display='block';
}
function HideDiv(div)
{
if(document.getElementById(div)!=null)
document.getElementById(div).style.display='none';
}
function Visible(div)
{
if(document.getElementById(div)!=null)
document.getElementById(div).style.visibility='visible';
}
function UnVisible(div)
{
if(document.getElementById(div)!=null)
document.getElementById(div).style.visibility='hidden';
}
function ShowHideDiv(div)
{
if(document.getElementById(div)!=null)
if(document.getElementById(div).style.display!='block')
document.getElementById(div).style.display='block';
else
document.getElementById(div).style.display='none';
}

//Используется на главной, изменяет размер картинки
function Test()
{
	document.getElementById('bgmain').style.marginTop=0+'px';
	document.getElementById('bgmain').style.width=900+'px';
	document.getElementById('tablemain').style.height=500+'px';
	document.getElementById('tablemain').style.width=900+'px';
	var w=document.body.scrollWidth;
	if(w<980) w=980;
	document.getElementById('bgmain').style.width=w+'px';
	document.getElementById('tablemain').style.width=w+'px';
	setTimeout("document.getElementById('tablemain').style.height=(document.body.scrollHeight)+'px'",5);
	document.getElementById('bgmain').style.marginTop=0+'px';
}

function ActivPhotoGalery(id_album)
{
	ServerMessage(id_album,'activphotogalery','imagebox');
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 65) / 2);
	var lightboxLeft = ((arrayPageSize[0] - 50) / 2);
	if(window.screen.width>1000)document.body.style.overflowX="hidden";
	document.getElementById('borderbox').style.left=(lightboxLeft-57)+'px';	
	document.getElementById('borderbox').style.top=(lightboxTop-57)+'px';
	document.getElementById('borderbox').style.width=100+'px';
	document.getElementById('borderbox').style.height=100+'px';
	document.getElementById('backimagebox').style.height=arrayPageSize[1]+'px';
	document.getElementById('backimagebox').style.width=arrayPageSize[0]+'px';
	document.getElementById('backimagebox').style.display='block';	
	document.getElementById('imagebox').style.display='block';
	document.getElementById('imagebox').innerHTML="";
	document.getElementById('imagebox').style.left=(lightboxLeft-400)+'px';	
	document.getElementById('imagebox').style.top=(lightboxTop-300)+'px';
	document.getElementById('imagebox').style.width=800+'px';
	document.getElementById('imagebox').style.height=600+'px';
	document.getElementById('imagebox').style.background="url(/img/loading.gif) center center no-repeat";
}

function ActivVideo(id_album,id2)
{
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 65) / 2);
	var lightboxLeft = ((arrayPageSize[0] - 50) / 2);
	if(window.screen.width>1000)document.body.style.overflowX="hidden";
	document.getElementById('backimagebox1').style.height=arrayPageSize[1]+'px';
	document.getElementById('backimagebox1').style.width=arrayPageSize[0]+'px';
	document.getElementById('backimagebox1').style.display='block';	
	document.getElementById('videoplay').style.left=(lightboxLeft-425)+'px';	
	document.getElementById('videoplay').style.top=(lightboxTop-200)+'px';
	document.getElementById('videoplay').style.display="block";
	document.getElementById('content').innerHTML="<div>"+document.getElementById('cod_video'+id_album).value+"</div>";
	var videomax=document.getElementById('maxvideo'+id2).value;
	var videomin=document.getElementById('minvideo'+id2).value;
	var next,prev;
	if(id_album==videomax)next=videomin;else next=id_album+1;
	if(id_album==videomin)prev=videomax;else prev=id_album-1;
	document.getElementById('videoleft').innerHTML=document.getElementById('videocover'+prev).innerHTML;
	document.getElementById('videoright').innerHTML=document.getElementById('videocover'+next).innerHTML;
}
function ActivVideo2(id_album)
{
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 65) / 2);
	var lightboxLeft = ((arrayPageSize[0] - 50) / 2);
	if(window.screen.width>1000)document.body.style.overflowX="hidden";
	document.getElementById('backimagebox2').style.height=arrayPageSize[1]+'px';
	document.getElementById('backimagebox2').style.width=arrayPageSize[0]+'px';
	document.getElementById('backimagebox2').style.display='block';	
	document.getElementById('videoplay2').style.left=(lightboxLeft-225)+'px';	
	document.getElementById('videoplay2').style.top=(lightboxTop-200)+'px';
	document.getElementById('videoplay2').style.display="block";
	document.getElementById('content2').innerHTML="<div>"+document.getElementById('cod_video'+id_album).value+"</div>";
}
/*Устанавливаем изображение и соответсвеннто подложку по центру экрана*/
function SetImagePosition(id) 
{
	if(document.getElementById('backimagebox').style.display!="none")
	{
	if(document.getElementById('imgpl1')!=null)
	document.getElementById("contentbox").innerHTML="<img src='"+(document.getElementById('imgpl1').src)+"' id=imgpl style='opacity:0.01;filter:alpha(opacity=1);'>";
	document.getElementById("tempbox").innerHTML="";
//Координаты страницы
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 65) / 2);
	var lightboxLeft = ((arrayPageSize[0] - 50) / 2);
//Подложка, при нажатии на которую изображение исчезает
/*	document.getElementById('backimagebox').style.height=arrayPageSize[1]+'px';
	document.getElementById('backimagebox').style.width=arrayPageSize[0]+'px';
	document.getElementById('backimagebox').style.display='block';*/
//Получаем ширину и высоту самой фотографии
    var oHlpr = document.createElement('IMG');
    var oPic = document.getElementById(id);
    oHlpr.style.visibility = 'hidden';
    oHlpr.style.position = 'absolute';
    oHlpr.top = 0; oHlpr.left = 0;
    oHlpr.src = oPic.src;
    document.body.appendChild( oHlpr);
    var imWidth=oHlpr.offsetWidth;
	var imHeight=oHlpr.offsetHeight;
    document.body.removeChild( oHlpr);
//Устанавливаем на место рамку под фоткой
	$('#borderbox').animate(
	{
		top:(lightboxTop-imHeight/2-7),
		left:(lightboxLeft-imWidth/2-7),
		width:(imWidth+14),
		height:(imHeight+14)
		
	},
	500
	);
//Устанавливаем на место кнопки вперед/назад
	document.getElementById('prevnext').style.left=((lightboxLeft-imWidth/2))+'px';	
	document.getElementById('prevnext').style.top=((lightboxTop-imHeight/2))+'px';
	document.getElementById('prevnext').style.width=(imWidth)+"px";
	document.getElementById('prevnext').style.height=(imHeight)+'px';
//Устанавливаем на местро фотографию
	document.getElementById('imagebox').style.background="none";
	document.getElementById('imagebox').style.left=((lightboxLeft-imWidth/2))+'px';	
	document.getElementById('imagebox').style.top=((lightboxTop-imHeight/2))+'px';
	document.getElementById('imagebox').style.width=imWidth+'px';
	document.getElementById('imagebox').style.height=imHeight+'px';
	document.getElementById('preloader').style.left=((lightboxLeft-10))+'px';	
	document.getElementById('preloader').style.top=((lightboxTop-10))+'px';
	document.getElementById('preloader').style.display="none";
	}
	else
	{
	HideDiv('imagebox');Hide('prevnext');HideDiv('borderbox');HideDiv('preloader');
	}
}
function SetImagePosition2(id) 
{
	if(document.getElementById('backimagebox').style.display!="none")
	{
//Координаты страницы
	document.getElementById('imagebox').style.background="none";
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 65) / 2);
	var lightboxLeft = ((arrayPageSize[0] - 50) / 2);
//Получаем ширину и высоту самой фотографии
    var oHlpr = document.createElement('IMG');
    var oPic = document.getElementById(id);
    oHlpr.style.visibility = 'hidden';
    oHlpr.style.position = 'absolute';
    oHlpr.top = 0; oHlpr.left = 0;
    oHlpr.src = oPic.src;
    document.body.appendChild( oHlpr);
    var imWidth=oHlpr.offsetWidth;
	var imHeight=oHlpr.offsetHeight;
    document.body.removeChild( oHlpr);
//Устанавливаем на место рамку под фоткой
	$('#borderbox').animate(
	{
		top:(lightboxTop-imHeight/2-7),
		left:(lightboxLeft-imWidth/2-7),
		width:(imWidth+14),
		height:(imHeight+14)
		
	},
	500
	);
//Устанавливаем на местро фотографию

	document.getElementById('imagebox').style.left=((lightboxLeft-imWidth/2))+'px';	
	document.getElementById('imagebox').style.top=((lightboxTop-imHeight/2))+'px';
	document.getElementById('imagebox').style.width=imWidth+'px';
	document.getElementById('imagebox').style.height=imHeight+'px';
	}
	else
	{
	HideDiv('imagebox');Hide('prevnext');HideDiv('borderbox');
	}
}
function HideAnimate()
{
	if(document.getElementById('backimagebox').style.display!="none")
	{
	$('#imgpl').animate(
	{
		opacity: 0.01
	},
	500
	);	
	setTimeout("document.getElementById('preloader').style.display='block'",200);
	}
	else
	{
	HideDiv('imagebox');Hide('prevnext');HideDiv('borderbox');HideDiv('preloader');
	}
}
function DisplayPhoto()
{
	if(document.getElementById('backimagebox').style.display!="none")
	{
//	HideAnimate();
	setTimeout("SetImagePosition('imgpl')",220);
	setTimeout("Display()",720);
	}
	else
	{
	HideDiv('imagebox');Hide('prevnext');HideDiv('borderbox')
	}
}
function DisplayPhoto1()
{
	if(document.getElementById('backimagebox').style.display!="none")
	{
	
	SetImagePosition('imgpl');
	setTimeout("Display()",500);
	}
	else
	{
	HideDiv('imagebox');Hide('prevnext');HideDiv('borderbox');HideDiv('preloader');
	}
}
function DisplayScan()
{
	if(document.getElementById('backimagebox').style.display!="none")
	{
	SetImagePosition2('imgpl');
	setTimeout("Display2()",500);
	}
	else
	{
	HideDiv('imagebox');Hide('prevnext');HideDiv('borderbox');HideDiv('preloader');
	}
}
function Display()
{
	if(document.getElementById('backimagebox').style.display!="none")
	{
	document.getElementById('borderbox').style.display="block";
	$('#imgpl').animate(
	{
		opacity: 1
	},
	800
	);	
	document.getElementById('prevnext').style.visibility='visible';
	}
	else
	{
	HideDiv('imagebox');Hide('prevnext');HideDiv('borderbox');HideDiv('preloader');
	}
}
function Display2()
{
	if(document.getElementById('backimagebox').style.display!="none")
	{
	document.getElementById('borderbox').style.display="block";
	$('#imgpl').animate(
	{
		opacity: 1
	},
	800
	);	
	//document.getElementById('prevnext').style.visibility='visible';
	}
	else
	{
	HideDiv('imagebox');Hide('prevnext');HideDiv('borderbox');HideDiv('preloader');
	}
}
//Общаемся с серваком по ajax
function ServerMessage(keyword,table,name_div)
{
	var req;
	var sss;
	if (window.XMLHttpRequest)
	{
		req=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		try	{req=new ActiveXObject('MSXML2.XMLHTTP.3.0');}
		catch(e){}
	}
	if(req)
	{
		req.open("post","/ajax.php",true);
		req.setRequestHeader("Content-Type"," application/x-www-form-urlencoded;");
		req.onreadystatechange=function()
		{
	   	 if (req.readyState==4 && req.status==200)
	    	{
	    		sss=req.responseText;
	    		document.getElementById(name_div).style.display='block';
	    		document.getElementById(name_div).innerHTML=sss;
	    	}
		}
		req.send('keyword='+table+'|'+encodeURIComponent(keyword));
	}
}

function ShowNextPhoto()
{
	if(document.getElementById('backimagebox').style.display!="none")
	{
	HideAnimate();
	var id=parseInt(document.getElementById('photonow').value);
	var maxphoto=parseInt(document.getElementById('photomax').value);
	if(id<maxphoto)id++;else id=1
	SetPhoto(id);
	}
	else
	{
	HideDiv('imagebox');Hide('prevnext');HideDiv('borderbox')
	}
}
function ShowPrevPhoto()
{
	if(document.getElementById('backimagebox').style.display!="none")
	{
	HideAnimate();
	var id=parseInt(document.getElementById('photonow').value);
	var maxphoto=parseInt(document.getElementById('photomax').value);
	if(id>1)id--;else id=maxphoto;
	SetPhoto(id);
	}
	else
	{
	HideDiv('imagebox');Hide('prevnext');HideDiv('borderbox')
	}
}
function SetPhoto(id)
{
	if(document.getElementById('backimagebox').style.display!="none")
	{
	var name=document.getElementById('name_img'+id).value;
	document.getElementById('tempbox').innerHTML='<img id=imgpl1 style="opacity:0.01;filter:alpha(opacity=1);" src="/admin/photo/'+name+'" onload=DisplayPhoto()>';
	document.getElementById('photonow').value=id;
	}
	else
	{
	HideDiv('imagebox');Hide('prevnext');HideDiv('borderbox')
	}
}

function ShowImageScan(id)
{
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 65) / 2);
	var lightboxLeft = ((arrayPageSize[0] - 50) / 2);
	if(window.screen.width>1000)document.body.style.overflowX="hidden";
	document.getElementById('borderbox').style.left=(lightboxLeft-57)+'px';	
	document.getElementById('borderbox').style.top=(lightboxTop-57)+'px';
	document.getElementById('borderbox').style.width=100+'px';
	document.getElementById('borderbox').style.height=100+'px';
	document.getElementById('backimagebox').style.height=arrayPageSize[1]+'px';
	document.getElementById('backimagebox').style.width=arrayPageSize[0]+'px';
	document.getElementById('backimagebox').style.display='block';	
	document.getElementById('imagebox').style.display='block';
	document.getElementById('imagebox').innerHTML="";
	document.getElementById('imagebox').style.left=(lightboxLeft-50)+'px';	
	document.getElementById('imagebox').style.top=(lightboxTop-50)+'px';
	document.getElementById('imagebox').style.width=100+'px';
	document.getElementById('imagebox').style.height=100+'px';
	var name=document.getElementById('nimg'+id).value;
	document.getElementById('imagebox').style.background="url(/img/loading.gif) center center no-repeat";
	document.getElementById('imagebox').innerHTML='<img id=imgpl style="opacity:0.01;filter:alpha(opacity=1);" src="/admin/scanpages/'+name+'" onload=DisplayScan() onclick="HideDiv(\'backimagebox\');HideDiv(\'imagebox\');Hide(\'prevnext\');HideDiv(\'borderbox\');setScroll();HideDiv(\'preloader\')">';
}

function setScroll()
{
document.body.style.overflowX='auto';
}

function Hide(div)
{
if(document.getElementById(div)!=null)
document.getElementById(div).style.visibility='hidden';
document.getElementById(div).style.top=-330+'px';
}

/*Карта, показать подсказку справа от точки*/
function ActivMessageRight(point,desc)
{
	$('#'+point).tooltip({bodyHandler: function(){
        return $('#'+desc)[0].innerHTML;
    },
    showURL: false,    
	track: true, 
	delay: 200,
	extraClass: "left",
	top:15,
	left:0
	});
}
/*Конец Карта*/

function ActivOpen(point,desc)
{
	$('.'+point).tooltip({bodyHandler: function(){
        return $('#'+desc)[0].innerHTML;
    },
    showURL: false,    
	track: true, 
	delay: 0,
	extraClass: "left",
	top:15,
	left:0
	});
}

function PlayMusic2(id,name)
{
var namep;
if(name=='OnlineRadio') namep='Online Radio';
else namep=name;
AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '240',
			'height', '140',
			'id', 'mju',
			'src', '/player2',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'flashvars', 'playlist=/admin/playlists/playlist'+id+'.xml&playname='+namep+'&stopplay=0',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'swLiveConnect', 'true',
			'id', '".$name."',
			'bgcolor', '#ffffff',
			'name', '".$name."',
			'menu', 'false',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', '/player2',
			'salign', '');	
document.getElementById('opennw').innerHTML="<a href='javascript:void(0)' onclick=OpenFM('"+id+"','"+name+"')>открыть плеер в новом окне</a>";
}
function PlayMusic3(id,name)
{
var namep;
if(name=='OnlineRadio') namep='Online Radio';
else namep=name;
AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '240',
			'height', '140',
			'id', 'mju',
			'src', '/player2',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'flashvars', 'playlist=/admin/playlists/playlist'+id+'.xml&playname='+namep+'&stopplay=0',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'swLiveConnect', 'true',
			'id', '".$name."',
			'bgcolor', '#ffffff',
			'name', '".$name."',
			'menu', 'false',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', '/player2',
			'salign', '');	
//document.getElementById('opennw').innerHTML="<a href='javascript:void(0)' onclick=OpenFM('"+id+"','"+name+"')>открыть плеер в новом окне</a>";
}

function PlayMusic4(id,name)
{
var namep;
if(name=='OnlineRadio') namep='Online Radio';
else namep=name;
AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '240',
			'height', '140',
			'id', 'mju',
			'src', '/player10',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'flashvars', 'playlist=/playlist2.xml&playname='+namep+'&stopplay=0',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'swLiveConnect', 'true',
			'id', '".$name."',
			'bgcolor', '#ffffff',
			'name', '".$name."',
			'menu', 'false',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', '/player10',
			'salign', '');	
//document.getElementById('opennw').innerHTML="<a href='javascript:void(0)' onclick=OpenFM('"+id+"','"+name+"')>открыть плеер в новом окне</a>";
}

function PlayMusic1(id,name)
{
var namep;
if(name=='OnlineRadio') namep='Online Radio';
else namep=name;
AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '240',
			'height', '140',
			'id', 'mju',
			'src', '/player2',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'flashvars', 'playlist=/admin/playlists/playlist'+id+'.xml&playname='+namep+'&stopplay=1',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'swLiveConnect', 'true',
			'id', '".$name."',
			'bgcolor', '#ffffff',
			'name', '".$name."',
			'menu', 'false',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', '/player2',
			'salign', '');	
document.getElementById('opennw').innerHTML="<a href='javascript:void(0)' onclick=OpenFM('"+id+"','"+name+"')>открыть плеер в новом окне</a>";
}
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 (window.sidebar) t = 'Netscape';
 return {type:t,version:v};
}
function bookmark(a){
// var id_connection=document.getElementById('code_connection_user').value;
 var url = window.document.location;
 var title = window.document.title;
 var b = getBrowserInfo();
 if (b.type == 'IE') window.external.AddFavorite(url,title);
 else if (b.type == 'Opera') {
  a.href = url;
  a.rel = "sidebar";
  a.title = title;
  return true;
 }
 else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
 else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
// SM1(id_connection,'addfav');
 return false;
}

function OpenFM(id,name) {
var b = getBrowserInfo();
if(b.type == 'IE')
{window.showModelessDialog("http://edvinfm.ru/player.php?id="+id+"&name="+name,"OnlineRadio","width=250px,height=150px,alwaysRaised=yes,directories=no,location=no,menubar=no,statusbar=no,resizable=no,scrollbar=no,toolbar=no");}
else
{
window.open("http://edvinfm.ru/player.php?id="+id+"&name="+name,"OnlineRadio","width=250px,height=150px,alwaysRaised=yes,directories=no,location=no,menubar=no,statusbar=no,resizable=no,scrollbar=no,toolbar=no");
}
}

function SetClassName(id)
{
	var i;
	for(i=0;i<20;i++)
	{
		if(document.getElementById('link'+i)!=null)
		document.getElementById('link'+i).className='listintext';
	}
	if(document.getElementById('link'+id)!=null)
	{
		document.getElementById('link'+id).className='alistintext';
	}
}

/*Форум*/

function PrintMessage(item,ans,page)
{
	var feedback=true;
	re1=/^[А-Яа-я\ \-_0-9a-zA-Z]+$/;
	re2=/^[0-9a-zA-Z\-_]+@[0-9a-zA-Z\-_\.]+\.[a-zA-Z]{2,3}$/;
	var idmes=document.getElementById('nummessage').value;
	var author_message=document.getElementById('author_message').value;
	var mail_message=document.getElementById('mail_message').value;
	var newcod,mes;
	var cod=document.getElementById("codbuttoncomment").src;
	var len=cod.length;
	var ras=cod.substr(len-6,6);
	ras=ras.substr(0,2);
	ras=parseInt(ras);
	ras=ras*56-15;
	if(mail_message=="" || !re2.test(mail_message)) {feedback=false;mes='Проверьте адрес';}
	if(author_message=="" || !re1.test(author_message)){feedback=false;mes='Имя содежржит недопустимые символы';}
	if(parseInt(document.getElementById("cod_message").value)!=ras){
	var t=document.getElementById("cod_message").value;
	feedback=false;mes='Неверный код';alert(ras+"d"+t);}
	var text_message=document.getElementById('textreviewcomment').value;
	text_message=text_message.replace(/"/g,'&quot;');	
	text_message=text_message.replace(/'/g,'`');
	GenCode();
	if(feedback!=false)
	{
		ServerMessage(idmes+'|'+item+'|'+ans+'|'+page+'|'+mail_message+'|'+author_message+'|'+text_message,'printmessage','listmessage');
		HideDiv('message');
		CleanMessage();
	}
	else alert(mes);
}

function GenCode()
{
		newcod=(Math.round(Math.random()*7+2)*10 + Math.round(Math.random()*1+1));
		document.getElementById('codbuttoncomment').src="/cod/cod_"+newcod+".jpg";
		document.getElementById('codbuttoncomment').value=newcod;
}
function CleanMessage()
{
		document.getElementById('author_message').value="";
		document.getElementById('mail_message').value="";
		document.getElementById('textreviewcomment').value="";
		document.getElementById('cod_message').value="";
}
function isNotMax(e,div){
	e = e || window.event;
	var target = e.target || e.srcElement;
	var code=e.keyCode?e.keyCode:(e.which?e.which:e.charCode)
	if(target.value.length > target.getAttribute('maxlength')) target.value=target.value.substr(0,target.getAttribute('maxlength'))
	document.getElementById(div).innerHTML=target.value.length;
	return target.value.length <= target.getAttribute('maxlength');
}
/*Конец Форум*/
