		var result;
		function searchYahoo(){
			url ="http://boss.yahooapis.com/ysearch/web/v1/"+$('#query')[0].value+"?appid=owAqF0HV34EUpGlt3pAT0bUW0G5z7Mui0yFMqdMdKiWqJhm1bgvIWelcp_H.aP1fkA--&callback=processContent&count=30";
			clearDynamicData();
			if(!checkForEmptiness()){
				return false;
			}
			loadScript(url);
		}
		function checkForEmptiness(){
			if($('#query')[0].value==""){
				alert("Enter some search query!!!");
				return false;
			}
			return true;
		}
		function clearDynamicData(){
			$('#footer-count').empty();
			$('#body-content').empty();
		}
		function openTopPage(){
			alert('This functionality is not available yet');
		}
		$(document).ready(function(){
			$('#query').focus();
			$('#load-url').hide();
			});
		
		function loadScript(url){
			var script = document.createElement('script');
			script.setAttribute('id','newScript');
			script.setAttribute('src',url);
			$('head')[0].appendChild(script);
		}
		
		function processContent(docs){
			result = docs.ysearchresponse.resultset_web;
			drawFooter(result.length);
			drawContent(1);
		}
		function drawContent(pageNum){
			for(var i=((pageNum-1)*5); i<((pageNum)*5); i++){
				createElements(i);
				$('#title'+i)[0].innerHTML = "<a href='"+result[i].clickurl + "'>" + result[i].title + "</a>";
				$('#abstract'+i)[0].innerHTML = result[i].abstract;
				$('#dispurl'+i)[0].innerHTML = "<a href='"+ result[i].clickurl + "' style='color:green' onmouseover=\"openPage('"+result[i].clickurl+"')\">"  + result[i].dispurl + "</a>";
			}
		}
		
		function openPage(url){
			$('#load-url').slideDown("slow");
			$('#load-url')[0].src = url ;
		}
		function drawFooter(count){
			for(var i=1; i<count/5; i++){
				var span = document.createElement('span');
				var a = document.createElement('a');
				a.setAttribute('href', '#');
				a.setAttribute('onClick', 'loadPage('+ i +')');
				a.setAttribute('style','margin-right:12px');
				var text = document.createTextNode('' + i);
				a.appendChild(text);
				span.appendChild(a);
				$('#footer-count')[0].appendChild(span);
			}
		}
		function loadPage(pageNum){
			clearDynamicData();
			drawContent(pageNum);
			drawFooter(result.length);
		}
		function createElements(count){
			var container = document.createElement('div');
			container.setAttribute('id','container');
			var title = document.createElement('div');
			title.setAttribute("style",'font-size:medium');
			title.setAttribute('id','title'+ count);
			var abstract = document.createElement('div');
			abstract.setAttribute('id','abstract'+ count);
			abstract.setAttribute('style','font-family:arial,sans-serif;font-size:small;');
			var dispurl = document.createElement('div');
			dispurl.setAttribute('style','font-family:arial,sans-serif;font-size:small;');
			dispurl.setAttribute('id','dispurl'+ count);
			container.appendChild(title);
			container.appendChild(abstract);
			container.appendChild(dispurl);
			$('#body-content')[0].appendChild(container);
		}
