// JavaScript Document
var current_id=1;
var current_img='';
var cur,prv;
var search_url = 'http://search.sify.com/';
var s = new Array( 
              	new Array("<table border='0' cellspacing='0' cellpadding='0'><tr>" +
"<td width='371'align='left' valign='middle'><input type='text' id='search' style='height:25px;width:345px;'  name='q'/>" +
"</td><td><table align='right' valign='top'><tr><td width='75'>" + 
"<input type='submit' name='Submit' value='Search' /></td>" +
"<input name='lt' type='hidden' value='8'><td><img src='http://search.sify.com/images/cse.jpg'> </td></tr></table></td></tr></table>",
search_url + 'search.php','GET',search_url + 'images/home/SShome_07.gif',search_url + 'images/home/SShome_o_07.gif')

,new Array(  "<table border='0' cellspacing='0' cellpadding='0'><tr>" +
"<td width='371'align='left' valign='middle'><input type='text' id='search' style='height:25px;width:345px;'   name='q'/>" +
"</td><td><table align='right' valign='top'><tr><td width='75'>" + 
"<input type='submit' name='Submit' value='Search' /></td>" +
"<input name='lt' type='hidden' value='8'><td><img src='http://search.sify.com/images/cse.jpg'> </td></tr></table></td></tr></table>",
search_url + 'search.php','GET',search_url + 'images/home/SShome_07.gif',search_url + 'images/home/SShome_o_07.gif')

,new Array(  "<table border='0' cellspacing='0' cellpadding='0'><tr>" +
"<td width='371'align='left' valign='middle'><input type='text' id='search' style='height:25px;width:345px;'   name='q'/>" +
"</td><td><table align='right' valign='top'><tr><td width='75'>" + 
"<input type='submit' name='Submit' value='Search' /></td>" +
"<input name='lt' type='hidden' value='8'><td><img src='http://search.sify.com/images/cse.jpg'> </td></tr></table></td></tr></table>",
search_url + 'search.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;
  //g('search').focus();  
 // g('inftxt').innerHTML = s[id][3];
}
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;
        }
//var arSS = new Array('web','india','sify');
var arSS = new Array('0','1','2');

        for(i=0;i<3;i++)
        {
          if(document.frminp.rd != null &&  document.frminp.rd[i].checked)
           {
              channel=arSS[document.frminp.rd[i].value];
           }
        }
 
             ss_val = document.frminp.ss.value;
       g('frminp').method="POST";
       g('frminp').action = sifyURL(ss_val,channel,g('search').value);

}
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){}
}

