/* Note: PLEASE PUT ALL COMMENTS IN MULTILINE SYNTAX FORMAT , e.g. */   /* comment */
/* This type of comment is reliably stripped out */

/* 
This is one master file containing all the JS files formerly called individually on the Clean channel and reply-type pages.
=====================================================
Formerly CONTENTS of w3c.js file 
=====================================================
*/

function ss(w){window.status=w;return true;} /*set status bar text */
function cs(){window.status='';} /* clear status bar text */

/* Check Version: increment this number by 1 when you update all.js. Must synch with version in version.html (or an infinite loop will result). */
function cv() { return 1; }

/* Reusable client sniffing stuff */
function an() {return navigator.appName;} /* return client browser appName*/
function av() {return navigator.appVersion; }/* return client browser appVersion */
function ua()  {return navigator.userAgent; } /*return client useragent */
function mac() {var m=av().indexOf("Mac"); if (m != -1) {return true;} else {return false;}} /* true/false- Mac */
function lnx() {var l=ua().indexOf("Linux"); if (l != -1) {return true;} else {return false;}} /* true/false- Linux*/
function sfr() {var l=ua().indexOf("Safari"); if (l != -1) {return true;} else {return false;}} /* true/false- Safari */

/* Reusable form sniffing stuff */
function qs( D ) { 	/* Return qsrc value on given document.form object (D) */
	var qsrc = (D.qsrc) ? D.qsrc.value : "";
	return qsrc;
}
function og( D ) { /* Return o parameter on given document.form object (D) */
	var o = (D.o) ? D.o.value : "";
	return o;
}
function qu( D ) { /* Return q parameter (user's value from input box) on given document.form object (D) */
	var q = (D.q) ? D.q.value : "";
	return q;
}

/*This is used in the rollover events to change one image to another on form buttons */
function changeButtonPic(cmdButton, src) { 
	 cmdButton.src = src; 
}
/*This leftalign() function positions Related Search*/
/* 
In general: if the window is too narrow, the related search is positioned statically at about 595px. 
Otherwise, it's dynamically positioned based on about 75% of the width
*/
function leftalign()
{	
	var L = 830; /*L = leftposition*/
	/* IE positioning */
	if (document.all)	{
		var R = document.all['RelatedSearchOutline']; 
		if (R) {
			var b = document.body;
			var o = b.offsetWidth;
			var f =0; /*f => Related Search Outline left */
			if (o > (L - (o)*0.02))
			{		
				f = (mac()) ? (o)*0.78 : (o)*0.75 ;
			}
			else
			{
				f = (mac()) ? L-200 : L-230;
			}
			R.style.left = f;
		}
	}
	/* Mozilla positioning */
	else
	{
		var R2 = document.getElementById("RelatedSearchOutline");
		if (document.getElementById && R2)
		{
			var w = window.innerWidth; /* variable width: 891, 700, etc */
			var p=0.73;
			if (sfr()) {  p=0.76; 
			}else if (mac()||lnx()){p=0.75; }
			var w2 = w*0.02; /* 20% of width: 17.34, 11.23, etc */
			var l2 = (L-w2); /* 830px minus 20% of window's width. 812.98, 825.45, etc */
			
			if (w > l2) { /* The window is wider than recalc'd left position */
				R2.style.left = ""+(w*p)+"px"; /* Move Related Search to ~75% of window's width */
			}
			else {
				var l3 = (L-235);
				R2.style.left = l3+"px";
			}
		}
	}
}

function reloadme(){window.location.reload();}

