//首页地区滑动选择
function nTabs(thisObj,Num){
if(thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=0; i <tabList.length; i++)
{
  if (i == Num)
  {
   thisObj.className = "active"; 
      document.getElementById(tabObj+"_Content"+i).style.display = "block";
  }else{
   tabList[i].className = "normal"; 
   document.getElementById(tabObj+"_Content"+i).style.display = "none";
  }
} 
}

//更多地区选择开始
function $(o){
	if(typeof(o) == "string")
	return document.getElementById(o);
	return o;
}
function openBg(state){
	if(state == 1)
	{
		$("bg").style.display = "block";
		var h = document.body.offsetHeight > document.documentElement.offsetHeight ? document.body.offsetHeight : document.documentElement.offsetHeight;
		$("bg").style.height = h + "px";
	}
	else
	{
		$("bg").style.display = "none";
	}	
}
function openSelect(state){
	if(state == 1)	
	{
		$("selectItem").style.display = "block";
		$("selectItem").style.left = ($("bg").offsetWidth - $("selectItem").offsetWidth)/2 + "px";
		$("selectItem").style.top = document.body.scrollTop + 100 + "px";		
	}
	else
	{
		$("selectItem").style.display = "none";
	}
}
function showSelect(id){
	for(var i = 0 ; i < grow ;i++)
	{
		$("c0" + i).style.display = "none";
	}
	$("c0" + id).style.display = "block";
	showGrow = id;
}
function open(id,state){ 
	if(state == 1)
	$(id).style.display = "block";
	$(id).style.diaplay = "none";
}
function addPreItem(){	
	$("previewItem").innerHTML = "";
	var len　= 0 ;
	for(var i = 0 ; i < items.length ; i++)
	{
		if(items[i].checked == true)
		{
			var mes = "<input type='checkbox' checked='true' value='"+ items[i].value +"' onclick='copyItem(\"previewItem\",\"previewItem\");same(this);'>" + items[i].value;
			$("previewItem").innerHTML += mes;
		}
	}
}
function makeSure(){
	openBg(0);
	openSelect(0);
	copyItem("previewItem","makeSureItem")	
}
function copyHTML(id1,id2){
	$(id2).innerHTML = $("id1").innerHTML;
}
function copyItem(id1,id2){
	
	var mes = "";
	var items2 = $(id1).getElementsByTagName("input");
	for(var i = 0 ; i < items2.length ; i++)
	{
		if(items2[i].checked == true)
		{
		mes += "<input type='checkbox' checked='true' value='"+ items2[i].value +"' onclick='copyItem(\"" + id2+ "\",\""+ id1 +"\");same(this);'>" + items2[i].value;			
		}
	}
	$(id2).innerHTML = "";
	$(id2).innerHTML += mes;
}
function same(ck){
	for(var i = 0 ; i < items.length ; i++)
	{
		if(ck.value == items[i].value)
		{
			items[i].checked = ck.checked;
		}
	}
}	
var oDrag = "";
var ox,oy,nx,ny,dy,dx;
function drag(e,o){
	var e = e ? e : event;
	var mouseD = document.all ? 1 : 0;
	if(e.button == mouseD)
	{
		oDrag = o.parentNode;
		ox = e.clientX;
		oy = e.clientY;		
	}
}
function dragPro(e){
	if(oDrag != "")
	{	
		var e = e ? e : event;
		dx = parseInt($(oDrag).style.left);
		dy = parseInt($(oDrag).style.top);
		nx = e.clientX;
		ny = e.clientY;
		$(oDrag).style.left = (dx + ( nx - ox )) + "px";
		$(oDrag).style.top = (dy + ( ny - oy )) + "px";
		ox = nx;
		oy = ny;
	}
}
//更多地区选择结束
//輸入搜索内容判断
function checksearch(search) {
if (search.keywords.value==""){
alert("请输入搜索内容！");
return false;
}
}
//表格隔行换色鼠标点击变色
function senfe(o,a,b,c,d){
var t=document.getElementById(o).getElementsByTagName("tr");
for(var i=0;i<t.length;i++){
t[i].style.backgroundColor=(t[i].sectionRowIndex%2==0)?a:b;
t[i].onclick=function(){
if(this.x!="1"){
this.x="1";//本来打算直接用背景色判断，FF获取到的背景是RGB值，不好判断
this.style.backgroundColor=d;
}else{
this.x="0";
this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b;
}
}
t[i].onmouseover=function(){
if(this.x!="1")this.style.backgroundColor=c;
}
t[i].onmouseout=function(){
if(this.x!="1")this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b;
}
}
}

//輸入关餐信息内容判断
function post(theform) {
  if(theform.address.value=="") {
  alert("请输入送餐地址！");
  theform.address.focus();
  return false;
  }
  if(theform.adrslxr.value=="") {
  alert("请输入联系人姓名！");
  theform.adrslxr.focus();
  return false;
  }
  if(theform.lxtel.value=="") {
  alert("请输入联系人电话！");
  theform.lxtel.focus();
  return false;
  }
}
