//判断浏览器ie6创建的div的样式和非ie6创建的div的样式 会员登录
//创建div
function showid(idname) {
	var isIE = (document.all) ? true : false;
	var isIE6 = isIE
			&& ( [ /MSIE (\d)\.0/i.exec(navigator.userAgent) ][0][1] == 6);
	var newbox = document.getElementById(idname);
	newbox.style.zIndex = "9999";
	newbox.style.display = "block"
	newbox.style.position = !isIE6 ? "fixed" : "absolute";
	newbox.style.top = newbox.style.left = "50%";
	newbox.style.marginTop = -newbox.offsetHeight / 2 + "px";
	newbox.style.marginLeft = -newbox.offsetWidth / 2 + "px";
	var layer = document.createElement("div");
	layer.id = "layer";
	layer.style.width = layer.style.height = "100%";
	layer.style.position = !isIE6 ? "fixed" : "absolute";
	layer.style.top = layer.style.left = 0;
	layer.style.backgroundColor = "#000";
	layer.style.zIndex = "9998";
	layer.style.opacity = "0.6";
	document.body.appendChild(layer);

	function layer_iestyle() {
		layer.style.width = Math.max(document.documentElement.scrollWidth,
				document.documentElement.clientWidth)
				+ "px";
		layer.style.height = Math.max(document.documentElement.scrollHeight,
				document.documentElement.clientHeight)
				+ "px";
	}
	function newbox_iestyle() {
		newbox.style.marginTop = document.documentElement.scrollTop
				- newbox.offsetHeight / 2 + "px";
		newbox.style.marginLeft = document.documentElement.scrollLeft
				- newbox.offsetWidth / 2 + "px";
	}
	if (isIE) {
		layer.style.filter = "alpha(opacity=60)";
	}
	if (isIE6) {
		layer_iestyle()
		newbox_iestyle();
		window.attachEvent("onscroll", function() {
			newbox_iestyle();
		})
		window.attachEvent("onresize", layer_iestyle)
	}
	document.getElementById('closeBg').onclick = function() {
		newbox.style.display = "none";
		layer.style.display = "none";
		//		for ( var i = 0; i < sel.length; i++) {
		//			sel[i].style.visibility = "visible";
		//		}
	}
}

