
function getShopOnRoad(pRoadName)//具体点击某条路时触发的事件
{
	window.open("singleRoad.aspx?road="+pRoadName);
}
//点击某个商店时触发的事件
function getShopPage(pUserName)
{
	window.open("../subcompany/subindex.aspx?username="+pUserName);
}

//左边商店的分页
function showShop(pCurrentPage,pMaxPage)
{
	var html='';
	var obj=document.getElementById('divShop');
	var objDivs=obj.getElementsByTagName('div');
	for(var i=0;i<objDivs.length;i++)
	{
		if(objDivs[i].id!='')
		{
			if(objDivs[i].id.indexOf('divShopDetail')>-1)
			{
				if(objDivs[i].id.substring(13,objDivs[i].id.length)>(pCurrentPage-1)*10 && objDivs[i].id.substring(13,objDivs[i].id.length)<=pCurrentPage*10)
					objDivs[i].style.display="block";
				else objDivs[i].style.display="none";
			}
		}
	}
}
//输入的地方有多家店时的单击事件
function onClickSingleShop(pObj)
{
	var objs=pObj.getElementsByTagName('div');
	if(objs.length!=0)
	{		
		document.getElementById('hidShopName').value=objs[0].innerHTML;
		document.getElementById('txtsearch').value=objs[1].innerHTML;
		document.getElementById('multflag').value="1";
	}
	getRoad(2);
}


//输入的地方有多家店时的单击事件
function onClickSingleShopInit()
{	
	document.getElementById('txtsearch').value="天山路780";
	document.getElementById('hidShopName').value="天山商厦商住楼";
	document.getElementById('multflag').value="1";
	getRoad(2);
}




function changePage(pMaxPage)
{
	var objPage=document.getElementById('txtCurrentPage');
	if(objPage.value=="")
	{
		alert('请输入要跳转的页码');
		objPage.focus();
		return;
	}
	else
	{
		if(isNaN(objPage.value))
		{
			alert('请输入数字');
			objPage.focus();
			objPage.select();
			return;
		}
		else
		{
			if(objPage.value>pMaxPage || objPage.value<=0)
			{
				alert('输入的页码太大或太小');
				objPage.focus();
				objPage.select();
				return;
			}
			else
			{
				showShop(objPage.value,pMaxPage);
			}
		}
	}
}

//一列显示5个最上和最下的是箭头符号所以中间有三个
//向上或向左移动
function moveTopOrLeft(pObj,pCount)
{
	var objUp=pObj.parentNode.getElementsByTagName('div')[0];
	var objDown=pObj.parentNode.getElementsByTagName('div')[pCount+1];
	var objs=pObj.parentNode.getElementsByTagName('div');
	var curNum=pObj.parentNode.getElementsByTagName('input')[0];//存储当前第几个位置排在第一个
	if(objs.length>0)
	{
		//如果当前值的后两位>最大值个数 将除了↑↓的其它所有元素设置为不可见
		for(var j=1;j<objs.length-1;j++)
		{
			if(parseInt(curNum.value)>1)
				objs[j].style.display="none";
		}
		if(parseInt(curNum.value)>1)
		{
			for(var j=parseInt(curNum.value)-1;j<parseInt(curNum.value)+2;j++)
			{
				objs[j].style.display="block";
			}
			curNum.value=parseInt(curNum.value)-1;
		}
		// 控制左右按钮是否首页、末页是否显示Anson
		if(parseInt(curNum.value) == 1)
			objUp.style.visibility="hidden";
		else if(parseInt(curNum.value)+2 == pCount)
			objDown.style.visibility="hidden";
		else
		{
			objUp.style.visibility="visible";
			objDown.style.visibility="visible";
		}
	}
}
//向上或向左移动
function moveBottomOrRight(pObj,pCount)
{
	var objUp=pObj.parentNode.getElementsByTagName('div')[0];
	var objDown=pObj.parentNode.getElementsByTagName('div')[pCount+1];
	var objs=pObj.parentNode.getElementsByTagName('div');
	var curNum=pObj.parentNode.getElementsByTagName('input')[0];//存储当前第几个位置排在第一个

	if(objs.length>0)
	{
		//如果当前值的后两位<最大值个数 将除了↑↓的其它所有元素设置为不可见
		for(var j=1;j<objs.length-1;j++)
		{
			if(parseInt(curNum.value)+2<pCount)//如果当前值的后两个<最大值了
				objs[j].style.display="none";
		}
		if(parseInt(curNum.value)+2<pCount)
		{
			for(var j=parseInt(curNum.value)+1;j<parseInt(curNum.value)+4;j++)
			{
				objs[j].style.display="block";
			}
			curNum.value=parseInt(curNum.value)+1;
		}
		
		// 控制左右按钮是否首页、末页是否显示anson
		if(parseInt(curNum.value) == 1)
			objUp.style.visibility="hidden";
		else if(parseInt(curNum.value)+2 == pCount)
			objDown.style.visibility="hidden";
		else
		{
			objUp.style.visibility="visible";
			objDown.style.visibility="visible";
		}
		
		
	}
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{ //返回父类元素，大多说offsetParent返回body
		while (obj.offsetParent)
		{//遍历所有父类元素
			curleft += obj.offsetLeft;//当前元素的左边距
			obj = obj.offsetParent;        
		}
	}
	else if (obj.x) curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	}
	else if (obj.y) curtop += obj.y;
	return curtop;
}


function showCenterShopName(pObject)
{
	var show=document.getElementById('divShowInfo');
	show.style.display="block";
	show.style.left=event.clientX;
	show.style.top=event.clientY+200;
	window.status=event.clientX+"*"+event.clientY;
	show.innerHTML=pObject.innerHTML;
}
function hideCenterShopName()
{
	var show=document.getElementById('divShowInfo');
	show.innerHTML='';
}