var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all
var ns4=document.layers

function MM_findObj(n, d) { //v4.01
  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;
}

function isValidEmail(emailStr) {
	// checks if the e-mail address is valid
	var emailPat = /^(\".*\"|[A-Za-z0-9\.\-_]*)@(\[\d{1,3}(\.\d{1,3}){3}]|[\-A-Za-z_\-]*(\.[A-Za-z\-_]*)+)$/;		//	"
	var matchArray = emailStr.match(emailPat);
	if (matchArray == null) {
		//alert("Your email address seems incorrect.  Please try again (check the '@' and '.'s in the email address)");
		return false;
	}
	return true;
}


function get_radio_value(object_name)	{
//	достает значение radiobutton'a,  если не выбрано - вернет undefined
	tmp_value = 'undefined';
	my_object=MM_findObj(object_name);
	num = my_object.length;
	for( var i = 0; i < num; i++ ) {
		if( my_object[ i ].checked == '1' ) {
			tmp_value = my_object[ i ].value;
		}
	}
return(tmp_value);
}


function open_img(path)	{
	add_w = window.open('show_photo.php?id='+path,'ch','left=150,top=150,width=830,height=640,scrollbars=1,status=0,resizeable=0');
	add_w.focus(); if (add_w.opener == null) { add_w.opener = window; }
}


function popup(url,w,h,sb)
{
	atr = '';
	atr = atr + 'toolbar=no,';
	if (sb)
	{
		atr = atr + 'scrollbars=no,';
	}
	else
	{
		atr = atr + 'scrollbars=yes,';
	}
	atr = atr + 'location=no,';
	atr = atr + 'statusbar=no,';
	atr = atr + 'menubar=no,';
	atr = atr + 'resizable=no,';
	atr = atr + 'status=no,';
	atr = atr + 'toolbar=no,';
	atr = atr + 'menubar=no,';
	if (w) {
	atr = atr + 'width='+w+',';
	atr = atr + 'height='+h+',';
	}
	else{
	atr = atr + 'width=700,';
	atr = atr + 'height=700,';
	}
	atr = atr + ' left='+String((screen.width-w)/2)+', top='+String((screen.height-h)/2);
	new_window=window.open(url,'_blank',atr);
	new_window.focus();
}


function person_ext(id) {
url = '/person_ext.php?pid='+id;
w = 800;
h = 600;
sb = 'qwerty';

	atr = '';
	atr = atr + 'toolbar=no,';
	if (sb)
	{
		atr = atr + 'scrollbars=yes,';
	}
	else
	{
		atr = atr + 'scrollbars=yes,';
	}
	atr = atr + 'location=no,';
	atr = atr + 'statusbar=yes,';
	atr = atr + 'menubar=no,';
	atr = atr + 'resizable=yes,';
	atr = atr + 'status=no,';
	atr = atr + 'toolbar=no,';
	atr = atr + 'menubar=no,';
	if (w) {
	atr = atr + 'width='+w+',';
	atr = atr + 'height='+h+',';
	}
	else{
	atr = atr + 'width=700,';
	atr = atr + 'height=700,';
	}
	atr = atr + ' left='+String((screen.width-w)/2)+', top='+String((screen.height-h)/2);
	new_window=window.open(url,'_blank',atr);
	new_window.focus();

return(false);
}

function cre100_ext(id) {
url = '/cre100_ext.php?rid='+id;
w = 800;
h = 600;
sb = 'qwerty';

	atr = '';
	atr = atr + 'toolbar=no,';
	if (sb)
	{
		atr = atr + 'scrollbars=yes,';
	}
	else
	{
		atr = atr + 'scrollbars=yes,';
	}
	atr = atr + 'location=no,';
	atr = atr + 'statusbar=yes,';
	atr = atr + 'menubar=no,';
	atr = atr + 'resizable=yes,';
	atr = atr + 'status=no,';
	atr = atr + 'toolbar=no,';
	atr = atr + 'menubar=no,';
	if (w) {
	atr = atr + 'width='+w+',';
	atr = atr + 'height='+h+',';
	}
	else{
	atr = atr + 'width=700,';
	atr = atr + 'height=700,';
	}
	atr = atr + ' left='+String((screen.width-w)/2)+', top='+String((screen.height-h)/2);
	new_window=window.open(url,'_blank',atr);
	new_window.focus();

return(false);
}



var curr_photo = 1;
function rotate_birthday() {
//alert(photos[curr_photo]);
	MM_findObj('scroll_birthday').src = photos[curr_photo];
	MM_findObj('scroll_birthday_txt').innerHTML = photo_title[curr_photo];
	
	curr_photo = curr_photo + 1;
	if (curr_photo > total_birthdays)
		curr_photo = 1;
	setTimeout('rotate_birthday()',3000);
}



function img_popup(img)
{
	atr = '';
	atr = atr + 'scrollbars=no,';
	atr = atr + 'location=no,';
	atr = atr + 'statusbar=yes,';
	atr = atr + 'menubar=no,';
	atr = atr + 'status=yes,';
	atr = atr + 'toolbar=no,';
	atr = atr + 'resizable=no,';
	atr = atr + 'width=300,';
	atr = atr + 'height=300,';
//	atr = atr + ' left='+String((screen.width-w)/2)+', top='+String((screen.height-h)/2);
	atr = atr + ' left=150, top=150';

//	defaultStatus
//	window.status

	html = '<html><head><title></title></head><body style="margin:0 0 0 0;"><script>function fit_img(w,h){window.resizeTo(w+10,h+49);window.status=" ";}</script><img src="'+img+'" alt="закрыть окно" border=0 onClick=\"window.close(self)\" style=\"cursor:hand\" id="img" onload="fit_img(this.width, this.height);"></body></html>';

	win=window.open('','',atr);
	win.document.write(html);
	win.focus();
return(false);
}


function show_block(block_name)        {
        tmpobj = MM_findObj(block_name);
        if (tmpobj != null)        tmpobj.style.display=        'inline';
        return false;
}

function hide_block(block_name)        {
        tmpobj = MM_findObj(block_name);
        if (tmpobj != null)        tmpobj.style.display=        'none';
return false;
}

