
function matchme(){loc=document.getElementById("tx"+wid+"clocation");keyword=document.getElementById("tx"+wid+"keyword").value;agedoc=document.getElementById("tx"+wid+"age");genderdoc=document.getElementById("tx"+wid+"gender");age="";showalert=false;alert_text="";if(keyword==""||keyword=="Enter Condition"){alert_text+="Please enter your condition to find clinical trials\n";showalert=true;}
if(agedoc!=null){age=agedoc.value;if(age=="Enter Age"){showalert=true;alert_text="Please specify your Age\n";}}
gender="";if(genderdoc!=null){gender=genderdoc.value;if(gender==""){showalert=true;alert_text+="Please select your Gender\n";}}
state="";if(loc!=null){state=loc.value;if(state==""){showalert=true;alert_text+="Please select your Location\n";}}
if(showalert){alert(alert_text);}else{rdurl="http://trialx.com/match2trials?keyword="+keyword+"&age="+age+"&gender="+gender+"&clocation="+state+"&key="+wkey;window.open(rdurl,"","");}};function xss_ajax(_1){var _2=null;var _3=document.createElement("script");_3.setAttribute("type","text/javascript");_3.setAttribute("src",_1);_3.setAttribute("id","script_id");_2=document.getElementById("script_id");if(_2){document.getElementsByTagName("head")[0].removeChild(_2);}
document.getElementsByTagName("head")[0].appendChild(_3);};function callback(_4){res=_4.split("|");count=res[1];widgetobj=eval("("+res[0]+")");layoutWidgetWithParam(widgetobj);};var count="";var wkey="";var wid="";var as="";var TrialX=new Object();TrialX.load=function(_5){wid=_5;xss_ajax("http://trialx.com/get_widget/?wid="+_5);};function layoutWidgetWithParam(w){var _6=document.getElementById("txwidget");_6.style.width=w.width;_6.style.height=w.height;_6.style.backgroundColor=w.backcolor;_6.style.border="1px solid "+w.titlecolor;_6.style.fontFamily=w.fontfamily;_6.style.fontSize=w.fontsize;var _7=document.getElementById("txcon");var _8=document.getElementById("txhead");_8.style.width="100%";_8.style.textAlign="center";_8.style.backgroundColor=w.titlecolor;_8.style.color=w.titletextcolor;var _9=document.getElementById("txah");_9.style.color=w.titletextcolor;_9.style.textDecoration="none";var _a=document.createElement("div");_a.style.cssFloat="left";_a.style.width="100%";_a.style.position="relative";_a.style.textAlign="center";_a.style.marginTop="10px";_a.style.marginRight="0px";_a.style.marginLeft="0px";_a.style.marginBottom="0px";_a.style.paddingTop="0px";_a.style.paddingBottom="0px";_a.style.paddingLeft="0px";_a.style.paddingRight="0px";if(w.isfixedcondition){_a.style.fontWeight="bold";ktext="<span style=\"width:"+w.inputwidth+"\">"+count+" active "+w.keyword+" trials</span>";_a.innerHTML=ktext;var _b=document.createElement("input");_b.type="hidden";_b.id="tx"+wid+"keyword";_b.name="tx"+wid+"keyword";_b.value=w.keyword;_7.appendChild(_a);_7.appendChild(_b);}else{var _b=document.createElement("input");_b.type="text";_b.id="tx"+wid+"keyword";_b.name="tx"+wid+"keyword";_b.style.color="#666";_b.style.fontStyle="italic";_b.value="Enter Condition";_b.style.width=w.inputwidth;_a.appendChild(_b);_7.appendChild(_a);}
if(w.age){var _c=document.createElement("div");_c.style.cssFloat="left";_c.style.width="100%";_c.style.position="relative";_c.style.marginTop="10px";_c.style.textAlign="center";_c.style.marginRight="0px";_c.style.marginLeft="0px";_c.style.marginBottom="0px";_c.style.paddingTop="0px";_c.style.paddingBottom="0px";_c.style.paddingLeft="0px";_c.style.paddingRight="0px";var _d=document.createElement("input");_d.type="text";_d.id="tx"+wid+"age";_d.style.color="#666";_d.style.fontStyle="italic";_d.style.width=w.inputwidth;_d.value="Enter Age";_c.appendChild(_d);_7.appendChild(_c);}
if(w.gender){var _e=document.createElement("div");_e.style.cssFloat="left";_e.style.width="100%";_e.style.position="relative";_e.style.marginTop="10px";_e.style.textAlign="center";_e.style.marginRight="0px";_e.style.marginLeft="0px";_e.style.marginBottom="0px";_e.style.paddingTop="0px";_e.style.paddingBottom="0px";_e.style.paddingLeft="0px";_e.style.paddingRight="0px";var _f=document.createElement("select");_f.id="tx"+wid+"gender";_f.style.width=w.inputwidth;var _10=new Array("","Select Gender","Male","Male","Female","Female");for(var i=0;i<_10.length;i=i+2){_11=document.createElement("option");_11.value=_10[i];otext=document.createTextNode(_10[i+1]);_11.appendChild(otext);_f.appendChild(_11);}
_e.appendChild(_f);_7.appendChild(_e);}
if(w.state){var _12=document.createElement("div");_12.style.cssFloat="left";_12.style.width="100%";_12.style.position="relative";_12.style.marginTop="10px";_12.style.textAlign="center";_12.style.marginRight="0px";_12.style.marginLeft="0px";_12.style.marginBottom="0px";_12.style.paddingTop="0px";_12.style.paddingBottom="0px";_12.style.paddingLeft="0px";_12.style.paddingRight="0px";var _13=document.createElement("select");_13.id="tx"+wid+"clocation";_13.style.width=w.inputwidth;var _10=new Array("","Select State","AL","Alabama","AK","Alaska","AZ","Arizona","AR","Arkansas","CA","California","CO","Colorado","CT","Connecticut","DE","Delaware","DC","Dist of Columbia","FL","Florida","GA","Georgia","HI","Hawaii","ID","Idaho","IL","Illinois","IN","Indiana","IA","Iowa","KS","Kansas","KY","Kentucky","LA","Louisiana","ME","Maine","MD","Maryland","MA","Massachusetts","MI","Michigan","MN","Minnesota","MS","Mississippi","MO","Missouri","MT","Montana","NE","Nebraska","NV","Nevada","NH","New Hampshire","NJ","New Jersey","NM","New Mexico","NY","New York","NC","North Carolina","ND","North Dakota","OH","Ohio","OK","Oklahoma","OR","Oregon","PA","Pennsylvania","RI","Rhode Island","SC","South Carolina","SD","South Dakota","TN","Tennessee","TX","Texas","UT","Utah","VT","Vermont","VA","Virginia","WA","Washington","WV","West Virginia","WI","Wisconsin","WY","Wyoming");for(var i=0;i<_10.length;i=i+2){_11=document.createElement("option");_11.value=_10[i];otext=document.createTextNode(_10[i+1]);_11.appendChild(otext);_13.appendChild(_11);}
_12.appendChild(_13);_7.appendChild(_12);}
var _14=document.createElement("div");_14.style.cssFloat="left";_14.style.width="100%";_14.style.position="relative";_14.style.marginTop="10px";_14.style.textAlign="center";_14.style.marginRight="0px";_14.style.marginLeft="0px";_14.style.marginBottom="0px";_14.style.paddingTop="0px";_14.style.paddingBottom="0px";_14.style.paddingLeft="0px";_14.style.paddingRight="0px";var _15=document.createElement("input");if(w.btn_image){_15.type="image";_15.src=w.btn_image;}else{_15.type="button";_15.style.width=w.inputwidth;}
_15.id="tx"+wid+"matchbtn";_15.value="Show";_15.setAttribute("onclick","matchme()");_14.appendChild(_15);_7.appendChild(_14);var _16=document.getElementById("txpow");_16.style.textAlign="right";_16.style.fontSize="10px";var _17="p-0fcFju62lRV3A";var _18="http://pixel.quantserve.com/pixel/";var _19=document.createElement("img");_19.src=_18+_17+".gif";_7.appendChild(_19);wkey=w.key;var _11={script:"http://trialx.com/jtermautocomplete/?",varname:"q",json:true,maxresults:5};as=new bsn.AutoSuggest("tx"+wid+"keyword",_11);runLoad();};function runLoad(){theInput=document.getElementById("tx"+wid+"keyword");if(theInput){addEvent(theInput,"focus",clearDefaultText,false);addEvent(theInput,"blur",replaceDefaultText,false);theInput.defaultText=theInput.value;}
theInput=document.getElementById("tx"+wid+"age");if(theInput){addEvent(theInput,"focus",clearDefaultText,false);addEvent(theInput,"blur",replaceDefaultText,false);theInput.defaultText=theInput.value;}};function clearDefaultText(e){var _1a=window.event?window.event.srcElement:e?e.target:null;if(!_1a){return;}
if(_1a.value==_1a.defaultText){_1a.value="";}};function replaceDefaultText(e){var _1b=window.event?window.event.srcElement:e?e.target:null;if(!_1b){return;}
if(_1b.value==""&&_1b.defaultText){_1b.value=_1b.defaultText;}};function addEvent(_1c,_1d,_1e,_1f){if(_1c.addEventListener){_1c.addEventListener(_1d,_1e,_1f);return true;}else{if(_1c.attachEvent){var r=_1c.attachEvent("on"+_1d,_1e);return r;}else{return false;}}};function knackerEvent(_20){if(_20&&_20.stopPropagation){_20.stopPropagation();}
if(window.event&&window.event.cancelBubble){window.event.cancelBubble=true;}
if(_20&&_20.preventDefault){_20.preventDefault();}
if(window.event){window.event.returnValue=false;}};function cancelEventSafari(){return false;};if(typeof(bsn)=="undefined"){_b=bsn={};}
if(typeof(_b.Autosuggest)=="undefined"){_b.Autosuggest={};}
_b.AutoSuggest=function(id,_21){if(!document.getElementById){return 0;}
this.fld=_b.DOM.gE(id);if(!this.fld){return 0;}
this.sInp="";this.nInpC=0;this.aSug=[];this.iHigh=0;this.oP=_21?_21:{};var k,def={minchars:1,meth:"get",varname:"input",className:"autosuggest",timeout:2500,delay:500,offsety:-5,shownoresults:true,noresults:"No results!",maxheight:250,cache:true,maxentries:25};for(k in def){if(typeof(this.oP[k])!=typeof(def[k])){this.oP[k]=def[k];}}
var p=this;this.fld.onkeypress=function(ev){return p.onKeyPress(ev);};this.fld.onkeyup=function(ev){return p.onKeyUp(ev);};this.fld.setAttribute("autocomplete","off");};_b.AutoSuggest.prototype.onKeyPress=function(ev){var key=(window.event)?window.event.keyCode:ev.keyCode;var _22=13;var TAB=9;var ESC=27;var _23=1;switch(key){case _22:this.setHighlightedValue();_23=0;break;case ESC:this.clearSuggestions();break;}
return _23;};_b.AutoSuggest.prototype.onKeyUp=function(ev){var key=(window.event)?window.event.keyCode:ev.keyCode;var _24=38;var _25=40;var _26=1;switch(key){case _24:this.changeHighlight(key);_26=0;break;case _25:this.changeHighlight(key);_26=0;break;default:this.getSuggestions(this.fld.value);}
return _26;};_b.AutoSuggest.prototype.getSuggestions=function(val){if(val==this.sInp){return 0;}
_b.DOM.remE(this.idAs);this.sInp=val;if(val.length<this.oP.minchars){this.aSug=[];this.nInpC=val.length;return 0;}
var ol=this.nInpC;this.nInpC=val.length?val.length:0;var l=this.aSug.length;if(this.nInpC>ol&&l&&l<this.oP.maxentries&&this.oP.cache){var arr=[];for(var i=0;i<l;i++){if(this.aSug[i].value.substr(0,val.length).toLowerCase()==val.toLowerCase()){arr.push(this.aSug[i]);}}
this.aSug=arr;this.createList(this.aSug);return false;}else{var _27=this;var _28=this.sInp;clearTimeout(this.ajID);this.ajID=setTimeout(function(){_27.doAjaxRequest(_28);},this.oP.delay);}
return false;};_b.AutoSuggest.prototype.doAjaxRequest=function(_29){if(_29!=this.fld.value){return false;}
var _2a=this;if(typeof(this.oP.script)=="function"){var url=this.oP.script(encodeURIComponent(this.sInp));}else{var url=this.oP.script+this.oP.varname+"="+encodeURIComponent(this.sInp);}
if(!url){return false;}
var _2b=this.oP.meth;var _29=this.sInp;xss_ajax(url);};_b.AutoSuggest.prototype.jterm_callback=function(_2c){var _2d=this.sInp;this.setSuggestions(_2c,_2d);};_b.AutoSuggest.prototype.setSuggestions=function(_2e,_2f){if(_2f!=this.fld.value){return false;}
this.aSug=[];if(this.oP.json){var _30=eval("("+_2e+")");for(var i=0;i<_30.results.length;i++){this.aSug.push({"id":_30.results[i].id,"value":_30.results[i].value,"info":_30.results[i].info});}}else{var xml=_2e;var _31=xml.getElementsByTagName("results")[0].childNodes;for(var i=0;i<_31.length;i++){if(_31[i].hasChildNodes()){this.aSug.push({"id":_31[i].getAttribute("id"),"value":_31[i].childNodes[0].nodeValue,"info":_31[i].getAttribute("info")});}}}
this.idAs="as_"+this.fld.id;this.createList(this.aSug);};_b.AutoSuggest.prototype.createList=function(arr){var _32=this;_b.DOM.remE(this.idAs);this.killTimeout();if(arr.length==0&&!this.oP.shownoresults){return false;}
var div=_b.DOM.cE("div",{id:this.idAs,className:this.oP.className});var _33=_b.DOM.cE("div",{className:"as_corner"});var _34=_b.DOM.cE("div",{className:"as_bar"});var _35=_b.DOM.cE("div",{className:"as_header"});_35.appendChild(_33);_35.appendChild(_34);div.appendChild(_35);var ul=_b.DOM.cE("ul",{id:"as_ul"});for(var i=0;i<arr.length;i++){var val=arr[i].value;var st=val.toLowerCase().indexOf(this.sInp.toLowerCase());var _36=val.substring(0,st)+"<em>"+val.substring(st,st+this.sInp.length)+"</em>"+val.substring(st+this.sInp.length);var _37=_b.DOM.cE("span",{},_36,true);if(arr[i].info!=""){var br=_b.DOM.cE("br",{});_37.appendChild(br);var _38=_b.DOM.cE("small",{},arr[i].info);_37.appendChild(_38);}
var a=_b.DOM.cE("a",{href:"#"});var tl=_b.DOM.cE("span",{className:"tl"}," ");var tr=_b.DOM.cE("span",{className:"tr"}," ");a.appendChild(tl);a.appendChild(tr);a.appendChild(_37);a.name=i+1;a.onclick=function(){_32.setHighlightedValue();return false;};a.onmouseover=function(){_32.setHighlight(this.name);};a.style.color="#333";a.style.display="block";a.style.textDecoration="none";a.style.backgroundColor="transparent";a.style.position="relative";a.style.padding="0";a.style.width="100%";var li=_b.DOM.cE("li",{},a);li.style.padding="0";li.style.margin="0 4px 4px";li.style.textAlign="left";ul.appendChild(li);}
ul.style.listStyle="none";ul.style.margin="0 0 -4px 0";ul.style.padding="0";ul.style.overflow="hidden";ul.style.backgroundColor="#FFF";if(arr.length==0&&this.oP.shownoresults){var li=_b.DOM.cE("li",{className:"as_warning"},this.oP.noresults);ul.appendChild(li);}
div.appendChild(ul);div.style.position="absolute";div.style.padding="10px 0 0 0";var _39=_b.DOM.cE("div",{className:"as_corner"});var _3a=_b.DOM.cE("div",{className:"as_bar"});var _3b=_b.DOM.cE("div",{className:"as_footer"});_3b.appendChild(_39);_3b.appendChild(_3a);div.appendChild(_3b);var pos=_b.DOM.getPos(this.fld);div.style.left=pos.x+"px";div.style.top=(pos.y+this.fld.offsetHeight+this.oP.offsety)+"px";div.style.width=this.fld.offsetWidth+"px";div.onmouseover=function(){_32.killTimeout();};div.onmouseout=function(){_32.resetTimeout();};document.getElementsByTagName("body")[0].appendChild(div);this.iHigh=0;var _32=this;this.toID=setTimeout(function(){_32.clearSuggestions();},this.oP.timeout);};_b.AutoSuggest.prototype.changeHighlight=function(key){var _3c=_b.DOM.gE("as_ul");if(!_3c){return false;}
var n;if(key==40){n=this.iHigh+1;}else{if(key==38){n=this.iHigh-1;}}
if(n>_3c.childNodes.length){n=_3c.childNodes.length;}
if(n<1){n=1;}
this.setHighlight(n);};_b.AutoSuggest.prototype.setHighlight=function(n){var _3d=_b.DOM.gE("as_ul");if(!_3d){return false;}
if(this.iHigh>0){this.clearHighlight();}
this.iHigh=Number(n);_3d.childNodes[this.iHigh-1].className="as_highlight";_3d.childNodes[this.iHigh-1].style.backgroundColor="#ccc";_3d.childNodes[this.iHigh-1].style.color="#FFF";this.killTimeout();};_b.AutoSuggest.prototype.clearHighlight=function(){var _3e=_b.DOM.gE("as_ul");if(!_3e){return false;}
if(this.iHigh>0){_3e.childNodes[this.iHigh-1].className="";_3e.childNodes[this.iHigh-1].style.backgroundColor="#FFF";_3e.childNodes[this.iHigh-1].style.color="#CCC";this.iHigh=0;}};_b.AutoSuggest.prototype.setHighlightedValue=function(){if(this.iHigh){this.sInp=this.fld.value=this.aSug[this.iHigh-1].value;this.fld.focus();if(this.fld.selectionStart){this.fld.setSelectionRange(this.sInp.length,this.sInp.length);}
this.clearSuggestions();if(typeof(this.oP.callback)=="function"){this.oP.callback(this.aSug[this.iHigh-1]);}}};_b.AutoSuggest.prototype.killTimeout=function(){clearTimeout(this.toID);};_b.AutoSuggest.prototype.resetTimeout=function(){clearTimeout(this.toID);var _3f=this;this.toID=setTimeout(function(){_3f.clearSuggestions();},1000);};_b.AutoSuggest.prototype.clearSuggestions=function(){this.killTimeout();var ele=_b.DOM.gE(this.idAs);var _40=this;if(ele){var _41=new _b.Fader(ele,1,0,250,function(){_b.DOM.remE(_40.idAs);});}};if(typeof(_b.DOM)=="undefined"){_b.DOM={};}
_b.DOM.cE=function(_42,_43,_44,_45){var ne=document.createElement(_42);if(!ne){return 0;}
for(var a in _43){ne[a]=_43[a];}
var t=typeof(_44);if(t=="string"&&!_45){ne.appendChild(document.createTextNode(_44));}else{if(t=="string"&&_45){ne.innerHTML=_44;}else{if(t=="object"){ne.appendChild(_44);}}}
return ne;};_b.DOM.gE=function(e){var t=typeof(e);if(t=="undefined"){return 0;}else{if(t=="string"){var re=document.getElementById(e);if(!re){return 0;}else{if(typeof(re.appendChild)!="undefined"){return re;}else{return 0;}}}else{if(typeof(e.appendChild)!="undefined"){return e;}else{return 0;}}}};_b.DOM.remE=function(ele){var e=this.gE(ele);if(!e){return 0;}else{if(e.parentNode.removeChild(e)){return true;}else{return 0;}}};_b.DOM.getPos=function(e){var e=this.gE(e);var obj=e;var _46=0;if(obj.offsetParent){while(obj.offsetParent){_46+=obj.offsetLeft;obj=obj.offsetParent;}}else{if(obj.x){_46+=obj.x;}}
var obj=e;var _47=0;if(obj.offsetParent){while(obj.offsetParent){_47+=obj.offsetTop;obj=obj.offsetParent;}}else{if(obj.y){_47+=obj.y;}}
return{x:_46,y:_47};};if(typeof(_b.Fader)=="undefined"){_b.Fader={};}
_b.Fader=function(ele,_48,to,_49,_4a){if(!ele){return 0;}
this.e=ele;this.from=_48;this.to=to;this.cb=_4a;this.nDur=_49;this.nInt=50;this.nTime=0;var p=this;this.nID=setInterval(function(){p._fade();},this.nInt);};_b.Fader.prototype._fade=function(){this.nTime+=this.nInt;var _4b=Math.round(this._tween(this.nTime,this.from,this.to,this.nDur)*100);var op=_4b/100;if(this.e.filters){try{this.e.filters.item("DXImageTransform.Microsoft.Alpha").opacity=_4b;}
catch(e){this.e.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+_4b+")";}}else{this.e.style.opacity=op;}
if(this.nTime==this.nDur){clearInterval(this.nID);if(this.cb!=undefined){this.cb();}}};_b.Fader.prototype._tween=function(t,b,c,d){return b+((c-b)*(t/d));};