
function setGalleryPos(){
	objBigDiv.style.left = (findPosX(document.getElementById('inmanage'))+105)+"px";
	objBigDiv.style.top = (findPosY(document.getElementById('inmanage'))-425)+"px";
	try{
		document.getElementById('imageText2').style.left = (parseInt(document.getElementById('imageText2').style.left) + parseInt(objBigDiv.style.left)) + 'px';
		document.getElementById('imageText2').style.top = (parseInt(document.getElementById('imageText2').style.top) + parseInt(objBigDiv.style.top)) + 'px';
		document.getElementById('imageCell2').style.left = (parseInt(document.getElementById('imageCell2').style.left) + parseInt(objBigDiv.style.left)) + 'px';
		document.getElementById('imageCell2').style.top = (parseInt(document.getElementById('imageCell2').style.top) + parseInt(objBigDiv.style.top)) + 'px';
		document.getElementById('gallery_right2').style.left = (parseInt(document.getElementById('gallery_right2').style.left) + parseInt(objBigDiv.style.left)) + 'px';
		document.getElementById('gallery_right2').style.top = (parseInt(document.getElementById('gallery_right2').style.top) + parseInt(objBigDiv.style.top)) + 'px';
		document.getElementById('gallery_left2').style.top = (parseInt(document.getElementById('gallery_left2').style.top) + parseInt(objBigDiv.style.top)) + 'px';
		document.getElementById('gallery_left2').style.left = (parseInt(document.getElementById('gallery_left2').style.left) + parseInt(objBigDiv.style.left)) + 'px';
		document.getElementById('gallery_close_btn2').style.left = (parseInt(document.getElementById('gallery_close_btn2').style.left) + parseInt(objBigDiv.style.left)) + 'px';
		document.getElementById('gallery_close_btn2').style.top = (parseInt(document.getElementById('gallery_close_btn2').style.top) + parseInt(objBigDiv.style.top)) + 'px';
	}catch(e){}
}

function showImage(num,txt,galleryid,index){
	//objBigImg.style.background = "url(http://www.mosesrest.co.il/_media/gallery/" + galleryid + "/" + num + ".jpg) center no-repeat";
	objBigImg.src = "/_media/gallery/" + galleryid + "/" + num + ".jpg";
	objBigImg.title = txt;
	objBigTxt.innerHTML = txt;
	objBigDiv.style.display = "block";
	try{
		document.getElementById('imageText2').style.display = "block";
		document.getElementById('imageCell2').style.display = "block";
		document.getElementById('gallery_right2').style.display = "block";
		document.getElementById('gallery_left2').style.display = "block";
		document.getElementById('gallery_close_btn2').style.display = "block";
	}catch(e){}
	cur_image_index = index;
	cur_gallery = galleryid;
}

function showAdvImage(pic_id){
	advpath = "/_media/gallery/35/" + pic_id + "_big.jpg";
	display(advpath);
}

function display(myimage) {
	 html = "<HTML><HEAD><TITLE>Photo</TITLE>" +
	  "</HEAD><BODY LEFTMARGIN=0 " 
	  + "MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0><CENTER>" 
	  + "<IMG SRC='" + myimage + "' BORDER=0 NAME=image " 
	  + "onload='window.resizeTo(document.image.width,(document.image.height+100))'>"
	  + "</CENTER>" 
	  + "</BODY></HTML>";
	 popup=
	 window.open
	  ('','image',
	  'toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1,resizable=1');
	 popup.document.open();
	 popup.document.write(html);
	 popup.document.focus();
	 popup.document.close()
 }



function hideImage(){
	objBigDiv.style.display = "none";
	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){}
}

function findPosX(obj){
	var curleft = 0;
	try{
		if (obj.offsetParent){
			while (obj.offsetParent){
				curleft += obj.offsetLeft;
				//curtop += obj.currentStyle.borderWidth;
				obj = obj.offsetParent;
			}
		}else{
			if (obj.x) curleft += obj.x;
		}
	}catch(e){}
	return curleft;
}

function findPosY(obj){
	var curtop = 0;
	try{
		if (obj.offsetParent){
			while (obj.offsetParent){
				curtop += obj.offsetTop;
				//curtop += obj.currentStyle.borderHeight;
				obj = obj.offsetParent;
			}
		}else{
			if (obj.y) curtop += obj.y;
		}
	}catch(e){}
	return curtop;
}

function showMenuImage(num,txt){
	//objBigImg.style.background = 'url(http://www.mosesrest.co.il/salat2/_static/courses/images/' + num + '.jpg) center no-repeat';
	objBigImg.src = '/salat2/_static/courses/images/' + num + '.jpg';
	objBigImg.title = txt;
	//objBigImg.src = newSrc;
	objBigTxt.innerHTML = txt;
	objBigDiv.style.display = "block";
}

function prevImage(){
	cur_image_index--;
	if(cur_image_index<0) cur_image_index=gallery_images_arr.length-1;
	var num = gallery_images_arr[cur_image_index];
	try{ var txt = document.getElementById('img_'+cur_gallery+'_'+num).title; }catch(e){}
	objBigImg.src = "/_media/gallery/" + cur_gallery + "/" + num + ".jpg";
	objBigImg.title = txt;
	objBigTxt.innerHTML = txt;
}

function nextImage(){
	cur_image_index++;
	if(cur_image_index>gallery_images_arr.length-1) cur_image_index=0;
	var num = gallery_images_arr[cur_image_index];
	try{ var txt = document.getElementById('img_'+cur_gallery+'_'+num).title; }catch(e){}
	objBigImg.src = "/_media/gallery/" + cur_gallery + "/" + num + ".jpg";
	objBigImg.title = txt;
	objBigTxt.innerHTML = txt;
}

function change1(){
	document.getElementById("test1").style.background='url(b.gif)';
}


/*
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=="imageText1") || (p.attributes['id'].value=="imageCell1"))){
			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=="imageText1") || (p.attributes['id'].value=="imageCell1"))){
			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(){
	alert(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()
}
