function checkmodify(){
	trimspace($$("email"));
	if($$("email").value==""){
		alert("对不起,请输入电子邮件！");
		$$("email").focus();
		return false;
	}
	if(!isRightEmail($$("email").value)){
		alert("对不起,请正确输入电子邮件！");
		$$("email").select();
		return false;
	}
	trimspace($$("chrqq"));
	if($$("chrqq").value==""){
		alert("对不起,请正确输入腾讯QQ！");
		$$("chrqq").focus();
		return false;
	}
	var cname="真实姓名";
	if($$("styleid").value=="1"){
		cname="企业名称";	
	}
	trimspace($$("chrtruename"));
	if($$("chrtruename").value==""){
		alert("对不起,请输入"+cname+"！");
		$$("chrtruename").focus();
		return false;
	}
	if($$("styleid").value=="1"){
		trimspace($$("faren"));
		if($$("faren").value==""){
			alert("对不起,请输入法人代表！");
			$$("faren").focus();
			return false;
		}
		trimspace($$("qiyedizhi"));
		if($$("qiyedizhi").value==""){
			alert("对不起,请输入企业地址！");
			$$("qiyedizhi").focus();
			return false;
		}
		trimspace($$("chrtel"));
		if($$("chrtel").value==""){
			alert("对不起,请输入联系电话！");
			$$("chrtel").focus();
			return false;
		}
		trimspace($$("chrfax"));
		if($$("chrfax").value==""){
			alert("对不起,请输入传真号码！");
			$$("chrfax").focus();
			return false;
		}
	}
}

function set_image(){
	var cityid=document.getElementById('chrdiqu').value;
	var shop_x=document.getElementById('shop_x').value;
	var shop_y=document.getElementById('shop_y').value;
	var shop_z=document.getElementById('shop_z').value;
	var url='../company/ezmarker.aspx?city='+cityid+'&x='+shop_x+'&y='+shop_y+'&z='+shop_z;
	var va = showModalDialog(url,"","dialogWidth:510px; dialogHeight:430px; status:0;help:0;scroll:0");
	if(va!=null)
	{
	    var str=va.split('|');
	    document.getElementById("shop_x").value=str[0];			
	    document.getElementById("shop_y").value=str[1];
	    document.getElementById("shop_z").value=str[2];		
	}
}

function BuildSel(str,sel)
{
/*
*--------------- BuildSel(str,sel) -----------------
* BuildSel(str,sel) 
* 功能:通过str构建Select.
* 参数:str,字符串,由服务端返回的.有特定结构"字符串1|,字符串2,字符串3"
*          也可为"字符串1序号|字符串1文本,字符串2序号|字符串2文本,字符串3序号|字符串3文本",如本例
* 参数:sel,要构建的Select
* 实例:BuildSel(unescape(oBao.responseText),document.all.sel2)
*--------------- BuildSel(str,sel) -----------------
*/
//先清空原来的数据.
sel.options.length=0;
var arrstr = new Array();
arrstr = str.split(",");
//开始构建新的Select.
sel.options.add(new Option( "::请选择::","")); 
if(str.length>0)   
{

for(var i=0;i<arrstr.length-1;i++)
{
//分割字符串
var subarrstr=new Array
subarrstr=arrstr[i].split("|")
//生成下级菜单

sel.options.add(new Option(subarrstr[1],subarrstr[0])); 
}
sel.options[0].selected=true
}

}


function showquyu(str)
{ 
	if (str.length > 0)
	{ 
		var url="../request.aspx?action=quyu&id="+str
		xmlHttp=GetXmlHttpObject(stateChangedHint2)
		xmlHttp.open("POST", url , true)
		xmlHttp.send(null)
	} 
	else
	{ 
	
	} 
} 
function stateChangedHint2() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		if(document.getElementById("qu_classid1")){
			BuildSel(xmlHttp.responseText ,document.getElementById("qu_classid"))
		}
		else if(document.getElementById("qu_classid"))
		{
			BuildSel(xmlHttp.responseText ,document.getElementById("qu_classid"))
		}
	} 
} 


