var blnOriginalMsgCopied = false;
var strPosTweets = "";
var strNegTweets = "";
var strAllPosRating = "";
var strAllNegRating = "";
var radValue = "";
var curParam = "";
var curPosRat = "";
var curNegRat = "";
var pager;
var obje = new Object();
obje.method = 'get';
obje.asynchronous = true;
var twitter_url='';
var vicon_url='';
var tweetId='';
var tweetUser='';
var returnShortenedUrl=false;
var shortUrl='';
var lurl;
var bitlyWorked = false;
var curTab = "divTabBlock_1";
//var searchText = "";
var sTime;
//Ashutosh : April 16 2010 : for "On the Web Retip"
var webRetip = "";

sitepathPHP = sitepath+"/expconurl.php"; 

window.onerror=function(msg, url, linenumber){
	 return true
}

/*
window.onerror=function(msg, url, linenumber){

if (sitepath && (sitepath.indexOf('twitter_test') >=0)  ) {
	alert('Error message: '+msg+'\nURL: '+url+'\nLine Number: '+linenumber)
	return false;
} else {
	 return true
	}
}
*/
//Added by Sowmya on June 23,2009 for Expanding/Contracting URLS
//Modified by sowmya on June 30,2009 using prototype for hide and show
//Modified by sowmya on July 16,2009 for path issue
function ajaxfunction(p1,id){
	var ajaxRequest;  // The variable that makes Ajax possible!
	//alert(p1+'p1'+id+'id');
	obje.parameters="url="+p1+"&id="+id;
	obje.onSuccess=display;
	ajaxRequest =  new Ajax.Request(sitepathPHP,obje);
	return;	
}

function display(str){
 	//Sowmya:1-June-2010 Added condition not to show contract Image if Expanded version is not available
	str = str.responseText;
	//alert(str);
	str = str.split(' ');
	surl = str[1];    
	lurl = str[0];
	len	=	lurl.length;
//	alert(surl +'                            surl');
//	alert(lurl + '                           lurl');
	if(lurl!=''){
		durl = lurl.substring(0,25);
		if(len>25)
		durl=durl+'...';
	//wahab: 10-Nov-09 added url redirection
		checkUrl = surl.toLowerCase();
		if (checkUrl.indexOf('feeltiptop.com') >= 0 || checkUrl.indexOf('twitter.com') >= 0) {
		 	checkUrl = surl;
		} else {
		 	checkUrl = "http://beta.tiptopbest.com/redir.php?url="+surl;
		}
		$('spa'+id).innerHTML = "<a href='"+checkUrl+"' target='_blank'>"+durl+"</a>";	
			$('sp'+id).hide();
			$('spa'+id).show();
			$('spa'+id).title =lurl;
			$('sp'+id).title = surl;
			$('span'+id).innerHTML = "<img src='"+sitepath+"/images/contract.png' title=Shrink id=img"+id+" align=absmiddle style = 'padding-left:4px;cursor:pointer;' onclick=javascript:ExpShr(this,'"+id+"')>";
	}
	else{
	 		$('span'+id).innerHTML = "<img src='"+sitepath+"/images/expand_disable.png' title='Expanded url not found' id=img"+id+" align=absmiddle style = 'padding-left:4px;'>";
	}
}

function ExpShr(obje,id)
{
 	//Expanding and contracting url (hide and show)
	if(obje.title == "Expand"){
			$('sp'+id).hide();
			$('spa'+id).show();
			$('spa'+id).title =lurl;
			$('sp'+id).title = surl;
			//alert(surl);
			$('span'+id).innerHTML = "<img src='"+sitepath+"/images/contract.png' title=Shrink id=img"+id+" align=absmiddle class='imgExp' onclick=ExpShr(this,'"+id+"')>";
			
		}
		else if(obje.title == "Shrink"){
			$('sp'+id).show();
			$('spa'+id).hide();
			$('span'+id).innerHTML = "<img src='"+sitepath+"/images/expand.png' title=Expand id=img"+id+" align=absmiddle class=imgExp onclick=ExpShr(this,'"+id+"')>";	
		}	
}

function ExpCon(surl,obje,id){
 this.id=id;
 source = obje.src;
 	if($('spa'+id).innerHTML == ''){
		if(source.indexOf(sitepath+"/images/expand.png") >= 0 ) {
				ajaxfunction(surl,id);			
		} 
	}
}


var objs = new Object();
objs.method = 'get';
objs.asynchronous = false;
function getShortUrl(longUrl){
	var ajaxRequest1;  // The variable that makes Ajax possible!
	objs.parameters="url="+longUrl;
	objs.onSuccess=shortenedUrl;
	ajaxRequest1 =  new Ajax.Request(sitepath+"/includes/tinyurl_api.php",objs);
	return;	
}

function shortenedUrl(str){
	shortUrl=str.responseText;	
	if(shortUrl=="No content"){
		alert('Error occured while shortening URL');
		return;
	}
	returnShortenedUrl=true;
	return;
}
var obj = new Object();
obj.method = 'get';
obj.asynchronous = false;
function getBitlyAndRecirsiveUrls(user,id,long_urls,queryTerm,tweetMessage){
/*
* Ajax Function to call php script bitly_api.php to get short urls , also add recursive url.
* Added by: Ashutosh Anand
* Date: 11-08-2009
* Used for re-tweet
*/
//alert('worked');
var ajaxRequest;  // The variable that makes Ajax possible!
queryTerm = encodeString.encode(queryTerm);
tweetMessage = encodeString.encode(tweetMessage);
var url = sitepath+'/bitly_recursive_api.php?user='+user+'&id='+id+'&long_urls='+long_urls+'&queryTerm='+queryTerm+'&tweetMessage='+tweetMessage;
obj.onSuccess = function(str){
		bitlyWorked = true;
		retip_status = str.responseText;
		if(0 == retip_status.length){
			bitlyWorked = false;
			}
		//alert(retip_status);
		return;
		}
ajaxRequest = new Ajax.Request(url,obj);
return;
}