/* Consolidated all submitqboxbyval[X] functions
	strDest 				1=pictures, 2=news, 3=products, FULL TABLE OF IDS BELOW FUNC
	barID 				"questionbar" or "questionbarbottom" (or other <form> id)
	redirectDomain 	"http://www.ask.com/" (up to forward slash following domain. Can be null.)
*/
function submitQBox(strDest, barID, redirectDomain) {

	var D = document[barID]; /*form object*/
	var qsrc = qs(D); 	/* Find qsrc on form */
	var o = og(D);		/* Find o parameter on form*/
	var q = qu(D);		/* Find user's value from input box on form*/

	/* Localization */
	var currentDomain = "http://web.ask.com/";
	if(redirectDomain && ("" != redirectDomain)) {
		currentDomain = redirectDomain;
	}

	/* Piece together the query */
	var query = "q=" + enc(q);
	
	
	/* Product is a special case */
	if ('3' == strDest) {
		var u = "http://products.ask.com";	/*BLANK QUERY*/
		if ('' != q) {	
			u = "http://ask2.pricegrabber.com/search_gen_top.php?topcat_search=1&form_keyword="+q+"&qsrc="+qsrc+"&o="+o;
		}
		window.top.location.href = 'http://tm.ask.com/r?t=c&s=a&id=10315&sv=z6f6365e5&uid=20a00155a0a00155a&sid=30a00155a0a00155a&p=%2fweb&o='+o+'&u='+u;
	} else {	/* ste=1 is pictures, ste=2 is news */
		query = currentDomain + "web?" + query + "&ste=" + strDest + '&o=' + o + '&qsrc=' + qsrc;
		window.top.location.href = query;
	}
	/* return true; */
}

/* This function appends the query onto the <a> href 
 	Except products - that is replaced altogether. 
	Here are static Javascript IDs for the destination sites/channels: 
 	- these should not change even if UI or display order does
			0	Web				
			1	Pictures
			2	News	
			3	Products
			4	Local
			5	Kids
			6	Jeeves IQ
			7	Maps	
			8	Directions
			9	Local News
			10	Weather
*/