function setfuwu(val){
	if(val==0){
		document.getElementById("fuwu1").style.display="none";	
		document.getElementById("fuwu1").innerHTML="<bR><br>编辑器加载中，请稍候...";
	}
	else{
		document.getElementById("fuwu1").style.display="";	
		document.getElementById("fuwu1").innerHTML="<bR><br><input type='hidden' id='FckNr1' name='fuwu' value='' /><input type='hidden' id='FckNr___Config1' value='' /><iframe id='FckNr___Frame1' src='../editor/editor/fckeditor.html?InstanceName=FckNr1&amp;Toolbar=Default' width='100%' height='200px' frameborder='no' scrolling='no'></iframe>";
	}
}

function setfukan(val){
	if(val==0){
		document.getElementById("fukan1").style.display="none";	
		document.getElementById("fukan1").innerHTML="<bR><br>编辑器加载中，请稍候...";
	}
	else{
		document.getElementById("fukan1").style.display="";	
		document.getElementById("fukan1").innerHTML="<bR><br><input type='hidden' id='FckNr2' name='fukan' value='' /><input type='hidden' id='FckNr___Config2' value='' /><iframe id='FckNr___Frame2' src='../editor/editor/fckeditor.html?InstanceName=FckNr2&amp;Toolbar=Default' width='100%' height='200px' frameborder='no' scrolling='no'></iframe>";
	}
}
function setpeisong(val){
	if(val==0){
		document.getElementById("peisong1").style.display="none";	
		document.getElementById("peisong1").innerHTML="<bR><br>编辑器加载中，请稍候...";
	}
	else{
		document.getElementById("peisong1").style.display="";	
		document.getElementById("peisong1").innerHTML="<bR><br><input type='hidden' id='FckNr3' name='peisong' value='' /><input type='hidden' id='FckNr___Config3' value='' /><iframe id='FckNr___Frame3' src='../editor/editor/fckeditor.html?InstanceName=FckNr3&amp;Toolbar=Default' width='100%' height='200px' frameborder='no' scrolling='no'></iframe>";
	}
}


function setqiyong(val,aabb){
	
	if(val==0){
		document.getElementById("qiyong1").style.display="none";	
		//$("qiyong1").innerHTML="<bR><br>编辑器加载中，请稍候...";
	}
	else{
		document.getElementById("qiyong1").style.display="";	
		document.getElementById("qiyong1").innerHTML="<bR><br><input type='hidden' id='FckNr3' name='chrcontent' value='' /><input type='hidden' id='FckNr___Config3' value='' /><iframe id='FckNr___Frame3' src='../editor/editor/fckeditor.html?InstanceName=FckNr3&amp;Toolbar=Default' width='100%' height='200px' frameborder='no' scrolling='no'></iframe>";
		document.getElementById("chrcontent").value=aabb;
		
	}
}


function delmygood(id)
{
    if ( confirm("该操作将不可逆！\n您确定要删除此条商品吗(删除商品此商品的订单将会连同删除)？"))
    {
      	var url="../member/mygood.aspx?action=del&id="+escape(id);
		var  Digital=new  Date();
		Digital=Digital+40000;
		url=url+"&k="+Digital;
		xmlHttp=GetXmlHttpObject(requestdelmygood)
		xmlHttp.open("POST", url , true)
		xmlHttp.send(null)
    }
}

function requestdelmygood()
{
	if(xmlHttp.readyState==4)
	{
		if(xmlHttp.status==200)
		{
			if(xmlHttp.responseText!=1)
			{
				alert(xmlHttp.responseText);	
			}else{
				alert("删除成功！");
				window.location.href="mygood.aspx";
			}
						
		}
	}
}
function delgoodrevert(id)
{
    if ( confirm("该操作将不可逆！\n您确定要删除此评论吗？"))
    {
      	var url="mygood.aspx?action=delrevert&id="+escape(id);
		var  Digital=new  Date();
		Digital=Digital+40000;
		url=url+"&k="+Digital;
		xmlHttp=GetXmlHttpObject(requestdelgoodrevert)
		xmlHttp.open("POST", url , true)
		xmlHttp.send(null)
    }
}

function requestdelgoodrevert()
{
	if(xmlHttp.readyState==4)
	{
		if(xmlHttp.status==200)
		{
			if(xmlHttp.responseText!=1)
			{
				alert(xmlHttp.responseText);	
			}else{
				alert("删除成功！");
				window.location.href="mygood.aspx?action=revertlist";
			}
						
		}
	}
}

