function fnWrite(strTarget) {
    document.write(strTarget);
}

function addWebFlash(strParam, width, height) {
    var strObject;
    strObject = "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='" + width + "' HEIGHT='" + height + "' id='menu'> <PARAM NAME=movie VALUE='" + strParam + "'>" + "<PARAM NAME=menu VALUE=false>" + "<PARAM NAME=quality VALUE=High>" + "<PARAM NAME=wmode VALUE=transparent>" + "<PARAM NAME=bgcolor VALUE=#011d28>" + "<EMBED src='" + strParam + "' menu=false quality=High wmode=transparent bgcolor=#011d28 WIDTH='" + width + "' HEIGHT='" + height + "' NAME='menu' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED>" + "</OBJECT>";
    fnWrite(strObject);
}

function addVoideByFlv(strParam, width, height,root){
	    if(root==null) root="";	    
	    var pi=strParam.indexOf(".flv");
		if(pi!=-1) strParam=strParam.substring(0,pi);
		var strObject;
		strObject ='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" id="FLVPlayer">';
		strObject+='<param name="movie" value="'+root+'FLVPlayer.swf" />';
		strObject+='<param name="salign" value="lt" />';
		strObject+='<param name="quality" value="high" />';
		strObject+='<param name="scale" value="noscale" />';
		strObject+='<param name="FlashVars" value="&MM_ComponentVersion=1&skinName='+root+'FLVPlayer_Skin&streamName='+strParam+'&autoPlay=true&autoRewind=false" />';
		strObject+='<embed src="'+root+'FLVPlayer.swf" flashvars="&MM_ComponentVersion=1&skinName='+root+'FLVPlayer_Skin&streamName='+strParam+'&autoPlay=true&autoRewind=false" quality="high" scale="noscale" width="'+width+'" height="'+height+'" name="FLVPlayer" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		strObject+='</object>';
		fnWrite(strObject);
}

function addWebVoide(strParam, width, height,root) {
		if(root==null) root="";	
		var pi=strParam.indexOf(".flv");
		if(pi!=-1){
			addVoideByFlv(strParam, width, height,root);
			return;
		}
		var strObject;
		strObject = '<object id="WMPlay" width="' + width + '" height="' + height + '" name="wmplayer" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft? Windows Media? Player components..." type="application/x-oleobject"> <param name="FileName" value="' + strParam + '" /><param name="autostart" value="1" /><embed src="' + strParam + '" width="' + width + '" height="' + height + '" name="wmplayer" ></embed></object>';
		fnWrite(strObject);
}

function addWebFlashPic(focus_width, focus_height, text_height, pics, links, texts) {
    var swf_height = focus_height + text_height;
    var strObject;
    if(links==null || links=="") links=pics;
    strObject = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + focus_width + '" height="' + swf_height + '" title="点击放大">';
    strObject = strObject + '<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="picflash.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">';
    strObject = strObject + '<param name="menu" value="false"><param name=wmode value="opaque">';
    strObject = strObject + '<param name="FlashVars" value="pics=' + pics + '&links=' + links + '&texts=' + texts + '&borderwidth=' + focus_width + '&borderheight=' + focus_height + '&textheight=' + text_height + '">';
    strObject = strObject + '<embed src="picflash.swf" wmode="opaque" FlashVars="pics=' + pics + '&links=' + links + '&texts=' + texts + '&borderwidth=' + focus_width + '&borderheight=' + focus_height + '&textheight=' + text_height + '" menu="false" bgcolor="#F0F0F0" quality="high" width="' + focus_width + '" height="' + focus_height + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
    strObject = strObject + '</object>';
    document.write(strObject);
}

function openHouse(feaId, feaName) {
    if (feaName == null) feaName = "";
    //window.open('../houseDetail.jsp?feaId='+feaId+"&feaName="+feaName,'_blank',',screenX=0,screenY=0,left=0,top=0,width=1020,height=715,resizable=1,titlebar=no,scrollbars=0');

    /**以下为单机版***/
    window.open('househtmls/houseDetail.asp?feaId=' + feaId + "&feaName=" + feaName, '_blank', ',screenX=0,screenY=0,left=0,top=0,width=1020,height=715,resizable=1,titlebar=no,scrollbars=0');
}

function showFiles(otherlist,ism) {
    if (otherlist != null && otherlist.length > 0) {
        for (var i = 0; i < otherlist.length; i++) {
            var filename = otherlist[i].substr(otherlist[i].lastIndexOf("/") + 1);
            document.writeln("<a href='" + otherlist[i] + "' target='_blank'>" + (i + 1) + "." + filename + "&nbsp;&nbsp;</a>");
            if(ism!=null && ism){
               document.writeln("<font style=\"cursor:hand;font-size:13px;\" onclick=\"if(window.confirm('确定要删除此数据？')) fileMange('','"+ otherlist[i] +"','del');\">删除</font><br>");
            }
        }
    }
}

