function e(s) 
  {
    rex=true;
    if (window.RegExp) 
      {
        st="a";ex=new RegExp(st);
        if (st.match(ex)) 
          {
            r1=new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
            r2=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
            b=(!r1.test(s)&&r2.test(s));
          }
        else
          {
            rex=false;
          }
      }
    else
      {
        rex=false;
      }
    if(!rex) b=(s.indexOf("@")>0&&s.indexOf(".")>0&&s!=""&&s!="TтхфшЄх E-mail");
      return (b);
}


function showBig(img_path, img_alt)
{
    var str, StrBody;
    
    if (!img_alt) {
        img_alt = document.title;
    }

	str = 'resizable=yes,width=100,height=100,screenX=100,screenY=100,left=100,top=100';
	
	StrBody = '<body id="page" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="White"" onresize="self.window.location.reload();">';
		
	var win_op = window.open('', 'show', str);
	win_op.document.open();
	win_op.document.writeln('<html>');
	win_op.document.writeln('<head>');
	win_op.document.writeln('<title>' + img_alt + '</title>');
	win_op.document.writeln('<script>');
	win_op.document.writeln('function resize_img() {');

	win_op.document.writeln('var width = document.image.width;');
	win_op.document.writeln('var height = document.image.height;');
	win_op.document.writeln('self.resizeTo(width,height);');

	win_op.document.writeln('var width = 2*document.image.width-page.clientWidth;');
	win_op.document.writeln('var height = 2*document.image.height-page.clientHeight;');

	win_op.document.writeln('if (!(document.all)){ self.resizeTo(width,height); } else { self.resizeTo(width,height);');
	win_op.document.writeln(' }');
	win_op.document.writeln('}');

	win_op.document.writeln('</scr' + 'ipt>');	
	win_op.document.writeln('</he' + 'ad>');
	win_op.document.writeln(StrBody);
	win_op.document.writeln('<img name="image" src='+ img_path + ' border=0 alt="'+img_alt+'" onload="resize_img();">');
	win_op.document.writeln('</body>');
	win_op.document.writeln('</html>');		
	win_op.document.close();
}


function photo_win(img_path,img_alt){
var str, StrBody;

	str = 'resizable=yes,width=200,height=200,screenX=100,screenY=100,left=100,top=100';
	
	if (document.all){ 
		StrBody = '<body id="page" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="White" onblur="self.window.close();" onresize="self.window.location.reload();">';
	} else {
		StrBody = '<body id="page" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="White" onblur="self.window.close();">';
	}
		
	var win_op = window.open('','show', str);
	win_op.document.open();
	win_op.document.writeln('<html>');
	win_op.document.writeln('<head>');
	win_op.document.writeln('<title>' + img_alt + '</title>');
	win_op.document.writeln('<script>');

	win_op.document.writeln('function resize_img() {');

	win_op.document.writeln('var width = document.image.width');
	win_op.document.writeln('var height = document.image.height');
	win_op.document.writeln('self.resizeTo(width,height);');
	win_op.document.writeln('var width = 2*document.image.width-page.clientWidth;');
	win_op.document.writeln('var height = 2*document.image.height-page.clientHeight;');


/*

var hSize = 2*'+w+'-page.clientWidth;
vSize = 2*'+h+'-page.clientHeight;

    sHTML +='window.resizeTo(hSize,vSize); ';
*/



	win_op.document.writeln('if (!(document.all)){ self.resizeTo(width,height); } else { self.resizeTo(width,height);');
	win_op.document.writeln(' }');
	win_op.document.writeln('}');
	win_op.document.writeln('</script>');	
	win_op.document.writeln('</head>');
	win_op.document.writeln(StrBody);
	win_op.document.writeln('<img name="image" src=/img_logo.php?img='+ img_path + ' border=0 alt="'+img_alt+'" onload="resize_img();">');
	win_op.document.writeln('</body>');
	win_op.document.writeln('</html>');		
	win_op.document.close();
}
function photo_win2(img_path,img_alt){
var str, StrBody;

	str = 'resizable=yes,width=100,height=100,screenX=100,screenY=100,left=100,top=100';
	
	if (document.all){ 
		StrBody = '<body id="page" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="White" onblur="self.window.close();" onresize="self.window.location.reload();">';
	} else {
		StrBody = '<body id="page" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="White" onblur="self.window.close();">';
	}
		
	var win_op = window.open('','show', str);
	win_op.document.open();
	win_op.document.writeln('<html>');
	win_op.document.writeln('<head>');
	win_op.document.writeln('<title>' + img_alt + '</title>');
	win_op.document.writeln('<script>');
	win_op.document.writeln('function resize_img() {');
	win_op.document.writeln('var width = document.image.width');
	win_op.document.writeln('var height = document.image.height');
	win_op.document.writeln('self.resizeTo(width,height);');
	win_op.document.writeln('var width = 2*document.image.width-page.clientWidth;');
	win_op.document.writeln('var height = 2*document.image.height-page.clientHeight;');
	win_op.document.writeln('if (!(document.all)){ self.resizeTo(width,height); } else { self.resizeTo((width),(height));');
	win_op.document.writeln(' }');
	win_op.document.writeln('}');
	win_op.document.writeln('</script>');	
	win_op.document.writeln('</head>');
	win_op.document.writeln(StrBody);
	win_op.document.writeln('<img name="image" src='+ img_path + ' border=0 alt="'+img_alt+'" onload="resize_img();">');
	win_op.document.writeln('</body>');
	win_op.document.writeln('</html>');		
	win_op.document.close();
}

