$(document).ready(function(){
	var w = 416;
	var h = 279;
	$(".rightsidetwopage").append("<div style='width: " + w + "px;height: " + h + "px;position: absolute;z-index: 100;' id='div_img'></div>");
	$("#div_img").hide();
	$(".a_img").each(function(i){
		$(this).attr("id", "aaaa_" + i);
	});
	$("select").each(function(i){
		$(this).attr("id", "ssss_" + i);
	})
	$(".a_img").hover(function(){
		var x = getAbsoluteLeft2($(this).attr("id"));
		var y = getAbsoluteTop2($(this).attr("id"));
		$("#div_img")
				.css("background-image", "url('" + $(this).attr("src") + "')")
				.css("left", (x + 60) + "px")
				.css("top", (y + 10) + "px")
				.show();
		$("select").each(function(){
			var x2 = getAbsoluteLeft2($(this).attr("id"));
			var y2 = getAbsoluteTop2($(this).attr("id"));
			if(x2 > x && x2 < (x - 0 + w) && y2 > y && y2 < (y - 0 + h + 30)){
				$(this).hide();
			}
		});
	}, function(){
		$("#div_img").hide();
		$("select").show();
	});
});


function getAbsoluteTop2(objectId) {
	// Get an object top position from the upper left viewport corner
	o = document.getElementById(objectId)
	oTop = o.offsetTop            // Get top position from the parent object
	while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent  // Get parent object reference
		oTop += oParent.offsetTop // Add parent top position
		o = oParent
	}
	return oTop
}

function getAbsoluteLeft2(objectId) {
	// Get an object left position from the upper left viewport corner
	o = document.getElementById(objectId)
	oLeft = o.offsetLeft            // Get left position from the parent object
	while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent    // Get parent object reference
		oLeft += oParent.offsetLeft // Add parent left position
		o = oParent
	}
	return oLeft
}
