	function SubmitForm(name,message)
	{
		if (document.all(name).value=="") {alert(message);document.all(name).focus();return false;}
	}//end function SubmitForm
	

function Submit_Form(form,message1,message2,message3)
{
	for(i=0;i<required_fields.length;i++)
	{
		if(document.all(required_fields[i]).value=="")
		{
			document.all(required_fields[i]).focus();
			alert(message1);
			return false;
		}
	}

	for(i=0;i<email_fields.length;i++)
	{
		if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.all(email_fields[i]).value)) )
		{  
			alert(message2);
			document.all(email_fields[i]).focus();
			return false;
		}
	}
	
	if(document.all(pwd_fields[0]).value !=document.all(pwd_fields[1]).value)
	{
		alert(message3);
		document.all(pwd_fields[0]).focus();
		return false;
	}

}//End function Submit_Form




function SubmitFormFields(message)
{
	var b_error=false;
	for(i=0;i<required_fields.length;i++)
	{
		if(document.all(required_fields[i]).value=="")
		{
			document.all(required_fields[i]).focus();
			alert(message);
			return false;
			break;
		}
	}//for
}//end function SubmitFormFields

function trim(s)
{
	return s.replace(/^\s*(.+?)\s*$/, "$1");
}

	
	function Delete_record(form,message)
	{
		if(confirm(message)) {form.submit();return true;}
		return false;
	}

	function Delete_all_record(message)
	{
		if(confirm(message)) {return true;}
		return false;
	}

	function Form_Delete_file(form,element,name,str)
	{
	if(confirm(str+" "+name+"?"))
	{
		document.all(element).value=name;
		form.submit();
		return true;
	}
	return false;
	}
	
	function Form_Multi_Values(form,element)
	{
		document.all(element).value=1;
		form.submit();
		return true;
	}


	function setPointer(theTD, thePointerColor)
	{
	  theTD.style.backgroundColor = thePointerColor;
	  
	  

	}

	function setCheckboxes(the_form, do_check)
	{
		var elts = the_form.elements['permission[]'];

		var elts_cnt  = (typeof(elts.length) != 'undefined')
					  ? elts.length
					  : 0;


		if (elts_cnt) {
			for (var i = 0; i < elts_cnt; i++) {
				elts[i].checked = do_check;
			} // end for
		} else {
			elts.checked        = do_check;
		} // end if... else

		return true;
	} // end of the 'setCheckboxes()' function


	function ShowPreview(img_value,img_src)
	{
		var re=/\\/g;
		var sn="file://localhost/"+img_value.replace(re,"/");
		document.all(img_src).src=sn;
	}


	function check_pass(message)
	{
		if(f1.password.value!=f1.password2.value)
		{
			alert(message);
			f1.password.focus();
		}
	}

	function check_form(b_name)
	{
		var b_error=false;
		if(f1.descr.value=="")b_error=true;
		if(f1.login.value=="")b_error=true;
		if(f1.email.value=="")b_error=true;
		if(!b_error)
		{
			document.all(b_name).disabled=false;
		}
	}


function Submit_Reg(message1,message2)
{
		if (document.all("login").value=="") {alert(message1);document.all("login").focus();return false;}
		if (document.all("pwd").value=="") {alert(message2);document.all("pwd").focus();return false;}
}

function Submit_Subscribe(message1,message2)
{
		if (document.all("name").value=="") {alert(message1);document.all("name").focus();return false;}
		if (document.all("email").value=="") {alert(message1);document.all("email").focus();return false;}

		if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.all("email").value)) )
		{  
				alert(message2);
				document.all("email").focus();
				return false;
		}
}

function HideImg(ImgHide,ImgVisible)
{
  var whiteBlockEdit = "table-row";
  if(navigator.appName == "Microsoft Internet Explorer")
  {
    whiteBlockEdit = "block";
  }
  
  
  ImgHide.style.display="none";
  document.getElementById(ImgVisible).style.display = whiteBlockEdit;
}
  

	function showGalleryImage(url, name, w, h)
	{
		var n3 = (navigator.appName.indexOf('Netscape')!=-1 && navigator.appVersion.indexOf('3.')!=-1)?true:false;
		var ww = (n3)?(parseInt(w)+15):parseInt(w);
		var wh = (n3)?(parseInt(h)+15):parseInt(h);
		var winname = (name.indexOf(' ')!=-1)?name.substring(0, name.indexOf(' ')):name;
		var wnd = window.open('', winname, 'width='+ww+',height='+(wh));
		var code = '<html><head>\n<title>'+name+'</title></head>\n'+
			   '<body bgcolor="White" marginwidth=0 marginheight=0 leftmargin=0 topmargin=0>\n'+
			   '<div align="center"><img src='+url+' onLoad="window.moveTo((screen.width - this.width) / 2 , (screen.height - this.height) / 2); if (navigator.appName==\'Netscape\'){window.outerWidth = this.width;	window.outerHeight = this.height+75;}else window.resizeTo(this.width, this.height+75); window.focus();" name="main_img"></div></body></html>';
		wnd.document.write(code);
		wnd.document.close();
	}
	
	String.prototype.printAddr = 
function (_hamper,_prefix,_postfix,_face)
{
  _hamper=
  _prefix+
  "@"+
  this+
  (_postfix || '')
  document.write((_face||_hamper).link("mailto:"+_hamper));
}
