function openWin(){
window.open('/_genplan/genplan.html/', '', 'width=1024, height=768, Toolbar=0,Location=0,Directories=0,Status=0,Menubar=0, Resizable=1');
}
 

function formSubmit(formName) {
	document.forms[formName].submit();
}

function addFavorite(name) {
	window.external.addFavorite(document.getElementsByTagName("base")[0].href , name);
}

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 += 20; h += 20; }
	if(w > maxwidth) w = maxwidth; else w += 12;
	param  = param + ',width=' + w;
	if(h > maxheight) h = maxheight; else 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 style=text-align:center;>");
    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 videoView()
{
	var args=videoView.arguments;
	var vid_name=args[0];
	var w=args[1];
	var h=args[2];
	var v_w;
	var v_h;
	if (args.length==5){
		v_w=args[3];
		v_h=args[4];
	}
	else {
		v_w=w;
		v_h=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 += 20; h += 20; }
	if(w > maxwidth) w = maxwidth; else w += 12;
	param  = param + ',width=' + w;
	if(h > maxheight) h = maxheight; else 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 style=text-align:center;>");
    var bhref=document.getElementsByTagName("base")[0].href;
    imgWin.document.writeln('<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="'+v_w+'" height="'+v_h+'" id="FLVPlayer">'+
		'<param name="movie" value="'+bhref+'/images/FLVPlayer_Progressive.swf" />'+
		'<param name="salign" value="lt" />'+
		'<param name="quality" value="high" />'+
		'<param name="scale" value="noscale" />'+
		'<param name="FlashVars" value="&MM_ComponentVersion=1&skinName='+bhref+'/images/Clear_Skin_3&streamName='+vid_name+'&autoPlay=true&autoRewind=true" />'+
		'<embed src="'+bhref+'/images/FLVPlayer_Progressive.swf" flashvars="&MM_ComponentVersion=1&skinName='+bhref+'/images/Clear_Skin_3&streamName='+vid_name+'&autoPlay=true&autoRewind=true" quality="high" scale="noscale" width="'+v_w+'" height="'+v_h+'" name="FLVPlayer" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" />'+
		'</object>');
    imgWin.document.writeln("<br><br>");
    imgWin.document.write("</body></html>");
	imgWin.focus();
}

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);
}
