doc={x:1030,y:440};
private_mess_page='write-private-message.shtml';

function div(x,y) {
	return Math.floor(x/y);
}

function preload_images() {
	imgs=new Array();
	for(i=0; i<arguments.length; i++) {
		imgs[i]=new Image;
		imgs[i].src=arguments[i];
	}
}

function wrt(s) {document.write(s)}

function wrt_mail(user,host,content) {
	if (lang == 'en') wrt("<a href='mailto:"+user+"@"+host+"' title='write a letter'>"+content+"</a>")
	else wrt("<a href='mailto:"+user+"@"+host+"' title='написать письмо'>"+content+"</a>");
}

function wrt_langswitcher() {
	j=location.search;
	if (j == '') wrt("<A href='?")
	else wrt("<A href='");
	if (lang == 'en') wrt(j +"&lang=ru'>en/ru</A>")
	else wrt(j +"&lang=en'>en/ru</A>");
}

function get_doc_dimentions(doc) {
	if (window.innerWidth) {
		doc_w=window.innerWidth;
		doc_h=window.innerHeight;
	}
	else if (document.body) {
		doc_w=document.body.clientWidth;
		doc_h=document.body.clientHeight;
	}
	else if (screen.width) {
		doc_w=screen.width-270;
		doc_h=screen.height-160;
	}
	else {
		doc_w=1030;
		doc_h=440;
	}
	doc.x=doc_w;
	doc.y=doc_h;
}

function open_window(link,w,h) {
	get_doc_dimentions(doc);
	var win = "width="+w+",height="+h+",screenX="+div(doc.x-w,2)+",screenY="+div(doc.y-h,2)+",menubar=no,location=no,resizable=yes,scrollbars=yes";
	newWin = window.open(link,'newWin',win);
	newWin.focus();
}

