function CheckDel(url_string)
	{
	if(confirm('delete?'))
	location.href = "?"+url_string;
	}
function showlogin(){
	document.getElementById('login').style.display = 'block';
	document.getElementById('grid').style.display = '';
	return false;
}
function hidelogin(){
	document.getElementById('login').style.display = 'none';
	document.getElementById('grid').style.display = 'none';
	return false;
}
function CheckForm(){
	name = document.Send.name.value;
	email = document.Send.mail.value;
	phone1 = document.Send.phone1.value;
	text = document.Send.text.value;
	error = 0;
	errormessage = "Ошибка!\n";
	var at="@"
	var dot="."
	var lat=email.indexOf(at)
	var lstr=email.length
	var ldot=email.indexOf(dot)
	if(name == ""){error = 1; errormessage = errormessage + "- укажите своё имя\n";}
	if(phone1 == ""){error = 1; errormessage = errormessage + "- укажите контактный телефон\n";}
	if(phone1.length <= 6 && phone1 != ""){error = 1; errormessage = errormessage + "- номер телефона введён не корректно\n";}
	if(email=="") {error = 1; errormessage = errormessage + "- укажите  адрес электронной почты\n";}
	if(text=="") {error = 1; errormessage = errormessage + "- текст сообщения пуст\n";}
	if(email!="" &&
		(
		email.indexOf(at)==-1 
		|| email.indexOf(at)==0
		|| email.indexOf(at)==lstr 
		|| email.indexOf(dot)==-1 
		|| email.indexOf(dot)==0
		|| email.indexOf(dot)==lstr 
		|| email.indexOf(at,(lat+1))!=-1 
		|| email.substring(lat-1,lat)==dot
		|| email.substring(lat+1,ldot).length<1 
		|| email.substring(lat+1,lat+2)==dot
		|| email.indexOf(dot,(lat+2))==-1 
		|| email.indexOf(" ")!=-1 
		|| email.substring(ldot+1,lstr).length < 2)
		)
	{error = 1; errormessage = errormessage + "- электронный адрес введён не корректно\n";}
	if(error == 0){return true;}
	else{alert(errormessage); return false;}
	}
function waitLoginHide(){
//ltime=setTimeout("hidelogin()",8500);
}
function cancelLoginHide(){
//clearTimeout(ltime)
}

var CAPTION=6;
var LEFT=7;
var RIGHT=8;
var CENTER=9;
var FGCOLOR=12;
var BGCOLOR=13;
var TEXTCOLOR=14;
var CAPCOLOR=15;
var WIDTH=17;
var STATUS=19;
var HEIGHT=22;
var ABOVE=35;
var BELOW=36;
var FRAME=44;
var FUNCTION=46;
var DELAY=47;
var HAUTO=48;
var VAUTO=49;

if(typeof ol_fgcolor=='undefined'){var ol_fgcolor="#ffffff";}
if(typeof ol_bgcolor=='undefined'){var ol_bgcolor="#917b53";}
if(typeof ol_textcolor=='undefined'){var ol_textcolor="#000000";}
if(typeof ol_capcolor=='undefined'){var ol_capcolor="#ffffff";}
if(typeof ol_text=='undefined'){var ol_text="Default Text";}
if(typeof ol_cap=='undefined'){var ol_cap="";}
// vertical alignment RIGHT/LEFT/CENTER.
if(typeof ol_hpos=='undefined'){var ol_hpos=LEFT;}
if(typeof ol_status=='undefined'){var ol_status="";}
// If the status bar automatically should load either text or caption.
// 0=nothing, 1=text, 2=caption
if(typeof ol_autostatus=='undefined'){var ol_autostatus=1;}
if(typeof ol_height=='undefined'){var ol_height=-1;}
// Sets the popups horizontal and vertical position to a fixed column.
// Anything above -1 will cause fixed position.
if(typeof ol_fixx=='undefined'){var ol_fixx=-1;}
if(typeof ol_fixy=='undefined'){var ol_fixy=-1;}
// Default vertical position of the popup. Default should normally be BELOW.
// ABOVE only works when HEIGHT is defined.
if(typeof ol_vpos=='undefined'){var ol_vpos=BELOW;}

// Default height of popup to use when placing the popup above the cursor.
if(typeof ol_aboveheight=='undefined'){var ol_aboveheight=0;}

// Default frame. We default to current frame if there is no frame defined.
if(typeof ol_frame=='undefined'){var ol_frame=self;}
// Default javascript funktion. By default there is none.
if(typeof ol_function=='undefined'){var ol_function=Function();}

