
function getSelectedStockCondition(form) {
	var t = document.getElementById("selectedconditions");
	var selectedStockCondition = "";
	if (t.length > 0){
		for (var i = t.length - 1; i >= 0; i--) {
			selectedStockCondition = selectedStockCondition + t.options[i].value;
			if (i != 0) {
				selectedStockCondition = selectedStockCondition + ",";
			}
		}
		document.getElementById("selectedStockCondition").value = selectedStockCondition;
		form.submit();
	}
}

function getInduystrId(obj){
	document.getElementById("industryId").value = (obj.options[obj.selectedIndex]).value;
}

function addCondition() {
	var s = document.getElementById("allconditions");
	var t = document.getElementById("selectedconditions");
	for (var i = s.length - 1; i >= 0; i--) {
		if (s.options[i].selected == true) {
			t.options.add(new Option(s.options[s.selectedIndex].text, s.options[s.selectedIndex].value));
			s.remove(s.selectedIndex);
		}
	}
}
function delCondition() {
	var s = document.getElementById("allconditions");
	var t = document.getElementById("selectedconditions");
	for (var i = t.length - 1; i >= 0; i--) {
		if (t.options[i].selected == true) {
			s.options.add(new Option(t.options[t.selectedIndex].text, t.options[t.selectedIndex].value));
			t.remove(t.selectedIndex);
		}
	}
}

function setMethodParameter(f1,methodName){
	if (methodName == 'prevStep'){
		f1.action="../stock/stockCondition.do";
	}
	if ( methodName == 'stockSearch' ){
		f1.action="../stock/stockConditionSearch.do";
	}
	if (methodName == 'prevStep2'){
		f1.action="../stock/stockConditionSet.do";
	}	
	f1.submit();
}

function jumpSearch(event) {
	if(event.keyCode==13){
		var pageof = document.getElementById("pageof").value;
		goPage(pageof);
	}
}

function jumpPrm(event) {
	if(event.keyCode==13){
		var prm = document.getElementById("parameter").value;
		var pageof = document.getElementById("pageof").value;
	    var path = window.location.href.split("?")[0] + "?" + prm + "&page=" + pageof;
		window.location = path;
	}
}


function jumpContentPage(event) {
	if(event.keyCode==13){
		var pageof = document.getElementById("pageof").value;
		toContentPage(pageof)
	}
}

function toContentPage(pageof) {
	document.getElementById("stockPageForm").action = 
		document.getElementById("stockPageForm").action + "&page=" + pageof;
	document.getElementById("stockPageForm").submit();
}

function jumpHistoryPage(event) {
	if(event.keyCode==13){
		var pageof = document.getElementById("pageof").value;
		toHistoryPage(pageof)
	}
}

function toHistoryPage(pageof) {
	document.getElementById("stockPriceHistoryForm").action = 
		document.getElementById("stockPriceHistoryForm").action + "&page=" + pageof;
	document.getElementById("stockPriceHistoryForm").submit();
}

function jumpIndusryIndexPage(event) {
	if(event.keyCode==13){
		var pageof = document.getElementById("pageof").value;
		toHistoryPage(pageof)
	}
}

function toIndusryIndexPage(pageof) {
	document.getElementById("stockIndusryIndexHistoryForm").action = 
		document.getElementById("stockIndusryIndexHistoryForm").action + "&page=" + pageof;
	document.getElementById("stockIndusryIndexHistoryForm").submit();
}

