
function rePosition(){
	var t = document.getElementById('inmanage');
	var objRegDiv = document.getElementById("stationDiv");
	var objContestDiv = document.getElementById("contestDiv");
	if (t){
		x = findPosX(t);
		y = findPosY(t);
		if (objBigDiv){
			objBigDiv.style.left = (x+350)+"px";
			objBigDiv.style.top  = (y-420)+"px";
		}
		if (objRegDiv){
			objRegDiv.style.left = (x-60)+"px";
			objRegDiv.style.top  = (y-455)+"px";
			objRegDiv.style.display  = "block";
		}
		if (objContestDiv){

			objContestDiv.style.left = (x+755)+"px";
			objContestDiv.style.top  = (y-465)+"px";
			objContestDiv.style.display  = "block";
			
		}
	}
}

function showPopup () {
	objBigDiv.style.display = "block";
	document.getElementById('imageCell').innerHTML = '<strong>כניסה לחשבון</strong>';
	//document.getElementById('password').style.display = 'block';
	document.getElementById('bottom_password').style.display = 'none';
	//document.getElementById('bottom_login').style.display = 'block';
	document.FRIENDS.email.focus();
}

document.onkeypress = function(e) {
	var KEYENTER = 13;
	var KEYESC=27;
	e = e||window.event;
	key = e.keyCode || e.which;
	if (key == KEYENTER && objBigDiv.style.display == "block") 
		doLogin()
	else if (key == KEYESC)
		hidePopup();
};

function hidePopup () {
	try{
		document.getElementById('bottom_login').style.display = 'block';
		document.getElementById('password').style.display = 'block';
		document.getElementById('email').style.display = 'block';
	}catch(e){}
	try{
		document.getElementById('imageText2').style.display = "none";
		document.getElementById('imageCell2').style.display = "none";
		document.getElementById('gallery_right2').style.display = "none";
		document.getElementById('gallery_left2').style.display = "none";
		document.getElementById('gallery_close_btn2').style.display = "none";
	}catch(e){}
	objBigDiv.style.display = "none";
}

function lost_password () {
	document.getElementById('imageCell').innerHTML = '<strong>שיחזור סיסמא</strong>';
	document.getElementById('password').style.display 			= 'none';
	document.getElementById('bottom_password').style.display 	= 'block';
	document.getElementById('bottom_login').style.display 		= 'none';
}

function get_password () {
	if (IsEmail(document.FRIENDS.email.value)){	
		document.getElementById('FRIENDS').action= '?act=lost';
		document.getElementById('FRIENDS').submit();
	}else{
		alert("נא להזין כתובת אימייל");
		document.FRIENDS.email.focus();
		confirmed="";
	}
}

function password_sent (msg){
	objBigDiv.style.display = "block";
	document.getElementById('imageCell').innerHTML = '<strong>' + msg + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong>';
	document.getElementById('bottom_password').style.display 	= 'none';
	document.getElementById('bottom_login').style.display 		= 'none';
	document.getElementById('email').style.display 			 	= 'none';
	document.getElementById('password').style.display 			= 'none';
}

function doLogin () {
	if (document.FRIENDS.password.value==""){
		alert("נא למלא סיסמא");
		document.FRIENDS.password.focus();
		confirmed="";
	}else{ 
		if (IsEmail(document.FRIENDS.email.value)){	
			confirmed="yes";
		}else{
			alert("נא להזין כתובת אימייל");
			document.FRIENDS.email.focus();
			confirmed="";
		}	
	}
	if (confirmed != ""){
		document.getElementById('FRIENDS').submit();
	}
}

function IsEmail(sText) {
	var at="@"
	var dot="."
	var lat=sText.indexOf(at)
	var lstr=sText.length
	var ldot=sText.indexOf(dot)
	if (sText=="" || sText==null){ return false }
	if (sText.indexOf(at)==-1 || sText.indexOf(at)==0 || sText.indexOf(at)==lstr){ return false }
	if (sText.indexOf(dot)==-1 || sText.indexOf(dot)==0 || sText.indexOf(dot)==lstr){ return false }
	if (sText.indexOf(at,(lat+1))!=-1){ return false }
	if (sText.substring(lat-1,lat)==dot || sText.substring(lat+1,lat+2)==dot){ return false }
	if (sText.indexOf(dot,(lat+2))==-1){ return false }
	if (sText.indexOf(" ")!=-1){ return false }
 	return true					
}

function findPosX(obj){
	var curleft = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curleft += obj.offsetLeft;
			//curtop += obj.currentStyle.borderWidth;
			obj = obj.offsetParent;
		}
	}else{
		if (obj.x) curleft += obj.x;
	}
	return curleft;
}

function findPosY(obj){
	var curtop = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curtop += obj.offsetTop;
			//curtop += obj.currentStyle.borderHeight;
			obj = obj.offsetParent;
		}
	}else{
		if (obj.y) curtop += obj.y;
	}
	return curtop;
}

<!--

var x,y;
var tx, ty;
var isDrag=false;

var firefox=document.getElementById&&!document.all;

document.onmousemove=mouseMove;
document.onmousedown=selectMouse;
document.onmouseup=function(){
	isDrag=false;
}

function selectMouse(e) 
{	
	if (firefox){
		//verify that user clicked the 'titlebar' element 
		var p=e.target;	
		if (p.attributes['id'] && ((p.attributes['id'].value=="titlebar") || (p.attributes['id'].value=="imageText") || (p.attributes['id'].value=="imageCell"))){
			isDrag=true;
			x=e.clientX;
			y=e.clientY;
			//get the widget coordinates from the root, 'widget1' element
			tx=parseInt(document.getElementById('widget1').style.left);
			ty=parseInt(document.getElementById('widget1').style.top);
		}
	}
	else{		//IE
		//verify that user clicked the 'titlebar' element
		var p=event.srcElement;		
		if (p.attributes['id'] && ((p.attributes['id'].value=="titlebar") || (p.attributes['id'].value=="imageText") || (p.attributes['id'].value=="imageCell"))){
			isDrag=true;
			x=event.clientX;
			y=event.clientY;
			//get the widget coordinates from the root, 'widget1' element
			tx=parseInt(document.getElementById('widget1').style.left);
			ty=parseInt(document.getElementById('widget1').style.top);
		}
	}
}
	

function mouseMove(e)
{
  if (isDrag)	//only move the box if the user is dragging it
  {
	var box=document.getElementById("widget1");
	if (firefox){
		box.style.left = e.clientX + (tx - x);
		box.style.top  = e.clientY + (ty - y);
	}
	else{		//IE
		box.style.left = event.clientX + (tx - x);
		box.style.top  = event.clientY + (ty - y);
	}    
  }
}

function change_place_menu()
{
	if(doc!=0)
	{
		windowWidth=document.body.offsetWidth
		widthRight=(windowWidth-777-22)/2
		lay3=eval(doc+"pic1"+sty)
		lay3.left=widthRight+323
	}
}


var doc=0
var sty=0
var nameOf='';

function f_sniffer()
{

	nameOf=navigator.appName

	if(nameOf=='Netscape')
	{
		doc='document.'
		sty=''
	}
	if(nameOf=='Microsoft Internet Explorer')
	{
		doc='document.all.'
		sty='.style'
	}
alert(doc);
alert(sty);
	//change_place()
}

function grant_access(sid)
{
	document.location.href = '/my_moses?sid='+sid;
}


//-->
