function SelectThis(a){ClearAll();document.getElementById(a).className="ys";a=document.getElementById(a);var b=document.getElementById("searchbutton1");if(a.id=="span1")b.value="Search Site";else if(a.id=="span2")b.value="Search Bookstore";else if(a.id=="span3")b.value="Search Products";else if(a.id=="span4")b.value="Search Conferences";else if(a.id=="span5")b.value="Search Cases";else if(a.id=="span6")b.value="Search Blogs"}
function ClearAll(){document.getElementById("span1").className="ns";document.getElementById("span2").className="ns";document.getElementById("span3").className="ns";document.getElementById("span4").className="ns";document.getElementById("span5").className="ns";document.getElementById("span6").className="ns"}
function SearchNow(){var a="",b="";b=trim(document.getElementById("searchLN").value);if(b==""||b=="Search LexisNexis"||b=="%%")alert("Please enter search term");else if(document.getElementById("span1").className=="ys")a="site";else if(document.getElementById("span2").className=="ys")a="store";else if(document.getElementById("span3").className=="ys")a="products";else if(document.getElementById("span4").className=="ys")a="conference";else if(document.getElementById("span5").className=="ys")a="cases";
else if(document.getElementById("span6").className=="ys")a="blogs";if(a=="store")document.location.href="http://www.lexisnexis.com.au/search-store.aspx?query="+b;else if(a=="site")document.location.href="http://www.lexisnexis.com.au/search-site.aspx?query="+b;else if(a=="cases")document.location.href="http://www.lexisnexis.com/community/fastsearch/Search.aspx?query= "+b+"&type=Cases&start=1";else if(a=="conference")document.location.href="http://www.lexisnexis.com.au/PD/search.aspx?query=%25"+b+"%25";
else if(a=="blogs")document.location.href="http://www.lexisnexis.com.au/blogs/corporations-law/search.aspx?q="+b;else if(a=="products")document.location.href="http://www.lexisnexis.com.au/catalog-search/?type=q&query="+b}function ClearText(){var a=document.getElementById("searchLN");if(a.value=="Search LexisNexis"){a.value="";a.style.fontStyle="normal"}}
function trim(a){for(;a.substring(0,1)==" ";)a=a.substring(1,a.length);for(;a.substring(a.length-1,a.length)==" ";)a=a.substring(0,a.length-1);return a}function onkeydown_Search(a){var b;if(a.keyCode)b=a.keyCode;else if(a.which)b=a.which;if(b==13){SearchNow();return false}return true};



//2009-11-13: SK: Adding function to retrieve email.


/*
	id: 		refers to id of the span element.
	start: 		refers to the start of the email address till the @ symbol
	emailSubject: 	email subject

*/

function SetPrivacyEmail(id, start, emailSubject)
{
var str = document.getElementById(id).innerHTML; 
if (str.indexOf("@") == -1)
{

var emailarray=[64,108,101,120,105,115,110,101,120,105,115,46,99,111,109,46,97,117] //encrypted form of "AT lexisnexis.com.au"
var email='' //variable for encrypted email 
for (var i=0; i<emailarray.length; i++)
 	email+= String.fromCharCode(emailarray[i])

document.getElementById(id).innerHTML = '<a href="mailto:'+start+email+'?subject='+emailSubject+'">' + start + email + '</a>';
document.getElementById(id).title = "Click to email";
document.location = "mailto:"+start+email + "?subject=" + emailSubject;
}
} 
