function popup(link)
{
	var win = null;
	var w = 680;
	var h = 480;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,toolbar=1,resizable=0,'
        win = window.open(link+"?popup=1",'small_popup',settings);
	if(win.window.focus){win.window.focus();}
}

function big_popup(link)
{
	var win = null;
	var w = 800;
	var h = 600;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,toolbar=1,resizable=0,'
        win = window.open(link+"?popup=1",'big_popup',settings);
	if(win.window.focus){win.window.focus();}
}

function show_pic(link,w,h)
{
	var win = null;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,toolbar=0,resizable=0,'
        win = window.open("/popup.php?image="+link+"&popup=1",'big_popup',settings);
	if(win.window.focus){win.window.focus();}
}

function print_popup(link)
{
	var win = null;
	var w = 720;
	var h = 600;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,menubar=1,toolbar=1,resizable=0,'
        win = window.open(link+"&popup=1&print=1",'print_popup',settings);
	if(win.window.focus){win.window.focus();}
}

function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable';
var mylink = mypage+'&popup=1';
win = window.open(mylink,myname,settings)
if(win.window.focus){win.window.focus();}
}

function maildecode (input)
	{
	var output=input;
	output=output.replace(/\|/, '@');
	output=output.replace("#xxcom#", ".");
	output=output.replace("#xxcom#", ".");
	output=output.replace("#xxcom#", ".");
	output=output.replace("#xxcom#", ".");
	output=output.replace("#xxcom#", ".");
	output=output.replace("#xxcom#", ".");
	output=output.replace("#xxcom#", ".");
	return (output);
	}

function writemaillink ($input,$hid)
	{
	$showmail=maildecode($input);
	$showmail=$showmail.replace('@','&#64;');
	$showmail=$showmail.replace(/\./,'&#46;');
	$showmail=$showmail.replace(/\?.*/,'');
	document.write('<?=$txt["list_email"]?>: ');
	document.write ("<a href=\"javascript:makemail('"+$input+"','"+$hid+"')\">");
	document.write($showmail);
	document.write ('</a><br>');
	}

function makemail($link,$hid)
	{
	if ($hid>0) mailtocount($hid);
	$link=maildecode($link);
	this.location.href="mailto:"+$link;
	}

function show_div(myid,myname)
	{
	for (i=1; i<=3; i++)
		{
		var x = myname + i;
		var my_div = document.getElementById(x);
		if(i == myid)
			{
			my_div.style.display = "inline";
			}
		else
			{
			my_div.style.display = "none";
			}
		}
	}