function check_s_email(){
	o=document.getElementById("s_email");
	if (!IsEmailValid(o.value))
		alert("Введите верный E-mail");
	else window.open("sub_insert.php?e="+o.value+"&action=sub","si","width=400,height=200,srollbar=no,toolbar=no");
} 

function on(n) {
		document.getElementById('m'+n).style.backgroundColor = "#f7e5c4";
		document.getElementById('l'+n).style.backgroundColor = "#f7e5c4";
}
function off(n) {
		document.getElementById('m'+n).style.backgroundColor = "#f4ddb1";
		document.getElementById('l'+n).style.backgroundColor = "#f4ddb1";
}
function goto_p(o){
		if (o.options[o.selectedIndex].value)
			location.replace(o.options[o.selectedIndex].value);
}

function checkBoardPost(obj){
	if (obj.message.value.length < 1){
		alert("Введіть оголошення!");
		return false;
	}
	else return true;
}

function checkForumPost(obj){
	t = '';
	if (obj['forum[topic]'].value.length < 1) t = t + 'Введіть тему!\n';
	if (obj['forum[message]'].value.length < 1) t = t + 'Введіть текст повідомлення!\n';
	if (t) {
		alert(t);
		return false;
	}
	else return true;
}

function put_contact(user,host){ 
  var mail = user+'@'+host;
  document.write('<a href="mailto:'+mail+'">'+mail+'</a>');
} 
function IsEmailValid(checkThisEmail) {
    var myEMailIsValid = true;
    var myAtSymbolAt = checkThisEmail.indexOf('@');
    var myLastDotAt = checkThisEmail.lastIndexOf('.');
    var mySpaceAt = checkThisEmail.indexOf(' ');
    var myLength = checkThisEmail.length;

if (myAtSymbolAt < 1 )
 {myEMailIsValid = false}

if (myLastDotAt < myAtSymbolAt)
 {myEMailIsValid = false}

if (myLength - myLastDotAt <= 2)
 {myEMailIsValid = false}

if (mySpaceAt != -1)
 {myEMailIsValid = false}

return (myLength?myEMailIsValid:true)
}