//弹开查看窗口
function openview(tradeid){
	var th =  document.form1;
	var window_height = screen.availHeight -70 ;
	var window_width = screen.availWidth -150 ;
	var window_dimensions = "top = 20" + ",left = 50" + ",height=" + window_height + ",width=" + window_width + ",scrollbars=yes" + ",resizable=1,status=yes";
	window.open('','viewtrade'+tradeid,window_dimensions);
	th.action = "showtrade.jsp?tradeid="+tradeid;
	th.target = "viewtrade"+tradeid;
	th.submit();
}
//弹开修改窗口
function openupdate(tradeid){
	var th =  document.form1;
	th.action_flag.value="updatetrade";
	var window_height = screen.availHeight -70 ;
	var window_width = screen.availWidth -150 ;
	var window_dimensions = "top = 20" + ",left = 50" + ",height=" + window_height + ",width=" + window_width + ",scrollbars=yes" + ",resizable=1,status=yes";
	window.open('','update',window_dimensions);
	th.action = "updatetrade.jsp?tradeid="+tradeid;
	th.target = "update";
	th.submit();
}
//弹开添加窗口
function openadd(){
	var th =  document.form1;
	th.action_flag.value="addtrade";
	var window_height = screen.availHeight -70 ;
	var window_width = screen.availWidth -150 ;
	var window_dimensions = "top = 20" + ",left = 50" + ",height=" + window_height + ",width=" + window_width + ",scrollbars=yes" + ",resizable=1,status=yes";
	window.open('','addtrade',window_dimensions);
	th.target = "addtrade";
	th.action = "addtrade.jsp";
	th.submit();
}

//添加提交
function addsubmit(){
	var th =  document.form1;
	if(trim(th.title.value)==""){
		alert("请输入标题！");
		return;
	}
	th.action_flag.value = "add";
	th.action = "addtrade.jsp";
	th.target = "_self";
	th.submit();
}

//修改提交
function updatesubmit(){
	var th =  document.form1;
	if(trim(th.title.value)==""){
		alert("请输入标题！");
		return;
	}
	th.action_flag.value = "update";
	th.action = "updatetrade.jsp";
	th.target = "_self";
	th.submit();
}

//删除提交
function dodelete(tradeid){
	if (!confirm("确定删除本条信息么?")){
		return ;
	}
	var th = document.form1;
	th.action_flag.value="delete";
	th.action = "trademanager.jsp?hid_CurrPage=&tradeid="+tradeid;
	th.target = "_self";
	th.submit();
}

//回刷
function doreload(){
	var th =  document.form1;
	th.action_flag.value="reload";
	th.action = "trademanager.jsp";
	th.target = "_self";
	th.submit();
}

//manager界面用
function loadtype(type){
	var th =  document.form1;
	th.action_flag.value="reload";
	if(type!='picnews'){
		th.action = "trademanager.jsp?type="+type+"&hid_CurrPage=";
	}else{
		th.action = "../picnews/picnewsmanager.jsp?hid_CurrPage=";
	}
	th.target = "_self";
	th.submit();
}

//list界面用
function loadtypelist(type){
	var th =  document.form1;
	th.action_flag.value="reload";
	if(type!='picnews'){
		th.action = "tradelist.jsp?type="+type+"&hid_CurrPage=";
	}else{
		th.action = "../picnews/picnewslist.jsp?hid_CurrPage=";
	}
	th.target = "_self";
	th.submit();
}

//主页界面用
function loadmainlist(type){
	var th = parent.document.form1;
	parent.document.form1.action = "jsp/webpage/trade/tradelist.jsp?type="+type;
	th.target = "_self";
	th.submit();
}

//转到search界面
function opensearch(){
	var th = document.form1;
	th.action_flag.value="opensearch";
	th.action = "tradesearch.jsp";
	th.target = "_self";
	th.submit();
}

//search提交
function searchsubmit(){
	var th = document.form1;
	th.action_flag.value="searchsubmit";
	th.action = "tradesearch.jsp";
	th.target = "_self";
	th.submit();
}

//搜索页面重置查询条件
function doreset(){
	var th = document.form1;
	th.title.value="";
	th.type.value="";
	th.infotype.value="";
	return;
}
