/* Harnesslink On The Bit
    YS Edward Hsiao 2007-11-12
    http://www.harnesslink.com
    copyright @ Harnesslink Limited
*/
var onthebit;
var e=document.createElement("script");
e.src='http://www.google.com/coop/cse/brand?form=searchbox_009867397274664613489%3A_yjfy2p_fdk';
e.type='text/javascript';
function OnTheBit(type, new_w, your, url, name) {
    name = unescape(name);
    url = unescape(url);
    url = 'http://' + url;
    var i = Math.round(10000*Math.random());
    document.write('<div id="onthebit_'+i+'">');
    if (type == 1) {
        document.write('<table border="0" cellspacing="0" cellpadding="0" width="300" bgcolor="#FFFFFF"><tr><td align="center"><a href="http://www.harnesslink.com/onthebit"><img src="http://www.harnesslink.com/images/onthebit/logos/onthebit_90x45.jpg" width="90" height="45" border="0" alt="On the Bit - Harness Racing Search Engine" align="middle"></a></td></tr>');
        document.write('<tr><td align="center">');
        document.write('<!-- Google CSE Search Box Begins -->');
        document.write('<form id="searchbox_009867397274664613489:_yjfy2p_fdk" action="http://www.harnesslink.com/onthebit.results"');
        if (your == 1) document.write(' onsubmit="search('+i+');"');
        if (new_w == 1) document.write(' target="_blank"');
        document.write('>');
        document.write('<input type="hidden" name="cx" value="" /><input type="hidden" name="cof" value="" />');
        document.write('<input name="q" type="text" size="40" /><input type="submit" name="sa" value="Search" />');
        document.write('<!-- Google CSE Search Box Ends -->');
        document.write('</td></tr>');
        if (your == 1 && url && name) document.write('<tr><td colspan="3" align="center"><input type="radio" name="sitesearch" checked onclick="change(this,'+i+');" value='+ url +' />'+name+'&nbsp;&nbsp;<input type="radio" name="sitesearch" onclick="change(this,'+i+');" value="" />On The Bit - Harness Websites</td></tr>');
        document.write('</table></form>');
    }
    else if (type == 2) {
        document.write('<table border="0" cellspacing="0" cellpadding="0"><tr><td>');
        document.write('<!-- Google CSE Search Box Begins -->');
        document.write('<form id="searchbox_009867397274664613489:_yjfy2p_fdk" action="http://www.harnesslink.com/onthebit.results"');
        if (your == 1) document.write(' onsubmit="search('+i+');"');
        if (new_w == 1) document.write(' target="_blank"');
        document.write('>');
        document.write('<input type="hidden" name="cx" value="" /><input type="hidden" name="cof" value="" />');
        document.write('<input type="image" src="http://www.harnesslink.com/images/onthebit/logos/onthebit_119x25.jpg" width="119" height="25" alt="On the Bit - Harness Racing Search Engine" border="0" align="absmiddle"/>');
        document.write('<input name="q" type="text" size="40" /><input type="submit" name="sa" value="Search" />');
        document.write('<!-- Google CSE Search Box Ends -->');
        document.write('</td>');
        if (your == 1 && url && name) document.write('<tr><td colspan="3" align="center"><input type="radio" name="sitesearch" checked onclick="change(this,'+i+');" value='+ url +' />'+name+'&nbsp;&nbsp;<input type="radio" name="sitesearch" onclick="change(this,'+i+');" value="" />On The Bit - Harness Websites</td></tr>');
        document.write('</table></form>');
    }
    else if (type == 3) {
        document.write('<table border="0" cellspacing="0" cellpadding="0"><tr><td align="center"><a href="http://www.harnesslink.com/onthebit"><img src="http://www.harnesslink.com/images/onthebit/logos/onthebit_154x80.jpg" border="0" alt="On the Bit - Harness Racing Search Engine" align="middle"></a></td></tr>');
        document.write('<tr><td align="center">');
        document.write('<!-- Google CSE Search Box Begins -->');
        document.write('<form id="searchbox_009867397274664613489:_yjfy2p_fdk" action="http://www.harnesslink.com/onthebit.results"');
        if (your == 1) document.write(' onsubmit="search('+i+');"');
        if (new_w == 1) document.write(' target="_blank"');
        document.write('>');
        document.write('<input type="hidden" name="cx" value="" /><input type="hidden" name="cof" value="" />');
        document.write('<input name="q" type="text" size="40" /><input type="submit" name="sa" value="Search" />');
        document.write('<!-- Google CSE Search Box Ends -->');
        document.write('</td></tr>');
        if (your == 1 && url && name) document.write('<tr><td colspan="3" align="center"><input type="radio" name="sitesearch" checked onclick="change(this,'+i+');" value='+ url +' />'+name+'&nbsp;&nbsp;<input type="radio" name="sitesearch" onclick="change(this,'+i+');" value="" />On The Bit - Harness Websites</td></tr>');
        document.write('</table></form>');
    }
    else if (type == 4) {
        document.write('<table border="0" cellspacing="0" cellpadding="0"><tr><td><a href="http://www.harnesslink.com/onthebit"><img src="http://www.harnesslink.com/images/onthebit/logos/onthebit_154x80.jpg" border="0" alt="On the Bit - Harness Racing Search Engine" align="middle"></a></td>');
        document.write('<td style="padding:20px 0 0 10px;">');  
        document.write('<!-- Google CSE Search Box Begins -->');
        document.write('<form id="searchbox_009867397274664613489:_yjfy2p_fdk" action="http://www.harnesslink.com/onthebit.results"');
        if (your == 1) document.write(' onsubmit="search('+i+');"');
        if (new_w == 1) document.write(' target="_blank"');
        document.write('>');
        document.write('<input type="hidden" name="cx" value="" /><input type="hidden" name="cof" value="" />');
        document.write('<input name="q" type="text" size="40" /><input type="submit" name="sa" value="Search" />');
        document.write('<!-- Google CSE Search Box Ends -->');
        document.write('</td></tr>');
        if (your == 1 && url && name)  document.write('<tr><td colspan="3" align="center"><input type="radio" name="sitesearch" checked onclick="change(this,'+i+');" value='+ url +' />'+name+'&nbsp;&nbsp;<input type="radio" name="sitesearch" onclick="change(this,'+i+');" value="" />On The Bit - Harness Websites</td></tr>');
        document.write('</table></form>');
    }
    else if (type == 5) {
        document.write('<table border="0" cellspacing="0" cellpadding="0" width="130">');
        document.write('<tr><td align="center"><a href="http://www.harnesslink.com/onthebit"><img src="http://www.harnesslink.com/images/onthebit/logos/onthebit_119x25.jpg" width="119" height="25" border="0" alt="On the Bit - Harness Racing Search Engine" align="middle"></a></td></tr>');
        document.write('<tr><td align="center"><!-- Google CSE Search Box Begins -->');
        document.write('<form id="searchbox_009867397274664613489:_yjfy2p_fdk" action="http://www.harnesslink.com/onthebit.results"');
        if (your == 1) document.write(' onsubmit="search('+i+');"');
        if (new_w == 1) document.write(' target="_blank"');
        document.write('>');
        document.write('<input type="hidden" name="cx" value="" /><input type="hidden" name="cof" value="" />');
        document.write('<input name="q" type="text" size="16" /><br /><input type="submit" name="sa" value="Search" />');
        document.write('<!-- Google CSE Search Box Ends -->');
        document.write('</td></tr>');
        if (your == 1 && url && name) document.write('<tr><td colspan="3"><input type="radio" name="sitesearch" checked onclick="change(this,'+i+');" value='+ url +' />'+name+'<br /><input type="radio" name="sitesearch" onclick="change(this,'+i+');" value="" />Harness Sites</td></tr>');
        document.write('</table></form>');
    }
    else if (type == 6) {
        document.write('<table border="0" cellspacing="0" cellpadding="0" width="130">');
        document.write('<tr><td align="center"><a href="http://www.harnesslink.com/onthebit"><img src="http://www.harnesslink.com/images/onthebit/logos/onthebit_90x45.jpg" width="90" height="45" border="0" alt="On the Bit - Harness Racing Search Engine" align="middle"></a></td></tr>');
        document.write('<tr><td align="center"><!-- Google CSE Search Box Begins -->');    
        document.write('<form id="searchbox_009867397274664613489:_yjfy2p_fdk" action="http://www.harnesslink.com/onthebit.results"');
        if (your == 1) document.write(' onsubmit="search('+i+');"');
        if (new_w == 1) document.write(' target="_blank"');
        document.write('>');
        document.write('<input type="hidden" name="cx" value="" /><input type="hidden" name="cof" value="" />');
        document.write('<input name="q" type="text" size="16" /><br /><input type="submit" name="sa" value="Search" />');
        document.write('<!-- Google CSE Search Box Ends -->');
        document.write('</td></tr>');
        if (your == 1 && url && name) document.write('<tr><td colspan="3"><input type="radio" name="sitesearch" checked onclick="change(this, '+i+');" value='+ url +' />'+name+'<br /><input type="radio" name="sitesearch" onclick="change(this, '+i+');" value="" />Harness Sites</td></tr>');
        document.write('</table></form>');
    }
    else document.write('<a href="http://www.harnesslink.com/onthebit"><img src="http://www.harnesslink.com/images/onthebit/logos/onthebit_154x80.jpg" border="0" alt="On the Bit - Harness Racing Search Engine" align="middle"></a>');
    document.write('<\/div>');
    var searchbox = document.getElementById('onthebit_'+i).getElementsByTagName('form')[0];
    searchbox.q.style.cssText = 'border: 1px solid #7e9db9; padding: 2px;';
    if (your == 0) {
        document.getElementsByTagName("head")[0].appendChild(e);
        searchbox.q.style.background = '#FFFFFF url(http://www.google.com/coop/images/google_custom_search_watermark.gif) left no-repeat';
        searchbox.cx.value='009867397274664613489:_yjfy2p_fdk';
        searchbox.cof.value='FORID:9';
    }
}
function search(i) {
    if (document.getElementById('onthebit_'+i).getElementsByTagName('form')[0].sitesearch[0].checked) document.getElementById('onthebit_'+i).getElementsByTagName('form')[0].action = 'http://www.google.com/search';
    else document.getElementById('onthebit_'+i).getElementsByTagName('form')[0].action = 'http://www.harnesslink.com/onthebit.results';
}
function change(type, i) {
    if (type.value == '') {
        document.getElementsByTagName("head")[0].appendChild(e);
        if (document.getElementById('onthebit_'+i).getElementsByTagName('form')[0].q.value < 1) document.getElementById('onthebit_'+i).getElementsByTagName('form')[0].q.style.background = '#FFFFFF url(http://www.google.com/coop/images/google_custom_search_watermark.gif) left no-repeat';
        document.getElementById('onthebit_'+i).getElementsByTagName('form')[0].cx.value='009867397274664613489:_yjfy2p_fdk';
        document.getElementById('onthebit_'+i).getElementsByTagName('form')[0].cof.value='FORID:9';
    }
    else {
        document.getElementById('onthebit_'+i).getElementsByTagName('form')[0].q.style.background ='#fff';
        document.getElementById('onthebit_'+i).getElementsByTagName('form')[0].cx.value='';
        document.getElementById('onthebit_'+i).getElementsByTagName('form')[0].cof.value='';
    }
}

