function createPictureWindow(_pic,_width,_height) {
	wTop = (screen.height-_height)/3;
	wLeft = (screen.width-_width)/2;
	WinFeatures = "top="+wTop+",left="+wLeft+",width="+_width+",height="+_height+",maximize=no,minimize=no,Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=no,resize=no";
	_newPicture = window.open("zoom.php?id="+_pic+"&dir=pictures","frontendPictureWindow",WinFeatures);
}

function createDynamicWindow(Path,Width,Height,Title)
{
	var p = Math.ceil(Math.random()*10000);
	var q = Math.ceil(Math.random()*p);
	windowName = p+'X'+(Width*p)+(Height*q);
	WinFeatures = "top="+(screen.height-Height)/2+",left="+(screen.width-Width)/2+",width="+Width+",height="+Height+",Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=no";
	w = window.open("",windowName,WinFeatures);
	w.document.open();
	w.document.write('<head><title>'+Title+'</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head>');
	w.document.write("<body bgcolor='#FFFFFF' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'><img src='"+Path+"' height='"+Height+"' width='"+Width+"' alt='&quot;"+Title+"&quot;'></body>"); 
	w.document.close();
}

function createDescriptionWindow(_file,_width,_height)
{
	wTop = (screen.height-_height)/3;
	wLeft = (screen.width-_width)/2;
	WinFeatures = "top="+wTop+",left="+wLeft+",width="+_width+",height="+_height+",maximize=no,minimize=no,Status=yes,toolbar=no,menubar=no,location=no,directories=no,scrollbars=auto,resize=no";
	_newDescription = window.open(_file,"frontendDescriptionWindow",WinFeatures);
}

function createMovieWindow(_file,_width,_height,_title)
{
	wTop = (screen.height-_height)/3;
	wLeft = (screen.width-_width)/2;
	wName = Math.ceil(Math.random()*10000)+'x'+(_width*Math.ceil(Math.random()*10000))+(_height*Math.ceil(Math.random()*Math.ceil(Math.random()*10000)));
	WinFeatures = "top="+wTop+",left="+wLeft+",width="+_width+",height="+_height+",maximize=no,minimize=no,Status=no,fullscreen=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=no,resize=no";
	mapWindow = window.open('',wName,WinFeatures);
	mapWindow.document.open();
	mapWindow.document.write('<html><head><title>'+_title+'</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head><body bgcolor="#050505" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" scroll=no><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width=100% height=100%><param name=movie value="'+_file+'"><param name=loop value=false><param name=menu value=false><param name=quality value=high><embed src="'+_file+'" loop=false menu=false quality=high width=100% height=100% type="application/x-shockwave-flash" pluginspage="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"></embed></object></body></html>');
	mapWindow.document.close();
}

function checkAllFields(form) {
	formElement = document.forms[form].elements;
	isFilled = true;
	for(j=0; j<formElement.length; j++) if(formElement[j].value == '') isFilled = false;
	if (!isFilled)  {
		alert('Все поля формы должны быть заполнены!'); return false;
	}
	else return true;
}

function formValid(form) {
	f1 = document.forms[form].mail.value;

	if ((f1 == "") || (f1.indexOf('@')<0) || (f1.indexOf('.')<0)) {
		alert("Введите, пожалуйста, корректный e-Mail");
		return false;
	}
	else return true;
}