// Default timeout. By default there is no timeout.
if(typeof ol_delay=='undefined'){var ol_delay=0;}

// If overLIB should decide the horizontal and vertical placement.
if(typeof ol_hauto=='undefined'){var ol_hauto=0;}
if(typeof ol_vauto=='undefined'){var ol_vauto=0;}

// Runtime variables init. Used for runtime only, don't change, not for config!
var o3_text="";
var o3_cap="";
var o3_hpos=RIGHT;
var o3_offsetx=2;
var o3_offsety=2;
var o3_fgcolor="";
var o3_bgcolor="";
var o3_textcolor="";
var o3_capcolor="";
var o3_width="";
var o3_status="";
var o3_autostatus=0;
var o3_height=-1;
var o3_fixx=-1;
var o3_fixy=-1;
var o3_vpos=BELOW;
var o3_aboveheight=0;
var o3_frame=self;
var o3_allowmove=0;
var o3_function=Function();
var o3_delay=0;
var o3_delayid=0;
var o3_hauto=0;
var o3_vauto=0;

// Display state variables
var o3_x=0;
var o3_y=0;
var o3_allow=0;
var o3_showingsticky=0;
var o3_removecounter=0;

// Our layer
var over=null;


// Decide browser version
var ns4=(document.layers)? true:false;
var ns6=(document.getElementById)? true:false;
var ie4=(document.all)? true:false;
var ie5=false;

// Microsoft Stupidity Check(tm).
if(ie4){
	if(navigator.userAgent.indexOf('MSIE 5')>0){
		ie5=true;
	}
	if(ns6){
		ns6=false;
	}
}

// Capture events, alt. diffuses the overlib function.
if((ns4)||(ie4)||(ns6)){
	document.onmousemove=mouseMove
	if(ns4) document.captureEvents(Event.MOUSEMOVE)
} else {
	overlib=no_overlib;
	nd=no_overlib;
	ver3fix=true;
}


// Fake function for 3.0 users.
function no_overlib(){return ver3fix;}

// overlib(arg0, ..., argN)
// Loads parameters into global runtime variables.
function overlib(){
	
// Load defaults to runtime.
o3_text=ol_text;
o3_cap=ol_cap;
o3_hpos=ol_hpos;
o3_offsetx=-360;
o3_offsety=10;
o3_fgcolor=ol_fgcolor;
o3_bgcolor=ol_bgcolor;
o3_textcolor=ol_textcolor;
o3_capcolor=ol_capcolor;
o3_width=350;
o3_status=ol_status;
o3_autostatus=ol_autostatus;
o3_height=ol_height;
o3_fixx=ol_fixx;
o3_fixy=ol_fixy;
o3_vpos=ol_vpos;
o3_aboveheight=ol_aboveheight;
o3_function=ol_function;
o3_delay=ol_delay;
o3_hauto=ol_hauto;
o3_vauto=ol_vauto;

	// Special for frame support, over must be reset...
	if((ns4)||(ie4)||(ns6)){
		o3_frame=ol_frame;
		if(ns4) over=o3_frame.document.overDiv
		if(ie4) over=o3_frame.overDiv.style
		if(ns6) over=o3_frame.document.getElementById("overDiv");
	}
	
	
	// What the next argument is expected to be.
	var parsemode=-1;

	for (i=0; i < arguments.length; i++){
		
		if(parsemode==0){
			// Arg is command
			if(arguments[i]==CAPTION){ parsemode=CAPTION;}
			if(arguments[i]==LEFT){ parsemode=opt_HPOS(arguments[i]);}
			if(arguments[i]==RIGHT){ parsemode=opt_HPOS(arguments[i]);}
			if(arguments[i]==CENTER){ parsemode=opt_HPOS(arguments[i]);}
			if(arguments[i]==FGCOLOR){ parsemode=FGCOLOR;}
			if(arguments[i]==BGCOLOR){ parsemode=BGCOLOR;}
			if(arguments[i]==TEXTCOLOR){ parsemode=TEXTCOLOR;}
			if(arguments[i]==CAPCOLOR){ parsemode=CAPCOLOR;}
			if(arguments[i]==WIDTH){ parsemode=WIDTH;}
			if(arguments[i]==STATUS){ parsemode=STATUS;}
			if(arguments[i]==HEIGHT){ parsemode=HEIGHT;}
			if(arguments[i]==ABOVE){ parsemode=opt_VPOS(arguments[i]);}
			if(arguments[i]==BELOW){ parsemode=opt_VPOS(arguments[i]);}
			if(arguments[i]==FRAME){ parsemode=FRAME;}
			if(arguments[i]==FUNCTION){ parsemode=FUNCTION;}
			if(arguments[i]==DELAY){ parsemode=DELAY;}
			if(arguments[i]==HAUTO){ parsemode=opt_HAUTO(arguments[i]);}
			if(arguments[i]==VAUTO){ parsemode=opt_VAUTO(arguments[i]);}
		} else {
			if(parsemode < 0){
				// Arg is maintext, unless INARRAY
					o3_text=arguments[i];
					parsemode=0;
			} else {
				// Arg is option for command
				if(parsemode==CAPTION){ parsemode=opt_CAPTION(arguments[i]);}
				if(parsemode==FGCOLOR){ parsemode=opt_FGCOLOR(arguments[i]);}
				if(parsemode==BGCOLOR){ parsemode=opt_BGCOLOR(arguments[i]);}
				if(parsemode==TEXTCOLOR){ parsemode=opt_TEXTCOLOR(arguments[i]);}
				if(parsemode==CAPCOLOR){ parsemode=opt_CAPCOLOR(arguments[i]);}
				if(parsemode==STATUS){ parsemode=opt_STATUS(arguments[i]);}
				if(parsemode==HEIGHT){ parsemode=opt_HEIGHT(arguments[i]);}
				if(parsemode==FRAME){ parsemode=opt_FRAME(arguments[i]);}
                                if(parsemode==FUNCTION){ parsemode=opt_FUNCTION(arguments[i]);}
				if(parsemode==DELAY){ parsemode=opt_DELAY(arguments[i]);}
			}
		}
	}

	if(o3_delay==0){
		return overlib330();
	} else {
		o3_delayid=setTimeout("overlib330()", o3_delay);
		return;
	}
}

