/* Вывод флеш объекта через функцию */
//<script type="text/javascript">flash("/images/flash_object.swf", "/images/flash_altimg.gif", "400", "400")</script>

function flash(src, img, w, h) {

var flash='';
flash = flash + '<object type="application/x-shockwave-flash" width=' + w + ' height=' + h + ' data=' + src + '>';
flash = flash + '<param value=' + src + ' name="movie" />';
flash = flash + '<img src=' + img + ' width=' + w + ' height=' + h + 'alt=""/>';
flash = flash + '<param name="WMode" VALUE="Transparent" />';
flash = flash + '</object>';

document.write(flash);
}

function imgView(href,w,h)
{
	var maxwidth = screen.width;
	var maxheight = screen.height;
	var top = Math.max(Math.floor((screen.height - h) / 2), 10);
	var left = Math.max(Math.floor((screen.width - w) / 2), 10);
	var param = 'toolbar=0,top=' + top + ',left=' + left + ',Toolbar=0,Location=0,Directories=0,Status=0,Menubar=0, Resizable=0';
	if (w <= maxwidth && h <= maxheight) param += ',scrollbars=0';
	else { param += ',scrollbars=1'; w; h=h- -20; }
	if(w > maxwidth) w = maxwidth; else w=w- -0;
	param  = param + ',width=' + w;
	if(h > maxheight) h = maxheight; else h=h- -30;
	param = param + ',height=' + h;

	imgWin = window.open('', '_blank', param);
	imgWin.opener = window;
	imgWin.resizeTo(w,h);
    imgWin.document.open("text/html");
    imgWin.document.writeln("<html>");
    imgWin.document.writeln("<head><title> </title></head>");
    imgWin.document.writeln("<body leftMargin='0' topMargin='0'>");
    imgWin.document.writeln('<img src='+document.getElementsByTagName("base")[0].href + href+
    	' onclick="parent.close()" style=cursor:hand;>');
    imgWin.document.writeln("<br>");
    imgWin.document.write("</body></html>");
	imgWin.focus();
}

function checkContact() {
	f = document.contact;
	if (f.fio.value == "") {
		alert("Представьтесь, пожалуйста.");
		return false;
	} else if (f.email.value == "") {
		alert("Пожалуйста, укажите адрес электронной почты.");
		return false;
	} else if (f.phone.value == "") {
		alert("Пожалуйста, укажите контактный телефон.");
		return false;
	} else if (!(isEmailValid(f.email.value) || (f.email.value == ""))) {
		  alert("Указан неверный адрес электронной почты.");
		  return false;
	} else if (f.comments.value == "") {
		alert("Пожалуйста, укажите Ваш вопрос.");
		return false;
	}
	return true;
}

function isEmailValid(email) {
     var s = "[\\w\\-]+(\\.[\\w\\-]+)*@((([a-zA-Z0-9]+)|([a-zA-Z0-9]+[\\w\\-]*))(\\.([\\w^_]+\\.\\2))?\\.)?[\\w\\-]{2,}\\.[a-zA-Z]{2,}";
     var re = new RegExp(s);
     return re.test(email);
}

function OpenWin(filename) {
var params='width=800, height=600, top=0, left=0, menubar=1, scrollbars=1, resizable=0'
msgWindow=window.open(filename,"_blank",params);
// print();
}
