  /*This function is used to check for the search term entered,depending on type of radio button selected.*/
function checkSearchTerm(URL,id,SearchTerm,fname) 
{	
	
  var st = SearchTerm.replace(/^\s+|\s+$/g, "");
  var atk = '';
  if(st=='')
     {
	if((URL.indexOf("home")!=-1)&&(id=='null'))
	  {
	
	    getNewHtml('error-search','home-page-search-error');
	 			
	  }
	else
	  {
	  
	     getNewHtml('header','article-error');				
	  }
	  return false;
     }
          /*Added for ENH-259 changes--Used to find the selected radio button*/
  else
     {
       for (var i=0; i <fname.searchprop.length; i++)
       {
          if (fname.searchprop[i].checked)
          {
		atk=fname.searchprop[i].value;
          }
       }
    	if(atk=="img")
        {
          /*Changed for BUG-103 to change the location href and return*/
          /* Changed for WBDP-378 */
          //fname.action="search?st1=picture:"+st;
          //location.href="search?st1=picture:"+st;
          fname.action="search?st1="+st+"&dt=0&mt=pc";
          location.href="search?st1="+st+"&dt=0&mt=pc";
          /* WBDP-378 Changes end here */
          return false;
	}
       else
       {
       	  /* Changed for BUG-103 to submit through the form name*/
	   fname.action="search?st1="+st;
	}		
     }
	return true;		
}

function getNewHtml(strId,strClass)
{
	
	var createElement="false";
	t = document.getElementById("error-classes");
	if(!t)
	{
		var prevHTML = document.getElementById(strId).innerHTML;
		var addHTML='<div id="error-classes" class="'+strClass+'">'+
				'No Search term entered'+
				'<ul>'+
				'<li>Please enter one or more words in the search box. </li>'+
				'</ul>'+
				'</div>';
		createElement="true";
	}
					
	if(createElement == "true")
	{
		var newHTML = prevHTML + addHTML;
		document.getElementById(strId).innerHTML = newHTML;	
	}else{
		showeerrorbox('error-classes');
	}
	hideawayerrorbox('error-classes');
}



var theerrordiv;
function hideawayerrorbox(which){
	theerrordiv = document.getElementById(which);
	setTimeout('hideerror()',4000);
}
function hideerror(){
	theerrordiv.style.display = 'none';
}

function showeerrorbox(which){
	theerrordiv = document.getElementById(which);
	theerrordiv.style.display = 'block';
}
function defaultlink(which){
}

/* This function is used for the EBOOK center functionality in WBA Added for
 * ENH-72 and is used to submit the form used for ebook center
 */
function EBookSearch(){
	document.ebooksrchform.action="ebookcenter?st1="+escape(document.ebooksrchform.st1.value);
	document.ebooksrchform.submit();	
}
/* ENH-72 changes ends here*/


