function puImage(url,width,height,seof,scrll)
{
	var ad = '';
	var ed = '';
	var xpars = '';

	if (seof==1) {
		ad = '/';
		ed = '/';
	}
	else {
		ad = '&';
		ed = '=';
	}

	width = parseInt(width)+200;
	height = parseInt(height)+200;
	if (width>screen.width) {
		width = screen.width-100;
		url=url+ad+"w"+ed+width;
	}
	if (height>screen.height) {
		height = screen.height-100;
		url=url+ad+"h"+ed+(height-100);
	}
	var iLeft = (screen.width - width) / 2 ;
	var iTop = (screen.height - height) / 2 ;

	if (scrll) xpars += ',scrollbars=yes';

	var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes"+xpars;
	sOptions += ",width=" + width ;
	sOptions += ",height=" + height ;
	sOptions += ",left=" + iLeft ;
	sOptions += ",top=" + iTop ;

	var oWindow = window.open( url, "ImageWindow", sOptions ) ;
	if (window.focus) {oWindow.focus()}
}
function shCatMap() {
	var cm = document.getElementById("catalog_map");

	if (cm.style.display == "none") {
		cm.style.display="block";
	} else {
		cm.style.display="none";
	}
}
function ge(id){
	var e = document.getElementById(id);
	if (!e) {
		e=document.createElement("div");
		e.id=id;
	}
	return e;
}
function showhide(id) {
	var e = document.getElementById(id);

	if (e.style.display == "none") {
		e.style.display="";
	} else {
		e.style.display="none";
	}
	return false;
}
function sInpLmt(maxl, sID, dID) {
	var o=ge(sID);
	inStr = o.value;
	if (inStr.length > maxl ) o.value=inStr.substring(0,maxl);
	ge(dID).innerHTML = "Осталось знаков: " + (maxl - o.value.length);
}
function sM(sn, sc, sd) {
	var locs = 'm'+'a'+'i'+'lto:'+sn+'@'+sc+'.'+sd;
	window.location.replace(locs);
}
function checkform (form)
{
	var index = 0;
	var fname = "";

	for (i=0;i<form.elements.length;i++) {
		index=form.elements[i].name.indexOf("required");
		if (index>0) {
			if (form.elements[i].value=="") {
				fname=form.elements[i].name.substring(0,index);
				form.elements[i].focus();
				alert( "Заполните, пожалуйста, " + fname );
				return false;
			}
		}
	}
	return true;
}
function puW(url,width,height,center,iLeft,iTop,wn) {
	var center = (center == null) ? true : false;
	var iTop = (iTop == null) ? 10 : parseInt(iTop);
	var iLeft = (iLeft == null) ? 10 : parseInt(iLeft);
	var width = (width == null) ? 500 : parseInt(width);
	var height = (height == null) ? 500 : parseInt(height);
	var wn = (wn == null) ? "puW" : wn;
	if (center) {
		iLeft = (screen.width - width) / 2 ;
		iTop = (screen.height - height) / 2 ;
	}
	var sO = "toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes" ;
	sO += ",width=" + width ;
	sO += ",height=" + height ;
	sO += ",left=" + iLeft ;
	sO += ",top=" + iTop ;
	var oW = window.open(url,wn,sO);
	if (window.focus) {oW.focus()}
}

function showHideV(dn,iv) {
	var vd = document.getElementById( dn );
	if (vd==null) return false;
	if (iv) {
		vd.style.display = '';
	} else {
		vd.style.display = 'none';
	}
}
