if (document.layers) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=hide;

var current_sub='';	
var current_img='';
var img_height=26;
var img_width=165;
var xOffset=-30;
var yOffset=0;

function hideDivs(sub_menu){
	if(current_sub!='' && current_sub!=sub_menu){
		changeObjectVisibility(current_sub,'hidden');
		current_sub='';
	}			
}

function show(sel_img,sub_menu){
	hideDivs(sub_menu);
	
	current_sub=sub_menu;
	current_img=sel_img;

	moveXY(sub_menu,getImageLeft(sel_img)+xOffset+img_width,getImageTop(sel_img)+yOffset);
	changeObjectVisibility(sub_menu,'visible');
}

function hide(e) {
	if(current_sub!=''){
		var xMenuTopLeftCorner = getImageLeft(current_img);
		var yMenuTopLeftCorner = getImageTop(current_img);
		
		var xMenuBottomRightCorner = xMenuTopLeftCorner + img_width;
	  	var yMenuBottomRightCorner = yMenuTopLeftCorner + img_height;
	  			
		var xSubTopLeftCorner = xMenuBottomRightCorner + xOffset;
		var ySubTopLeftCorner = yMenuBottomRightCorner - img_height;
		var xSubBottomRightCorner = xSubTopLeftCorner + getElementWidth(current_sub) ;
	  	var ySubBottomRightCorner = ySubTopLeftCorner + getElementHeight(current_sub) + yOffset;		
		var xmouse;
		var ymouse;	
		
	  if (document.layers){
			xmouse=e.pageX;
			ymouse=e.pageY;			  
	  }else if(document.all){
			xmouse=event.x;
			ymouse=event.y+document.documentElement.scrollTop;
		}else{ 
			xmouse=e.pageX;
			ymouse=e.pageY;						
		}
		if(!(xmouse>=xSubTopLeftCorner && xmouse<=xSubBottomRightCorner && ymouse>=ySubTopLeftCorner && ymouse<=ySubBottomRightCorner) && !(xmouse>=xMenuTopLeftCorner && xmouse<=xMenuBottomRightCorner && ymouse>=yMenuTopLeftCorner && ymouse<=yMenuBottomRightCorner)){
			changeObjectVisibility(current_sub,'hidden');
			current_sub='';
		} 
	}else {
		hide2(e)
	}					
}

var current_sub2='';	
var current_img2='';
var img_height2 = 35;
var img_width2 = 100;
var xOffset2 = 0;
var yOffset2 = 6;

function hideDivs2(sub_menu){
	if(current_sub2!='' && current_sub2!=sub_menu){
		changeObjectVisibility(current_sub2,'hidden');
		current_sub2='';
	}			
}

function show2(sel_img,sub_menu){
	var x = getImageLeft(sel_img) + xOffset2;
	var y = getImageTop(sel_img) + yOffset2;
	
	hideDivs2(sub_menu);
	
	current_sub2=sub_menu;
	current_img2=sel_img;

	moveXY(sub_menu, x, y);
	changeObjectVisibility(sub_menu,'visible');
}

function hide2(e) {
	if(current_sub2!=''){
		var xTopLeftCorner = getImageLeft(current_img2) + xOffset2;
		var yTopLeftCorner = getImageTop(current_img2)  - img_height2;
		var xBottomRightCorner = xTopLeftCorner + getElementWidth(current_sub2);
		var yBottomRightCorner = yTopLeftCorner + getElementHeight(current_sub2) + yOffset2 + img_height2;
		var xmouse;
		var ymouse;	
		
		if (document.layers){
			xmouse=e.pageX;
			ymouse=e.pageY;			  
		}else if(document.all){
			xmouse=event.x;
			ymouse=event.y+document.documentElement.scrollTop;
		}else{ 
			xmouse=e.pageX;
			ymouse=e.pageY;						
		}
		
		if(!(xmouse>=xTopLeftCorner && xmouse<=xBottomRightCorner && ymouse>=yTopLeftCorner && ymouse<=yBottomRightCorner)){
			changeObjectVisibility(current_sub2,'hidden');
			current_sub2='';
		}					
	}
}

function popUp(picPath,picWidth,picHeight){
	pw=picWidth;
	var winLeft = screen.availWidth;
	winLeft=(winLeft/2)-(picWidth/2);
			
	newwin=window.open("http://www.froehlichhomes.com/showpic.asp?picPath="+picPath+"&w="+picWidth+"&h="+picHeight,"Informations","width=" + picWidth + ",height=" + picHeight + ",left=" + winLeft + ",top=0,menubar=0,location=0,toolbar=0,personalbar=0,status=0,resizable=1,scrollbars=0");
}

function put_pic(src,w,img){
	img.src = src;
}	

function openWin(url){
	var winWidth = 780;
	var winHeight = 433;
	var winLeft = screen.availWidth;
	winLeft=(winLeft/2)-(winWidth/2)-16;
	window.open(url,"HomeInProgress","width=" + winWidth + ",height=" + winHeight + ",left=" + winLeft + ",top=150,menubar=0,location=0,toolbar=0,personalbar=0,status=0,resizable=1,scrollbars=0");
}

function openTool(url){
	var winWidth = 440;
	var winHeight = 350;
	var winLeft = screen.availWidth;
	winLeft=(winLeft/2)-(winWidth/2)-16;
	window.open(url,"Tools","width=" + winWidth + ",height=" + winHeight + ",left=" + winLeft + ",top=0,menubar=0,location=0,toolbar=0,personalbar=0,status=0,resizable=1,scrollbars=0");
}
		
function addBookmark(title,url) {
	if (window.sidebar) { 
		window.sidebar.addPanel(title, url,""); 
	}else if( document.all ) {
		window.external.AddFavorite( url, title);
	} else if( window.opera && window.print ) {
		return true;
	}
}	