function photo_win_count(img_list, img_path, img_alt){
var str, StrBody;

	str = 'resizable=yes,width=800,height=600,screenX=100,screenY=100,left=100,top=100';
	
//	if (document.all){ 
//		StrBody = '<body id="page" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="White" onblur="self.window.close();" onresize="self.window.location.reload();">';
//	} else {
//		StrBody = '<body id="page" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="White" onblur="self.window.close();">';
//	}

	StrBody = '<body id="page" marginwidth="0" marginheight="0" topmargin="20" bottommargin="20" leftmargin="10" rightmargin="10" bgcolor="White">';
		
	var win_op = window.open('','show', str);
	win_op.document.open();
	win_op.document.writeln('<html>');
	win_op.document.writeln('<head>');
	win_op.document.writeln('<title>' + img_alt + '</title>');
	win_op.document.writeln('<style> A {color: #62bc46; font-family: Arial, Sans-serif; font-size: 11px;}');
	win_op.document.writeln('body {font-family: Arial, Sans-serif; font-size: 11px;} </style>');
	win_op.document.writeln('<script>');
	win_op.document.writeln('function MM_preloadImages() { ');
	win_op.document.writeln('  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();');
	win_op.document.writeln('    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)');
	win_op.document.writeln('    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}');
	win_op.document.writeln('}');



	for (i = 0; i < img_list.length; i++)
	  if (img_list[i] == img_path){
		win_op.document.writeln('var no_img = '+i+';');
var no_img_i = i;
}


	win_op.document.writeln('MM_preloadImages("http://www.solo.ru/img/imgl.jpg");');
	win_op.document.writeln('MM_preloadImages("http://www.solo.ru/img/imgr.jpg");');

	for (i = 0; i < img_list.length; i++)
{
  no_img_i1 = no_img_i - i;
  no_img_i2 = no_img_i + i;
  if (no_img_i1 >= 0)
	win_op.document.writeln(' MM_preloadImages("http://www.solo.ru/img_logo.php?img='+img_list[no_img_i1]+'")');
  if (no_img_i2 < img_list.length)
	win_op.document.writeln(' MM_preloadImages("http://www.solo.ru/img_logo.php?img='+img_list[no_img_i2]+'")');
}

	win_op.document.writeln('function resize_img() {');

//	win_op.document.writeln('var width = document.image.width');
//	win_op.document.writeln('var height = document.image.height');
//	win_op.document.writeln('self.resizeTo(width,height);');
//	win_op.document.writeln('var width = 2*document.image.width-page.clientWidth + 170;');
	win_op.document.writeln('var width = 800;');
//	win_op.document.writeln('var height = 2*document.image.height-page.clientHeight + 140;');
	win_op.document.writeln('var height = 600;');

//	win_op.document.writeln('if (!(document.all)){ self.resizeTo(width,height+20); } else { self.resizeTo(width,height+20);');
//	win_op.document.writeln(' }');
	win_op.document.writeln('}');
	win_op.document.writeln('var imgs_list = new Array();');
	win_op.document.writeln('var i = 0;');
	for (i = 0; i < img_list.length; i++)
		win_op.document.writeln('imgs_list[' + i + '] = "' + img_list[i] + '";');

	win_op.document.writeln('function refr(imgs_list, no) {');
	win_op.document.writeln('no_img = no;');
	win_op.document.writeln('document.image.src="http://www.solo.ru/img_logo.php?img=" + imgs_list[no];');
	win_op.document.writeln('var descr = "";');
	win_op.document.writeln('var descr2 = "";');
	win_op.document.writeln("if (no > 0) { descr2 = descr2 + '<a onClick=\\'refr(imgs_list, ' + (no - 1) + ')\\' style=\\'cursor:pointer;\\'><img src=\\'http://www.solo.ru/img/imgl.jpg\\' widht=39 height=36></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';}");
	win_op.document.writeln("if (no <= 0) { descr2 = descr2 + '<a><img src=\\'http://www.solo.ru/img/spacer.gif\\' widht=39 height=36></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';}");
	win_op.document.writeln("for (i = 0; i < imgs_list.length; i++) { descr = descr  + '<a onClick=\\'refr(imgs_list, ' + i + ')\\' style=\\'cursor:pointer;\\'>' + (i == no ? ('<b>' + (i + 1)+'</b>') :(i + 1)) + '</a> ';}");
	win_op.document.writeln("if (no < imgs_list.length - 1) { descr2 = descr2 + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a onClick=\\'refr(imgs_list, ' + (no + 1) + ')\\' style=\\'cursor:pointer;\\'><img src=\\'http://www.solo.ru/img/imgr.jpg\\' widht=39 height=36></a> ';}");
	win_op.document.writeln("if (no >= imgs_list.length - 1) { descr2 = descr2 + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a ><img src=\\'http://www.solo.ru/img/spacer.gif\\' widht=39 height=36></a> ';}");
	win_op.document.writeln('document.all.divrrr.innerHTML = descr;');
	win_op.document.writeln('document.all.divrrr2.innerHTML = descr2;');
	win_op.document.writeln('}');
	win_op.document.writeln('</script>');	
	win_op.document.writeln('</head>');
	win_op.document.writeln(StrBody);
	win_op.document.writeln('<table border="0" width="760" cellspacing="0" cellpadding="0" bgcolor="e8e8e8" align="center"><tr><td bgcolor="#ffffff" align=center>' + img_alt + '</td></tr><tr><td style="padding: 25 65 15 65" align=center><img name="image" id="image" src=http://www.solo.ru/img_logo.php?img='+ img_path + ' border=0 alt="'+img_alt+'">');
	win_op.document.writeln('<div align=center name="divrrr" id="divrrr"></div></td></tr></table><br>');
	win_op.document.writeln('<div align=center name="divrrr2" id="divrrr2">');

//	for (i = 0; i < img_list.length; i++)
//		win_op.document.writeln("<a onClick=\"document.image.src='http://www.solo.ru/img_logo.php?img=" + img_list[i] + "';\" style='cursor:pointer;'>" + (i + 1) + "</a>");
	win_op.document.writeln('</div>');

	win_op.document.writeln('</body>');
	win_op.document.writeln('<script>');	
	win_op.document.writeln('refr(imgs_list, no_img);');
	win_op.document.writeln('</script>');	
	win_op.document.writeln('</html>');		
	win_op.document.close();
}

