/*************************************************
*		Opens a window
*************************************************/
function openWin(file, width, height){
	var place;
	if(document.all){
		place=', top='+(screen.height/2-height/2)+',left='+(screen.width/2-width/2);
	}else{
		place=', top='+(document.body.clientWidth/2-height/2)+',left='+(document.body.clientHeight/2-width/2);
	}
	newWindow=window.open(file,'newWin','toolbar=no,location=no,scrollbars=yes,resizable=yes,width='+ width +', height='+ height+place);
}

function redirect(to, variables){
	varsArr=variables.split(',');
	for(i=0;i<varsArr.length;i++){
		varVals=varsArr[i].split('=');
		eval("document.vars."+varVals[0]+".value='"+varVals[1]+"'");
	}
	document.vars.action=to;
	document.vars.submit();
}

function chengeToIndex(box, val){
	for(i=0;i<box.options.length;i++){
		if(box.options[i].value==val){
			box.options[i].selected=true;
			return;
		}
	}
}

window.onload=init;

function makeHidden(hidd){
	top.ha.location=hidd;
	//openWin(hidd, 500, 500);
}

function init(){

}

function changeClass(id){
	if(getObj(id).className=="apear"){
		getObj(id).className="disapear";
	}else{
		getObj(id).className="apear";
	}
}


function showCredits(){
	if(getObj(document, "credits").style.visibility=="visible"){
		getObj(document, "credits").style.visibility="hidden";
	}else{
		getObj(document, "credits").style.position="absolute";
		getObj(document, "credits").style.visibility="visible";
		getObj(document, "credits").style.top=mouseY-100;
		getObj(document, "credits").style.left=mouseX-197;	
	}
}
function closeCredits(){
		getObj(document, "credits").style.visibility="hidden";
}


var http_request = false;
var response_object = '';
var closeLayer = '';
function makePOSTRequest(url, parameters, response_object1, closeLayer1) {
  http_request = false;
  response_object = response_object1;
  closeLayer=closeLayer1;
  
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
	 http_request = new XMLHttpRequest();
	 if (http_request.overrideMimeType) {
		// set type accordingly to anticipated content type
		http_request.overrideMimeType('text/xml');
		//http_request.overrideMimeType('text/html');
	 }
  } else if (window.ActiveXObject) { // IE
	 try {
		http_request = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
		try {
		   http_request = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {
		}
	 }
  }
  if (!http_request) {
	 //alert('Cannot create XMLHTTP instance');
	 return false;
  }
  
  http_request.onreadystatechange = alertContents;
  http_request.open('POST', url, true);
  http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http_request.setRequestHeader("Content-length", parameters.length);
  http_request.setRequestHeader("Connection", "close");
  http_request.send(parameters);
}

function alertContents() {
   if (http_request.readyState < 4) {
	document.getElementById(response_object).innerHTML = "שולח...";
   }
   
  if (http_request.readyState == 4) {
	
	 if (http_request.status == 200) {
		//alert(http_request.responseText);
		//result = http_request.responseText;
		
		result=http_request.responseXML.getElementsByTagName('data')[0].firstChild.data;
		
		
		document.getElementById(response_object).innerHTML = result;
		
	
		document.getElementById(closeLayer).className='Form_disapear';


		
	 } else {
		//alert('There was a problem with the request.');
		document.getElementById(response_object).innerHTML = "יש בעיה עם שליחת הדואל, אנא נסה שנית";
	 }
  }
}