function MM_openBrWindow(theURL,winName,w,h,pw,ph,s,r,tit) { //v2.0
prop= "width="+w+",height="+h+",scrollbars="+s+",resizable="+r;
NewWin = window.open(theURL,winName,prop);
s=screen
if (pw=='c') pw=(s.width-w)/2
if (ph=='c') ph=(s.height-h)/2
if (pw && ph) NewWin.moveTo(pw,ph);
NewWin.focus()
if (tit!='') {
var String=""+
"<html>"+
"<head>"+
"<title>"+tit+"</title>"+
"</head>"+
"<img src='"+theURL+"' border=0>"+
"</html>"
NewWin.document.write(String);
}
}

function bookmark(title, url) {
	// если название страницы не было чётко указано, возьмём заголовок текущей страницы
	if (title == undefined)
		title = document.title;

	// то же самое и с URL-ом
	if (url == undefined)
		url = top.location.href;

	if (window.sidebar) {
		// Firefox
		window.sidebar.addPanel(title, url, '');
	} else if (window.opera && window.print) {
		// Opera
		var t = document.createElement('a');
		t.setAttribute('rel', 'sidebar');
		t.setAttribute('href', url);
		t.setAttribute('title', title);
		t.click();
	} else {
		// IE
		window.external.AddFavorite(url, title);
	}
	return false;
}

/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

function validate() {
if (numprj.project_num.value=='Введите номер') numprj.project_num.value='';
var r1 = new RegExp("^([A-Ka-k]{0,1}[-_. ]{0,1}[0-9]{0,4}([-_. ][0-9]{0,1}){0,1})$");
	if (r1.test(numprj.project_num.value) == false) {
		alert("Неверный формат номера");
		numprj.project_num.value =  numprj.project_num.value.substring(0,numprj.project_num.value.length-1);
		numprj.project_num.focus()
		return false;
	}else{
return true;
}
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function WOpen(theURL){
prop="width=500,height=340,scrollbars=1,resizable=1,menubar=0,status=0,toolbar=0";
NewWin = window.open(theURL,'new',prop);
}

dophelp='';
function HelpOpen(id){
prop="width=500,height=340,scrollbars=1,resizable=1,menubar=0,status=0,toolbar=0";
NewWin = window.open(domen+'/help.php?id='+id+'&dophelp='+dophelp,'help',prop);
}

function PicOpen(w,h,tit,pic){
prop="width="+w+",height="+h+",scrollbars=1,resizable=1,menubar=0,status=0,toolbar=0";
NewWin = window.open(domen+'/projects/pictures.php?tit='+tit+'&img='+pic,'help',prop);
}


var PicPrj;
function EmailOpen(mail){
prop="width=480,height=350,scrollbars=1,resizable=1,menubar=0,status=0,toolbar=0";
NewWin = window.open(domen+'/contact.php?mail='+mail+'&project='+PicPrj+'&id='+id+'&tit='+tit,'email',prop);
}

function EmailOpen2(mail,project){
prop="width=480,height=350,scrollbars=1,resizable=1,menubar=0,status=0,toolbar=0";
NewWin = window.open(domen+'/contact.php?mail='+mail+'&project='+project,'email',prop);
}

function FormOpen(project){
prop="width=690,height=400,left=100,top=100,scrollbars=1,resizable=1,menubar=0,status=0,toolbar=0,location=0";
NewWin = window.open(domen+'/form/index.php?project='+project,'form',prop);
NewWin.focus();
}
function Form2Open(project){
prop="width=690,height=400,left=100,top=100,scrollbars=1,resizable=1,menubar=0,status=0,toolbar=0,location=0";
NewWin = window.open(domen+'/form/form_2.php?project='+project,'form',prop);
NewWin.focus();
}
function Form3Open(){
prop="width=690,height=400,left=100,top=100,scrollbars=1,resizable=1,menubar=0,status=0,toolbar=0,location=0";
NewWin = window.open(domen+'/form/form_3.php','form',prop);
NewWin.focus();
}

function OpenInfo(t,link){
help.style.visibility = 'visible';
with (document.getElementById('Helptxt')) innerHTML = TextHelp[link];
}



function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function SwapImage(Imgname,ImgFile){
oldname=Imgname;
oldimg=document.images[Imgname].src;
document.images[Imgname].src=ImgFile
}

function SwapImgRestore() { //v3.0
document.images[oldname].src=oldimg;
}

function GoWeb(weblink){
theURL='http://'+weblink;
NewWin = window.open(theURL,'','');
}

function AdvWindow(advtit){
prop="width=860,height=650,scrollbars=yes"
AdvWin = window.open('',advtit,prop);
if (!AdvWin.document.title){
window.open('adv/'+advtit,advtit,prop);
}
AdvWin.focus()
}