// uniTip - written by Nathan Ford for Unit Interactive
//
// uniTip is based on qTip:
// qTip - CSS Tool Tips - by Craig Erskine
// http://qrayg.com

var uniTipTag = "a,img"; //Which tag do you want to uniTip-ize? Keep it lowercase. No spaces around commas.//
var uniTipClass = "tip"; //Which classes do you want to uniTip-ize? If you leave this blank, then all the tags designated above will get uniTip-ized. Match case. No spaces around commas.

var uniTipX = -10; // X offset from cursor//
var uniTipY = -7; // Y offset from cursor//

//______________________________________________There's no need to edit anything below this line//

var offsetX = uniTipX, offsetY = uniTipY, elewidth = null, eleheight = null, tipid = null, tiptop = null, tipbot = null, tipcapin=null, tippointin=null, altText=false;

var x=0, y=0, WinWidth=0, WinHeight=0, TipWidth=0, TipHeight=0, CapHeight=0, PointHeight=0;

// first, find all the correct elements
init = function () {
	var elementList = uniTipTag.split(",");
	for(var j = 0; j < elementList.length; j++) {	
		var elements = document.getElementsByTagName(elementList[j]);
		
		if(elements) {
			for (var i = 0; i < elements.length; i ++) {
				if (uniTipClass != '') {
				
					var elClass = elements[i].className;
					var elClassList = uniTipClass.split(",");
					
					for (var h=0; h < elClassList.length; h++) { if (elClass.match(elClassList[h])) unitipize(elements[i]); }
					
				} else unitipize(elements[i]);
			}
		}
	}
}

