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("/img/imgl.jpg");');
	win_op.document.writeln('MM_preloadImages("/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("/img_logo.php?img='+img_list[no_img_i1]+'")');
  if (no_img_i2 < img_list.length)
	win_op.document.writeln(' MM_preloadImages("/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="/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=\\'/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=\\'/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=\\'/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=\\'/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=/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='/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();
}
