var handle = false;
function showPhoneWin(e) {
	var byPhone = document.getElementById("byPhone");
	var xy = findPosition(byPhone);
	
	var winPhone = document.getElementById("phone_window");
	if (winPhone) {
		winPhone.style.display = "block";
		winPhone.style.top = xy[1] + parseInt(byPhone.offsetHeight) + 'px';
		winPhone.style.left = xy[0] - parseInt(winPhone.offsetWidth) + parseInt(byPhone.offsetWidth) + 'px';
	}
	handle = false;
}

function hidePhoneWin(e) {
	var winPhone = document.getElementById("phone_window");
	if (winPhone) {
		winPhone.style.display = "none";
	}
	handle = true;
}

function findPosition(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}

function initPhoneWindow() {
	document.onclick = function() {
		if (handle) {
			hidePhoneWin();
			handle = false;
		}
		else {
			handle = true;
		}
		//hidePhoneWin();
	}
}
