	function $(elem){
    	return document.getElementById(elem);
	}
	function openPriceDiv(type){
			var type = type;
			var backDiv = document.createElement('div');
			backDiv.id = "backDiv";
			backDiv.style.backgroundColor = "Black";
			backDiv.style.filter = "alpha(opacity=30)";
			backDiv.style.MozOpacity = "0.30";
			backDiv.style.position = "absolute";
			backDiv.style.left = "0px";
			backDiv.style.top = "0px";
			backDiv.style.width = Math.max(document.body.scrollWidth, document.documentElement.clientWidth) +"px";
			backDiv.style.height = Math.max(document.body.scrollHeight, document.documentElement.clientHeight)+"px";
			document.body.appendChild(backDiv);
			backDiv.style.zIndex = 1000;
			var pricediv = document.createElement('div');
			pricediv.id="pricediv";
			pricediv.style.position = "absolute";
			var w = 400;
			var h = 400;
			pricediv.style.width =  w+"px";
			pricediv.style.height = h+"px";
//			pricediv.style.backgroundColor = "Black";
			//if(document.body.clientWidth-w>0){
			//	alert(document.body.clientWidth);
			//	pricediv.style.left = (document.body.clientWidth-w)/2+"px";				
			//}
			pricediv.style.left = (document.documentElement.clientWidth/2 + document.documentElement.scrollLeft - 150) +"px";
			//if(document.body.clientHeight-h>0){
			//	alert(document.body.clientHeight);
			//	pricediv.style.top =(document.body.clientHeight-h)/4+"px";
			//}
			pricediv.style.top =(document.documentElement.clientHeight/2 + document.documentElement.scrollTop - 100) +"px";
			var ht="<div style=\"background:url(/images/10.gif);width: 404px;height: 404px;font-size: 13px;\">";
			    	ht+="<div style=\"width: 100%;margin-top: 9px;line-heigh=28px;\"><a class=\"aa\" href=\"javascript:void(0);\" style=\"\"><div style=\"float: right;cursor:hand;\" onclick=\"closeOpenPrice();\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></a>&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"font-size:14px;font-weight:bold;\">&nbsp;&nbsp;发布报价信息</span></div>";
    	ht+="<div style=\"padding-top:35px;text-align: center;width:404px;\">";
	    	ht+="<form id=\"priceForm\">";
	    		ht+="公司名称:<input type=\"text\" id=company name=\"company\" style=\"width: 200px;\"><br><br>";
	    		ht+="公司信息:<textarea rows=\"3\" id=name cols=\"20\" name=\"name\" style=\"width: 200px;\"></textarea><br><br>";
	    		ht+="报价内容:<textarea rows=\"3\" id=price cols=\"20\" name=\"price\" style=\"width: 200px;\"></textarea><br><br>";
	    		ht+="联系方式:<input type=\"text\" id=touch name=\"touch\" style=\"width: 200px;\"><br><br>";
	    		ht+="备　　注:<input type=\"text\" id=mark name=\"mark\" style=\"width: 200px;\"><br><br>";
	    		ht+="<input type=\"hidden\" name=\"bak\" value="+type+">";
	    		ht+="<a class=aa href=\"javascript:void(0);\"  onclick=\"submitprice();\" style=\" font-size:14px; font-weight:bold; \">提&nbsp;交</a>"
	    	ht+="</form>";
    	ht+="<div>";
    ht+="</div>";
    pricediv.innerHTML = ht;
			document.body.appendChild(pricediv);
			pricediv.style.zIndex = 11111;
	}
	function closeOpenPrice(){
		var pricediv = document.getElementById("pricediv");
		document.body.removeChild(pricediv);
		var backDiv = document.getElementById('backDiv');
		document.body.removeChild(backDiv);
	}

	function getInfo()
	{
		var s = "";
		s += "<br> 网页可见区域宽："+ document.body.clientWidth;
		s += "<br> 网页可见区域高："+ document.body.clientHeight;
		s += "<br> 网页可见区域宽："+ document.body.offsetWidth + " (包括边线和滚动条的宽)";
		s += "<br> 网页可见区域高："+ document.body.offsetHeight + " (包括边线的宽)";
		s += "<br> 网页正文全文宽："+ document.body.scrollWidth;
		s += "<br> 网页正文全文高："+ document.body.scrollHeight;
		s += "<br> 网页被卷去的高(ff)："+ document.body.scrollTop;
		s += "<br> 网页被卷去的高(ie)："+ document.documentElement.scrollTop;
		s += "<br> 网页被卷去的左："+ document.body.scrollLeft;
		s += "<br> 网页正文部分上："+ window.screenTop;
		s += "<br> 网页正文部分左："+ window.screenLeft;
		s += "<br> 屏幕分辨率的高："+ window.screen.height;
		s += "<br> 屏幕分辨率的宽："+ window.screen.width;
		s += "<br> 屏幕可用工作区高度："+ window.screen.availHeight;
		s += "<br> 屏幕可用工作区宽度："+ window.screen.availWidth;
		s += "<br> 你的屏幕设置是 "+ window.screen.colorDepth +" 位彩色";
		s += "<br> 你的屏幕设置 "+ window.screen.deviceXDPI +" 像素/英寸";
		//alert (s);
		return s;
	}
	
	

    
       function submitprice(){
       
        var params = $("#priceForm").serialize();
       	var company = document.getElementById("company");
        if(company.value.length<5){
        	alert("请输入正确的公司名称");
        	return;
        }
        var name = document.getElementById("name");
        if(name.value.length<10){
        	alert("请输入正确的公司信息");
        	return;
        }
        var price = document.getElementById("price");
        if(price.value.length<6){
        	alert("请输入正确的报价内容");
        	return;
        }
        var touch = document.getElementById("touch");
        if(touch.value.length<11){
        	alert("请输入正确的联系方式");
        	return;
        }
        
       	  $.ajax({ 
       	   type:"post",
       	   url:"/ajaxAddNiePrice.do",
       	   data:params,
       	   success:function(action){
       	     //eval("var data="+action); 
  	         //   if(data.success==true){
	         //      window.location.href="/sysUser.do?act=welcome";
	         //   }else{
	          //     alert(data.msg);
	          //  }
	        //document.forms[0].reset();
	        if(action=='false'){
	        	alert("提交失败，请重新提交！");
	        }else{
	        	alert("提交成功，请等待审核！");
	        	closeOpenPrice();
	        }
       	   }
       	  });
        };
    
  