// Clears popups if appropriate
function nd(){
	if(o3_removecounter >= 1)o3_showingsticky=0;
	if((ns4)||(ie4)||(ns6)){
		if( o3_showingsticky==0 ){
			o3_allowmove=0;
			if(over != null) hideObject(over);
		} else o3_removecounter++;
	}
	return true;
}

function overlib330(){
	// Make layer content
	var layerhtml;
	// They want a popup box.
	// Prepare popup background & colors
	if(o3_fgcolor != "") o3_fgcolor="BGCOLOR=\""+o3_fgcolor+"\"";
	if(o3_bgcolor != "") o3_bgcolor="BGCOLOR=\""+o3_bgcolor+"\"";

	// Prepare popup height
	if(o3_height > 0) o3_height="HEIGHT=" + o3_height;
	else o3_height="";

	// Decide which kinda box.
	if(o3_cap=="") layerhtml=ol_content_simple(o3_text); // Plain
	else layerhtml=ol_content_caption(o3_text, o3_cap); // With caption

	layerWrite(layerhtml);
	
	// do status bar
	if(o3_autostatus > 0){
		o3_status=o3_text;
		if(o3_autostatus > 1)o3_status=o3_cap;
	}

	// When placing a layer 1st time, even stickies may be moved.
	o3_allowmove=0;

	// Show layer
	disp(o3_status);
	return true;
}


// Makes simple table without caption
function ol_content_simple(text){
	txt="<TABLE WIDTH="+o3_width+" BORDER=0 CELLPADDING=1 CELLSPACING=0 "+o3_bgcolor+" "+o3_height+"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 "+o3_fgcolor+" "+o3_fgbackground+" "+o3_height+"><TR><TD VALIGN=TOP><FONT FACE=\"Arial\" COLOR=\""+o3_textcolor+"\" SIZE=\"1\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";
	return txt;
}

// Makes table with caption
function ol_content_caption(text, title){
	txt="<TABLE WIDTH="+o3_width+" BORDER=0 CELLPADDING=1 CELLSPACING=0 "+o3_bgcolor+" "+o3_height+"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0><TR><TD><B><FONT COLOR=\""+o3_capcolor+"\" FACE=\"Arial\" style=\"font-size:12px;\">"+title+"</FONT></B></TD></TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 "+o3_fgcolor+" "+o3_height+"><TR><TD VALIGN=TOP><p>"+text+"</p></TD></TR></TABLE></TD></TR></TABLE>";
	return txt;
}

// Displays the popup
function disp(stxt){
if((ns4)||(ie4)||(ns6)){
	if(o3_allowmove==0){placeLayer();showObject(over);o3_allowmove=1;}
	}
	if(stxt != "")self.status=stxt;
}