// next, add the tooltip function to those elements
unitipize = function (element) {
	var a = element;
	altText = (a.alt && a.getAttribute("alt") != '' ) ? true : false;
	var sTitle = (altText == true) ? a.getAttribute("alt") : a.getAttribute("title");				
	if(sTitle) {
		a.onmouseover = function() {build(a, sTitle);};
		a.onmouseout = function() {hide(a, sTitle);};
	}
}

// now, we build the tooltip
build = function (a) {
	tipid = a;
	var ii = document.getElementById(tipid);
	
	document.onmousemove = function (evt) {move (evt)};
        ii.style.display = 'block';
}

// now, we track the mouse and make the tooltip follow
move = function (evt) {
	var ii = document.getElementById(tipid);
	
	if (window.event) {
		x = window.event.clientX;
		y = window.event.clientY;
		
		if (document.documentElement.scrollLeft) ii.style.left = (TipWidth >= WinWidth ) ? ((x - offsetX - elewidth) + document.documentElement.scrollLeft) + "px" :  (x + offsetX + document.documentElement.scrollLeft) + "px";
		else ii.style.left = (TipWidth >= WinWidth ) ? ((x - offsetX - elewidth) + document.body.scrollLeft) + "px" :  (x + offsetX + document.body.scrollLeft) + "px";
		
		if (document.documentElement.scrollTop) ii.style.top = (TipHeight >= WinHeight) ? ((y - offsetY - eleheight) + document.documentElement.scrollTop) + "px" : (y + offsetY + document.documentElement.scrollTop) + "px";
		else ii.style.top = (TipHeight >= WinHeight) ? ((y - offsetY - eleheight) + document.body.scrollTop) + "px" : (y + offsetY + document.body.scrollTop) + "px";
		
	} else {
		x = evt.clientX;
		y = evt.clientY;	
		
		ii.style.left = (TipWidth >= WinWidth ) ? ((x - offsetX - elewidth) + window.scrollX) + "px" :  (x + offsetX + window.scrollX) + "px";
		ii.style.top = (TipHeight >= WinHeight) ? ((y - offsetY - eleheight) + window.scrollY) + "px" : (y + offsetY + window.scrollY) + "px";
	}
	
	TipWidth = x + elewidth + 20;
	TipHeight = y + eleheight + 20;
	
}

// lastly, hide the tooltip
hide = function (a) {
        if (a == tipid)
          {
  	    var ii = document.getElementById(tipid);
	    ii.style.display = "none";
	  }
}

// add the event to the page
if (window.addEventListener) window.addEventListener("load", init, false);
if (window.attachEvent) window.attachEvent("onload", init);





function n_GetX(pid)
{
var X = 0;
do { X += pid.offsetLeft } while ((pid = pid.offsetParent) != null);
return X;
}

function n_GetY(pid)//Cлужебная функция, определяет позицию TOP родительского элемента 

{
var Y = 0;
do { Y += pid.offsetTop } while ((pid = pid.offsetParent) != null);
return Y;
}

function build2(a)
  {
    var ii = document.getElementById(a);
    if (ii.style.display != 'block')
      {
        ii.style.display = 'block';
        ii.style.left = n_GetX(ii) - 100;
        ii.style.top = n_GetY(ii) - 170;
      }
  }
function hide2(a)
  {
    var ii = document.getElementById(a);
    if (ii.style.display != 'none')
      {
        ii.style.left = parseInt(n_GetX(ii)) + 100;
        ii.style.top = parseInt(n_GetY(ii)) + 170;
        ii.style.display = 'none';
      }
  }
