//Copyright 2003-2006 A9.com or its affiliates
var a9search=new Object;
a9search.defText="Give it a try, go ahead kick our tires.";
a9search.defText2="Go ahead, test drive the A9 Product Search.";
a9search.blur=function(elemName){
if(!elemName)
elemName="q";
var t=document.getElementById(elemName);
var inputDefText=t.defText;
if(!t.defText&&t.getAttribute("defText"))
inputDefText=t.getAttribute("defText");
if(t.value==""||t.value==a9search.defText||
(t.value==inputDefText)){
t.style.color="#aaa";
if( inputDefText )
t.value=inputDefText;
else
t.value=a9search.defText;
}
if(t.value==""||t.value==a9search.defText2){
t.style.color="#aaa";
t.value=a9search.defText2;
}
}
a9search.focus=function(elemName){
if(!elemName)
elemName="q";
var t=document.getElementById(elemName);
var inputDefText=t.defText;
if(!t.defText&&t.getAttribute("defText"))
inputDefText=t.getAttribute("defText");
a9search.noInitBlur=true;
if(t.value==a9search.defText)
t.value="";
if(t.value==a9search.defText2)
t.value="";
if(t.value==inputDefText)
t.value="";
t.style.color="black";
}
function getSearchUrl(base,val){
val=a9Trim(val);
if(val=="robots.txt"||val=="favicon.ico"||val=="siteinfo.xml"){
val='"'+val+'"';
}
if( /.*field-keywords=$/.test(base) )
return base+a9Encode(val);
else
return base.replace(/(?:q=|([?]|$))/,a9Encode(val)+"$1");
}
function checkSearchAction(formName,selectName,booksOnly){
if(!formName)
formName="sf";
if(!selectName)
selectName="searchSelect";
var form=document.getElementById(formName);
var searchSelect=document.getElementById(selectName);
if( searchSelect&&!searchSelect.checked ){
form.action=a9productSearchUrl;
}
else
form.action=a9searchUrl.replace(/http:\/\/[^\/]+\//,"http://"+document.location.host+"/");
if( booksOnly )
form.action=a9bookSearchUrl;
}
function submitProductSearch(val){
if(val==null){
val="";
}
var u=getSearchUrl(a9productSearchUrl,val);
u=fixUrl(u);
location.href=u;
return false;
}
function submitSearch(elemName,formName,selectName,booksOnly){
if(!elemName)
elemName="q";
if(!formName)
formName="sf";
var form=document.getElementById(formName);
var q=document.getElementById(elemName);
var val=q.value;
var defValue=q.defValue;
if(!q.defValue&&q.getAttribute("defValue"))
defValue=q.getAttribute("defValue");
if(!defValue )
defValue=a9search.defText;
var defText=q.defText;
if(!q.defText&&q.getAttribute("defText"))
defText=q.getAttribute("defText");
checkSearchAction(formName,selectName,booksOnly);
if(val==null){
val="";
}
else if((val==defText)||(val=="")){
val=defValue;
}
var u=getSearchUrl(form.action,val);
u=fixUrl(u);
location.href=u;
return false;
}
function fixUrl(u){return u;}
function ferr(s){
}
function a9SetAttribute(obj,attr,value){
try{
if(a9IsSafari){
obj[attr]=""+value;
}else{
obj.setAttribute(attr,value);
}
}catch (e){}
}
function a9GetAttribute(obj,attr){
try{
if(a9IsSafari){
return obj[attr];
}else{
return obj.getAttribute?obj.getAttribute(attr):null;
}
}catch (e){
return null;
}
}
function a9Encode(s){
if(typeof(encodeURIComponent)!="undefined"){
return encodeURIComponent(s);
}
return escape(s);
}
function a9Decode(s){
if(typeof(decodeURIComponent)!="undefined"){
return decodeURIComponent(s);
}
return unescape(s);
}
function a9PopupWin(url,name,options){
var win=window.open(url,name,options);
win.opener=this;
win.focus();
}
function a9GetElText(el){
var tt=a9GetAttribute(el, "textTitle");
if(tt){
if(tt==1){
if(el.title){
return el.title;
}
}else{
return tt;
}
}
if(el.innerText){
return el.innerText;
}
function getElTextInt(el){
var text="";
var children=el.childNodes;
for(var i=0;i<children.length;i++){
if(children[i].nodeType==3){
text+=children[i].nodeValue;
}else{
text+=getElTextInt(children[i]);
}
}
return text;
}
return getElTextInt(el).replace(/^\s+/,"").replace(/\s+$/,"");
}
function a9Image(name,ext){
return A9IMAGES+"/"+name+"."+(ext?ext:"gif");
}
function a9Png(name){return a9Image(name,"png");}
function getOffsetLeft(el){
var l=0;
while(el){
l+=el.offsetLeft-el.scrollLeft;
el=el.offsetParent;
}
return l;
}
function getOffsetTop(el){
var t=0;
while(el){
t+=el.offsetTop-el.scrollTop;
el=el.offsetParent;
}
return t;
}
function a9Trim(s){
return s.replace(/^\s+/,"").replace(/\s+$/,"")
}
function cloneNoId(n,iehack){
function removeIds(n){
if(n.id) n.id="";
for(var i=0;i<n.childNodes.length;i++) removeIds(n.childNodes[i]);
}
var c;
if(a9IsIE&&iehack&&n.getElementsByTagName("style").length){
c=document.createElement(n.tagName);
c.innerHTML=n.innerHTML;
c.className=n.className;
}else{
c=n.cloneNode(true);
}
removeIds(c);
return c;
}
function getStyle(el,attr){
if(window.getComputedStyle){
return window.getComputedStyle(el, "")[attr];
}
if(document.defaultView&&document.defaultView.getComputedStyle){
return document.defaultView.getComputedStyle(el, "")[attr];
}
if(el.currentStyle){
return el.currentStyle[attr];
}
return null;
}
function getPxStyle(el,attr){
var sz=getStyle(el,attr);
if(sz){
return parseInt(sz.replace("px", ""));
}
return 0;
}
function a9resize(){
var co=document.getElementById("content");
var t=getOffsetTop(co);
var b=getOffsetTop(document.getElementById("footer"));
var h=b-t-5;
co.style.height=h+"px";
}
function jsLangAll(){
for(var i=0;i<document.prefsform.lchoice.length;i++){
document.prefsform.lchoice[i].checked=false;
}
document.prefsform.lang[0].checked=true;
}
function jsLangClick(){
var count=0;
for(var i=0;i<document.prefsform.lchoice.length;i++){
if(document.prefsform.lchoice[i].checked){count++;}
}
document.prefsform.lang[0].checked=(count<=0);
document.prefsform.lang[1].checked=(count>0);
}
function jsSetDefault(){
jsLangAll();
for(var i=0;i<document.prefsform.or.length;i++){
document.prefsform.or[i].checked=false;
}
document.prefsform.or[0].checked=true;
for(var i=0;i<document.prefsform.colradio.length;i++){
document.prefsform.colradio[i].checked=false;
}
document.prefsform.colradio[0].checked=true;
document.prefsform.safe.selectedIndex=1;
}
function cancelPrefs(){
location.href=(A9NOSEARCH+"/home.jsp");
}

