function view(x,y,name) {
  newwin = window.open(name,"_blank","width="+x+",height="+y);
  newwin.document.writeln('<html><head><title>Zoom photo</title></head>');
  newwin.document.writeln('<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0> <img src='+name+'> </body></html>');
}

function CommentsChuse(CommentNumber) {
	for (var i = 0; i < 400; i++) {		
		var ThisComment = document.getElementById("CommentNumber_" + i);
		if (i != CommentNumber) {
			if (ThisComment.style.display == 'inline') ThisComment.style.display = 'none';
		} else if (ThisComment.style.display == 'none') ThisComment.style.display = 'inline';		
	}		
}

function load() {

	var generator=window.open('','name','height=250, width=500');
  
  generator.document.write('<html><title>Как и зачем F1CD меня запомнит?</title>');
  generator.document.write('<link href="/files/new_styles.css" type="text/css" rel="stylesheet">');
  generator.document.write('</head><body style=\"margin: 10\"><h1>Запомнить меня на этом компьютере</h1>');
  generator.document.write('<span style=\"font-size: 13 \"><p><b>F1CD</b> запомнит Ваш выбор имени и в дальнейшем всегда будет вставлять это имя в поле \"Представьтесь:\". <p>Для запоминания используются только cookie, поэтому для использования данной функции необходимо, чтобы Ваш браузер поддерживал работу с cookie');

  generator.document.close();
}

function CheckRemember(FormName) {	
	checkSet = eval("document."+FormName+".remember")
	checkSet.checked = !(checkSet.checked)
}

function popup(code,w,h)
        { window.open('plug.php?o='+code,'','toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width='+w+',height='+h+',left=32,top=16'); }
function pfs(id,c1,c2)
        { window.open('pfs.php?userid='+id+'&c1='+c1+'&c2='+c2,'PFS','status=1, toolbar=0,location=0,directories=0,menuBar=0,resizable=1,scrollbars=yes,width=754,height=512,left=32,top=16'); }
function help(rcode,c1,c2)
        { window.open('plug.php?h='+rcode+'&c1='+c1+'&c2='+c2,'Help','toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width=480,height=512,left=32,top=16'); }
function comments(rcode)
        { window.open('comments.php?id='+rcode,'Comments','toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width=480,height=512,left=16,top=16'); }
function ratings(rcode)
        { window.open('ratings.php?id='+rcode,'Ratings','toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width=480,height=512,left=16,top=16'); }
function polls(rcode)
        { window.open('polls.php?id='+rcode,'Polls','toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width=608,height=448,left=16,top=16'); }
function pollvote(rcode,rvote)
        { window.open('polls.php?a=send&id='+rcode+'&vote='+rvote,'Polls','toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width=608,height=448,left=16,top=16'); }
function picture(url,sx,sy)
        { window.open('pfs.php?m=view&v='+url,'Picture','toolbar=0,location=0,directories=0,menuBar=0,resizable=1,scrollbars=yes,width='+sx+',height='+sy+',left=0,top=0'); }
function redirect(url)
        { location.href = url.options[url.selectedIndex].value; }
function toggleblock(id)
        {
        var bl = document.getElementById(id);
        if(bl.style.display == 'none')
                { bl.style.display = ''; }
        else
                { bl.style.display = 'none'; }
        }
window.name='main';



/*** This is a script from www.dhtmlgoodies.com. ***/	

var dhtmlgoodies_tooltip = false;
var dhtmlgoodies_tooltipShadow = false;
var dhtmlgoodies_shadowSize = 1;
var dhtmlgoodies_tooltipMaxWidth = 300;
var dhtmlgoodies_tooltipMinWidth = 120;
var dhtmlgoodies_iframe = false;
var tooltip_is_msie = (navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('opera')==-1 && document.all)?true:false;