function appendQ(strDest, barID, el) {
	var D = document[barID]; 	/*form object*/
	var qsrc = qs(D); 	/* Find qsrc on form */
	var o = og(D);		/* Find o parameter on form*/
	var q = qu(D);		/* Find user's value from input box on form*/

	
	if(q) {


		q = enc(q);


		/* Piece together the query */
		var query = "q=" + q;
		var href = "";
		/* Pricegrabber is special as the url with no query is http://products.ask.com, but
		   if there is a query it's http://ask2.pricegrabber.com/....*/
		if(strDest == 3) {
			var productURL = "http://ask2.pricegrabber.com/search_gen_top.php?topcat_search=1&form_keyword="+q+"&qsrc="+qsrc+"&o="+o;
			el.href = el.href.replace(/http:\/\/Products.ask.com\//i, productURL); /* special url for pricegrabber */
		}
		else {
			var channel = "web?";
			if(strDest == 1) { channel = "pictures?"; }
			if(strDest == 2) { channel = "news?"; }
			if(strDest == 4) { channel = "blogsearch?"; }
			if (strDest == 5) //KIDS
			{
				query = "&ask=" + q;
				channel = "";
				o ="";//origin is already in base href
			}
			if (strDest == 6) //JEEVESIQ
			{
				query = "&" + query;
				channel = "";
				o ="";//origin is already in base href
			}

			href = channel + query ;
			if (o)	href += '&o=' + o;	//this may be elsewhere in URL, so don't append if not set here
			href += '&qsrc=' + qsrc;
			
			//NEWS handling
			if((strDest == 2)&&(q != ""))
			{
				href += '&news=true';
			}

			el.href += href;
		}
	} else {
		return true;
	}
}

/* VL: who uses this? */
function setValue (item, value) {
	if(item && value) {
		item.value = value;
	}
	return;
}

/**
 * this function checks if the answer should be opened
 * in new window. If yes, it opens a new window with the
 * answer and returns false; otherwise returns true.
 */
function submitKAForm(form)
{
	if (form) {
		newWin = false;
		cook = document.cookie;
		if (cook) {
			pos = cook.indexOf("newwin=");
			if (pos != -1) {
				value = cook.substring(pos+7, pos+11);
				newWin = ("True" == value) ? true : false;
			}
		}
		fullUrl = form.action + "?";
		if (form.elements) for (k=0; k<form.elements.length; k++) {
			elem = form.elements[k];
			fullUrl = fullUrl + "&" + elem.name + "=" + escape(elem.value);
		}
		if (newWin) { window.open(fullUrl); return false; }
	}
	return true;
}


/* 
=====================================================
Formerly CONTENTS of preview.js file  (BINOCULARS)
=====================================================
*/
var y1 = 20;   /* change the # on the left to adjust the Y coordinate */
var BinocURL = 'http://binoculars.ask.com/binocl_get?url=';
var PreviewInProcess = false;

function hideIt() {
	if (document.layers) {}
	else {
		PreviewInProcess = false;
		document.getElementById('binocPreview').style.visibility='hidden';
		document.getElementById('binocPreview').innerHTML = "";
		document.getElementById('binocCover').style.display='none';
	}
  }
 
/*FUNCTION: getRealPos() - used to get the offsetTop for elements.  This is used because IE5 does not handle 
  offsetTop correctly when DIVs are positioned relatively */
function getRealPos(el,which) {
	iPos = 0
	while (el!=null) {
	 	iPos += el["offset" + which]
		el = el.offsetParent
	}
	return iPos
}
  
function finalizeshow(ItemOrd, PreviewWidth, PreviewHeight)
{  
	if (document.layers) 
	{
		/*
		document.layers['binocPreview'].visibility='show';
		document.layers['binocPreview'].innerHTML = '<img src='+BinocURL + BinocParam + ' />';
		document.layers['binocImpression'].innerHTML = '<img src='+ImpressionURL + LogParam+' />';
		*/
	}
	else 
	{
		if (PreviewInProcess)
		{
			var Preview = document.getElementById('binocPreview');
			var Cover = document.getElementById('binocCover');
			var Impression = document.getElementById('binocImpression');
			var ResultTop = document.getElementById('resultTop'+ItemOrd);
			var ResultBottom = document.getElementById('resultBottom'+ItemOrd);
			var CurrentTop = document.body.scrollTop;
		
			if ((ResultTop.offsetTop - PreviewHeight) > CurrentTop)
			{ /*on top of result*/
				Preview.style.pixelTop = (ResultTop.offsetTop - PreviewHeight);
				Preview.style.top = (ResultTop.offsetTop - PreviewHeight);
			}
			else
			{ /*below result*/
				/*COMMENTED OUT DUE TO IE5 BUG WITH RELATIVE POSITION
				  Preview.style.pixelTop = (ResultBottom.offsetTop + 20);		
				  Preview.style.top = (ResultBottom.offsetTop + 20);	
				*/
	
				Preview.style.pixelTop = (getRealPos(ResultBottom,"Top")+ 20);		
				Preview.style.top = (getRealPos(ResultBottom,"Top") + 20);	
			}	
	
			Cover.style.zIndex = Preview.style.zIndex - 1;

			Preview.style.width = PreviewWidth;
			Preview.style.height = PreviewHeight;

			/*REMOVED A BLOCK OF CODE DUE TO ERROR IN IE5*/

			Preview.style.visibility = 'visible';			
		}
	}
}
 
 
/* 
	showIt() 
	Binoc image
	
	h = browserHeight
	h2 = PreviewHeight
	w2 = PreviewWidth
*/
function showIt(BinocParam, ItemOrd, LogParam) {
	if (document.layers) 
	{
		/*
		document.layers['binocPreview'].visibility='show';
		document.layers['binocPreview'].innerHTML = '<img src='+BinocURL + BinocParam + ' />';
		document.layers['binocImpression'].innerHTML = '<img src='+ImpressionURL + LogParam+' />';
		*/
	}
	else 
	{
		var h = window.innerHeight;
		if (h == null)
		{
			h = document.body.offsetHeight
		}
		var h2 = 260;
		var w2 = 346;
		if (h <= 600)
		{
			h2 = 180;
			w2 = 240;
		}
		var Preview = document.getElementById('binocPreview');
		var Cover = document.getElementById('binocCover');
		PreviewInProcess = true;
		Preview.innerHTML = '<img width=\"'+w2+'\" height=\"'+h2+'\" src=\"'+ LogParam + BinocURL + BinocParam +'\" onload=\"Javascript:finalizeshow('+ItemOrd+','+w2+','+h2+')\;\"/>';
	}
}


/* 
=====================================================
Formerly CONTENTS of detect.js file  (BINOCULARS)
=====================================================
*/

/* Binocs function to see if user has supported browser; set cookie if so*/
function bc() /* bc = binocularsCheck */
{
	var s= false; /*s = SupportedBrowser*/
	var a = av().toLowerCase(); /* a = appVersion*/
	var u = ua(); /* u = userAgent*/
	/*allow IE 5.5 and up*/
	var i  = a.indexOf('msie'); /* i = iePos */
	if (i != -1) { /*for IE users,  allow IE with  version >=5.5, but not Mac, and not Opera*/
		is_minor = parseFloat(a.substring(i+5,a.indexOf(';',i)));
		if (u.indexOf("Mac") < 0 && is_minor >= 5.5 && u.indexOf("Opera") < 0)
		{
			s = true;
		}
	}else { /*for non-IE users, allow Mozilla useragents, but not Opera, not Mac*/
		if  (u.indexOf("Mozilla") >= 0 && u.indexOf("Opera") < 0 && u.indexOf("Mac") < 0)
		{
			s = true;
		}
	}
	var e = new Date(); /*e= expiredate */
	e.setTime(e.getTime() + 1000 * 60 * 60 * 24 * 7);	/*set cookie to expire in 24 hrs*/
	if (s==true)
	{
		/* set cookie to false if document model is unsupported */
		if (document.layers)
		{document.cookie = 'isBinocsBrowser=false;expires='+e+';domain=ask.com';}  
		else /* otherwise set cookie value to true since supported browser */
		{
			document.cookie = 'isBinocsBrowser=true;expires='+e+';domain=ask.com';
		}
	} 
	/* NOTE: if unsupported browser  we don't write any cookie */
}

/* 
=====================================================
Formerly CONTENTS of snip.js file   (MYJEEVES)
=====================================================
*/
/* Global variables */
var snipit = null;		/* sets during snip operation */
var snipIframe = null;	/* sets by the iframe document onload */

/* 
	Performs web result snipping by extracting the url, title, abstract and bino id.
	@param idx the index position of the web result.
			     (ie first, second, third, etc. position in the result list)
	@param e the "Save" button DOM element so that when snip is succes we can change
	         the state of the save button
*/
function doSnipWeb(idx, e, pickUrl) {
	
	/* if we have another link waiting to be safe we don't do anything. */
	if (null != snipit)
		return;
		
	if (e.innerHTML == "Saved") {
			return;
		}
			
	e.innerHTML = "Saving...";
	/* regular expression to remove any tags in title/abstract*/
	var regex = /<\/?[^>]+>/gi;

	/* two DOM element we are interested for the extraction logic */
	var eTop = document.getElementById("resultTop" + idx);
	var eBottom = document.getElementById("resultBottom" + idx);

	/* get the web result title */
	var title = eTop.getElementsByTagName("A")[0].innerHTML.replace(regex,"");
	/* don't use escape() for the query >> now it will get encoded by the Form, since that page now has a Meta tag included */
	var query = document.questionbar.q.value;
	title = title.replace("&amp;", "&");
	
/*REMOVE nextsibling backwards compatible logic after 4/4 release*/
	/* get the web result abstract */
	var abs = (document.getElementById("ab" + idx)) ? document.getElementById("ab" + idx).innerHTML:  eTop.nextSibling.innerHTML;

	/* get the web result url */
	var url = document.getElementById("ruri" + idx).innerHTML;
	url = "http://" + url;
	
	/* get the binocular id */
	var binoid=null;
	bid = eBottom.innerHTML.match(/(bi|showIt)\([^\)]*['"](\w{32})[&amp;]+s=\d+['"]/i);
	if (bid ) { binoid = bid[2];}
	
	var pickU = pickUrl;
	var pickframesrc = snipIframe.document.getElementById("logging");
	
	pickframesrc.src= pickU;
	
	/* save the extracted values to be use later in the process. */
	var data = {
		title: title.replace(regex,""),
		text: abs.replace(regex,""),
		url: url,
		binoid: binoid,
		pickU: pickU,
		query: query
	}
	
	performSnip(data, "wb", e);
}


/* Snipping from the Final Answer Frame: no abstract, etc. as in reply page. */
function doSnipWeb2(e) 
{
	if (null != snipit)
		return;
	if (e.innerHTML == "Saved")
	{
		return;
	}
	e.innerHTML = "Saving...";
	snipit = e;
	var title = document.getElementById("tit").value;
	var query = document.getElementById("qry").value;
	var abs = document.getElementById("abs").value;
	var url = document.getElementById("url").value;
	var bin = document.getElementById("bin").value;
	var cat = document.getElementById("cat").value;
	var purl = document.getElementById("purl").value;
	title = title.replace("&amp;", "&");
	
	var pickU = purl;
	var pickframesrc = snipIframe.document.getElementById("logging");
	pickframesrc.src= pickU;
	
	var snipFormEle = snipIframe.document.snipForm;
	snipFormEle.query.value = query;
	snipFormEle.category.value = "";
	snipFormEle.text.value = abs;
	snipFormEle.title.value = title;
	snipFormEle.url.value = url;
	snipFormEle.binoid.value = bin;
	snipFormEle.category.value = cat;
	snipFormEle.pickUrl.value = purl;
	snipFormEle.submit();
}

/* 
	Performs snipping preperation before setting the values into the form
	@param data the data object that contains all the extracted meta data
	@param cid the snip category id
	@param e the "Save" button DOM element so that when snip is succes we can change
	         the state of the save button
*/
function performSnip(data, cid, el) {
	/* handle button state */
	disableBtn(el);

	/* save off the button element to be use when snipping is done */
	snipit = el;

	/* start the snip form process */
	doSnipForm(cid, data);
}

function disableBtn(ele) {
	/* ele.className = "r"; */
	/* ele.disabled = true; */
}

function enableBtn(ele) {
	ele.className = "snipBtnEnable";
	ele.disabled = false;
}

/*
	Performs the snip form post to snipit server
	@param cid the snip category id
	@param data the data object that contains all the extracted meta data
*/
function doSnipForm(cid, data) {
	
	var snipFormEle = snipIframe.document.snipForm;
	
	/* add to the form */
	snipFormEle.query.value = data.query;
	snipFormEle.category.value = cid;
	
	snipFormEle.text.value = data.text;
	snipFormEle.title.value = data.title;
	snipFormEle.url.value = data.url;
	if(data.binoid == null)
	{
		
	}
	else
	{
		snipFormEle.binoid.value = data.binoid;
	}
	/* snipFormEle.pickUrl.value = data.pickU; */

	snipFormEle.submit();
}

function isCookieEnabled() {
	document.cookie = "testCookie";
	if( document.cookie.indexOf("testCookie") != -1 ) {
		document.cookie = "";
		return true;
	}
	return false;
}

function doSnipImage(e, imageUrl, pageUrl, pickU, title) 
{
	if (null != snipit)
		return;
	if (e.innerHTML == "Saved")
		return;

	e.innerHTML = "Saving...";
	snipit = e;
	var query = document.questionbar.q.value;
	
	var pickframesrc = snipIframe.document.getElementById("logging");
	pickframesrc.src= pickU;
	
	var snipFormEle = snipIframe.document.snipForm;
	snipFormEle.query.value = query;
	snipFormEle.iurl.value = imageUrl;
	snipFormEle.url.value = pageUrl;
	snipFormEle.title.value = title;
	snipFormEle.submit();
}

/* 
=====================================================
END OF snip.js
=====================================================
*/
/*THESE strDest IDS SHOULD BE MODIFIED TO MATCH THE STATIC LIST ABOVE */
/*Passes parameters between local hub home & reply pages*/
function localHomeAppendParams(strDest, barID, el, strPage)
{
	/* Parameters for all channels */
	var P = ""; /* var paramValue; */

	/* Parameters for Web Channel */
	var wP = ""; /* var wparamValue; */
	
	var D = document[barID];	/*form object*/
	
	if (strPage == 1)
	{
		P = D.location.value;
		wP = D.terms.value + ' ' + D.location.value;
		
	}

	if (strPage == 2) 
	{
		P = enc(D.a2.value) + '&fa1=' + enc(D.a1.value);
		wP = enc(D.a1.value) + ' ' + enc(D.a2.value);
	}
	
	if (strPage == 3)
	{
		P = enc(D.fa2.value) + '&a1=' + enc(D.fa1.value);
		wP = '';
	}

	if (strPage == 4)
	{
		P = enc(D.altcity.value);
		wP = enc(D.altcity.value);
	}

	if (strPage == 5)
	{
		P = enc(D.altcity.value);
		wP = enc(D.altcity.value);
	}
	
	var qsrc = qs(D); 	/* Find qsrc on form */
	var o = og(D);		/* Find o parameter on form*/
	var q = qu(D);		/* Find user's value from input box on form*/
	q = enc(q);
	

	/* Piece together the query */
	var query = "?q=" + q + '&o=' + o + '&qsrc=' + qsrc;
	var href = "";

	if (strDest == 0)
		href = '?q=' + wP;

	if (strDest == 1)	
		href = query + '&location=' + P;	

	if (strDest == 2)
		href = query + '&home=1&a2=' + P;	

	if (strDest == 3)
		href =query + '&home=1&fa2=' + P;	

	if (strDest == 4)
		href = '?q=' + P;	

	if (strDest == 5)
			href = '?q=' + P + '&altcity=' + P;	
	
	el.href += href;
}


/*
=======================
Smart Answer Javascript
=======================
*/

/* ONLY USED BY SHOPPING ESAS - ON SHOP CHANNEL*/
function getAboutHref() {
	var da = document.getElementById("DA1");
	if(!da) {
		da = document.getElementById("DA2");
		if(!da) { return; } else {
			/* DA2 */
			document.getElementById("aboutLink").href = "http://sp.ask.com/docs/about/ps_mpp.html";
		}
	} else {
		/* DA1 */
		document.getElementById("aboutLink").href = "http://sp.ask.com/docs/about/ps_csa.html";
	}
	
}

 var onclick = false;
 var divDisplayed = "";

 function ddopen(oBtn,sName){
 var d = document;
 var dd;

 if (divDisplayed!="")
 {
	 onclick = false;
	 ddremove();
	 return;
 }	 
 else
 {
	 ddremove();
 }
 	
 divDisplayed = sName + "dd";
 dd = d.getElementById(divDisplayed);
 dd.style.visibility = "visible";

 addEvent(document, 'click', ddremove);
 onclick = true;
 }



 function ddMouseOut()
 {
 onclick = false;
 }


 function ddremove() 
 {
 var d = document;

 if (!onclick && divDisplayed != "")
 {
 if (d.getElementById(divDisplayed).style.visibility=="visible")
 {
 d.getElementById(divDisplayed).style.visibility = "hidden";
 divDisplayed="";
 }
 }
 }




 function SLPopA1A2(sender, sA1Id, sA2Id, sA1, sA2)
 {
 var obj1 =null;
 var obj2=null;

 var form = findform(sender);
 if (form==null) return;

 var a1obj = form[sA1Id];
 var a2obj = form[sA2Id];

 if (a1obj!=null)
 {
 if (sA1==null)
 a1obj.value="";
 else
 a1obj.value=sA1;
 }

 if (a2obj!=null)
 {
 if (sA2==null)
 a2obj.value="";
 else
 a2obj.value=sA2;			
 }
 return;
 }

 function addEvent(obj, evType, fn)
 { 
 if (obj.addEventListener){ 
    obj.addEventListener(evType, fn, false); 
    return true; 
 } else if (obj.attachEvent){ 
    var r = obj.attachEvent("on"+evType, fn); 
    return r; 
 } else { 
    return false; 
 } 
 }
 
 function removeEvent(obj, evType, fn)
 {
 if (obj.removeEventListener){
	obj.removeEventListener(evType, fn, false);
    return true;
 } else if (obj.detachEvent){
    var r = obj.detachEvent("on"+evType, fn); 
    return r; 
 } else { 
    return false; 
 } 
 }

 function findform(obj)
 {
 
 if (obj==null)
 { 
 return null;
 }
 
 if (obj.tagName.toLowerCase()=="form")
 {
 return obj;
 }
 
 if (obj.parentElement)
 {
 return findform(obj.parentElement);
 }
 if (obj.parentNode)
 {
 return findform(obj.parentNode);
 }
 
 return null;
 }

 function dSbmt(obj, value1, value2)
 {
 ddremove();
 findform(obj)[value1].value = value2;
 findform(obj).submit();
 }

function clearCookie(name)
{
document.cookie = name +"=" + 
";expires= Thu, 01-Jan-70 00:00:01 GMT";
}

/********************************************************/
/* ENCODING RELATED FUNCTIONS				*/
/********************************************************/

/*
 * enc() - wrapper for EncodeURIComponent(), falls back to escape() in older browsers
 */
function enc(str)
{
	if(isEncSup()) /* if encoding functions are supported...*/
		return encodeURIComponent(str);	
	else
		return escape(str);
}
/*
 * encU() - wrapper for EncodeURI(), falls back to escape() in older browsers
 */
function encU(str)
{
	
	if(isEncSup()) /* if encoding functions are supported...*/
		return encodeURI(str);	
	else
		return escape(str);
}
/*
 * isEncSup() - "Is Encoding Supported" - determines if we should use encodeURI and encodeURIComponent or if we should fall back to escape()
 */
function isEncSup()
{
	var s= true; /*s = SupportedBrowser*/
	var a = av().toLowerCase(); /* a = appVersion*/
	var u = ua(); /* u = userAgent*/
	var i  = a.indexOf('msie'); /* i = iePos */

	if (i != -1) { /*for MAC IE users, version 5.5 or below, fall back to legacy "escape()"*/
		var is_minor = parseFloat(a.substring(i+5,a.indexOf(';',i)));
		if (u.indexOf("Mac") > -1 && is_minor <= 5.5)
		{
			s = false;
		}
	}else { /*for non-IE users, allow all but Netscape 4.x*/
		if  (u.indexOf("Mozilla/4.") >= 0 || u.indexOf("Mozilla/3.") >= 0)
		{
			s = false;
		}
	}
	return s;
}

function unHide(total, display, tr)
{
	if(tr == "RI")
		document.getElementById("More1").style.display="none";
	if(tr == "RA")
		document.getElementById("More2").style.display="none";
	if(tr == "RN")
		document.getElementById("More3").style.display="none";		
	
	for(var i=display ; i<total; i++)
	{
		if(tr == "RI")
			obj = "RI" + i;
		if(tr == "RA")
			obj = "RA" + i;
		if(tr == "RN")
			obj = "RN" + i;		
		document.getElementById(obj).style.display="block";
	}
	
	
	if (document.getElementById)
	{
		rel = document.getElementById("RelatedSearchOutline");
		bot = document.getElementById("BottomSectionOutline");
		pag = document.getElementById("resultspagingstrip");
		if (rel && bot)
		{
			if (rel.offsetTop + rel.offsetHeight + 10 > bot.offsetTop)
			{
				bot.style.position = "absolute";
				bot.style.top = rel.offsetTop + rel.offsetHeight + 10;
				
				pag.style.position = "absolute";
				pag.style.top = rel.offsetTop + rel.offsetHeight - 40;
			}
		}
	}
}