var objc = new Object();
objc.method = 'get';
objc.asynchronous = false;
function RecursiveRetweetURL(user,id,long_urls,queryTerm,tweetMessage)
{
 	/* Added by sowmya on August 25,2009 for recursive retweet
	 	Ajax Fuction to call php script bitly_retweet_api.php
	 */
	var ajax_Request;  // The variable that makes Ajax possible!
	queryTerm = encodeString.encode(queryTerm);
tweetMessage = encodeString.encode(tweetMessage);
	var retweeturl = sitepath+'/bitly_recursive_api.php?user='+user+'&id='+id+'&long_urls='+long_urls+'&queryTerm='+queryTerm+'&tweetMessage='+tweetMessage;
	objc.onSuccess = function(str_retweet)
	{
		bitlyWorked = true;
		retweet_status = str_retweet.responseText;
		//alert(retweet_status);
		if(0 == retweet_status.length)
		{
			bitlyWorked = false;
		}
		return;
	}
	ajax_Request = new Ajax.Request(retweeturl,objc);
	return;
	
}

var objt = new Object();
objt.method = 'get';
objt.asynchronous = false;
function RecursiveTipsPitsURL(tipsPitsShare,long_urls,t_concept)
{
 	/* Added by sowmya on August 25,2009 for recursive tshares(tips pits,concept cloud),retweet
	 	Ajax Fuction to call php script bitly_recursive_api.php
	 */
	var ajax_tips_Request;  // The variable that makes Ajax possible!
//alert(long_urls);	
	var tipspitsurl = sitepath+'/bitly_recursive_api.php?tipsPitsShare='+tipsPitsShare+'&long_urls='+long_urls+'&t_concept='+t_concept;
	//alert(tipspitsurl);
	objt.onSuccess = function(str_tipspits)
	{
		bitlyWorked = true;
		tipspits_status = str_tipspits.responseText;
		//alert(tipspits_status);
		if(0 == tipspits_status.length)
		{
			bitlyWorked = false;
		}
		return;
	}
	ajax_tips_Request = new Ajax.Request(tipspitsurl,objt);
	return;
	
}


function addClicksToLog(objName,objType){
/*
* Ajax Function to add number of hits of concepts / categories / twitter share / facebook share
* Added by: Ashutosh Anand
* Date: 13-07-2009
*/
//alert(objType+':'+objName);
var ajaxRequest;  // The variable that makes Ajax possible!
var logObj = new Object();
var url = sitepath+'/logClicks.php?objType='+objType+'&objName='+objName;
logObj.method = 'get';
logObj.asynchronous = true;
logObj.onSuccess = function(res){}
ajaxRequest = new Ajax.Request(url,logObj);
return;	
}



//wahab: 25-May; higlight "ALL" tab when concept clicked
function highlightAllTab() {
 	if ($('divA')) {
// 	 	$('divA').className = "button";
 	}
// 	alert ("1");
var tabs = $$('a.buttonHighlight');
	for (i=0;i<tabs.length;i++) {
	 	tabs[i].id = "";
	 	tabs[i].className = "button";
	}
	
// 	alert ("2"); 	
var tabs = $$('a.button');
	for (i=0;i<tabs.length;i++) {
	 	html = tabs[i].innerHTML;
	 	html = html.toUpperCase();
 	 	tabs[i].id = "";
	 	if (html == "<SPAN>NO FILTER</SPAN>") {
	 	 	tabs[i].className = "buttonNoFilter";
//	 	 	tabs[i].id = "divA";
	 	 	break;
	 	}
	}
	deselectConcept();
}

function deselectConcept() {
 if ($$('a.conceptHighlight') != "") {
  		concept=$$('a.conceptHighlight');
		for (i=0;i<concept.length;i++) {
			concept[i].className = "conceptA";
		}
	}
}

function submitForm(objForm) {
//wahab: 22-Oct; search not working, since id of the text box changed
//alert (objForm);
var val = "";
//textbox of header id = q2; footer id = q
	if (objForm == "tiptopitform1") {
		if ($('q2')) {
		 	val1 = $F('q2');
			if(val1==''){
			alert('Please enter query');
			return false;
			}
			val2 = $F('geocode');
			val =val1+' '+val2;
		}
	} else {
	 	if ($('q')) {
		 val1 = $F('q');
		 if(val1==''){
		 alert('Please enter query');
		 return false;
		 }
		 val2 = $F('geocode');
		 val =val1+' '+val2;
		}
	}
//alert (val);
if (objForm.id == 'tiptopitform1') {
 	val1 = $F('q2');
	if(val1==''){
	alert('Please enter query');
	return false;
	}
	val2 = $F('geocode');
	val =val1+' '+val2;;		
}
//alert (val);

    val = val.trim();
	var orgVal = val; 	
	try{
		val = (defaultTextBoxVal == val) ? "" : val;  
	}catch(err){
		val = orgVal;
	}
//	alert (val);
if (val != ""){
 	//val = val.trim();
	//val = val.replace(/#/g,"%2523");
	val=encodeURIComponent(val);
 	val = val.replace(/%23/g,"%2523");
	val = val.replace(/%2F/g,"/");
 	if ("" != val) {
//wahab: May-20-10; display busy img when search is initialized in compact
/*
	if ($('compactDivBusyImg')) { 	
		$('compactDivBusyImg').style.visibility = 'visible';
		$('compactDivBusyImg').style.display = 'block';
//		alert ('wahab test');
	}
*/
//		alert ('in js');
 	 	window.location.href = "/"+val+"/";
 	 	return false;
 	}
} 
	return false;
}


function imgFixIE() {
// return;
browser = navigator.appName;
//alert (browser);
tImages = $$('img.tImg');
x = "";
var IE = false;
if (browser.indexOf("Microsoft Internet Explorer") >= 0) {
 	IE = true;
}
imgLength = tImages.length;
for (i=0;i<imgLength;i++) {
 	if  (IE && (!tImages[i].complete)) {
 	 	tImages[i].src = "/twitter/twitter/images/no_image_found.gif";
 	} 
}
//alert (x);
}
 
//wahab: 4-Jun-09; show/hide profile div
function showProfile(close) {
// alert (close);
 
	if (close != undefined) {
			$('divProfile').style.visibility = "hidden";
			$('divProfile').style.display = "none";
	} else {
	 		$('divProfile').style.visibility = "visible";
			$('divProfile').style.display = "block";
			$('divProfile').style.top = "50px";
			$('divProfile').style.left = "50px";
			$('divProfile').style.position = "absolute";
	}
}  

/*wahab: 5-Jun-09; TipTop says this about ram from  3 hours ago till now & returns the query
ie ram
*/
function getQuery() {
 	return "";
	searchText =  $$('h2.main_headings a');
	searchText = searchText[0].innerHTML;
	pos = searchText.indexOf("+until:");
	if (pos >= 0 ) {
	 	searchText = searchText.substring(0,pos);
	}
		return searchText;
//	return searchText[0].innerHTML;
}
function getQueryWithTime() {
	searchText =  $$('div.preTime');
	searchText = searchText[0].innerHTML;
	p1 = searchText.indexOf('"/');
	p2 = searchText.indexOf('">From');
	return searchText.substring(p1+2,p2);
	
}
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}

