function emailMe()
{
        if (fn_check_email(document.getElementById('subscribe_email').value, 'Invalid email!'))
        {
                document.subscribe_form.submit();
                document.getElementById('join_out').innerHTML = "<div id=\"message\">THANK YOU FOR JOINING</div>";
        }
        return false;
}

function emailMe2()
{
        if (fn_check_email(document.getElementById('subscribe_email').value, 'Invalid email!')) document.subscribe_form.submit();
        return false;
}

function checkMail()
{
    var email=document.getElementById('email');
    
    email.onfocus = '';
    var reg= new RegExp("[0-9a-z_]+@[0-9a-z_^.]+.[a-z]{2,3}", 'i');
    if (!reg.test(email.value)) {
        alert('Wrong e-mail format!');
        email.focus();
        return false;
    }
    return true;
}
function addJS(script) {
        if (addJS.arguments[1]) arg = "?" + addJS.arguments[1];
        else arg = "";
        var o = document.createElement('script');
        o.setAttribute('src', script + arg);
        o.setAttribute('id', script);
        document.body.appendChild(o);
}
function send()
{
        if (checkMail())
        { 
                addJS("/htm/send.php", "name=" + document.getElementById('name').value + "&email=" + document.getElementById('email').value + "&phone=" + document.getElementById('phone').value + "&body=" + document.getElementById('body').value + "&from=22");
        }
}


function fcs(id)
{
        document.getElementById(id).style.backgroundColor = "#86776c";
        if (fcs.arguments[1]) document.getElementById(fcs.arguments[1]).focus();
        
        if (id!='nm') document.getElementById('nm').style.backgroundColor = "transparent";
        if (id!='em') document.getElementById('em').style.backgroundColor = "transparent";
        if (id!='ph') document.getElementById('ph').style.backgroundColor = "transparent";
        if (id!='mn') document.getElementById('mn').style.backgroundColor = "transparent";
}
function blr(id)
{
        document.getElementById(id).style.backgroundColor = "transparent";
}
function reqPrice()
{
        document.getElementById('mess').style.display = "none";
        document.getElementById('img_reqPrice').src="/i/contacts/request3.gif";
        document.getElementById('img_send').src="/i/contacts/send.gif";

        document.getElementById('frm').style.display = "block";
        document.getElementById('cls').style.display = "block";
        document.getElementById('from').innerHTML = "price";
        
        document.getElementById('cmt').innerHTML = "MESSAGE:";
        document.getElementById('phn').innerHTML = "PHONE # <b style='font-weight:normal'>(optional)</b>:";
}
function emailFr()
{
        document.getElementById('mess').style.display = "none";
        document.getElementById('img_reqPrice').src="/i/contacts/request3-2.gif";
        document.getElementById('img_send').src="/i/contacts/send2.gif";

        document.getElementById('frm').style.display = "block";
        document.getElementById('cls').style.display = "block";
        document.getElementById('from').innerHTML = "friend";
        
        document.getElementById('cmt').innerHTML = "MESSAGE:";
        document.getElementById('phn').innerHTML = "FRIEND'S EMAIL:";
        document.getElementById('phone').value = "";
}

function send2(tit)
{
        if (checkMail())
        { 
                addJS("/htm/send.php", "name=" + document.getElementById('name').value + "&email=" + document.getElementById('email').value + "&phone=" + document.getElementById('phone').value + "&body=" + document.getElementById('body').value + "&title=" + tit + "&from=" + document.getElementById('from').innerHTML);
        }
}





  /* google toolbar yellow fields fix */
  if(window.attachEvent)
    window.attachEvent("onload",setListeners);

  function setListeners(){
    inputList = document.getElementsByTagName("INPUT");
    for(i=0;i<inputList.length;i++){
      inputList[i].attachEvent("onpropertychange",restoreStyles);
      inputList[i].style.backgroundColor = "";
    }
    selectList = document.getElementsByTagName("SELECT");
    for(i=0;i<selectList.length;i++){
      selectList[i].attachEvent("onpropertychange",restoreStyles);
      selectList[i].style.backgroundColor = "";
    }
  }

  function restoreStyles(){
    if(event.srcElement.style.backgroundColor != "")
      event.srcElement.style.backgroundColor = "";
  }