function delwangzhi(id)
{
    if ( confirm("该操作将不可逆！\n您确定要删除此网址吗？"))
    {
      	var url="mydaohang.aspx?action=del&id="+escape(id);
		var  Digital=new  Date();
		Digital=Digital+40000;
		url=url+"&k="+Digital;
		xmlHttp=GetXmlHttpObject(requestdelwangzhi)
		xmlHttp.open("POST", url , true)
		xmlHttp.send(null)
    }
}

function requestdelwangzhi()
{
	if(xmlHttp.readyState==4)
	{
		if(xmlHttp.status==200)
		{
			if(xmlHttp.responseText!=1)
			{
				alert(xmlHttp.responseText);	
			}else{
				alert("删除成功！");
				window.location.href="mydaohang.aspx";
			}
						
		}
	}
}
function delarticle(id)
{
    if ( confirm("该操作将不可逆！\n您确定要删除此篇文章吗？"))
    {
      	var url="myarticle.aspx?action=del&id="+escape(id);
		var  Digital=new  Date();
		Digital=Digital+40000;
		url=url+"&k="+Digital;
		xmlHttp=GetXmlHttpObject(requestdelwangzhi)
		xmlHttp.open("POST", url , true)
		xmlHttp.send(null)
    }
}

function requestdelwangzhi()
{
	if(xmlHttp.readyState==4)
	{
		if(xmlHttp.status==200)
		{
			if(xmlHttp.responseText!=1)
			{
				alert(xmlHttp.responseText);	
			}else{
				alert("删除成功！");
				window.location.href="myarticle.aspx";
			}
						
		}
	}
}
function delyouhui(id)
{
    if ( confirm("该操作将不可逆！\n您确定要删除此优惠券吗？"))
    {
      	var url="myyouhui.aspx?action=del&id="+escape(id);
		var  Digital=new  Date();
		Digital=Digital+40000;
		url=url+"&k="+Digital;
		xmlHttp=GetXmlHttpObject(requestdelyouhui)
		xmlHttp.open("POST", url , true)
		xmlHttp.send(null)
    }
}

function requestdelyouhui()
{
	if(xmlHttp.readyState==4)
	{
		if(xmlHttp.status==200)
		{
			if(xmlHttp.responseText!=1)
			{
				alert(xmlHttp.responseText);	
			}else{
				alert("删除成功！");
				window.location.href="myyouhui.aspx";
			}
						
		}
	}
}
function delmyce(id)
{
    if ( confirm("该操作将不可逆！\n您确定要删除此相册吗,删除相册将会删除此相册下面所有的相片？"))
    {
      	var url="myce.aspx?action=del&id="+escape(id);
		window.location.href=url;
    }
}
function setclick(aa,bb){
	if(parseInt(aa)==parseInt(bb.value)){
			
	}	
	else{
		var tt =parseInt($$("count").value);
		$$("styleid").value=aa;
		$$("count").value="0";
		for(var mm=1;mm<=tt;mm++)
		{
			DeleteSignRow("SignItem"+mm);
		}
		$$("total").value="0";
		addphotorow();
	}
}
function DeleteSignRow(rowid){
	var signFrame = findObj("SignFrame",document);
	var signItem = findObj(rowid,document);
	//获取将要删除的行的Index
	if(signItem){
		var rowIndex = signItem.rowIndex;
		//删除指定Index的行
		signFrame.deleteRow(rowIndex);
	}
	if($$("total")){
		$$("total").value = parseInt($$("total").value)-1;	
	}
}
function addphotorow(){
	if(parseInt($$("total").value)>=10){
		alert("对不起,一次只能上传十张相片!");
		return false;
	}
	var txtTRLastIndex = findObj("count",document);
	var rowID = parseInt(txtTRLastIndex.value);
	var signFrame = findObj("SignFrame",document);
	//添加行
	var ab = rowID+1;
	var newTR = signFrame.insertRow(signFrame.rows.length);
	newTR.id = "SignItem" + ab;
	//添加列:付款时间
	var newNameTD=newTR.insertCell(0);
	//添加列内容
	var styleid=$$("styleid").value;
	if(styleid=="0"){
		newNameTD.innerHTML = "<input type=\"file\" class='text' name=\"file\" style=\"width:320px;\"  onchange=\"setupload('"+ab+"',this.value);\"/> 描述：<input type=\"text\"  class='text' style=\"width:200px;\" name=\"chrmark\" />  <a href=\"javascript:DeleteSignRow('SignItem"+ab+"')\">删除</a>";
	}
	else{
		newNameTD.innerHTML = "<input type=\"text\" class='text' name=\"url_"+ab+"\" style=\"width:320px;\"  value='http://' /> 描述：<input type=\"text\"  style=\"width:200px;\" class='text' name=\"urlmark_"+ab+"\" /> <a href=\"javascript:DeleteSignRow('SignItem"+ab+"')\">删除</a>";
	}
	//将行号推进下一行
	$$("count").value = (rowID + 1).toString() ;
	$$("total").value = parseInt($$("total").value)+1;
}