function showTooltip(e,tooltipTxt)
	{
	var bodyWidth = Math.max(document.body.clientWidth,document.documentElement.clientWidth) - 20;
	if(!dhtmlgoodies_tooltip)
		{
		dhtmlgoodies_tooltip = document.createElement('DIV');
		dhtmlgoodies_tooltip.id = 'dhtmlgoodies_tooltip';
		dhtmlgoodies_tooltipShadow = document.createElement('DIV');
		dhtmlgoodies_tooltipShadow.id = 'dhtmlgoodies_tooltipShadow';
		document.body.appendChild(dhtmlgoodies_tooltip);
		document.body.appendChild(dhtmlgoodies_tooltipShadow);	
		if(tooltip_is_msie)
			{
			dhtmlgoodies_iframe = document.createElement('IFRAME');
			dhtmlgoodies_iframe.frameborder='5';
			dhtmlgoodies_iframe.style.backgroundColor='#FFFFFF';
			dhtmlgoodies_iframe.src = '#'; 	
			dhtmlgoodies_iframe.style.zIndex = 100;
			dhtmlgoodies_iframe.style.position = 'absolute';
			document.body.appendChild(dhtmlgoodies_iframe);
			}
		}
	dhtmlgoodies_tooltip.style.display='block';
	dhtmlgoodies_tooltipShadow.style.display='block';
	if(tooltip_is_msie) { dhtmlgoodies_iframe.style.display='block'; }
	var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
	if(navigator.userAgent.toLowerCase().indexOf('safari')>=0) { st=0; }
	var leftPos = e.clientX - 15;
	dhtmlgoodies_tooltip.style.width = null;	// Reset style width if it's set 
	dhtmlgoodies_tooltip.innerHTML = tooltipTxt;
	dhtmlgoodies_tooltip.style.left = leftPos + 'px';
	dhtmlgoodies_tooltip.style.top = e.clientY + 10 + st + 'px';
	dhtmlgoodies_tooltipShadow.style.left =  leftPos + dhtmlgoodies_shadowSize + 'px';
	dhtmlgoodies_tooltipShadow.style.top = e.clientY + 10 + st + dhtmlgoodies_shadowSize + 'px';
	if(dhtmlgoodies_tooltip.offsetWidth>dhtmlgoodies_tooltipMaxWidth)
		{
		/* Exceeding max width of tooltip ? */
		dhtmlgoodies_tooltip.style.width = dhtmlgoodies_tooltipMaxWidth + 'px';
		}
	var tooltipWidth = dhtmlgoodies_tooltip.offsetWidth;		
	if(tooltipWidth<dhtmlgoodies_tooltipMinWidth) { tooltipWidth = dhtmlgoodies_tooltipMinWidth; }
	dhtmlgoodies_tooltip.style.width = tooltipWidth + 'px';
	dhtmlgoodies_tooltipShadow.style.width = dhtmlgoodies_tooltip.offsetWidth + 'px';
	dhtmlgoodies_tooltipShadow.style.height = dhtmlgoodies_tooltip.offsetHeight + 'px';		
	if((leftPos + tooltipWidth)>bodyWidth)
		{
		dhtmlgoodies_tooltip.style.left = (dhtmlgoodies_tooltipShadow.style.left.replace('px','') - ((leftPos + tooltipWidth)-bodyWidth)) + 'px';
		dhtmlgoodies_tooltipShadow.style.left = (dhtmlgoodies_tooltipShadow.style.left.replace('px','') - ((leftPos + tooltipWidth)-bodyWidth) + dhtmlgoodies_shadowSize) + 'px';
		}
	if(tooltip_is_msie)
		{
		dhtmlgoodies_iframe.style.left = dhtmlgoodies_tooltip.style.left;
		dhtmlgoodies_iframe.style.top = dhtmlgoodies_tooltip.style.top;
		dhtmlgoodies_iframe.style.width = dhtmlgoodies_tooltip.offsetWidth + 'px';
		dhtmlgoodies_iframe.style.height = dhtmlgoodies_tooltip.offsetHeight + 'px';
		}
	}
	
function hideTooltip()
	{
	dhtmlgoodies_tooltip.style.display='none';
	dhtmlgoodies_tooltipShadow.style.display='none';		
	if(tooltip_is_msie)dhtmlgoodies_iframe.style.display='none';		
	}

	
function ShowLayer(id, start, stop) {

	
	HideAll(start, stop);
	
	document.getElementById(id).style.display='inline';
	

}
function HideAll(count, start, stop) {
	
	for (i=5;i<=10;i++) {
	
	j = i+'';
	
		document.getElementById('layer_data_mini_'+j).style.display='none';
	
	}
}

function ChangeTopArt(id) {

// top_txt_link
// top_link
// top_img

document.getElementById('top_img').src = document.getElementById('top_art_img_'+id).src;

HideTopArt();
document.getElementById('top_art_div_'+id).style.display='inline';

// change links
document.getElementById('top_txt_link').href = document.getElementById('top_art_link_'+id).href;
document.getElementById('top_link').href = document.getElementById('top_art_link_'+id).href;
document.getElementById('top_data_link').href = document.getElementById('top_art_link_'+id).href;

document.getElementById('top_data_link').innerHTML = document.getElementById('top_art_data_'+id).innerHTML;
document.getElementById('top_txt_link').innerHTML = "<h1 style='margin:7 0 3 0;'>" + document.getElementById('top_art_title_'+id).innerHTML + "</h1>";

top_link = document.getElementById('top_link').href;


}

function HideTopArt() {
	
	for (i = 0; i < 6; i++) {
	
	document.getElementById('top_art_div_'+i).style.display='none';
	
	}
}

function ShowLoginBox(id) {
	
	var id_name = 'login_div_' + id;
	
	if (document.getElementById(id_name).style.display == 'none')
		document.getElementById(id_name).style.display = 'block';
			else document.getElementById(id_name).style.display = 'none';

}

function ZoomImg(url, e) {

var e = e || false;

if (url == '') {

 document.getElementById('top___line_div').innerHTML = '';
 document.getElementById('top___line_div').align = 'left';

} else {

	if(!e) e = window.event;
  var x = e.pageX || e.x;
  var y = e.pageY || e.y;
  	
	var num = 1;
	var new_img = document.createElement('img');
	new_img.setAttribute('id', 'preview______img');
	new_img.src = url;
	new_img.style.position = 'fixed';
	new_img.style.zIndex = '100';
	var marginLeft = (x - 100) + 'px'
	
	var ScrollTOP = self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);

	var marginTop = (y - ScrollTOP - 280) + 'px'
	new_img.style.marginLeft = marginLeft;
	new_img.style.marginTop = marginTop;
	new_img.style.padding = "3px";
	new_img.style.border = "2px solid #3f7fbf";
	new_img.style.background = "#ffffff";
	new_img.border = 1;
	document.getElementById('top___line_div').appendChild(new_img);	
	}
}

function createCookie(name, value, days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return false;
}

function DisplayNoneElement(id) {
	
	var cookie_name = id;
	if (!readCookie(cookie_name)) createCookie(cookie_name, '1', 600);	
	document.getElementById(id).style.display = 'none';

}

function DisplayNoneAdElement(id) {
	
	if (!readCookie(id)) createCookie(id, '1', 600);
		else createCookie(id, '2', 600);
	document.getElementById(id).style.display = 'none';

}

function AdClickSmartScreen(id, url) {

// alert(readCookie(id));

window.open(url, 'New', '');
DisplayNoneAdElement(id);

}
