function go_url(menu) {
	choice = menu.selectedIndex;

	if (menu.options[choice].value != "") {
        window.location.href = menu.options[choice].value;
    }
}

var eml=/^([\w-~_]+\.)*[\w-~_]+@([\w-_]+\.){1,3}\w{2,4}$/i;
var a_msg = [['name','Ваше имя','Your name'],['email','E-mail','E-mail',eml],['subject','Тема','Subject'],['message','Сообщение','Message']];
var a_subscr = [['email','E-mail',eml]];
function _chf(o, a, n){
	var s='', g = (n == 2 ? 2 : 1);
	for (var i = 0; i < a.length; i++)
	if (!o.elements[a[i][0]].value) s+=a[i][g] + (n == 2 ? ': you must enter value;\n' : ': поле необходимо заполнить;\n');
	else if (a[i][3]) if(!o.elements[a[i][0]].value.match(a[i][3])) s += a[i][g] + (n == 2 ? ': value is incorrect;\n' : ': поле заполнено неверно;\n');
	if (!s) return true;
	alert(s);
	return false;
}

function open_window(url) {
	sx = 800;
	sy	= 600;

	var winl = (screen.width-sx)/2;
   var wint = (screen.height-sy)/2;

	window.open(url,'Links','scrollbars=1, resizable=0 , width='+sx+', height='+sy+' , top='+wint+',left='+winl).focus();
}

function open_win(src, width, height){
	str = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\n' +
			'<html>\n' +
			'<meta http-equiv="Content-Type" content="text/html; charset=Windows-1251">\n' +
			'<head>\n' +
			'	<title>Фотография</title>\n' +
			'</head>\n' +
			'<body text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" marginheight="0" marginwidth="0">\n' +
			'<table border="0" cellpadding="0" cellspacing="0">\n' +
			'	<tr><td><a href="javascript: window.close()"><img src="' + src + '" border="0"></a></td></tr>\n' +
			'</table>\n' +
			'</body>\n' +
			'</html>';
	newWindow = window.open("", "_blank", "width=" + width + ",height=" + height + ",menubar=no,status=no,resizeable=no,toolbar=no,location=no");
	window.newWindow.document.open("text/html");
	window.newWindow.document.write(str);
	window.newWindow.document.close();
	window.newWindow.focus();
	return false;
}

function MM_findObj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

var ie=(document.all && document.all.item && !window.opera)?1:0;
var def_normal_class = 'nav2';
var def_hightlight_class = 'nav2_';

/* @todo заставить работать в Mozille */
function Show(div, evnt, elem1, class_highlight,type) {
	class_normal = def_normal_class;
	if(!class_highlight) class_highlight = def_hightlight_class;

	if (evnt) highlight(evnt, class_highlight);

	if ((obj=MM_findObj(div))!=null) {
		if(ie){
			if(type  == 0)  { x = 154; y = 12; }
			else			{ x = 0; y = 0; }

			//x = 226;y=13;
			
			//alert(x);

			obj.style.left = event.clientX - event.offsetX - x;// 
			obj.style.top = event.clientY - event.offsetY + document.body.scrollTop+ y;// 
		} else {
			if (event.srcElement.tagName=='TD') {
				obj.style.left = event.clientX - event.offsetX - 5;
				obj.style.top = event.clientY - event.offsetY + document.body.scrollTop + 23;
			}
		}
		ShowHide('show', obj, elem1, class_normal, class_highlight);
	}
}

function Hide(div, evnt, elem1, class_normal) {
	if(!class_normal) class_normal = def_normal_class;
	class_highlight = def_hightlight_class;

	if(evnt) highlight(evnt, class_normal);
	
	if ((obj=MM_findObj(div))!=null)
		ShowHide('hide', obj, elem1, class_normal, class_highlight);
}

function ShowHide(v, obj, elem1, class_normal, class_highlight) {
	if(!class_normal) class_normal = def_normal_class;
	if(!class_highlight) class_highlight = def_hightlight_class;
	//if (event.fromElement.tagName!='DIV') return;
	obj1 = MM_findObj(elem1);
	//obj2 = MM_findObj(elem2);
	if (obj1)
	if (obj1) {
		if (v=='hide') obj1.className=class_normal;
		else obj1.className=class_highlight;
	}
	if (obj.style) {
		obj=obj.style;
		v=(v=='show')?'block':(v=='hide')?'none':v;
	}
	obj.display=v;
}

function highlight(obj, class_name){
	obj.className = class_name;
}

function valid_email(address){
	if (address.replace(/^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/i, '').length)
		return false;
	else 
		return true;
}
