var defaultPrefs={title:"Featured Jobs",width:200,height:300,autoDim:false,count:7,hdrBG:"#666666",hdrTxt:"#FFFFFF",bodyBG:"#FFFFFF",bodyTxt:"#1054BA",featured:true,showIcon:true,showWalkins:false,baseUrl:"http://toostep.com/",imgUrl:"http://usrimg.toostep.com/",showPower:true,showSearch:true};var jobWidget=function(A){this.setPrefs(A)};jobWidget.prototype={setPrefs:function(A){this.Pref=A},init:function(A){var H=document.getElementById("tsJWbase1");if(!H){H=document.createElement("div");H.setAttribute("id","tsJWbase1");var G=document.getElementById("tsJWLnk");var D=G.parentNode;D.appendChild(H);D.removeChild(G)}var E=document.getElementsByTagName("head")[0];var I=document.createElement("style");I.type="text/css";if(I.styleSheet){I.styleSheet.cssText=this.getStyle()}else{var F=document.createTextNode(this.getStyle());I.appendChild(F)}E.appendChild(I);var C=new Array();C.push(this.getHead());C.push("<div id='tsJWbody1'><div style='text-align:center; padding: 5px;'>Fetching data...</div></div>");C.push(this.getFooter());if(!A){H.innerHTML=C.join("\n");this.getBody()}else{var B=document.getElementById("tsJWbody1").innerHTML;H.innerHTML=C.join("\n");document.getElementById("tsJWbody1").innerHTML=B}},getPref:function(A){var B=this.Pref[A];if(typeof B!="undefined"){return B}return defaultPrefs[A]},getStyle:function(){var B=this.getPref("autoDim");var A=new Array();A.push("#tsJWbase1 {");if(!B){A.push("width:");A.push(this.getPref("width"));A.push("px; ")}A.push("border: 1px solid ");A.push(this.getPref("hdrBG"));A.push(";}");A.push("#tsJWbody1 {");if(!B){A.push("height:");A.push(this.getPref("height"));A.push("px; ")}A.push("overflow-x:hidden; overflow-y:auto}");A.push(" .tsJWHdr1 {padding: 10px; background-color: ");A.push(this.getPref("hdrBG"));A.push("; color: ");A.push(this.getPref("hdrTxt"));A.push(";} #tsJWTitl1 {font-size: 1.5em;} ");A.push("#tsJWbody1 IMG {width:30px; height:30px;} #tsJWbody1 {background-color:");A.push(this.getPref("bodyBG"));A.push(";} #tsJWbody1 A {font-size:0.9em; color:");A.push(this.getPref("bodyTxt"));A.push(";}");A.push(" #tsJWbody1 TABLE TR TD.d {height:2px; border-bottom: 1px dotted ");A.push(this.getPref("bodyTxt"));A.push(";}");A.push(" #tsJWSrchTxt {border:none; width:130px; color:#666; font-size:0.9em}");A.push(" #tsJWSrchBtn {cursor:pointer; float:right; background:url(http://images.toostep.com/images/ra_search_small_v1.gif) no-repeat center; width:18px; height:0px;font-size:0.9em}");A.push(" #tsJWFtr1{background:##89B6D7;} #tsJWbase1 IMG {border: none; padding:0; margin:0}");return A.join("")},getHead:function(){var A=new Array();A.push('<div class="tsJWHdr1"><div id="tsJWTitl1">');A.push(this.getPref("title"));A.push("</div></div>");return A.join("")},getJobs:function(A){var F=this.getPref("baseUrl");var E=this.getPref("imgUrl");var C=this.getPref("count");var G=this.getPref("showIcon");var D=new Array();if(A.length<C){C=A.length}D.push("<table class='JobTable' width='100%'>");for(var B=0;B<C;B++){D.push("<tr>");if(G){D.push("<td><a href='");D.push(A[B].seoUrl);D.push("'><img src='");D.push(E);D.push(A[B].logoLink);D.push("'/></td>")}D.push("<td><a name='linker' target=_blank href='");D.push(A[B].seoUrl);D.push("'>");D.push(A[B].jobTitle);D.push("</a></td>");D.push("</tr>");if(B!=C){D.push("<tr><td colspan='2' class='d'></td></tr>")}}D.push("</table>");D.push("</div>");document.getElementById("tsJWbody1").innerHTML=D.join("")},getJobEvents:function(C){var F=this.getPref("baseUrl");var E=this.getPref("imgUrl");var B=this.getPref("count");var G=false;var D=new Array();if(C.length<B){B=C.length}D.push("<table class='JobTable'>");for(var A=0;A<B;A++){D.push("<tr>");D.push("<td><a name='linker' target=_blank href='");D.push(C[A].seoUrl);D.push("'>");D.push(C[A].jobEventTitle);D.push("</a>&nbsp;<span style='color:#666666; font-size:0.8em;'>("+C[A].startTime+")</span></td>");D.push("</tr>");if(A!=B){D.push("<tr><td colspan='2' class='d'></td></tr>")}}D.push("</table>");D.push("</div>");document.getElementById("tsJWbody1").innerHTML=D.join("")},getFooter:function(){var B=this.getPref("showPower");var A=this.getPref("showSearch");var C=new Array();C.push('<div id="tsJWFtr1">');C.push('<table width="100%">');if(A){C.push('<tr><td style="border:1px solid #CCC; width:150px;">');C.push('<form action="" onsubmit="doSearch(\'');C.push(this.getPref("baseUrl"));C.push('\'); return false;" style="padding:0;margin:0;border:0">');C.push('<div id="tsJWSrchBtn" onClick="doSearch(\'');C.push(this.getPref("baseUrl"));C.push("')\" >&nbsp;</div>");C.push('<input id="tsJWSrchTxt" type="text" value="Search jobs" onfocus="javascript:this.value=\'\';this.style.color=\'#000\';this.onfocus=\'\';" />');C.push('<input type="submit" style="top: -1000px; position: absolute;"/></form>');C.push('</td><td align="right"><a style="font-size:0.9em" href="');C.push(this.getPref("baseUrl"));C.push('jobsHome.html">Browse</a></td>');C.push("</tr>")}if(B){C.push('<tr><td colspan="2">');C.push('<div style="float:left; line-height:20px;"><A style="font-size:0.8em" href="');C.push(this.getPref("baseUrl"));C.push('widget/getJobsWidget.html"></a></div>');C.push('<div style="float:right"><A href="http://toostep.com/" title="powered by TooStep" target="_blank"></A></div>');C.push("</td></tr>")}C.push("</table>");C.push("</div>");return C.join("")},getBody:function(){var B=this.getPref("baseUrl")+"jobsForWidget.html";var E=new Array();if(this.getPref("featured")){E.push("featured=true")}if(this.getPref("posted")){E.push("posted=true");E.push("userId="+_currUser)}if(this.getPref("all")){E.push("all=true")}if(this.getPref("showWalkins")){E.push("showWalkins=true")}if(this.getPref("js")){E.push("jobsiteId="+this.getPref("js"))}E.push("pageSize="+this.getPref("count"));var F=new Date();var D=F.getFullYear()+"-"+F.getMonth()+"-"+F.getDate();E.push("d="+D);if(E.length>0){B+="?"+E.join("&")}var C=document.getElementsByTagName("head")[0];var A=document.createElement("script");A.type="text/javascript";A.src=B;C.appendChild(A)}};function doSearch(C){var A=document.getElementById("tsJWSrchTxt").value;A=A.replace(/^\s+|\s+$/g,"");if(A==""||A.toLowerCase()=="search jobs"){return }var B=C+"jobsHome.html?q="+encodeURIComponent(A);document.location.href=B};