//判断浏览器ie6创建的div的样式和非ie6创建的div的样式
//调整门店
function showidAS(idname,description,origin) {
	var isIE = (document.all) ? true : false;
	var isIE6 = isIE
			&& ( [ /MSIE (\d)\.0/i.exec(navigator.userAgent) ][0][1] == 6);
	var newbox = document.getElementById(idname);
	newbox.style.zIndex = "9999";
	newbox.style.display = "block"
	newbox.style.position = !isIE6 ? "fixed" : "absolute";
	newbox.style.top = newbox.style.left = "50%";
	newbox.style.marginTop = -newbox.offsetHeight / 2 + "px";
	newbox.style.marginLeft = -newbox.offsetWidth / 2 + "px";
	var layer = document.createElement("div");
	layer.id = "layer";
	layer.style.width = layer.style.height = "100%";
	layer.style.position = !isIE6 ? "fixed" : "absolute";
	layer.style.top = layer.style.left = 0;
	layer.style.backgroundColor = "#000";
	layer.style.zIndex = "9998";
	layer.style.opacity = "0.6";
	document.body.appendChild(layer);
	if(origin == 'applyFinance'){
		$('#applyFinanceDiv').show();
		$('#origin').val(origin);
	}

	function layer_iestyle() {
		layer.style.width = Math.max(document.documentElement.scrollWidth,
				document.documentElement.clientWidth)
				+ "px";
		layer.style.height = Math.max(document.documentElement.scrollHeight,
				document.documentElement.clientHeight)
				+ "px";
	}
	function newbox_iestyle() {
		newbox.style.marginTop = document.documentElement.scrollTop
				- newbox.offsetHeight / 2 + "px";
		newbox.style.marginLeft = document.documentElement.scrollLeft
				- newbox.offsetWidth / 2 + "px";
	}
	if (isIE) {
		layer.style.filter = "alpha(opacity=60)";
	}
	if (isIE6) {
		layer_iestyle()
		newbox_iestyle();
		window.attachEvent("onscroll", function() {
			newbox_iestyle();
		})
		window.attachEvent("onresize", layer_iestyle)
	}
	document.getElementById('closeBg_AS').onclick = function() {
		newbox.style.display = "none";
		layer.style.display = "none";
		if(origin == 'enterprise')
			window.location = "/jsp/enterprise/contactUs.jsp?cid=99999";
		if(origin == 'finance' || origin == 'applyFinance' ){
			window.location = "http://www.zuche.com/jsp/FinancingLease/index.jsp?iscuess=1&cid=99998";
		}
	}
	if(description != null){
		if($('#notifySpan').html() != undefined){
			$('#notifySpan').html(description);
		}
	}



}
//判断浏览器ie6创建的div的样式和非ie6创建的div的样式
//选择时段
function showidSD(idname,modeId,operatorType,modeName) {
	var isIE = (document.all) ? true : false;
	var isIE6 = isIE
			&& ( [ /MSIE (\d)\.0/i.exec(navigator.userAgent) ][0][1] == 6);
	var newbox = document.getElementById(idname);
	newbox.style.zIndex = "9999";
	newbox.style.display = "block"
	newbox.style.position = !isIE6 ? "fixed" : "absolute";
	newbox.style.top = newbox.style.left = "50%";
	newbox.style.marginTop = -newbox.offsetHeight / 2 + "px";
	newbox.style.marginLeft = -newbox.offsetWidth / 2 + "px";
	var layer = document.createElement("div");
	layer.id = "layer";
	layer.style.width = layer.style.height = "100%";
	layer.style.position = !isIE6 ? "fixed" : "absolute";
	layer.style.top = layer.style.left = 0;
	layer.style.backgroundColor = "#000";
	layer.style.zIndex = "9998";
	layer.style.opacity = "0.6";
	document.body.appendChild(layer);

	function layer_iestyle() {
		layer.style.width = Math.max(document.documentElement.scrollWidth,
				document.documentElement.clientWidth)
				+ "px";
		layer.style.height = Math.max(document.documentElement.scrollHeight,
				document.documentElement.clientHeight)
				+ "px";
	}
	function newbox_iestyle() {
		newbox.style.marginTop = document.documentElement.scrollTop
				- newbox.offsetHeight / 2 + "px";
		newbox.style.marginLeft = document.documentElement.scrollLeft
				- newbox.offsetWidth / 2 + "px";
	}
	if (isIE) {
		layer.style.filter = "alpha(opacity=60)";
	}
	if (isIE6) {
		layer_iestyle()
		newbox_iestyle();
		window.attachEvent("onscroll", function() {
			newbox_iestyle();
		})
		window.attachEvent("onresize", layer_iestyle)
	}
	document.getElementById('closeBg_SD').onclick = function() {
		newbox.style.display = "none";
		layer.style.display = "none";
		//		for ( var i = 0; i < sel.length; i++) {
		//			sel[i].style.visibility = "visible";
		//		}
	}
	$('#modeId').val(modeId);
	$('#modeName').val(modeName);
	changeHourF(operatorType);

}
function closeBg(id) {
	var newbox = document.getElementById(id);
	newbox.style.display = "none";
	$("div[id='layer']").each(function(){
		$(this).hide();
	})
}
//判断浏览器ie6创建的div的样式和非ie6创建的div的样式
//注册成功
function showidSUCCESS(idname,modeId,origin) {
	var isIE = (document.all) ? true : false;
	var isIE6 = isIE
			&& ( [ /MSIE (\d)\.0/i.exec(navigator.userAgent) ][0][1] == 6);
	var newbox = document.getElementById(idname);
	newbox.style.zIndex = "9999";
	newbox.style.display = "block"
	newbox.style.position = !isIE6 ? "fixed" : "absolute";
	newbox.style.top = newbox.style.left = "50%";
	newbox.style.marginTop = -newbox.offsetHeight / 2 + "px";
	newbox.style.marginLeft = -newbox.offsetWidth / 2 + "px";
	var layer = document.createElement("div");
	layer.id = "layer";
	layer.style.width = layer.style.height = "100%";
	layer.style.position = !isIE6 ? "fixed" : "absolute";
	layer.style.top = layer.style.left = 0;
	layer.style.backgroundColor = "#000";
	layer.style.zIndex = "9998";
	layer.style.opacity = "0.6";
	document.body.appendChild(layer);

	function layer_iestyle() {
		layer.style.width = Math.max(document.documentElement.scrollWidth,
				document.documentElement.clientWidth)
				+ "px";
		layer.style.height = Math.max(document.documentElement.scrollHeight,
				document.documentElement.clientHeight)
				+ "px";
	}
	function newbox_iestyle() {
		newbox.style.marginTop = document.documentElement.scrollTop
				- newbox.offsetHeight / 2 + "px";
		newbox.style.marginLeft = document.documentElement.scrollLeft
				- newbox.offsetWidth / 2 + "px";
	}
	if (isIE) {
		layer.style.filter = "alpha(opacity=60)";
	}
	if (isIE6) {
		layer_iestyle()
		newbox_iestyle();
		window.attachEvent("onscroll", function() {
			newbox_iestyle();
		})
		window.attachEvent("onresize", layer_iestyle)
	}
	$('#xnameSpan').html($('#xname').val());
	document.getElementById('closeBg_Button').onclick = function() {
		newbox.style.display = "none";
		layer.style.display = "none";
		if(origin == 'order'){
			window.opener.parent.location = "/order/OrderThirdControl.do_?cid=81152&modeId="+modeId;
			window.close();
		}else{
			if(origin == 'sfLog'){
				window.location  = "/order/ConvenienceSecondControl.do_";
			}else{
				window.location  = "http://www.zuche.com";
			}
		}
	}
	document.getElementById('closeBg_SUCCESS').onclick = function() {
		newbox.style.display = "none";
		layer.style.display = "none";
		if(origin == 'order'){
			window.opener.parent.location = "/order/OrderThirdControl.do_?cid=81152&modeId="+modeId;
			window.close();
		}else{
			if(origin == 'sfLog'){
				window.location  = "/order/ConvenienceSecondControl.do_";
			}else{
				window.location = "http://www.zuche.com";
			}
		}
	}

}
function showCancelOrder(idname,orderId,mobile) {
	var isIE = (document.all) ? true : false;
	var isIE6 = isIE
			&& ( [ /MSIE (\d)\.0/i.exec(navigator.userAgent) ][0][1] == 6);
	var newbox = document.getElementById(idname);
	newbox.style.zIndex = "9999";
	newbox.style.display = "block"
	newbox.style.position = !isIE6 ? "fixed" : "absolute";
	newbox.style.top = newbox.style.left = "50%";
	newbox.style.marginTop = -newbox.offsetHeight / 2 + "px";
	newbox.style.marginLeft = -newbox.offsetWidth / 2 + "px";
	var layer = document.createElement("div");
	layer.id = "layer";
	layer.style.width = layer.style.height = "100%";
	layer.style.position = !isIE6 ? "fixed" : "absolute";
	layer.style.top = layer.style.left = 0;
	layer.style.backgroundColor = "#000";
	layer.style.zIndex = "9998";
	layer.style.opacity = "0.6";
	document.body.appendChild(layer);

	function layer_iestyle() {
		layer.style.width = Math.max(document.documentElement.scrollWidth,
				document.documentElement.clientWidth)
				+ "px";
		layer.style.height = Math.max(document.documentElement.scrollHeight,
				document.documentElement.clientHeight)
				+ "px";
	}
	function newbox_iestyle() {
		newbox.style.marginTop = document.documentElement.scrollTop
				- newbox.offsetHeight / 2 + "px";
		newbox.style.marginLeft = document.documentElement.scrollLeft
				- newbox.offsetWidth / 2 + "px";
	}
	if (isIE) {
		layer.style.filter = "alpha(opacity=60)";
	}
	if (isIE6) {
		layer_iestyle()
		newbox_iestyle();
		window.attachEvent("onscroll", function() {
			newbox_iestyle();
		})
		window.attachEvent("onresize", layer_iestyle)
	}
	if(document.getElementById('cancelOrder') != undefined){
			document.getElementById('cancelOrder').onclick = function() {
			newbox.style.display = "none";
			layer.style.display = "none";
			$.ajax({url:"/order/CancelOrderJsonControl.do_", data:{orderId:orderId,mobile:mobile}, type:"post", cache:false, dataType:"json", error:function (xhr, status, err) {
				alert("系统异常");
			}, success:function (data) {
					//window.location = "/order/QueryOrderDetailControl.do_?orderId="+orderId;
					window.close();
					if(window.opener != undefined){
						window.opener.refreshPage();
					}

			}});
		}
	}
	if(document.getElementById('closeBg_Button') != undefined){
		document.getElementById('closeBg_Button').onclick = function() {
			newbox.style.display = "none";
			layer.style.display = "none";
		}
	}
	if(document.getElementById('closeBg_ButtonModify') != undefined){
		document.getElementById('closeBg_ButtonModify').onclick = function() {
			newbox.style.display = "none";
			layer.style.display = "none";
		}
	}


}