obj=new Object();obj.onSuccess=dispMsg;
obj.method="get";obj.asynchronous=true; 
 
//sudeep: Added for invite a friend column 
function sendInvitation() {
var mailObj=new Object();mailObj.onSuccess=dispMsg;
mailObj.method="get";mailObj.asynchronous=true; 
var toMail=$F('to_email_address');
	if (toMail =="" || toMail=="Enter e-mail address") {
		$('divInviteStatus').innerHTML="Please enter e-mail address";
		return false;
	}
var filter=/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter.test(toMail)) {
	alert('Please provide a valid email address');	
	return false;
}
	
	mailObj.parameters = "to_email="+$F('to_email_address');
	var aj = new Ajax.Request(sitepath+"/invite_friend.php",mailObj);
	$('divInviteStatus').innerHTML="<b>Status: </b>Sending mail";
 }
function dispMsg(str) {
//wahab: 20-Oct; change the display message based on input
	str = str.responseText;
	if (str.indexOf('Message successfully sent') >= 0 ) {
		$('divInviteStatus').innerHTML ='<b>Status: </b> Message successfully sent';
		$('to_email_address').value = 'Enter e-mail address';
	} else {
	 	$('divInviteStatus').innerHTML = '<b>Status: </b>email was not sent, please try again.';
		$('to_email_address').value = 'Enter e-mail address';
	}
}
function remind(msg1) {
	$('status').innerHTML="";
}
function dispWizard(widget_type,query) {
 //alert(query);	
 param = "";	
 
 if (query == "undefined") {
  	query = "";
}
 
 if (widget_type != "") {
  	param = "type="+widget_type;
 }
var isLive = sitepath.toLowerCase().indexOf('feeltiptop');
//alert(isLive);
var gadget_path = "";
if(isLive>-1){ //if live 
//wahab: 14-Sep-09; prevent url from Google indexing
	 gadget_path = 'http://';
	 gadget_path +='widgets.feeltiptop.com';
	 gadget_path += '/twitter/twitter/gadget_wizard.php';
	}
else{ 
	gadget_path = '/gadget_wizard.php';
	}
 	if(query == ""){
var win=window.open (gadget_path +"?"+param,'mywin',"status=0,toolbar=0,location=0,menubar=0,scrollbars=1,height=520,width=980");
	}else{
	query = query.replace(/#/g,"%23");
var win=window.open (gadget_path+"?q="+query+"&"+param,'mywin',"status=0,toolbar=0,location=0,menubar=0,scrollbars=1,height=520,width=980");
	}
	
	win.focus();
}

function addNewResults(){
	//alert('addResults()');
	var seconds = $('search_again_time_stamp').innerHTML;
	//alert('For Test: Data will refresh in '+seconds+' seconds');
	if(seconds<120){
		seconds = 120; 
	}
	var miliSec = seconds * 1000; 
	//alert('For Test: Refresh message will com after '+seconds+' seconds');
	var t = setTimeout('addRefreshLine()',miliSec);	
}	
function addRefreshLine(){
    //alert('addRefreshLine()');
	//alert('For Test: Refresh message will com now');
	var valQuery = getQuery();
	valQuery = encodeURIComponent(valQuery);
	valQuery = valQuery.replace(/%23/g,"%2523");
	valQuery = valQuery.replace(/%2F/g,"/");
	$('refresh_link').innerHTML = '<center>There are more results since you started searching. <a href="/'+valQuery+'/">Refresh</a> to see them.</center>'; 
}


/* added by teena on 14/08/09 for utf-8 encoding and decoding
The JavaScript Source!! http://javascript.internet.com
Created by: Justas | http://www.webtoolkit.info/ */
var encodeString = {

 	// public method for URL encoding
 	encode : function (string) {
 		 return escape(this._utf8_encode(string));
 	},

 	// public method for URL decoding
	 decode : function (string) {
 	 	return this._utf8_decode(unescape(string));
 	},

 	// private method for UTF-8 encoding
 	_utf8_encode : function (string) {
  		string = string.replace(/\r\n/g,"\n");
 	 	var utftext = "";

  		for (var n = 0; n < string.length; n++) {
   			var c = string.charCodeAt(n);
   			if (c < 128) {
    				utftext += String.fromCharCode(c);
 			} else if((c > 127) && (c < 2048)) {
  				utftext += String.fromCharCode((c >> 6) | 192);
  				utftext += String.fromCharCode((c & 63) | 128);
 			} else {
  				utftext += String.fromCharCode((c >> 12) | 224);
  				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
 	 			utftext += String.fromCharCode((c & 63) | 128);
 			}
 	}

		return utftext;
	},

 	// private method for UTF-8 decoding
 	_utf8_decode : function (utftext) {
 		 var string = "";
 		 var i = 0;
 		 var c = c1 = c2 = 0;

  		while ( i < utftext.length ) {
  			 c = utftext.charCodeAt(i);
   			if (c < 128) {
    				string += String.fromCharCode(c);
    				i++;
  			 } else if((c > 191) && (c < 224)) {
 				   c2 = utftext.charCodeAt(i+1);
    				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
    				i += 2;
  			 } else {
 				   c2 = utftext.charCodeAt(i+1);
    				c3 = utftext.charCodeAt(i+2);
    				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
   				 i += 3;
 			  }
		  }
		return string;
	 }
}
  
//wahab: 1-Sep-09 bookmark code
// All browser bookmark script
function bookmarksite(param){

	bookMarkTitle = 'TipTop Search Engine';
	bookMarkUrl = 'http://feeltiptop.com';

	if (param != undefined) {
 		bookMarkUrl += '/'+param;
		bookMarkTitle = param + ' in TipTop'; 		
 	}

userAgent = navigator.userAgent;
//alert (userAgent);
userAgent = userAgent.toUpperCase();

if (userAgent.indexOf("CHROME")>=0) {
	alert ("Google Chrome users please press Ctrl+D to bookmark this page");
	return false;
}

if (userAgent.indexOf("SAFARI")>=0) {
 	alert ("Safari users please press Ctrl+D to bookmark this page");
	return false;
}
    
if (userAgent.indexOf("OPERA")>=0) {
 //	alert ("Opera users please press Ctrl+D to bookmark this page");


	var elem = document.createElement('a');
	elem.setAttribute('href',bookMarkUrl);
    elem.setAttribute('title',bookMarkTitle);
	elem.setAttribute('rel','sidebar');
	elem.click();

	return false;
//	return false;
}
//alert ("a");

if (userAgent.indexOf("FIREFOX")>=0) {
    window.sidebar.addPanel(bookMarkTitle, bookMarkUrl, "");
   	return false;
}
//alert ("b");
if (userAgent.indexOf("MSIE")>=0) {
 // ie
     window.external.AddFavorite(bookMarkUrl, bookMarkTitle);
   	return false;
}
}

function instSearchProvider() {
// alert ("abc");
  url = 'http://www.feeltiptop.com/twitter/twitter/tiptopsearch.xml';
  
  if (window.external) {
    window.external.AddSearchProvider(url);
  } else {
    alert ("No search engine support");
  }
}


function showdeadcenterdiv(divid) {
// First, determine how much the visitor has scrolled
//Xwidth = $(divid).style.offsetWidth;
//Yheight = $(divid).style.offsetHeight;
Xwidth = 305;
Yheight = 138;
var scrolledX, scrolledY;
if( self.pageYOffset ) {
scrolledX = self.pageXOffset;
scrolledY = self.pageYOffset;
} else if( document.documentElement && document.documentElement.scrollTop ) {
scrolledX = document.documentElement.scrollLeft;
scrolledY = document.documentElement.scrollTop;
} else if( document.body ) {
scrolledX = document.body.scrollLeft;
scrolledY = document.body.scrollTop;
}

// Next, determine the coordinates of the center of browser's window
 
var centerX, centerY;
if( self.innerHeight ) {
centerX = self.innerWidth;
centerY = self.innerHeight;
} else if( document.documentElement && document.documentElement.clientHeight ) {
centerX = document.documentElement.clientWidth;
centerY = document.documentElement.clientHeight;
} else if( document.body ) {
centerX = document.body.clientWidth;
centerY = document.body.clientHeight;
}

// Xwidth is the width of the div, Yheight is the height of the
// div passed as arguments to the function:
var leftOffset = scrolledX + (centerX - Xwidth) / 2;
var topOffset = scrolledY + (centerY - Yheight) / 2;
// The initial width and height of the div can be set in the
// style sheet with display:none; divid is passed as an argument to // the function
var o=$(divid);
var r=o.style;
r.position='absolute';
r.top = topOffset + 'px';
r.left = leftOffset + 'px';
r.display = "block";
}   

function getRandomQuery(boxNumber){
	if(randomQueries == ""){
	return;
	}
	randomValue = Math.floor ( Math.random() * randomQueries.length ); 
	randomQuery = randomQueries[randomValue];
	//alert(randomValue);
	//alert(randomQuery);
	if(boxNumber == 2){
		$('tiptopitform').elements[0].value = randomQuery;
		$('pickButton').innerHTML = "Pick Another";
		$('pickButton').className = "pick_link1";
	}
	if(boxNumber == 1){
		$('tiptopitform1').elements[0].value = randomQuery;
		$('pickButton').innerHTML = "Pick Another";
		$('pickButton').className = "pick_link1";
	}
/*	
	else if(boxNumber == 2){
		$('tiptopitform2').elements[0].value = randomQuery;
		//$('tiptopitform2').elements[1].value = "Pick another";
		$('pickButton2').value = "Pick another";
	}
*/
	else{
		$('q').value = randomQuery;
		$('pickButton').innerHTML = "Pick Another";
		$('pickButton').className = "pick_link1";
	}
	
	
	
	return;
}

//Ashutosh : To add search operators and option lines on concept click
function addLines(clickedTerm,isConcept){
if(isConcept == false){
$('newSearch').innerHTML = '';
	return;
}
var qry = text_query;
qry = qry.replace("'", "\'");
qry = qry.replace('"', '\"');
if(qry.toUpperCase()===clickedTerm.toUpperCase()){
	$('newSearch').innerHTML = '';
	return;
	}
var hrefLink = escape(actual_query + " " + clickedTerm);
hrefLink = hrefLink.replace('%23','%2523');
var str = "<span class='more_search'>Want more such results? Search for <a href='/"+hrefLink+"/'>"+qry+" " +clickedTerm+"</a>";
str += " or only <a href='/"+escape(clickedTerm)+"/'>"+clickedTerm+"</a>.</span>";
var	tmpClickedTerm = escape(actual_query + " -" + clickedTerm);
tmpClickedTerm = tmpClickedTerm.replace('%23','%2523');
str += "<span class='more_search'>Want to exclude <i>"+clickedTerm+"<\/i> from the results? Search for <a href='/"+tmpClickedTerm+"/'>"+qry + " -" + clickedTerm+"</a>.</span>";
$('newSearch').innerHTML = str;
return;
}

function showHideRemoveFilterIcon(param,isConcept){
//Ashutosh : April, 2010 : To add "remove filter" icon next to clicked concept and remove the previously added icon.
$('concept_cloud').innerHTML =  $('concept_cloud_hidden').innerHTML;
if ("oriMsg" != param){
		var removeButton =  '<a class="no_filter" onmouseover="Tip(\'Click to clear filter.\')" onmouseout="UnTip()" onclick="displayTweet(\'oriMsg\',this,false)"><img src="'+sitepath+'/images/clear.gif"/></a>';
	$('remove_filter_'+param).innerHTML = removeButton;
	}
}


function displayTweet(param,obj,isConcept) {
//wahab: 22-Oct-09; modified to suit new layout
//Ashutosh :22-Oct-09; for apache log
//alert (param);
var clickedTerm = $(obj).innerHTML;
addClicksToLog(param,'Results_Filtered_By');
showHideRemoveFilterIcon(param,isConcept);
addLines(clickedTerm,isConcept);
deselectConcept();
$(obj).className = "conceptHighlight";
//for oriMsg display all rows
if (param == "oriMsg") {
  	showContainers();
	showHideTableRows('tblPositive',null,true);
	showHideTableRows('tblNegative',null,true);
	showHideTableRows('tblNeutral',null,true);
} else {
//pass table name, JSON key eg ( 	
if ((jsonData[param+"_positive"] == undefined) && (jsonData[param+"_negative"] == undefined)) {
 	//alert ("both");
	$('Tips').hide();
	$('tipsBottom').hide();
	
	$('piTs').hide();
	$('pitsBottom').hide();

} else {
	$('Tips').show();
	$('tipsBottom').show();
	
	$('piTs').show();
	$('pitsBottom').show();
 	
	showHideTableRows('tblPositive',param+"_positive",false);
	showHideTableRows('tblNegative',param+"_negative",false);
}


if (jsonData[param+"_neutral"] == undefined) {
//no neutral data
 	$('remaining').hide();
 	$('remainingBottom').hide();	  	
} else {
 	$('remaining').show();
 	$('remainingBottom').show();
	showHideTableRows('tblNeutral',param+"_neutral",false);
	}
}  
fitScrollBars();
}

//wahab: 23-Oct-09; used to show / hide rows
function showHideTableRows(table,keyStrIDs,showAllRows){
//alert ("table " + table + " key str " + keyStrIDs + " all " + showAllRows);
//show only required rows
if (!showAllRows) {
//get ids for the corresponding key
	strIDs = jsonData[keyStrIDs]; 	
//	alert ("table +" + table + "ids " + strIDs + " key str " + keyStrIDs + " all " + showAllRows);
//key is not there. Hide entire table
	if (strIDs == undefined) {
	 	$(table).hide();
	 	return;
	 	
}else {
//show the table
	 	$(table).show();
	}
} else {
 	 	$(table).show();
}

//count number of rows & get rows
	tableLength = $(table).rows.length;
 	rows = $(table).rows;
	for (i=0;i<tableLength;i++) {
		row = rows[i].cells
//need to show all rows. 
		if (showAllRows) {
		 	row[0].style.display = "";		
		 	continue;
		} 
//selectivly show required rows & hide remaining
			j = i+1;
		 	rowId = ","+j+",";
			if (strIDs.search(rowId) != -1) {
//show the row
			 	row[0].style.display = "";
			} else {
//hide it			 
			   row[0].style.display = "none";	
			}
	}	 	
}

//wahab: 23-Oct-09 recreate scroll bars 
function fitScrollBars() {
 	var scrollbarPos = new Control.ScrollBar('scrollbar_contentPos','scrollbar_trackPos'); 
 	scrollbarPos.recalculateLayout();

 	var scrollbarNeg = new Control.ScrollBar('scrollbar_contentNeg','scrollbar_trackNeg'); 
	scrollbarNeg.recalculateLayout();

	var scrollbarNeut = new Control.ScrollBar('scrollbar_contentNeut','scrollbar_trackNeut'); 
	scrollbarNeut.recalculateLayout();

} 

function hide(obj){
	$(obj).style.display="none";
}
function show(obj){
	$(obj).style.display="block";
}

function showHideWindow(obj,what) {
	if (what == "show") {
		$(obj).style.visibility = "visible";
	 	$(obj).style.display = "block";
	} else {
	 	$(obj).style.visibility = "hidden";
	 	$(obj).style.display = "none";
	}
}

/*
* Below code perform time slider operations
* Added by: Ashutosh Anand
* Date: 27-OCT-2009
*/
//Ashutosh : 27-OCT-2009 : For Indication of New Results (Blinking)
//alert('New Results will come at '+new_results_appear_time+' seconds');
function checkLatest(){
//if (typeof new_results_appear_time != "undefined"){
	try{
	new_results_appear_time = (new_results_appear_time < 120) ? 120 : new_results_appear_time;
	}catch(err){
	new_results_appear_time = 120;
	}
	//alert('Blink for Latest Results will come at '+new_results_appear_time+' seconds');	
	new_results_appear_time = new_results_appear_time * 1000;
	setTimeout('blinkLatest()',new_results_appear_time);
}
function blinkLatest(){
	//alert('blinking starts');
	if($('slider_latest')){
			$('slider_latest').innerHTML = '<blink>Latest</blink>';
			document.title = '(1+) '+document.title;
		}
	}
	

//Ashutosh : 27-OCT-2009 : For Handeling slider movements
function sliderHandler(pos, slider) {
	//alert('sliderHandler('+pos+',slider)');
	setTimeout('makeNewSearch('+pos+')',1000);
	}	

	function makeNewSearch(position){
	//alert(position);
	var latest_query = decodeURIComponent(actual_query);
	var earlier_query = decodeURIComponent(nextQuery)
	var still_earlier_query = decodeURIComponent(actual_query+' until:'+prevUntilDate);
	latest_query = latest_query.replace('#','%2523');
	earlier_query = earlier_query.replace('#','%2523');
	still_earlier_query = still_earlier_query.replace('#','%2523');
	latest_query = latest_query.replace('%23','%2523');
	earlier_query = earlier_query.replace('%23','%2523');
	still_earlier_query = still_earlier_query.replace('%23','%2523');
	
	if(0==position) {//previous day (Still earlier)
		if(''==prevUntilDate){
			return;
			}
		//alert('/'+still_earlier_query+'/');
		window.location.href = '/'+still_earlier_query+'/';
		return false;
		}
	if(33==position) {//previous 100 results (earlier)
		if(''==nextQuery){
			return;
			}
		//alert('/'+earlier_query+'/');
		window.location.href = '/'+earlier_query+'/';
		return false;
		}
	if(99==position) {//latest results
		//alert('/'+latest_query+'/');
		window.location.href = '/'+latest_query+'/';
		return false;
		}
	return;
	}//function makeNewSearch() ends

function checkErarlier(){
	//Ashutosh : 28-Oct-09 : For Indicating No Earlier or Still Earlier Results are available
	//alert('function checkErarlier()');
	if(!prevUntilDate){$("slider_still_earlier").innerHTML = '<del>Day(s) earlier</del>';}
	if(!nextQuery){$("slider_earlier").innerHTML = '<del>Just prior</del>';}
	return;
	}
//Ashutosh : Code for Time Slider Ends Here

//wahab: 2-Nov-09; hide tips / pits container when no tweet in both
// also hide neutral 
function hideEmptyContainers() {
 return;
 rowsPos = $('tblPositive').rows.length;
 rowsNeg = $('tblNegative').rows.length;
 rowsNeut = $('tblNeutral').rows.length;

if (rowsPos==0 && rowsNeg==0) {
//no positive & negative tweet. So hide both
	$('Tips').hide();
	$('piTs').hide();
}

if (rowsNeut==0) {
//no neutral tweet.
	$('remaining').hide();
}
}

//wahab: 4-Nov-09 fix 
//Remaining Messages module does not return after clicking Filter Results by: entrepreneur (where the RM module disappears-good!) then clicking "All Results" doesn't bring back "Remaining Messages"
function showContainers() {
	rowsPos = $('tblPositive').rows.length;
	rowsNeg = $('tblNegative').rows.length;
	rowsNeut = $('tblNeutral').rows.length; 	

if (rowsPos!=0 || rowsNeg!=0) {
//no positive & negative tweet. So hide both
	$('Tips').show();
	$('piTs').show();
}

if (rowsNeut!=0) {
//no neutral tweet.
	$('remaining').show();
}
}
//Ashutosh : Nov-16-2009
//On The Web : Retip
function web_retip(str){
var twurl = "http://twitter.com/home?status="+encodeURIComponent(str);var tweetShare=window.open(twurl,"Retweet","toolbar=0,status=0,width=626,height=436");tweetShare.focus();return false;
}

//Added by Mahesh: 25th-Jan-2010
//Product Module: ReTip
/*function prod_retip(str){
var tweetTxt=str;
tweetTxt = unescape(tweetTxt);
var lenTweet=tweetTxt.length;
 if(lenTweet>137){
var lenRem=lenTweet-137;
tweetTxt = tweetTxt.substring(0,(Math.abs(lenTweet-lenRem)));
tweetTxt = tweetTxt.substring(0,(tweetTxt.lastIndexOf(',')+1))+' ...';
}
else{
tweetTxt = tweetTxt+'...';
}
tweetTxt = tweetTxt.replace("'","");
var twurl = "http://twitter.com/home?status="+encodeString.encode(tweetTxt);
var tweetShare=window.open(twurl,"twitter","toolbar=0,status=0,width=626,height=436");tweetShare.focus();
return false;
}*/

//Added by Mahesh: 25th-Jan-2010
//People Module: ReTip
/*function people_retip(str){
var tweetTxt=str;
tweetTxt = unescape(tweetTxt);
var lenTweet=tweetTxt.length;
 if(lenTweet>137){
var lenRem=lenTweet-137;
tweetTxt = tweetTxt.substring(0,(Math.abs(lenTweet-lenRem)));
tweetTxt = tweetTxt.substring(0,(tweetTxt.lastIndexOf(',')+1))+' ...';
}
else{
tweetTxt = tweetTxt+'...';
}

var twurl = "http://twitter.com/home?status="+encodeString.encode(tweetTxt);
var tweetShare=window.open(twurl,"twitter","toolbar=0,status=0,width=626,height=436");tweetShare.focus();
return false;
}*/
//sowmya:feb 8,2010 for page for now Re-Tip
//sowmya:Mar 22,2010 :Added different messages for different queries(from,to,@,normalQueries)
//Sowmya:18 June,2010:Added condition if length is >140 characters (chopping query)
function overalltweet(orginalQuery,encodedQuery,query, pos, neg, neut, concept)
{			
			//To add query to MyTipTop on clicking This Page in consolidated I Like button.
			//Mahesh.
	query = query.replace("%3A","^^");
	addQueriesToCookie('ILike', query, pos, neg, neut, concept);
				/*var obj = new Object();
				obj.positive = pos;
				obj.negative = neg;
				obj.neutral = neut;
				obj.concept = concept;
				obj.query = unescape(query);
				returnVal = createCartCookies('QueriesId',obj,0);*/
 	var textBoxContent;	 
	var widgetquery = encodedQuery.replace(/%2523/g,"%252523");
	//alert(widgetquery);
	var siteMainUrl = 'http://feeltiptop.com/'+widgetquery+'/';
	var sampleWord = 'Reply';
	//var widgetquery = encodedQuery.replace(/#/g,'%2523');
	var widgetUrl = sitepath+'/gadget_wizard.php?q='+widgetquery;
	//alert(widgetUrl);
	var long_urls =  siteMainUrl+'<=>'+widgetUrl;
	RecursiveTipsPitsURL(sampleWord,long_urls,'');
	var splitUrls = tipspits_status.split(' ');
	var pageShortUrl = splitUrls[0];
	var widgetShortUrl = splitUrls[1];

 	if(orginalQuery.indexOf('from:')!= -1)
 	{
 	 	var userNameQuery = orginalQuery.substr(5);
 	 	 userNameQuery = userNameQuery.replace(/"/g,'');
 	 	 userNameQuery = userNameQuery.replace(/'/g,'');
	 	textBoxContent = 'Looking at tweets by @'+userNameQuery+' in TipTop at http://FeelTipTop.com/'+encodedQuery;
 	}
	else if(orginalQuery.indexOf('to:')!= -1)
	{
	 	var userNameQuery = orginalQuery.substr(3);
		userNameQuery = userNameQuery.replace(/"/g,'');
		 userNameQuery = userNameQuery.replace(/'/g,'');
  		textBoxContent = 'Looking at tweets sent to @'+userNameQuery+' in TipTop at http://FeelTipTop.com/'+encodedQuery;
	}
	else if(orginalQuery.indexOf('@')!= -1){
		orginalQuery = orginalQuery.replace(/"/g,'');
		 orginalQuery = orginalQuery.replace(/'/g,'');
	textBoxContent = 'Looking at tweets about '+orginalQuery+' in TipTop at' +pageShortUrl;
	}
	else{
		orginalQuery = orginalQuery.replace(/"/g,'');
		 orginalQuery = orginalQuery.replace(/'/g,'');
	 textBoxContent = 'Discover the latest influencers, tips & trends for TipTop\'s "'+orginalQuery+'" page at '+pageShortUrl+' Embed at '+widgetShortUrl;   
	}
//	alert(textBoxContent);
	var textBoxLen = textBoxContent.length;
	if(textBoxLen>140)
	{
	 		orginalQuery = orginalQuery.replace(/"/g,'');
		orginalQuery = orginalQuery.substring(0,(orginalQuery.length-(textBoxLen-135)))+' ...';
		textBoxContent = 'Discover the latest influencers, tips & trends for TipTop\'s "'+orginalQuery+'" page at '+pageShortUrl+' Embed at '+widgetShortUrl; 
	}
	var textBoxVal = encodeURIComponent(textBoxContent);
	var tweetShare=window.open('http://twitter.com/home?status='+textBoxVal, 'twitter', 'toolbar=0,status=0,width=626,height=436');
	tweetShare.focus();  
}


var ajaxObj = new Object();
ajaxObj.method = 'post';
ajaxObj.asynchronous = true;
ajaxObj.onSuccess = dispUrlTitle;

function getPageTitles() {
	//alert('getPageTitles');
	//alert(actual_query);
	strJsonUrls = $('divJsonUrls').innerHTML;
	//alert('AJAX REQUEST : '+sitepath+'/get_json_data.php?json='+strJsonUrls);
	ajaxObj.parameters = 'json='+strJsonUrls+'&query='+actual_query;
	new Ajax.Request(sitepath+'/get_json_data.php',ajaxObj);
}

function dispUrlTitle(str) {
  	//alert('AJAX RESPONSE : '+str.responseText);
	var ajaxResponse = str.responseText.trim();
	if(0 == ajaxResponse.length) {return;}
	var arrResponse = ajaxResponse.split('####web_retip####');
	if(2 == arrResponse.length){
		webRetip = arrResponse[1];
		webRetip = webRetip.replace(/&quot;/g,'"');
		webRetip = webRetip.replace(/&#34;/g,'"');
		$('on_the_web').innerHTML = "<div class=\"top_onweb\"><div class=\"cm_blue_head\"><span>Top Pages on the Web <a href=\"#\" class=\"all_tip\" onmouseout=\"UnTip()\" onmouseover=\"Tip('Links to relevant web pages are provided. The links that appear after a green bullet are from the Tips section, while those that appear after a red bullet are from the piTs section.', BGCOLOR, '#ffda53', WIDTH, 310)\"></a></span></div><div class=\"clr\"></div><div class=\"outBlk_cmbl\"><div class = \"time_font\">"+arrResponse[0]+"</div></div></div>";
	}
return;
}

var objtop = new Object();
objtop.method = 'get';    
objtop.asynchronous = false;

function getUrlsforTopTweets(long_urls)
{
	var ajaxRequest;  // The variable that makes Ajax possible!
	var toptweets = true;
	var url = sitepath+'/bitly_recursive_api.php?long_urls='+long_urls+'&toptweets='+toptweets;
	objtop.onSuccess = function(str)
	{
		bitlyWorked = true;
		finaltweets_status = str.responseText;
		//alert(finaltweets_status);
		if(0 == finaltweets_status.length)
		{
			bitlyWorked = false;
		}
		return;
	}
	ajaxRequest = new Ajax.Request(url,objtop);
	return;
}


//sowmya:20-jan-2010 for tweet entry box in the search results page
//Sending entered data to twitter in suggestions box
//Sowmya : 13-May-2010 for Tell TipTop button in search page
function sendtotwittiptop()
{
	var searchdata = $('twittersearch').value;
	var addTwittiptopID = '@twittiptop ';
	textboxlen = searchdata.length+addTwittiptopID.length;
	if(searchdata!=''&&searchdata!="Add your Tip here...")
	{
		if(textboxlen<=140)
		{      
			textboxval = addTwittiptopID +encodeURIComponent(searchdata);
			var tweetShare=window.open('http://twitter.com/home?status='+textboxval, 'sharetip', 'toolbar=0,status=0,width=626,height=436');
			tweetShare.focus();
		}		
	}
}
function getsearchtextboxdata()
{	
	var searchdata = $('twittersearch').value;
	textboxlen = searchdata.length;
	if(searchdata!=''&&searchdata!="Add your Tip here...")
	{
		if(textboxlen<=140)
		{      
			textboxval = encodeURIComponent(searchdata);
			var tweetShare=window.open('http://twitter.com/home?status='+textboxval, 'sharetip', 'toolbar=0,status=0,width=626,height=436');
			tweetShare.focus();
		}		
	}
	$('twittersearch').value = "Add your Tip here...";
	//$('twittersearch').innerHTML = "Add your Tip here...";
	counterSearchHub();//character count should be proper.
	disablebutton(-1);//passing -1 because the button should be disabled.
}
//For Character Count in suggestions Box
function counterSearchHub()
{
 //	alert('counter hub');	
 	var searchdata = $('twittersearch').value;
 	if(searchdata!='Add your Tip here...')
 	{
		remainingLen = 140-searchdata.length;
		$('characters').innerHTML = remainingLen;
		disablebutton(remainingLen);
	}
	else
	{
		$('characters').innerHTML = 140;
	}
//	alert($('characters').innerHTML);
}
function disablebutton(maxlength)
{
 	// document.getElementById
	var searchdata =$('twittersearch').value;
	if(searchdata!=''&&maxlength>=0&&maxlength!=140&&searchdata!="Add your Tip here...")
	{
		$('spanbutid').style.cursor="pointer";
		$('spanbutid').style.color="#000";
	}        
	else
	{
		$('spanbutid').style.cursor="text";
		$('spanbutid').style.color="#aaa";
	//	$('characters').innerHTML = 140;
	}
}    
function onthewebretip(query, pos, neg, neut, concept)
{				
			//To add query to MyTipTop on clicking Top Web Pages link in consolidated I Like button.
			//Mahesh.
				/*var obj = new Object();
				obj.positive = pos;
				obj.negative = neg;
				obj.neutral = neut;
				obj.concept = concept;
				obj.query = unescape(query);
				returnVal = createCartCookies('QueriesId',obj,0);*/
				query = query.replace("%3A","^^");
				addQueriesToCookie('ILike', query, pos, neg, neut, concept);
 	//Ashutosh : April 16, 2010 : Modified On the web retip logic
	if(''!=webRetip)  
	{
 		var tweetShare=window.open('http://twitter.com/home?status='+encodeURIComponent(webRetip), 'twitter', 'toolbar=0,status=0,width=626,height=436');
		tweetShare.focus();          
 	}
	else
	{
		alert('There are no Top Web Pages. Please choose something else to Re-Tip.');
	}
}
function dispProfile() {
	$('divProfile').style.visibility = "visible";
	$('divProfile').style.display = "block";
}

function getShoppingProductList() {
	if (json_shopping=="no data" || json_shopping=='"no data"') {
	 	return;
	}
	json_shopping=json_shopping.evalJSON();
	for(i=0;i<json_shopping.length;i++) {
	divAsinId=new String(json_shopping[i]);
	divAsinId=divAsinId.split(",");
//		if(!isNaN(divAsinId[1])){
	shopObj.parameters='divId='+divAsinId[0]+'&asin='+divAsinId[1]+'&nojson';
	displayBusyImg(divAsinId[0]);
	result=new Ajax.Request(sitepath+'/amazon/includes/get_ratings.php',shopObj);
//	}
	} 
}
function displayBusyImg(imgId) {
 	obj=$('overall_valmoney'+imgId);
if (obj) {
	obj.style.visibility="visible";
	obj.style.display="block";
	}
}
//wahab: 17-Dec-09; shopping ajax
function displayShoppingProductList(str) {
json=str.responseText;
json=json.trim();

if (json.indexOf('invalid param') >= 0 || json.indexOf('timeout') >= 0 ) {
//display N/A for rating
	divId=json.split(',');
	strRating='<span><b>Overall Quality: N/A</b></span><br />';
	strRating += '<span><b>Value for Money: N/A</b></span><br />';
	$('overall_valmoney'+divId[1]).innerHTML=strRating;
} else {
arrResult=json.split(',');
tagId='overall_valmoney'+arrResult[0];
strRating='<span><b>Overall Quality: '+arrResult[1]+'</b></span><br />';
strRating += '<span><b>Value for Money: '+arrResult[2].replace("]","")+'</b></span><br />';
$(tagId).innerHTML=strRating;
}
	return;
}

function addChannelData() {
 	//alert (addChannelQuery);
	var channelToAdd=$F('cboChannelName');
	channelObj.parameters='q='+addChannelQuery+'&nodisplay';
	filePath=sitepath+'/'+channelToAdd;
//	alert (channelObj.parameters);
	//alert (filePath);
	$('divAddChData').innerHTML="Addition was successful.";
	$('spanAddChData').style.visibility = "visible";
	$('spanAddChData').style.display = "inline";
	new Ajax.Request(filePath,channelObj);
//	alert (filePath);
}

function dispChConfirmation(str) {
}
function showTrendsData(bln) {
 	if (bln) {
 	 	$('trendsLog').style.visibility = "visible";
 	 	$('trendsLog').style.display = "block";
 	} else {
 	 	$('trendsLog').style.visibility = "hidden";
 	 	$('trendsLog').style.display = "none";
 	}
 		
	  		
}

function windowCollapse(){
	Effect.SlideUp('more_best_peeps'); 
	$('collapseButton').onclick = "";
	$('expandButton').onclick = windowExpand;
	$('collapseButton').src = sitepath+"/images/collapse.gif";
	$('expandButton').src = sitepath+"/images/exp_act.gif";
	$('collapseButton').className = "inactiveArrow";
	$('expandButton').className = "activeArrow";
	return false;
}
function windowExpand(){
	Effect.SlideDown('more_best_peeps'); 
	$('expandButton').onclick = "";
	$('collapseButton').onclick = windowCollapse;
	$('expandButton').src = sitepath+"/images/exp.gif";
	$('collapseButton').src = sitepath+"/images/collapse_act.gif";
	$('expandButton').className = "inactiveArrow";
	$('collapseButton').className = "activeArrow";
	return false;
}
/*function loadPageUrl(url){
window.open('/'+url+'/','','height=800,width=800,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');return false;
}*/
function loadPageUrl(url){
	frompath='/'+url+'/';
	//alert(frompath);
	$('myform').action=frompath;
	$('myform').submit();
	return ;
}
function loadPageUrlbeta(url){
	frompath=url;
	//alert(frompath);
	$('myform').action=frompath;
	$('myform').submit();
	return ;
}
function loadPageUrlTips(url){
	frompath='/'+url+'/';
	//alert(frompath);
	$('myform_tipssection').action=frompath;
	$('myform_tipssection').submit();
	return ;
} 
var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;
function mopen(id){	
	mcancelclosetime();
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';
}
function mclose(){
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}
function mclosetime(){
	closetimer = window.setTimeout(mclose, timeout);
}
function mcancelclosetime(){
	if(closetimer){
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}
document.onclick = mclose;


var objRetip = new Object();
objRetip.method = 'get';
function getAutomaticRetip(user,tweetUrl,query,pageUrl,fromPeople,removePeople){
/*
* Ajax Function to call retip from tip off for TiTop people module
* Added by: Teena
* Date: 08-03-2010
* Used for automatic retip from tip off
*/
//alert('worked');
var ajaxRequest; // The variable that makes Ajax possible!
query = encodeString.encode(query);
var url = sitepath+'/tipoff_retip_api.php?user='+user+'&tweetUrl='+tweetUrl+'&query='+query+'&pageUrl='+pageUrl+'&fromPeople='+fromPeople+'&removePeople='+removePeople;
//alert(url);
objRetip.onSuccess = function(str){
retip_status = str.responseText;
//alert(retip_status);
return;
}
ajaxRequest = new Ajax.Request(url,objRetip);
return;
}
 
//Sowmya:26-Mar-2010 for opening window using javascript onclick for concepts in tweet
function conceptBoldinTweets(conceptQuery)
{
 	conceptQuery = conceptQuery.trim();
	openpath = '/'+conceptQuery;
	window.open(openpath);
	return ;
}


//wahab: 3-May-10; delay downsizing text box after mouseout
var textBoxTimer;
var txtId;
function changeSize(what,obj) {  
//wahab: 22-mar-10; enlarge query text box when user hover mouse or click it. Return to original state when mouse moved away or lost focus.
//clear previous instance if any
 	clearTimeout(textBoxTimer); 
	if (what == "inc") {
	 	if (obj.style.width == "670px") {
	 	 	return;
		}	
		obj.style.width = "670px";
		return;
	} else {
	 	if (obj.style.width == "140px") {
	 	 	return;
		}	
		txtId = obj;
		textBoxTimer = setTimeout('reduceWidth()',2000);
		return false;
	}
}
//wahab 3-May-10; reduce width of text box
function reduceWidth() {
	txtId.style.width = "140px"; 
	return false;
}
/*function changeSize(what,obj) {  
 
browser = navigator.appName;
//alert (browser);
//wahab: 22-mar-10; enlarge query text box when user hover mouse or click it. Return to original state when mouse moved away or lost focus.
	if (what == "inc") {
//	 	alert (obj.style.width);
	 	if (obj.style.width == "670px") {
	 	 	return;
		}	
		obj.style.width = "670px";
//		obj.focus();	
	} else {
	 	if (browser.indexOf("Microsoft Internet Explorer") >= 0) {
	 		if (obj.style.width == "130px") {
	 	 		return;
			}
		}
		else
		{
			if (obj.style.width == "140px") {
	 	 		return;
			}
		}	
	 //	obj.style.width = "145px";
//clear previous instance if any
	clearTimeout(textBoxTimer); 
	txtId = obj;
	textBoxTimer = setTimeout('reduceWidth()',2000);
	return false;
	}
}
//wahab 3-May-10; reduce width of text box
function reduceWidth() {
 	if (browser.indexOf("Microsoft Internet Explorer") >= 0) {
	txtId.style.width = "130px"; 
	txtId.style.paddingRight = "10px";
		return false;
	}
	else
	{
		txtId.style.width = "140px"; 
		return false;
	}
}*/




