sort = 0;
var time_OnloadComplete;
function setInput(cid,text,date){
	//var dt = document.getElementById("cdt");
	var openword = window.document.getElementById("jsSearchopen").innerHTML;
	//alert(cid+"+"+text+"+"+date);
	var caption_word = document.getElementById("idTextfield");
	//alert(caption_word.value);
	//new Ajax.Updater({success:'TopByCat'},"TopByCat.do",{parameters:{cid:cid}});
	if(cid!=null&&cid!=""&&date!=null&&date!=""){
		window.document.kuaiform.ap_Id_t.value = cid;	
		window.document.kuaiform.ap_t.value = text;
		window.document.gailan_doctype_search.ap_Id_t.value = cid;	
		window.document.gailan_doctype_search.ap_t.value = text;
		document.getElementById("souwanxianshi").style.display = "none";
		var targetText = document.getElementById("conditionDiv");
		var targetDiv = document.getElementById("condWord");
		targetDiv.style.display='none';
		targetText.innerText=openword;
		var search_style = document.getElementById("search");
		if(search_style != null&&search_style.style.display == "block"){
		//var custom_condition_flag = document.getElementById("custom_condition_flag");
		//if(custom_condition_flag.value == "custom_condition_flag"){
			new Ajax.Updater({success:'DateStyle'},ctx+"/GLStyle.do",{parameters:{cid:cid,cond_flag:'0'}});
			//if(dt)
			//	new Ajax.Updater({success:'CaptionStyle'},ctx+"/GLStyle.do",{parameters:{cid:cid,cond_flag:'1'},onComplete:date_viewback(date,dt.value)});
			//else
			new Ajax.Updater({success:'CaptionStyle'},ctx+"/GLStyle.do",{parameters:{cid:cid,cond_flag:'1'},onComplete:function(){date_viewback(date,0)}});
			new Ajax.Updater({success:'AllConStyle'},ctx+"/GLStyle.do",{parameters:{cid:cid,cond_flag:'1',Allcon:'Allcon'}});
			new Ajax.Updater({success:'papersearch'},ctx+"/IsPaper.do",{parameters:{cid:cid}});
		}		
	}
	opendivwin();
	//document.getElementById("pageLoading_wait").style.display = "block";
	//time_OnloadComplete = window.setInterval("isOnloadComplete()",1000)
	
}
function styleonblur(){
	//alert(9);
	var input = document.getElementById("idTextfield");
	if(input){
		var styleinputblur = document.getElementById("styleinputblur");
		if(styleinputblur){
			input.blur;
			if (input.value ==''){input.blur();input.style.color='gray';var trscon = '${searchStyle.trs_condition}';if(trscon=='SYS_TOPIC'){input.value='当前默认检索标题';}else if(trscon=='DOC_SOURCE'){input.value='当前默认检索来源';}else if(trscon=='WT_KEYWORD2'){input.value='当前默认检索关键词';}else{input.value='当前默认检索标题';}}
		}else{
		//	input.focus;
			jQuery(input).focus();
		}
		//
	}
}
//初始化单选扭选中信息
function checkRadioValue_(RadioName, value){
	var obj;
	obj = document.getElementsByName(RadioName);
	if(obj != null){
		var i;
		for(i=0; i<obj.length; i++){
			if(obj[i].value == value){
				alert(obj[i].value);
				obj[i].checked = true;
			}
		}
	}
}
function date_viewback(date,dt){
//	if(dt != null&&dt != 0){
//		initPara_new_quiadv(dt);
//		if(dt == '0'||dt == '1'){
//			window.document.kuaiform.dm.value = 0;
//			window.document.gailan_doctype_search.dm.value = 0;			
//		}else{
//			window.document.kuaiform.dm.value = 1;
//			window.document.gailan_doctype_search.dm.value = 1;			
//		}
//	}else
		initPara_new_quiadv();
	if(date != null&&date != ""&&date!="null"){
		//alert("s");
		window.document.getElementById("r3").checked = true;
		changeTime(3);
		var objSelect = document.getElementById("selectDate");
		var objSelect_hide = document.getElementById("selectDate_hide");
		objSelect.value = date;
		objSelect_hide.value = date;
	}
	styleonblur();
}

function stop_init() {
	window.clearInterval(time_OnloadComplete);	
}
//循环检测检索条件反显
function isOnloadComplete(){
	initPara_new_quiadv();
	//alert(window.document.getElementById("isOnloadComplete"));
	if(window.document.getElementById("isOnloadComplete"))
		stop_init();
}


function setInput_root(){
	document.getElementById("ap_Id_t").value = document.getElementById("root_ap_Id_t").value;
	document.getElementById("ap_t").value = document.getElementById("root_ap_t").value;
}

function showADVSearch(){
	var ap_id;
	ap_id = document.getElementById("ap_Id_t");
	ct_id = document.getElementById("ct");
	//alert(ap_id.value+";"+ctx);
	//window.open('../ADVStyle.do?cid='+ap_id.value,'Popup');
	window.open(ctx+"/security/ADVStyle.do?cid="+ap_id.value+"&ct="+ct_id.value);
	//alert(ctx);
	//location.href = ADVStyle.do?cid=ap_id.value;
}


function slctWtoCW(){
	//SearchWordTocookie();
	var selectWord = document.getElementById("wordcookie").options[document.getElementById("wordcookie").selectedIndex].value;
	if(selectWord != "Noselectword"){
		document.getElementById("idTextfield").value = selectWord;
	}else{
		document.getElementById("idTextfield").value = "";
	}
}


function souwanxianshi(){
	top.document.getElementById("souwanxianshi").style.display = "block";
}

//为Firefox下的DOM对象增加innerText属性 
var lBrowser = {}; 
lBrowser.agt = navigator.userAgent.toLowerCase(); 
lBrowser.isW3C = document.getElementById ? true:false; 
lBrowser.isIE = ((lBrowser.agt.indexOf("msie") != -1) && (lBrowser.agt.indexOf("opera") == -1) && (lBrowser.agt.indexOf("omniweb") == -1)); 
lBrowser.isNS6 = lBrowser.isW3C && (navigator.appName=="Netscape") ; 
lBrowser.isOpera = lBrowser.agt.indexOf("opera") != -1; 
lBrowser.isGecko = lBrowser.agt.indexOf("gecko") != -1; 
lBrowser.ieTrueBody =function (){ 
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body; 
}; 

if(lBrowser.isNS6){ //firefox innerText define 
HTMLElement.prototype.__defineGetter__( "innerText", 
function(){ 
return this.textContent; 
} 
); 
HTMLElement.prototype.__defineSetter__( "innerText", 
function(sText){ 
this.textContent=sText; 
} 
); 
} 

function showXLFL(){
		
		$('xlfl').toggle();		
		var label = document.getElementById('xlLabel')
		if($('xlfl').style.display!="none")
		{				
			label.innerText = "Close";		
		}
		else
		{				
			label.innerText = "Open";			
		}	 
	}
	
