		function showPDF(file){
			window.open(file,"mywindow");
		}

		function reloadWindow(){
			//window.location.href="public";
			setTimeout( "window.location.href = 'public'", 0 );			
		}

		function displayDetails(nid){
			document.getElementById("hidDivExpire_"+nid).style.display="block";
		}

		function exipreDate(date){
			alert("This Product will Expire from CHPS Registry on "+date)
			return false;
		}
 
		function removeOptions(lstName)	{
			var ele=document.getElementById(lstName);
			var length =ele.length;
			for (var i=length-1;i>=0;i--){
				ele.remove(i);
			}
		}

		function getSubcategories(){
			var x="";
			var catId=document.getElementById("categories").value;
			var selected_index=document.getElementById("categories").selectedIndex;
			var selected_text = document.getElementById("categories").options[selected_index].text;
			selected_text=selected_text.replace(/&/, "_")
			document.getElementById("subcategories").options[0].text=" loading......";
  			var url="ajax_response.php?type=subCat&catname="+selected_text;
  
			resp=sendSyncReq(url);
			var subCat_lst=resp.split(";");
			removeOptions("subcategories");
			try{ 
				document.getElementById("subcategories").add(new Option("--All--","0"),null);
			}catch(ex) {
				document.getElementById("subcategories").add(new Option("--All--","0"));
     			}
			for(var i=0;i<subCat_lst.length-1;i++)  {
				var subCat=subCat_lst[i].split(":");
				if(x=="") x=subCat[0];
				else x=x+","+subCat[0];
				var optsubCat=new Option(subCat[1],subCat[0]);

				try {
					document.getElementById("subcategories").add(optsubCat,null); // standards compliant
				} catch(ex) {
					document.getElementById("subcategories").add(optsubCat); // IE only
				}
			}
		}
		function getChpsCredits(){ 
			document.getElementById("credit").options[0].text=" loading......";
			var attributes=document.getElementById("attributes").value;
			url="ajax_response.php?type=chpsCredit&attId="+attributes;
			resp=sendSyncReq(url);
			var chps_lst=resp.split(";");
			removeOptions("credit");
			try{ document.getElementById("credit").add(new Option("--All--","0"),null);
			}catch(ex) {
				document.getElementById("credit").add(new Option("--All--","0"));
			}
			for(var i=0;i<chps_lst.length-1;i++)  {
				var chps=chps_lst[i].split(":");
				var optchps=new Option(chps[1],chps[0]);
				try {
					document.getElementById("credit").add(optchps,null); // standards compliant
				} catch(ex) {
					document.getElementById("credit").add(optchps); // IE only
				}
			}
	 		return false; 
		}
 
		function GetXmlHttpObject() {
			var objXMLHttp=null;
			if (window.XMLHttpRequest){
				objXMLHttp=new XMLHttpRequest();
			}
			else if (window.ActiveXObject) {
				objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			if (objXMLHttp==null){
				alert ("Browser does not support HTTP Request")
			}
			return objXMLHttp;
		}

		function sendSyncReq(url)   {
			var xmlHttpReq=GetXmlHttpObject();
			if (xmlHttpReq==null) return;
			xmlHttpReq.open("GET",url,false);
			xmlHttpReq.send("null");
			var resp=xmlHttpReq.responseText;
			return resp;
		}