function senfe(o,a,b,c,h){
	 var obj = document.getElementById(o);
	 if (obj!=null){
		 var t=obj.getElementsByTagName("tr");
		 for(var i=0;i<t.length;i++){
			 var th = t[i].getElementsByTagName("th");
			 if (th.length>0){
				 var td = t[i].getElementsByTagName("td");
				 t[i].style.backgroundColor=(t[i].sectionRowIndex%2==0)?a:b;
				 for(var j=0;j<th.length;j++){
					 th[j].style.backgroundColor = h;
				 }
				 
				 t[i].onmouseover=function(){
			         if(this.x!="1")this.style.backgroundColor=c;
			     }
			     t[i].onmouseout=function(){
			    	 if(this.x!="1")this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b;
			     }
				 
			 } else {
				 t[i].style.backgroundColor=(t[i].sectionRowIndex%2==0)?a:b;
				  
			     t[i].onmouseover=function(){
			         if(this.x!="1")this.style.backgroundColor=c;
			     }
			     t[i].onmouseout=function(){
			    	 if(this.x!="1")this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b;
			     }
			 }
		 }
	 }
}

function doChange(value){
	var t=document.getElementById("adminForm").getElementsByTagName("table");
	for(var icount = 1; icount <= t.length; icount++ ) {
		if (icount <= value){
			t[icount].parentNode.parentNode.style.display = "";
		} else {
			t[icount].parentNode.parentNode.style.display = "none";
		}
	}
}

function changeChid(value){
	document.getElementById("chid").value = value;
}

function deleteChid() {
	var chid = document.getElementById("chid").value;
	var path = window.location.href.split("?")[0].replace("adminEditChan","adminChan") + "?lineId=" + chid;
	window.location = path;
}

function editChid() {
	var chid = document.getElementById("chid").value;
	document.getElementById("adminForm").action = 
		document.getElementById("adminForm").action + "&lineId=" + chid;
	document.getElementById("adminForm").submit();
}

function changeChan(value){
	document.getElementById("adminForm").submit();
}

function preView()
{
	var patn = /\.jpg|\.jpeg|\.gif/i;
	var uploadFile = document.getElementById("uploadFile");
	if(!uploadFile.value) return;
	if(patn.test(uploadFile.value))
	{
		document.getElementById("imgphoto").src="file:///" + uploadFile.value;
	}else{
		alert("图片格式只能为.jpg或.gif格式");
	}
}

function goPage(pageId) {
	document.getElementById("pageid").value = pageId;
	document.getElementById("adminForm").submit();
}

function jumpto(event) {
	if(event.keyCode==13){
		var pageof = document.getElementById("pageof").value;
		goPage(pageof);
	}
}

function saveAndNew() {
	document.getElementById("adminForm").action = 
		document.getElementById("adminForm").action.replace("-1","-2");
	document.getElementById("adminForm").submit();
}

function qiehuan(id1,id2) {
	var qh1 = "qh" + id1;
	var qiehuan1 = "qiehuan" + id1;
	var qh2 = "qh" + id2;
	var qiehuan2 = "qiehuan" + id2;
	document.getElementById(qh1).style.display = "";
	document.getElementById(qiehuan1).style.display = "";
	document.getElementById(qh2).style.display = "none";
	document.getElementById(qiehuan2).style.display = "none";
}

function swlxqh(id) {
	for (var icount = 1; icount <= 5; icount++ ){
		var sub = "sub" + icount;
		var subtext = "subtext" + icount;
		if (icount==id){
			document.getElementById(sub).style.background="url(../images/swlx_015.jpg)";
			document.getElementById(subtext).style.display = "";
		} else {
			document.getElementById(sub).style.background="url(../images/swlx_016.jpg)";
			document.getElementById(subtext).style.display = "none";
		}
	}
}

function travSearch() {
	var objs = document.getElementsByName("search");
	var theRadioValue = "";
	for(var i=0;i<objs.length;i++){
		if(objs[i].checked){
			theRadioValue = objs[i].value;
		}
	}
	if (theRadioValue != ""){
		document.getElementById("userForm").action = 
			document.getElementById("userForm").action + "&process=" + theRadioValue;
		document.getElementById("userForm").submit();
	}
}

function resetSearch() {
	var objs = document.getElementsByName("search");
	for(var i=0;i<objs.length;i++){  
		objs[i].checked = false;
	}
}

