﻿			function myFunction1(){
				var keyword ='';
				if(document.getElementById("ctl00_PlaceHolderTopNavBar_ctl02_S3A88BD45_go")!=null)
				{		
					 keyword = document.getElementById("ctl00_PlaceHolderTopNavBar_ctl02_S3A88BD45_InputKeywords").value;
				}else{
					 keyword = document.getElementById("ctl00_PlaceHolderTopNavBar_PlaceHolderSearchArea_ctl01_SB96F3E80_InputKeywords").value;
				}
					

					if (x.value == 'This Site'){
							//alert ('situs ini')
							//document.location ="http://"+ location.host + '/_layouts/OSSSearchResults.aspx?k='+keyword;
							location.replace('/search/results.aspx?k='+keyword);
					} else if (x.value== ''){
							//window.open('/pages/pencarian.aspx?PageURL=' + 'http://www.google.co.id/cse?cx=007706930201877165599%3Ay8myyj_3ncy&ie=ISO-8859-15&q=' + keyword + '&sa.x=0&sa.y=0&sa=Go','_self');
							window.open('/pages/pencarian.aspx?PageURL=' + 'http://www.google.co.id/cse?cx=007706930201877165599%3Ay8myyj_3ncy%26ie=ISO-8859-15%26q=' + keyword + '%26sa.x=0%26sa.y=0%26sa=Go','_self');
							//document.getElementById("WebPartWPQ2").location = 'http://www.google.com';
							//alert ('situs perpus')												
							//document.location="http://"+ location.host + '/search/results.aspx?k='+keyword;
							//location.replace('http://www.google.com/cse?cx=007706930201877165599%3Ay8myyj_3ncy&ie=UTF-8&q=' + keyword + '&siteurl=www.google.co.id%2Fcse%2Fhome%3Fcx%3D007706930201877165599%3Ay8myyj_3ncy');
					} else if (x.value == 'Katalog'){
							//alert ('Katalog')
							window.open('http://opac.pnri.go.id/opacGlobal.aspx?pDataItem='+keyword+'&pType=0','mywindow','width=800,height=600,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');
					}

			}

    function inputkeyword_OSBEK(evt1) { 

		var kCode =""; 

		if(navigator.appName == "Microsoft Internet Explorer")
		{
			
			kCode=String.fromCharCode(window.event.keyCode);
		}
		else
		{
			kCode=String.fromCharCode(evt1.which);
		}

		if(kCode == "\n" || kCode == "\r")
		{ 
		
			myFunction1();
			return false; 
		}
	}


		var x='';
		if(document.getElementById("ctl00_PlaceHolderTopNavBar_ctl02_S3A88BD45_go")!=null)
			{
			document.getElementById("ctl00_PlaceHolderTopNavBar_ctl02_S3A88BD45_go").href="javascript:myFunction1()";
			var mydiv = document.getElementById("ctl00_PlaceHolderTopNavBar_ctl02_S3A88BD45_go");
			
			//var x = document.getElementById("ctl00_PlaceHolderTopNavBar_PlaceHolderSearchArea_ctl01_SBScopesDDL");
			x = document.getElementById("ctl00_PlaceHolderTopNavBar_ctl02_SBScopesDDL");
			}else{
			
			document.getElementById("ctl00_PlaceHolderTopNavBar_PlaceHolderSearchArea_ctl01_SB96F3E80_go").href="javascript:myFunction1()";
			var mydiv = document.getElementById("ctl00_PlaceHolderTopNavBar_PlaceHolderSearchArea_ctl01_SB96F3E80_go");
			
			//var x = document.getElementById("ctl00_PlaceHolderTopNavBar_PlaceHolderSearchArea_ctl01_SBScopesDDL");
			x = document.getElementById("ctl00_PlaceHolderTopNavBar_PlaceHolderSearchArea_ctl01_SBScopesDDL");	
			
			}
			
			// hapus semua list yang ada di sharepoint list
			for (i = 0 ; i < x.length; i++) { 
					x.remove(i); 
			}
			 
			var y='';
			if(document.getElementById("ctl00_PlaceHolderTopNavBar_ctl02_S3A88BD45_go")!=null)
			{

				y=document.getElementById("ctl00_PlaceHolderTopNavBar_ctl02_S3A88BD45_InputKeywords");
			}else{
				
				y=document.getElementById("ctl00_PlaceHolderTopNavBar_PlaceHolderSearchArea_ctl01_SB96F3E80_InputKeywords");	
				//alert(document.getElementById("ctl00_PlaceHolderTopNavBar_PlaceHolderSearchArea_ctl01_SB96F3E80_InputKeywords").onkeypress);
				//document.getElementById("ctl00_PlaceHolderTopNavBar_PlaceHolderSearchArea_ctl01_SB96F3E80_InputKeywords").onkeypress="return inputkeyword_OSBEK(event)"
			}
				//alert(y.onkeypress);
				y.onkeypress=inputkeyword_OSBEK;//"return inputkeyword_OSBEK(event)";
				//alert(y.onkeypress);
			//isi baru list dengan data baru
			x.style.fontSize = 12;
			var newOpt1 =x.appendChild(document.createElement('option'));
     		newOpt1.text = "Situs ini";
     		newOpt1.value= "This Site";
			var newOpt2 =x.appendChild(document.createElement('option'));
     		newOpt2.text = "Situs perpustakaan";
     		newOpt2.value = "";
			var newOpt3 =x.appendChild(document.createElement('option'));
     		newOpt3.text = "Katalog";
     		newOpt3.value = "Katalog";
			
			//objec textbox ctl00$PlaceHolderSearchArea$ctl01$S6AE27B38_InputKeywords
			/*mydiv.attachEvent('onclick', function () {
					var keyword = document.getElementById("ctl00$PlaceHolderSearchArea$ctl01$S6AE27B38_InputKeywords").value;

					if (x.value == 'Situs ini'){
							//alert ('situs ini')
							location.replace('http://perpus:25552/_layouts/OSSSearchResults.aspx?k='+keyword);
					} else if (x.value== 'Situs perpustakaan'){
							//alert ('situs perpus')												
							location.replace('http://perpus:25552/search/results.aspx?k='+keyword);
					} else if (x.value == 'Katalog'){
							//alert ('Katalog')
							window.open('http://opac.pnri.go.id/opac/opacGlobal.aspx?pDataItem='+keyword+'&pType=0','mywindow','width=800,height=600,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');
					}
				}	
			);*/