// Decides where we want the popup.
function placeLayer(){
	var plX, plY;
	
	// HORIZONTAL PLACEMENT
	if(o3_fixx > -1)plX=o3_fixx;// Fixed position
	else {
		// If HAUTO, decide what to use.
		if(o3_hauto==1){
			if(ie4)iwidth=o3_frame.document.body.clientWidth;
			if(ns4)iwidth=o3_frame.innerWidth;
			if(ns6)iwidth=o3_frame.outerWidth;

			iwidth=(eval(iwidth)) / 2;
			if(o3_x > iwidth)o3_hpos=LEFT;
			else o3_hpos=RIGHT;
		}
		
		// From mouse
		if(o3_hpos==CENTER){plX=o3_x+o3_offsetx-(o3_width/2);}
		if(o3_hpos==RIGHT){plX=o3_x+o3_offsetx;}
		if(o3_hpos==LEFT){plX=o3_x-o3_offsetx-o3_width;}
	}
	
	if(o3_fixy > -1){plY=o3_fixy;}// Fixed vert.position
	else {
		// If VAUTO, decide what to use.
		if(o3_vauto==1){
			if(ie4)iheight=o3_frame.document.body.clientHeight;
			if(ns4)iheight=o3_frame.innerHeight;
			if(ns6)iheight=o3_frame.outerHeight;

			iheight=(eval(iheight)) / 2;
			if(o3_y > iheight) o3_vpos=ABOVE;
			else o3_vpos=BELOW;
		}

		// From mouse
		if(o3_aboveheight > 0 && o3_vpos==ABOVE) plY=o3_y-(o3_aboveheight+o3_offsety);
		else plY=o3_y+o3_offsety;// BELOW
	}
	if((ns4)||(ie4)){over.left=plX; over.top=plY;}
	else if(ns6){over.style.left=plX; over.style.top=plY;}
}


// Moves the layer
function mouseMove(e){
if((ns4)||(ns6)){o3_x=e.pageX; o3_y=e.pageY;}
if(ie4){o3_x=event.x; o3_y=event.y;}
if(ie5){o3_x=event.x+o3_frame.document.body.scrollLeft; o3_y=event.y+o3_frame.document.body.scrollTop;}
if(o3_allowmove==1) placeLayer();
}

// Makes sure target frame has overLIB
function compatibleframe(frameid){        
if(ns4){if(typeof frameid.document.overDiv =='undefined') return false;
} else if(ie4){if(typeof frameid.document.all["overDiv"] =='undefined') return false;
}
return true;
}

function layerWrite(txt){
if(ns4){var lyr=o3_frame.document.overDiv.document
lyr.write(txt)
lyr.close()
} else if(ie4){o3_frame.document.all["overDiv"].innerHTML=txt
} else if(ns6){range=o3_frame.document.createRange();
range.setStartBefore(over);
domfrag=range.createContextualFragment(txt);
while (over.hasChildNodes()) over.removeChild(over.lastChild);
over.appendChild(domfrag);
}
}

function showObject(obj){
if(ns4) obj.visibility="show"
else if(ie4) obj.visibility="visible"
else if(ns6) obj.style.display="block"
}

function hideObject(obj){
if(ns4) obj.visibility="hide"
else if(ie4) obj.visibility="hidden"
else if(ns6) obj.style.display="none"
if(o3_delayid > 0) clearTimeout(o3_delayid);
o3_delayid=0;
self.status="";
}

// Sets caption.
function opt_CAPTION(text){o3_cap=text; return 0;}

// Sets hpos, for LEFT, RIGHT and CENTER.
function opt_HPOS(pos){o3_hpos=pos; return 0;}

// status bar text
function opt_STATUS(text){o3_status=text; return 0;}

// Sets vpos, for ABOVE and BELOW
function opt_VPOS(pos){o3_vpos=pos; return 0;}

// Defines which frame we should point to.
function opt_FRAME(frm){
        o3_frame=compatibleframe(frm) ? frm : ol_frame;
	if((ns4)||(ie4 || (ns6))){
		if(ns4) over=o3_frame.document.overDiv
		if((ie4)||(ns6)) over=o3_frame.overDiv.style
	}
	return 0;
}

// Calls an external function
function opt_FUNCTION(callme){	o3_text=callme(); return 0;}

// popup delay (note: 1 sec=1000)
function opt_DELAY(waittime){o3_delay=waittime; return 0;}

// auto horizontal option
function opt_HAUTO(onoff){o3_hauto=1-o3_hauto; return 0;}

// Sets the auto vertical option
function opt_VAUTO(onoff){o3_vauto=1-o3_vauto; return 0;}
