var xmlhttp
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
  try {
  xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
 } catch (e) {
  try {
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  } catch (E) {
   xmlhttp=false
  }
 }
@else
 xmlhttp=false
@end @*/

if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
	try {
		xmlhttp = new XMLHttpRequest ();
	} catch (e) {
		xmlhttp = false}
}

function myXMLHttpRequest () {
	var xmlhttplocal;
	try {
		xmlhttplocal = new ActiveXObject ("Msxml2.XMLHTTP")}
		catch (e) {
			try {
				xmlhttplocal = new ActiveXObject ("Microsoft.XMLHTTP")}
				catch (E) {
					xmlhttplocal = false;
				}
		}

		if (!xmlhttplocal && typeof XMLHttpRequest != 'undefined') {
			try {
				var xmlhttplocal = new XMLHttpRequest ();
			}
			catch (e) {
				var xmlhttplocal = false;
				alert ('couldn\'t create xmlhttp object');
			}
		}
		return (xmlhttplocal);
}

var mnmxmlhttp = Array ();
var mnmString = Array ();
var mnmPrevColor = Array ();
var responsestring = Array ();
var myxmlhttp = Array ();
var responseString = new String;


function wanksit(user, id, md5) {
	if (xmlhttp) {
		url = "/?name=wankXML&mode=wanksit";
		content = "id=" + id + "&u=" + user + "&stamp=" + md5;
		mnmxmlhttp[id] = new myXMLHttpRequest ();
		if (mnmxmlhttp) {
			mnmxmlhttp[id].open ("POST", url, true);
			mnmxmlhttp[id].setRequestHeader ('Content-Type',
			'application/x-www-form-urlencoded');
			mnmxmlhttp[id].send (content);
			errormatch = new RegExp ("^ERROR:");
			var mainVo=document.getElementById('wankcontr'+id);
			mainVo.style.backgroundColor ='#FF9400';
			mnmxmlhttp[id].onreadystatechange = function () {
				if (mnmxmlhttp[id].readyState == 4) {
					mnmString[id] = mnmxmlhttp[id].responseText;
					if (mnmString[id].match (errormatch)) {
						mnmString[id] = mnmString[id].substring (6, mnmString[id].length);
						alert (mnmString[id]);
						changemnmvalues (id, true);
					} else {
						changemnmvalues(id, false);
					}
				}
			}
		}
	}
}

function changemnmvalues (id, error) {
	split = new RegExp ("~--~");
	b = mnmString[id].split (split);
	var mainVo=document.getElementById('maing'+id);
	var mainVoM=document.getElementById('wankcontr'+id);
	if (error) {
		mainVoM.innerHTML="<span>M...</span>";
		return false;
	}
	if (b.length==2 && b[0]==id) {
		mainVo.innerHTML=b[1];
		mainVoM.innerHTML="<span>נחמד</span>";
	}
	return false;
}



function checkfield() {
	if (xmlhttp) {
		var id=1;
		var Status=document.getElementById('usernamecheckitvalue');
		url = "/?name=members&action=checkfield";
		var UserOb=document.getElementById('username');
		var EmailOb=document.getElementById('email');
		content="";
		if (UserOb) content = "u=" + UserOb.value;
		if (EmailOb) content=content+"&em=" + EmailOb.value;
		mnmxmlhttp[id] = new myXMLHttpRequest ();
		if (mnmxmlhttp) {
			Status.innerHTML="<div class='okver'>אנא המתן...</div>";
			mnmxmlhttp[id].open ("POST", url, true);
			mnmxmlhttp[id].setRequestHeader ('Content-Type',
			'application/x-www-form-urlencoded');
			mnmxmlhttp[id].send (content);
			mnmxmlhttp[id].onreadystatechange = function () {
				if (mnmxmlhttp[id].readyState == 4) {
					mnmString[id] = mnmxmlhttp[id].responseText;
					split = new RegExp ("~--~");
					var ResArray = mnmString[id].split(split);

					
					if (UserOb.value && ResArray && ResArray[0]==1) {
						Status.innerHTML="<div class='okver'>'<b>"+UserOb.value+"</b>' פנוי ותקין</div>";
						OpenSubmit('Us');
					} else if(UserOb.value && ResArray && ResArray[0]==2) {
						Status.innerHTML="<div class='errorver'>'<b>"+UserOb.value+"</b>' אינו תקין</div>";
					} else {
						Status.innerHTML="<div class='errorver'>'<b>"+UserOb.value+"</b>' אינו פנוי</div>";
					}

					ResultU=document.getElementById('emailcheckitvalue');
					if (EmailOb.value) {
						if (ResArray && ResArray[1]==1) {
							ResultU.innerHTML="<div class='okver'>'<b>"+EmailOb.value+"</b>' פנוי</div>";
							OpenSubmit('Em');
						} else if(EmailOb.value && ResArray && ResArray[1]==2) {
							ResultU.innerHTML="<div class='errorver'>'<b>"+EmailOb.value+"</b>' אינו תקין</div>";
						} else {
							ResultU.innerHTML="<div class='errorver'>'<b>"+EmailOb.value+"</b>' אינוי פנוי</div>";
						}
					}

				}
			}
		}
	}
}


function checkfieldedit(Uid) {
	if (xmlhttp) {
		var id=1;
		url = "/?name=members&action=checkfield";
		var EmailOb=document.getElementById('email');
		content = "em=" + EmailOb.value+"&UID="+Uid;
		mnmxmlhttp[id] = new myXMLHttpRequest ();
		if (mnmxmlhttp) {
			mnmxmlhttp[id].open ("POST", url, true);
			mnmxmlhttp[id].setRequestHeader ('Content-Type',
			'application/x-www-form-urlencoded');
			mnmxmlhttp[id].send (content);
			mnmxmlhttp[id].onreadystatechange = function () {
				if (mnmxmlhttp[id].readyState == 4) {
					mnmString[id] = mnmxmlhttp[id].responseText;
					split = new RegExp ("~--~");
					var ResArray = mnmString[id].split(split);
					ResultU=document.getElementById('emailcheckitvalue');
					if (EmailOb.value) {
						if (ResArray && ResArray[1]==1) {
							ResultU.innerHTML="<div class='okver'>'<b>"+EmailOb.value+"</b>' פנוי</div>";
							OpenSubmit('Em');
						} else if(EmailOb.value && ResArray && ResArray[1]==2) {
							ResultU.innerHTML="<div class='errorver'>'<b>"+EmailOb.value+"</b>' אינו תקין</div>";
						} else {
							ResultU.innerHTML="<div class='errorver'>'<b>"+EmailOb.value+"</b>' אינוי פנוי</div>";
						}
					}

				}
			}
		}
	}
}





var OpenS=new Array(2);
OpenS['Us']=OpenS['Em']=false;

function OpenSubmit(ID) {
	OpenS[ID]=true;
	for (i in OpenS) {
		if (OpenS[i]==false) return false;
	}
	var submitOb=document.getElementById('submit');
	submitOb.disabled=false;
}

function enablebutton(EnObjName,Value) {
	var EnObj=document.getElementById(EnObjName);
	if (EnObj) {
		if (Value.length) {
			EnObj.disabled=false;
		} else {
			EnObj.disabled=true;
		}
	} else return false;
}



function CreateBookmarkLink() {
	title = "Dump.co.il - שדר בדאמפ";
	url = "http://www.dump.co.il/";
	if (window.sidebar) {
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) {
		window.external.AddFavorite( url, title); }
		else if(window.opera && window.print) {
			return true; }
}