			function isValidEmail (email, strict)
			{
				 if ( !strict ) email = email.replace(/^\s+|\s+$/g, '');
				 return (/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i).test(email);
				 alert(email);
			}
			function tvrand(){ $('rand').load('rand.php');}
			function reg(){document.getElementById('reg').style.display='block'; $('reg').morph({opacity: 1});}
			function log(){document.getElementById('log').style.display='block'; $('log').morph({opacity: 1});}
			
			function registr(on){
				var test = document.getElementById('email').value;
				var pass = document.getElementById('pass').value;
				var	pas2 = document.getElementById('pas2').value;
				if(isValidEmail(test) == true){
					if(pass == pas2){
						$(on).load('/reg.php?email='+test+'&pass='+pass+'&pas2='+pas2);
					}
					else
					{
						alert('Пароли не совпадают');
					}
				}
				else{
					alert("Введите настоящий E-Mail");
					document.getElementById('email').style.borderColor = 'red';
				}
			}
			
			function login(){
				var ltest = document.getElementById('lemail').value;
				var lpass = document.getElementById('lpass').value;
				$('log').load('/log.php?email='+ltest+'&pass='+lpass);
			}
			
			function closeall(){
				document.getElementById('reg').style.display='none';
				document.getElementById('log').style.display='none';
			}
			function closer(id){
				document.getElementById(id).style.display='none';
			}
			function opener(id){
				document.getElementById(id).style.display='block';
			}
			function comm1(){
				$('comm').morph({height:209,width:386});
			}
			function comm2(){
				$('comm').morph({height:60,width:220});
			}
			function enter(event){if (event.keyCode==13){login();}}
			function regenter(event){if (event.keyCode==13){registr();}}
			
			function searmer(vase,param){
			//	alert(vase);
				var l = vase.length;
				var g = '';
				
				for (f = 0; f < l; f++){
					var t = vase.charAt(f);
					a = t.charCodeAt(0);
					if (a>0xFF) a-=0x350;
					g = g+'|'+a;
				}
				$('load').load('/search.php?s='+g+param);
			}		
