
//伸展菜单
var item_one='start';
var item_two='start';
function turnit(ss,bb) {
  var ss = document.getElementById(ss);
  var bb = document.getElementById(bb);
  if (ss.style.display=="none") {
    if(item_one!='start') item_one.style.display="none";
    if(item_one!='start') item_two.src="";
    ss.style.display="";
    item_one=ss;
    item_two=bb;
    bb.src="";
  }
  else {
    ss.style.display="none"; 
    bb.src="";
  }
}

function ConfirmDel()
{
        if(confirm("确定要删除吗？删除将不能恢复！"))
                return true;
        else
                return false;
        
}

function getCookie(Name){ 
var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
if (document.cookie.match(re)) //if cookie found
return document.cookie.match(re)[0].split("=")[1] //return its value
return ""
}

function setCookie(name, value){
document.cookie = name+"="+value //cookie value is domain wide (path=/)
}


var xmlHttp = false;
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}

var xmlHttp1 = false;
try {
  xmlHttp1 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp1 = false;
  }
}
if (!xmlHttp1 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp1 = new XMLHttpRequest();
}




function ajaxSub(t,url) 
{
	if (url.indexOf("?")==-1)
		url = url + '?t000='+Math.random()
	else
		url = url + '&t000='+Math.random()

	xmlHttp.open("GET", url, true);
	switch (t) {
		case 0 :
			xmlHttp.onreadystatechange = getDeliverArea2
			break;
		case 1 :
			xmlHttp.onreadystatechange = getDeliverList;
			break;
//		case 2 :
//			xmlHttp.onreadystatechange = setarea2;
//			break;
		default :
			break;
	} 
	xmlHttp.send(null);  
}
/*******************/

function selectall() 
{ 
   var a = document.getElementsByTagName("input"); 
   for (var i=0; i<a.length; i++) 
      if (a[i].type == "checkbox") a[i].checked =!a[i].checked; 
} 


function market_tooltip(c){
	var _tooltips = document.getElementsByTagName('div');
	for (var i=0;i<_tooltips.length;i++) {
		if (_tooltips[i].getAttribute('tooltip') == 'market') _tooltips[i].parentNode.removeChild(_tooltips[i]);
	}
	var _tooltip = document.createElement('div');
	_tooltip.innerHTML = '<div id="fixedtipdiv">'+c+'</div>';
	_tooltip.className = 'mm_tips_market mm_tips_market_right';
	_tooltip.setAttribute('tooltip', 'market');
	//_tooltip.style.width='200px';
	_tooltip.style.zIndex = '999';
	_tooltip.style.display = 'none';
	return document.body.appendChild(_tooltip);
}

// 气泡控制
var simple_fixedtooltip_timer;
function fixedtooltip(o, _tooltip_body,offsetT,offsetL){
	clearTimeout(simple_fixedtooltip_timer);
	var tooltip = market_tooltip(_tooltip_body);
	tooltip.style.top = offsetT ? (_jsc.pos.getY(o) + offsetT) + 'px' : (_jsc.pos.getY(o) - 80) + 'px';
	tooltip.style.left = offsetL ? (_jsc.pos.getX(o) + offsetL) + 'px' : (_jsc.pos.getX(o) - 80) + 'px';
	tooltip.style.display = 'block';
	tooltip.id = 'market_tooltip';
	tooltip.onmouseover = function() {
		clearTimeout(simple_fixedtooltip_timer);
	}
	simple_fixedtooltip_timer = setTimeout(function(){
		document.getElementById('fixedtipdiv').style.display = 'none';
	}, 6000);
}


function isEmpty(pObj,errMsg){
   var obj = eval(pObj);
   if( obj == null || Trim(obj.value) == ""){
   if (errMsg == null || errMsg =="")
      alert("输入为空!");
   else
      alert(errMsg); 
      obj.focus(); 
      return false;
   }
   return true;
}

function Empty(pObj){
   var obj = eval(pObj);
   if( obj == null || Trim(obj.value) == ""){
      return true;
   }else{}
   return false;
}
function ShowinnerHTML(pObj,iobj,errMsg){
   document.getElementById(iobj).innerHTML = "<img src=\""+EshopDomin+"images/err.gif\"> <font color=\"red\">"+errMsg+"</font>";
   pObj.focus(); 
}
	/***** 地区 **********/
			function getDeliverArea2() {
			  if (xmlHttp.readyState < 4) {
				document.getElementById('deliver_area_2').innerHTML="loading...";
			  }
			  if (xmlHttp.readyState == 4) {
				var response = xmlHttp.responseText;
				document.getElementById('deliver_area_2').innerHTML=response;
			  }
			}

			/***** 列表地区**********/
			function ajaxSub1(t,url)
			{
				xmlHttp1.open("GET", url+'&t000='+Math.random(), true);
				xmlHttp1.onreadystatechange = getDeliverList;
				xmlHttp1.send(null);
			}

			function getDeliverList() {
			  if (xmlHttp1.readyState < 4) {
				document.getElementById('div_deliver_show').innerHTML="<span>loading...</span>";
			  }
			  if (xmlHttp1.readyState == 4) {
				var response = xmlHttp1.responseText;
				if (response == "")
				{
					//var pweight = document.getElementsByName('p_weight')[0].value/1000;
					document.getElementById('div_deliver_show').innerHTML="未选择";
					document.getElementsByName('sendtype')[0].value = '-';
					document.getElementsByName('deliver_price')[0].value = 0;
				}else
				{
					document.getElementById('div_deliver_show').innerHTML= response;
				
					
				}
			  }
			}

		function getDeliverPrice(i)
			{
			
				
				//var d_name = document.getElementsByName('deliver_name')[i].value;
				//var s_type = document.getElementsByName('s_type').value;
				//var d_name = document.getElementsByName('deliver_name')[i].value;
				var d_name = document.getElementsByName('deliver_name')[i].value;
				//var s_type = document.getElementsByName('s_type').value;
			document.getElementsByName('sendtype')[0].value = d_name;
				//document.getElementsByName('deliver_price')[0].value = deliverPrice;
			}
	function simOptionClick4IE(){ 
var evt=window.event ; 
var selectObj=evt?evt.srcElement:null; 
// IE Only 
if (evt && selectObj && evt.offsetY && evt.button!=2 
&& (evt.offsetY > selectObj.offsetHeight || evt.offsetY<0 ) ) { 

// 记录原先的选中项 
var oldIdx = selectObj.selectedIndex; 

setTimeout(function(){ 
var option=selectObj.options[selectObj.selectedIndex]; 
// 此时可以通过判断 oldIdx 是否等于 selectObj.selectedIndex 
// 来判断用户是不是点击了同一个选项,进而做不同的处理. 
showOptionValue(option) 

}, 60); 
} 
} 
function showOptionValue(opt,msg){ 
//alert('aa'); 
var now=new Date(); 
var dt= (1900+now.getYear())+'-'+(now.getMonth()+1)+'-'+now.getDate()+ 
' '+now.getHours()+':'+now.getHours()+':'+now.getSeconds()+'.'+now.getMilliseconds(); 
var resultZone=document.getElementById('reslut'); 
resultZone.style.margin="10px"; 
document.getElementsByName('sendtype')[0].value = opt.value;
document.getElementsByName('stype')[0].value = opt.text;
//resultZone.innerHTML=dt +" 时,点击了: " + (opt.text + ' = '+opt.value); 
} 

		