function addmypicrow(){
	if(parseInt($$("total").value)>=10){
		alert("对不起,一次只能上传十张展示图!");
		return false;
	}
	var txtTRLastIndex = findObj("count",document);
	var rowID = parseInt(txtTRLastIndex.value);
	var signFrame = findObj("SignFrame",document);
	//添加行
	var ab = rowID+1;
	var newTR = signFrame.insertRow(signFrame.rows.length);
	newTR.id = "SignItem" + ab;
	//添加列:付款时间
	var newNameTD=newTR.insertCell(0);
	//添加列内容
	newNameTD.innerHTML = "<input type=\"file\" class='text' name=\"file\" style=\"width:320px;\"  onchange=\"setupload('"+ab+"',this.value);\"/> <a href=\"javascript:DeleteSignRow('SignItem"+ab+"')\">删除</a>";
	//将行号推进下一行
	$$("count").value = (rowID + 1).toString() ;
	$$("total").value = parseInt($$("total").value)+1;
}
// Example: obj = findObj("image1");
function findObj(theObj, theDoc){var p, i, foundObj;if(!theDoc) theDoc = document;if( (p = theObj.indexOf("?")) > 0 && parent.frames.length){    theDoc = parent.frames[theObj.substring(p+1)].document;    theObj = theObj.substring(0,p);}if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];for (i=0; !foundObj && i < theDoc.forms.length; i++)     foundObj = theDoc.forms[i][theObj];for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)     foundObj = findObj(theObj,theDoc.layers[i].document);if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);return foundObj;}

function showphotocategory(str)
{ 
	if (str.length > 0)
	{ 
		var xmlhttp=createxmlhttp();
		if(!xmlhttp)
		{
			alert("你的浏览器不支持XMLHTTP！！");
			return;
		}
		var url="../request.aspx?action=addphoto&id="+str;
		var  Digital=new  Date();
		Digital=Digital+40000;
		url=url+"&k="+Digital;
		xmlhttp.onreadystatechange=requestdataquyu;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
		function requestdataquyu()
		{
			if(xmlhttp.readyState==4)
			{
				if(xmlhttp.status==200)
				{
					BuildSel_tt(xmlhttp.responseText ,document.getElementById("classid"),"请选择相册")
				}
			}
		}
	} 
	
} 

function setupload(aa,val){
	var tt=base_name(val);
	obj=document.form1.chrmark[(parseInt(aa)-1)]
	if(obj){
		
	}
	else{
		obj=document.form1.chrmark;
	}
	if(obj){
		if(obj.value=="")
		{
			if(tt.lastIndexOf(".")!=-1){
				tt=tt.substring(0,tt.lastIndexOf("."));
			}
			obj.value = tt;
		}
	}
}
function base_name(pFilePath){
	var temp_win = pFilePath.lastIndexOf("\\");
	var temp_unix = pFilePath.lastIndexOf("/");
	if (temp_win>0)
	{
		temp = temp_win;
	}
	else if (temp_unix>0)
	{
		temp = temp_unix;
	}
	else
	{
		temp = -1;    
	}
	file_name = pFilePath.substr(temp+1);
	return(file_name);
}

function delmyphoto(id)
{
    if ( confirm("该操作将不可逆！\n您确定要删除吗？"))
    {
        location.href = "myphoto.aspx?action=del&ID=" + id
     }
}


function delmyzhiwei(id)
{
    if ( confirm("该操作将不可逆！\n您确定要删除吗？"))
    {
        location.href = "myzhiwei.aspx?action=del&ID=" + id
     }
}

function delmypic(id)
{
    if ( confirm("该操作将不可逆！\n您确定要删除吗？"))
    {
        location.href = "myshop.aspx?action=picdel&ID=" + id
     }
}