function fileMange(root,filepath,actionid){
	openWeb(root+'filemanage.jsp?actionid='+actionid+'&filepath='+filepath,'_blank',200,100);
}

function addFileManage(bm,root,w,h){
	var outtext="<a href=\"javascript:void(null)\" onclick=\"openWeb('"+root+"../sys/userdata.jsp?bm="+bm+"','_blank',"+w+","+h+");\">多媒体数据管理</a>";
	document.writeln(outtext);
}

var webWidth = 500;
var webHeight = 220;
function openWeb(pagename, webname, w, h) {
    window.open(pagename, webname, ',screenX=0,screenY=0,left=10,top=50,width=' + w + ',height=' + h + ',scrollbars=1,resizable=1,titlebar=no');
}

function addFileInput(tdid,id){
     var tdobj=document.getElementById(tdid);    
     var o=document.createElement('<input name="'+id+'" type="file" id="'+id+'" size="15">');
     var o1=document.createElement('<br>');
     tdobj.appendChild(o1);
     tdobj.appendChild(o);
}

function checkImageSize(oFileChecker,fileObj,limit){
    if (oFileChecker.fileSize > limit*1024){
        alert("图片过大，建议压缩到"+limit+"K大小！");
    }    
}

String.prototype.trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

function SmallWebPage(bodyobj){
	this.bodyobj=bodyobj==null?window.document.body:bodyobj;
	this.showPage=function(id,left,top,width,height,url){
		var ifrid=id+'_iframe';
	    var divobj=document.getElementById(id); 
	    var ifrobj=document.getElementById(ifrid);
		if(divobj==null || ifrobj==null){
			divobj=document.createElement('div');
			divobj.id=id;
			divobj.name=id;
		  	divobj.innerHTML= '<iframe id="'+ifrid+'" name="'+ifrid+'" frameborder="0" style="border:0px solid #8CB6E4" height="'+height+'" width="'+width+'" align="middle" scrolling="auto" allowTransparency="true"></iframe>';
			divobj.style.border="1px solid #8CB6E4";
			
			/*
			ifrobj=document.createElement('iframe');
			ifrobj.id=ifrid;
			ifrobj.name=ifrid;
			ifrobj.frameborder="0";
			ifrobj.scrolling ="no";
			ifrobj.allowTransparency="true";
			//ifrobj.style.border="0px solid #8CB6E4";
		    divobj.appendChild(ifrobj);
		    */
		    
		    var div1=document.createElement('div');
			div1.style.position='absolute';
	     	div1.style.right=0;
	     	div1.style.top=0;
	     	div1.style.width=20;
	     	div1.style.background="#00FFFF";
	     	div1.style.border="1px solid #8CB6E4";
	     	div1.innerHTML='<font style="cursor:hand;font-size:15px;margin:5px" color="red" title="关闭" onclick="parentNode.parentNode.style.visibility=\'hidden\';">X</font>';
	     	divobj.appendChild(div1);
	        this.bodyobj.appendChild(divobj);
	        divobj.style.background="#ffffff";
	        divobj.style.filter="alpha(opacity=80,style=0)";
	        document.getElementById(ifrid).src=url;
		}else{
				ifrobj.width=width;
	        	ifrobj.height=height;
				ifrobj.src=url;
		}
	    divobj.style.position='absolute';
		divobj.style.left=left;
		divobj.style.top=top;
		divobj.style.width=width;
		divobj.style.height=height;
	//	ifrobj.width=width;
	//	ifrobj.height=height;
		divobj.style.visibility='visible';
	//	ifrobj.src=url;
	}
	
	this.hiddenPage=function(id){
		var divobj=document.getElementById(id); 
		divobj.style.visibility='hidden';
	}
	
	this.delPage=function(id){
		var divobj=document.getElementById(id); 
		divobj.innerHTML="";
		this.bodyobj.removeChild(divobj);
		divobj=null;
	}
}

document.writeln('<form name="mapdrawfrm" method="post" action="mapdraw.jsp" target="postFrame">');
document.writeln('<input name="sqlstr" type="hidden" value="">');
document.writeln('<input name="zoomto" type="hidden" value="0">');
document.writeln('<input name="isnew" type="hidden" value="1">');
document.writeln('</form>');
function mapDraw(root,sqlstr,zoomto,isnew,target){	
	if(sqlstr==null || sqlstr=="") return;
	if(zoomto==null || zoomto=="") zoomto=0;
	if(isnew==null || isnew=="") isnew=1;
	if(root!=null && root!="") mapdrawfrm.action=root+"mapdraw.jsp";
	if(target!=null && target!="") mapdrawfrm.target=target;
//	mapdrawfrm.sqlstr.value=sqlstr+" or layer='99901'";
	mapdrawfrm.sqlstr.value=sqlstr;
	mapdrawfrm.zoomto.value=zoomto;
	mapdrawfrm.isnew.value=isnew;
    mapdrawfrm.submit();
}