// JavaScript Document
var current_id="";
var prev_id="";
var title;
var url;
var desc;
function gob() {
	  if(document.frminp1.q.value =='') {
        alert("Please Enter the Keyword");
	      return false;
      }
	  else
	  document.frminp1.submit();
}

var current_id=1;
var current_img='';

//-- Code --
var cur,prv;
//var search_url = 'http://search.sify.com/';
var search_url = 'http://www.samachar.com/samasearch/'; // change for testing
var s = new Array( 
              	new Array("",
search_url + 'search_samachar.php','GET',search_url + 'images/home/SShome_07.gif',search_url + 'images/home/SShome_o_07.gif')

,new Array(  "",
search_url + 'search_samachar.php','GET',search_url + 'images/home/SShome_07.gif',search_url + 'images/home/SShome_o_07.gif')

,new Array(  "",
search_url + 'search_samachar.php','GET',search_url + 'images/home/SShome_07.gif',search_url + 'images/home/SShome_o_07.gif')
		  );
function g(e) 
{ 
  return document.getElementById(e);
}
function more()
{
window.location = "search.php";
}
function show(id,query)
{
  pval = g('search').value;
 
  g('idiv').innerHTML = s[id][0];
  if(query)
    g('search').value = query;
  else
    g('search').value = pval;
}
function go() 
{
          var val=g('search').value;
		
		 if(val =='') 
		 {
			alert("Please enter the search keyword");
			return false;
		}
		if(isWhitespace(val))
		{
		 alert("Blank space is not allowed");
		 return false;
        }
		return true;
}

var reWhitespace = /^\s+$/;
   function isWhitespace(s)
   { 
	return(reWhitespace.test(s));
   }

function activate(id,query)
{
  //if query is set , then the control has reached here due to
  // submit so set the icon
 // g('search').value = '';	
 
  if(query) {
    show(id -1,query);
  }
  else {
    //reset the previousely selected image
    if(current_id)
	  {
        
   //   g( 'Image' + current_id ).src = s[current_id - 1][4];
    show(id -1);
	  }
  }
 // g('Image' + id).src = s[id-1][5];

  current_id = id;
  current_img = s[id-1][4];
 
  if(s[id-1][1] == 'http://classifieds.sify.com/searchresults.php')
	 classified = "1";
  g('frminp').action = s[id-1][1];
  g('frminp').method = s[id-1][2];

}

function dosubmit() {
  try {
    if(g('search').value != "")
       g('frminp').submit();
  }
  catch(e){}
}
function frmsub()
	{
	   if(go())
	   {
	   /*	if(document.frminp.ss[1].checked)
		{
			document.location.href='http://search.samachar.com/search_page.php?t='+document.frminp.q.value+'&newsearch=1';
		}
		else
		*/
			document.frminp.submit();

	   }
	}



