function viewSearchBox(layName){
	if(document.getElementById(layName).style.display=="none" || document.getElementById(layName).style.display==""){
		document.getElementById(layName).style.display="inline";
	}else{
		document.getElementById(layName).style.display="none";
	}

}

function ajaxDirectPage(){
	var searchString=location.search;
	var searchURL;
	if(searchString.indexOf("content")!=-1){
		searchURL=searchString.replace(/\?/g,'');
	}else{
		searchURL="/cd/app/index.cgi"+searchString;
	}
	if(searchString){
		location.href=searchURL;
	}
}

function displayAjaxQuery(dispDiv,sendURL){
	var loadingTags='<div align="center" style="background-color:#fff;width:100%;padding:10px"><img src=/cd/include/image/loading.gif></div>';
	document.getElementById(dispDiv).style.display="block";
	newhttp=createAjaxQuerry();
	if(newhttp){
		newhttp.onreadystatechange=function(){
			if(newhttp.readyState==4 && newhttp.status==200){
				document.getElementById(dispDiv).innerHTML=newhttp.responseText;
			}else{
				document.getElementById(dispDiv).innerHTML=loadingTags;
			}
		}
		newhttp.open("get",sendURL);
		newhttp.send(null);
	}
}

function createAjaxQuerry(){
	var newHttpObject=null;
	try{
		newHttpObject=new XMLHttpRequest();
	}catch(e){
		try{
			newHttpObject=new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				newHttpObject=new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e){
				return null;
			}
		}
	}
	return newHttpObject;
}