/*
ubah 130809*/
			//y.style.width="100px";
			y.style.fontSize = 12;
			/*if(document.getElementById("ctl00_PlaceHolderTopNavBar_ctl02_S3A88BD45_go")!=null)
			{
			
					document.getElementById("ctl00_PlaceHolderTopNavBar_ctl02_S3A88BD45_InputKeywords").style.width="100px";
					document.getElementById("ctl00_PlaceHolderTopNavBar_ctl02_S3A88BD45_InputKeywords").style.fontSize = 18;

					document.getElementById("ctl00_PlaceHolderTopNavBar_ctl02_SBScopesDDL").style.width="160px";
			}else{
					document.getElementById("ctl00_PlaceHolderTopNavBar_PlaceHolderSearchArea_ctl01_SB96F3E80_InputKeywords").style.width="100px";
										document.getElementById("ctl00_PlaceHolderTopNavBar_PlaceHolderSearchArea_ctl01_SB96F3E80_InputKeywords").style.fontSize = 18;
					//document.getElementById("ctl00_PlaceHolderTopNavBar_PlaceHolderSearchArea_ctl01_SB96F3E80_InputKeywords")style.height="200px";
					document.getElementById("ctl00_PlaceHolderTopNavBar_PlaceHolderSearchArea_ctl01_SBScopesDDL").style.width="160px";

			}*/
/**/

