﻿// JavaScript Document
function invite(){
		var email;
		var id_father;
	    var rnd = Math.random();
		email = document.getElementById("invite_email").value;
		id_father = document.getElementById("id_father").value;
        document.getElementById("id_father").value='';
		document.getElementById("invite_email").value='';
		document.getElementById("send_email").style.display="";
		document.getElementById("send_email").innerHTML='<span class="normal_text" dir="ltr" style="line-height:170%;">Sending E-Mail...</span>';
		var http_request = false;

        if (window.XMLHttpRequest) {
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
            }
        } else if (window.ActiveXObject) {
           
 			var msxmlhttp = new Array(
				'Msxml2.XMLHTTP.5.0',
				'Msxml2.XMLHTTP.4.0',
				'Msxml2.XMLHTTP.3.0',
				'Msxml2.XMLHTTP',
				'Microsoft.XMLHTTP');
			for (var i = 0; i < msxmlhttp.length; i++) {
				try {
					http_request = new ActiveXObject(msxmlhttp[i]);
				} catch (e) {
					http_request = null;
				}
			}
        }

        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        http_request.onreadystatechange = function() {echo (http_request,'send_email');
		};
        http_request.open('GET', 'send_email.php?email='+email+'&id_father='+id_father+'&rnd='+rnd, true);
		http_request.send(null);
    }
    
	function echo(http_request,item_n) {

        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
                document.getElementById(item_n).innerHTML=unescape(http_request.responseText);
				
            } else {
                alert('There was a problem with the request.');
            }
        }

    }

function hash(){
if(document.join_form.name.value.length==0){
alert("نام و نام خانوادگي وارد شود");
document.join_form.name.focus();
return false;
}
if(document.join_form.pass.value.length<6){
alert("كلمه عبور بايد حداقل 6 كاراكتر باشد");
document.join_form.pass.focus();
return false;
}
}

function CheckAll()
{
count = document.main.elements.length;
    for (i=0; i < count; i++) 
	{
    if(document.main.elements[i].checked == 1)
    	{document.main.elements[i].checked = 1; }
    else {document.main.elements[i].checked = 1;}
	}
}
function UncheckAll(){
count = document.main.elements.length;
    for (i=0; i < count; i++) 
	{
    if(document.main.elements[i].checked == 1)
    	{document.main.elements[i].checked = 0; }
    else {document.main.elements[i].checked = 0;}
	}
}