function showCancelOrder2(idname,orderId,mobile) {
	var isIE = (document.all) ? true : false;
	var isIE6 = isIE
			&& ( [ /MSIE (\d)\.0/i.exec(navigator.userAgent) ][0][1] == 6);
	var newbox = document.getElementById(idname);
	newbox.style.zIndex = "9999";
	newbox.style.display = "block"
	newbox.style.position = !isIE6 ? "fixed" : "absolute";
	newbox.style.top = newbox.style.left = "50%";
	newbox.style.marginTop = -newbox.offsetHeight / 2 + "px";
	newbox.style.marginLeft = -newbox.offsetWidth / 2 + "px";
	var layer = document.createElement("div");
	layer.id = "layer";
	layer.style.width = layer.style.height = "100%";
	layer.style.position = !isIE6 ? "fixed" : "absolute";
	layer.style.top = layer.style.left = 0;
	layer.style.backgroundColor = "#000";
	layer.style.zIndex = "9998";
	layer.style.opacity = "0.6";
	document.body.appendChild(layer);

	function layer_iestyle() {
		layer.style.width = Math.max(document.documentElement.scrollWidth,
				document.documentElement.clientWidth)
				+ "px";
		layer.style.height = Math.max(document.documentElement.scrollHeight,
				document.documentElement.clientHeight)
				+ "px";
	}
	function newbox_iestyle() {
		newbox.style.marginTop = document.documentElement.scrollTop
				- newbox.offsetHeight / 2 + "px";
		newbox.style.marginLeft = document.documentElement.scrollLeft
				- newbox.offsetWidth / 2 + "px";
	}
	if (isIE) {
		layer.style.filter = "alpha(opacity=60)";
	}
	if (isIE6) {
		layer_iestyle()
		newbox_iestyle();
		window.attachEvent("onscroll", function() {
			newbox_iestyle();
		})
		window.attachEvent("onresize", layer_iestyle)
	}
	if(document.getElementById('cancelOrder') != undefined){
			document.getElementById('cancelOrder').onclick = function() {
			newbox.style.display = "none";
			layer.style.display = "none";
			$.ajax({url:"/order/CancelOrderJsonControl.do_", data:{orderId:orderId,mobile:mobile}, type:"post", cache:false, dataType:"json", error:function (xhr, status, err) {
				alert("系统异常");
			}, success:function (data) {
					window.location = "http://www.zuche.com";
			}});
		}
	}
	if(document.getElementById('closeBg_Button') != undefined){
		document.getElementById('closeBg_Button').onclick = function() {
			newbox.style.display = "none";
			layer.style.display = "none";
		}
	}
	if(document.getElementById('closeBg_ButtonModify') != undefined){
		document.getElementById('closeBg_ButtonModify').onclick = function() {
			newbox.style.display = "none";
			layer.style.display = "none";
		}
	}


}
