if (document.layers) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=hide;

var current_sub='';	
var current_img='';
var img_height=26;
var img_width=0;
var xOffset=-8;
var yOffset=15;

function hideDivs(sub_menu){
	if(current_sub!='' && current_sub!=sub_menu){
		changeObjectVisibility(current_sub,'hidden');
		current_sub='';
	}			
}

function show(sel_img,sub_menu){
	var x = getImageLeft(sel_img) - img_width + xOffset;
	var y = getImageTop(sel_img) + yOffset;
	
	hideDivs(sub_menu);
	
	current_sub=sub_menu;
	current_img=sel_img;

	moveXY(sub_menu, x, y);
	changeObjectVisibility(sub_menu,'visible');
}

function hide(e) {
	if(current_sub!=''){
		var xTopLeftCorner = getImageLeft(current_img) - img_width + xOffset;
		var yTopLeftCorner = getImageTop(current_img) - img_height + yOffset;
		var xBottomRightCorner = xTopLeftCorner + getElementWidth(current_sub);
		var yBottomRightCorner = yTopLeftCorner + getElementHeight(current_sub) + img_height;		
		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_sub,'hidden');
			current_sub='';
		}					
	}
}

function popUp(picPath,picWidth,picHeight){
	var winLeft = screen.availWidth;
	winLeft=winLeft/2-210;
	window.open("http://www.delagrange-homes.com/pic.asp?picPath=" + picPath,"Informations","width=" + picWidth + ",height=" + picHeight + ",left=" + winLeft + ",top=0,menubar=0,location=0,toolbar=0,personalbar=0,status=0,resizable=0,scrollbars=0");
}

function validation(){
	var msg='';
	if(document.forms.frmContact.from.value==''){msg+='\n  -Email';}

	if(msg==''){
		return true;
	}else{
		alert('You forgot to fill the following fields:\n\n' + msg);
		return false;
		}
	}		
