/***********************************************
* Conveyor belt slideshow script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/


//Specify the slider's width (in pixels)
var sliderwidth="400px"
//Specify the slider's height
var sliderheight="76px"
//Specify the slider's slide speed (larger is faster 1-10)
var slidespeed=10
//configure background color:
slidebgcolor="#EAEAEA"

//Specify the slider's images
var leftrightslide=new Array()
var finalslide=''
leftrightslide[0]='<a href="RCM.html"><img src="RCM.jpg" width="89" height="75" border="0"></a>'
leftrightslide[1]='<a href="2CAN.htm"><img src="2CAN_2_0_3.JPG" width="80" height="75" border=0></a>'
leftrightslide[2]='<a href="Router.html"><img src="ROUTER.jpg" width="125" height="75" border=0></a>'
leftrightslide[3]='<a href="Cross_link.html"><img src="control system.JPG" width="56" height="75" border=0></a>'
leftrightslide[4]='<a href="Cable.html"><img src="Cable.JPG" width="102" height="75" border=0></a>'
leftrightslide[5]='<a href="Power.html"><img src="Power cable.jpg" width="75" height="75" border=0></a>'
leftrightslide[6]='<a href="uCANDrive.html"><img src="uCANdrive1.png" width="133" height="75" border=0></a>'
leftrightslide[7]='<a href="Beak.html"><img src="BEAK_1.JPG" width="104" height="75" border=0></a>'

//Specify gap between each image (use HTML):
var imagegap="   "

//Specify pixels gap between each slideshow rotation (use integer):
var slideshowgap= 2


////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=slidespeed
var actualwidth=''
var cross_slide, ns_slide
var iedom=document.all||document.getElementById



function new_product(pic, link, desc, w, h)
{
  document.write('<a href="'+link+'">');
  document.write('<p><div class="product" style="height:'+(h+15)+'px;">');
  document.write('<img src="'+pic+'" border="0" align="left" width="'+w+'" height="'+h+'" HSPACE=5 VSPACE=5>');
  document.write('<font color = "black">'+desc+'</font>');
  document.write('</div></p></a>');
}

function featured_product(pic, link, desc, w, h, x, y, price)
{
  document.write('<a href="'+link+'">');
  document.write('<p><div class="featured_product" style="position:relative; left:'+x+'px; top:'+y+'px;">');
  document.write('<img src="'+pic+'" border="0" width="'+w+'" height="'+h+'" HSPACE=5 VSPACE=10>');
  document.write('<div style="position:relative; text-align:left; left:0px; top:0px; color:blue; margin-left: 20px;">'+desc+'</div>');
  document.write('<div style="position:relative; text-align:left; left:0px; top:0px; color:red; margin-left: 20px; margin-bottom:10px;">'+price+'</div>');
  document.write('</div></p></a>');
}

/*-------------------------------------------------------------------------------*/
/*********Presentation Functions.  Only called once.******************************/
/*-------------------------------------------------------------------------------*/

/***Top of page. Contains company name and tagline****/
function header(){
    document.write('<div id="div1"><img id="iheader" src="Label_logo_2.gif" alt="header image" >');
  //  document.write('<div id="div1"><img id="iheader" src="cross_the_road2.jpg" alt="header image" >');
    document.write('<div id="div2">Cross the Road Electronics<p id="tagline">Creative solutions for competitive robotics</p></div></div>');
    document.write('<div id="div3">'+TODAY+'</div>');
}

/***Main links on left of every page*****/
function process_main_links(){

document.write('<div id="linkwrapper">');
document.write('<div id="ddsidemenubar" class="markermenu">');

document.write('<ul>');
document.write('<div id="link1"><li><a class="one" href="products.html"rel="ddsubmenuside1" >Products</a></li></div>');
document.write('<div id="link2"><li><a class="one" href="about.html" >About us</a></li></div>');
document.write('<div id="link3"><li><a class="one" href="tutorial.html" >Tutorials</a></li></div>');
document.write('<div id="link4"><li><a class="one" href="contact.html">Contact us</a></li></div>');
document.write('<div id="link5"><li><a class="one" href="links.html" >Links</a></li></div>');
document.write('<div id="link6"><li><a class="one" href="index.html" style="border-bottom-width:0px">Home</a></li></div>');
document.write('</ul>');
document.write('</div>');
//document.write('</div>');
ddlevelsmenu.setup("ddsidemenubar", "sidebar");

 /* document.write('<div id="linkwrapper">');
  document.write('<div id="link1"><a class="one" href="products.html">products</a></div>');
  document.write('<div id="link2"><a class="one" href="about.html">about us</a></div>');
  document.write('<div id="link3"><a class="one" href="tutorial.html">tutorials</a></div>');
  document.write('<div id="link4"><a class="one" href="contact.html">contact us</a></div>');
  document.write('<div id="link5"><a class="one" href="links.html">links</a></div>');
  document.write('<div id="link6"><a class="one" href="index.html">home</a></div>'); */



  document.write('<div style="position:relative; font-size:20px; font-family:Arial; text-align:left; padding:0px; left:5px; top:295px;">Proud Sponsor of</div>');
  add_image("FIRSTvert_RGB.jpg", "AM", "http://www.usfirst.org", 25, 320);
  document.write('<div style="position:relative; font-size:20px; font-family:Arial; text-align:center; padding:0px; left:0px; top:375px;">Distributers</div>');
  add_image("am_logo_2.jpg", "AM", "http://www.andymark.com", 25, 400);


<!-- BEGIN: Constant Contact Stylish Email Newsletter Form -->
 document.write('<div style="position:relative; font-size:20px; font-family:Arial; text-align:left; padding:0px; left:0px; top:-90px;">');

document.write('<div align="center">');
document.write('<div style="width:160px; background-color: #ffffff;">');
document.write('<form name="ccoptin" action="http://visitor.r20.constantcontact.com/d.jsp" target="_blank" method="post" style="margin-bottom:3;"><span style="background-color: #006699; float:right;margin-right:5;margin-top:3"><img src="https://imgssl.constantcontact.com/ui/images1/visitor/email1_trans.gif" alt="Email Newsletter icon, E-mail Newsletter icon, Email List icon, E-mail List icon" border="0"></span>');
document.write('<font style="font-weight: bold; font-family:Arial; font-size:16px; color:#006699;">Sign up for our Email Newsletter</font>');
document.write('<input type="text" name="ea" size="20" value="" style="font-family:Verdana,Geneva,Arial,Helvetica,sans-serif; font-size:10px; border:1px solid #999999;">');
document.write('<input type="submit" name="go" value="GO" class="submit"  style="font-family:Verdana,Arial,Helvetica,sans-serif; font-size:10px;">');
document.write('<input type="hidden" name="llr" value="76omd9iab">');
document.write('<input type="hidden" name="m" value="1108977531836">');
document.write('<input type="hidden" name="p" value="oi">');
document.write('</form>');
document.write('</div>');
document.write('</div>');
document.write('</div>');


<!-- END: Constant Contact Stylish Email Newsletter Form -->
<!-- BEGIN: SafeSubscribe -->
document.write('<div align="center" style="padding-top:0px; position:relative; left:0px; top:-90px;">');
document.write('<img src="https://imgssl.constantcontact.com/ui/images1/safe_subscribe_logo.gif" border="0" width="168" height="14" alt=""/>');
document.write('</div>');
<!-- END: SafeSubscribe -->

<!-- BEGIN: Email Marketing you can trust -->
document.write('<div align="center" style="font-family:Arial,Helvetica,sans-serif;font-size:10px;color:#999999; position:relative; left:0px; top:-90px;">');
document.write('For <a href="http://www.constantcontact.com/jmml/email-marketing.jsp" style="text-decoration:none;font-family:Arial,Helvetica,sans-serif;font-size:10px;color:#999999;" target="_blank">Email Marketing</a> you can trust');
document.write('</div>');
<!-- END: Email Marketing you can trust -->

document.write('</div>');
process_submenu_1();
}

/*<!--HTML for the Drop Down Menus associated with Side Menu Bar-->
<!--They should be inserted OUTSIDE any element other than the BODY tag itself-->
<!--A good location would be the end of the page (right above "</BODY>")-->


<!--Side Drop Down Menu 1 HTML-->  */

function process_submenu_1()
{
 document.write('<ul id="ddsubmenuside1" class="ddsubmenustyle blackwhite">');
 document.write('<li><a href="#">Cables</a>');
 document.write('<ul>');
 document.write('<li><a href="Battery_Cable.html">Battery Cable</a></li>');
 document.write('<li><a href="Cable.html">CAN Cables</a></li>');
 document.write('<li><a href="Ethernet_cables.html">Ethernet Cables</a></li>');
 document.write('<li><a href="Power.html">RCM Cable</a></li>');
 document.write('</ul>');
 document.write('</li>');
 document.write('<li><a href="#">Connectors</a>');
 document.write('<ul>');
 document.write('<li><a href="window.html">Window Motor</a></li>');
 document.write('<li><a href="CAN_con.html">CAN RJ-11</a></li>');
 //document.write('<li><a href="#"></a></li>');
 document.write('</ul>');
 document.write('</li>');
 document.write('<li><a href="Cross_link.html">Control System</a>');
 document.write('<ul>');
 document.write('<li><a href="2CAN.htm">CAN Gateways</a></li>');
 document.write('<li><a href="RCM.html">Control Modules</a></li>');
 document.write('<li><a href="Router.html">Wireless Radios</a></li>');
 document.write('<li><a href="uCANDrive.html">uCANDrive</a></li>');
 document.write('</ul>');
 document.write('</li>');
 document.write('<li><a href="Beak.html">Battery Testing</a></li>');
 document.write('<li><a href="#">CAN Devices</a>');
 document.write(' <ul>');
 document.write('<li><a href="2CAN.htm">2CAN 2.0</a></li>');
 document.write('<li><a href="RCM.html">CANipede RCM</a>');
// document.write('<ul>');
// document.write('<li><a href="#">Sub Item 5.2.1a</a></li>');
// document.write('<li><a href="#">Sub Item 5.2.2a</a></li>');
// document.write('<li><a href="#">Sub Item 5.2.3a</a></li>');
 //document.write('<li><a href="#">Sub Item 5.2.4a</a></li>');
// document.write('</ul>');
 document.write('</li>');
 document.write('</ul>');
 document.write('</li>');
// document.write('<li><a href="#">Item 6a</a></li>');
 document.write('</ul>');
}

/***Displays the page name*****/
function page_name(name){
  document.write('<div id="title">'+name+'</div>');
}

function start_main_body(h)
{
document.write('<div id="mainbody" style="height:'+h+'px;">');
/*document.write('<a href="http://www.twitter.com/CrosstheRoad1"><img id="TWIT" src="http://twitter-badges.s3.amazonaws.com/twitter-b.png" alt="Follow CrosstheRoad1 on Twitter"/></a>');*/
add_body_text('<a href="http://www.twitter.com/CrosstheRoad1"><img id="TWIT" src="http://twitter-badges.s3.amazonaws.com/twitter-b.png" alt="Follow CrosstheRoad1 on Twitter"/></a>', 0, 0);
add_body_text('<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIG1QYJKoZIhvcNAQcEoIIGxjCCBsICAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYAdY8CQw963JDIWe24b/UG8bxJh6YrREMuV2Cie5J1mzgrGJPqXqoRveLn69b4yCwAI7OOIeKgMmQiwtDgsVyMH6KcYc58x0iXa77i6Qkb13uf3pHI3Df7yedZjscSXEEuiYBUg0CgpXzRnlB6krbC/ySUL/q4Gg6iL+vr0iLbIqTELMAkGBSsOAwIaBQAwUwYJKoZIhvcNAQcBMBQGCCqGSIb3DQMHBAimnWJwV/q4YoAwsmcRWrw3mZUyYEEQZKiKxSKHdN2xp7YVqPDduFHXaShrkYQMliaBhBn7ckmQQpHEoIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMB4XDTA0MDIxMzEwMTMxNVoXDTM1MDIxMzEwMTMxNVowgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBR07d/ETMS1ycjtkpkvjXZe9k+6CieLuLsPumsJ7QC1odNz3sJiCbs2wC0nLE0uLGaEtXynIgRqIddYCHx88pb5HTXv4SZeuv0Rqq4+axW9PLAAATU8w04qqjaSXgbGLP3NmohqM6bV9kZZwZLR/klDaQGo1u9uDb9lr4Yn+rBQIDAQABo4HuMIHrMB0GA1UdDgQWBBSWn3y7xm8XvVk/UtcKG+wQ1mSUazCBuwYDVR0jBIGzMIGwgBSWn3y7xm8XvVk/UtcKG+wQ1mSUa6GBlKSBkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTIwMTA0MTkyMDMxWjAjBgkqhkiG9w0BCQQxFgQU8EF8en6RpsN9EVTpcohsyJBxs/IwDQYJKoZIhvcNAQEBBQAEgYA6S4nLqRvlp+ZlfmGsLxL8jE/9q0LuExTaOO0JyuFVVIsYyoIoFJukZj/x3Dcf4zZdmZ37snElmf+FWyzFPSWWBDWMkBq90hcNcXMP0HumRDtU9C2kTR4gMAo+SFXLqzgx2JwqxDHtvfBka1RqpmhqSeDNv4TX4hcxFdLCdWeVoA==-----END PKCS7-----"><input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_viewcart_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"><img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"></form>',600,-20);

}

function end_main_body()
{
   document.write('</div>');
}
/*-------------------------------------------------------------------------------*/
/*********Content Functions.******************************************************/
/*-------------------------------------------------------------------------------*/
function buy_now(price, id, x, y){
  document.write('<div style="position:relative; text-align:left; left:'+x+'px; top:'+y+'px; font-size:20px; font-weight:bold; color:#b33222;">'+price+'<br><br>');
  add_body_text('<font style="color:blue; font-size:10px;"> You may adjust the order quantity upon checkout.</font>', -10, 50);
  document.write('<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">');
  document.write('<input type="hidden" name="cmd" value="_s-xclick">');
  document.write('<input type="hidden" name="hosted_button_id" value="'+id+'">');
  document.write('<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">');
  document.write('<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"></form></div>');

}


//BS6CXH9VVFJQE = 2CAN , 5VYBX5WMGWAWQ = RCM, P4A5WSVBNH5W4 = router, BAQCQCU7AUXGA = RCM power cable, GERLH6FPX83TG = Cross-link control system, MNH7XBZLHPY9A = Window Motor Connector
//Battery Cable = KFLPPQL7GV3VQ  CAN connector = TWP37QZLXME6A     CAN cable by the foot 6HRQBWWMP3ELE



function buy_now2(price, x, y){
  document.write('<div style="position:relative; text-align:left; left:'+x+'px; top:'+y+'px; font-size:20px; font-weight:bold; color:#b33222;">'+price+'<br>');
  document.write('<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">');
  document.write('<input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="NH78SMHHPKJH4">  ');
  document.write('<table><tr><td><input type="hidden" name="on0" value="Length" ><font size="2" color="black"> Select Length</font></td></tr><tr><td><select name="os0"><option value="10 inch">10 inch $2.99</option><option value="24 inch">24 inch $4.99</option>   ');
  document.write('</select> </td></tr></table><br>  ');
  document.write('<input type="hidden" name="currency_code" value="USD"><input type="image" src="https://www.paypal.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> ');
  document.write('<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"></form></div>');
}

function Buy_now_Enet(price, x, y){
 document.write('<div style="position:relative; text-align:left; left:'+x+'px; top:'+y+'px; font-size:20px; font-weight:bold; color:#b33222;">'+price+'<br>');
 document.write('<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">');
 document.write('<input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="BYSLAELM6DNZY"><table>');
 document.write('<tr><td><input type="hidden" name="on0" value="Color and Size"></td></tr><tr><td><select name="os0">');
 document.write('<option value="3 Feet Black">3 Feet Black $4.99 USD</option><option value="3 Feet Red">3 Feet Red $4.99 USD</option>');
 document.write('<option value="5 Feet Black">5 Feet Black $6.99 USD</option></select> </td></tr></table><input type="hidden" name="currency_code" value="USD">');
 document.write('<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">');
 document.write('<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"></form></div>');
}

function buy_now_beak(price, x, y){
    document.write('<div style="position:relative; text-align:left; left:'+x+'px; top:'+y+'px; font-size:20px; font-weight:bold; color:#b33222;">'+price+'<br>');
    document.write('<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">');
    document.write('<input type="hidden" name="cmd" value="_s-xclick">');
    document.write('<input type="hidden" name="hosted_button_id" value="RGSTKCB7KFML2"><table>');
    document.write('<tr><td><input type="hidden" name="on0" value="Battery Beak"></td></tr><tr><td><select name="os0">');
    document.write('<option value="Battery Beak">Battery Beak $119.99 USD</option>');
    document.write('<option value="Battery Beak with Adaptor">Battery Beak with Adaptor $134.98 USD</option>');
    document.write('<option value="Tamiya Adaptor Only">Tamiya Adaptor Only $14.99 USD</option></select> </td></tr></table>');
    document.write('<input type="hidden" name="currency_code" value="USD">');
    document.write('<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">');
    document.write('<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"></form>');
    document.write('<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"></form></div>');
}

/***Add new image*****/
/***Arguments: image file name, style sheet class, link*****/
function add_image(pic, style, link, x, y){

//var image = '<img id="ECABLERED" src="E_cable_red.JPG">';

//add_body_text(image, x, y);


document.write('<div style="position:relative; left:'+x+'px; top:'+y+'px; width:50%; height:auto;  text-align:left;">');
  if(link==0)
  {
    document.write('<img id="'+style+'" src="'+pic+'"></div>');
  }
  else{
    document.write('<a href="'+link+'"><img id="'+style+'" src="'+pic+'"></a></div>');
  }
//  document.write('</div>');
}


/***Create Bullet*****/
function _bullet(){
  document.write('<font color="#000000">&bull;&nbsp;&nbsp;&nbsp;</font>');
}

/***Add new link*****/
function new_link(link, text, size, x, y){
  document.write('<div  style="position:relative; text-align:left; padding:0px; left:'+x+'px; top:'+y+'px;">');
  _bullet();
  if(link==0){
    document.write('<font class="links" size = "'+size+'" color = "#000000">'+text+' ');
  }
  else{
    document.write('<a href="'+link+'"><font class="links" size = "'+size+'">'+text+' ');
  }
  document.write('</a></font></div>');
}

/***Add new link***************************/
/***Arguments: Text, Position(absolute)****/
function add_body_text(text,x,y){
    document.write('<div class="bodyText" style="position:relative; left:'+x+'px; top:'+y+'px;">'+text+'</div>');
}

/**Adds elements such as boxes or lines*********/
/**Needs style id as argument*******************/
function add_element(id, h){
 document.write('<div id="'+id+'" style=" height:'+h+'px;"></div>');
}

function footer(height, x,y){
 document.write('<div style="height:'+height+'px; width:auto; border:10px solid black; position:relative; top:'+y+'px; left:'+x+'px; ">&nbsp;FOOTER</div>');
}





function makeArray0() {
     for (i = 0; i<makeArray0.arguments.length; i++)
          this[i] = makeArray0.arguments[i];
}

var days = new makeArray0("Sunday","Monday","Tuesday","Wednesday",
    "Thursday","Friday","Saturday");

var months = new makeArray0('January','February','March',
    'April','May','June','July','August','September',
    'October','November','December');

function nths(day) {
     if (day == 1 || day == 21 || day == 31) return 'st';
     if (day == 2 || day == 22) return 'nd';
     if (day == 3 || day == 23) return 'rd';
     return 'th';
}

function getCorrectedYear(year) {
    year = year - 0;
    if (year < 70) return (2000 + year);
    if (year < 1900) return (1900 + year);
    return year;
}

function y2k(number) { return (number < 1000) ? number + 1900 : number; }

var last = document.lastModified;
var date = new Date(last);
var dateY2K = new Date(getCorrectedYear(date.getYear()),date.getMonth(),date.getDate());


function last_updated()
{
   var update  =  "Last updated on " +months[dateY2K.getMonth()] + ' ' +dateY2K.getDate() + nths(dateY2K.getDate()) + " , " +(y2k(dateY2K.getYear())) + ".";
   return update;
}

///****************************************************************************
function slideleft(){
if (iedom){
if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+8))
cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px"
else
cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px"

if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+8))
cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px"
else
cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px"

}
else if (document.layers){
if (ns_slide.left>(actualwidth*(-1)+8))
ns_slide.left-=copyspeed
else
ns_slide.left=ns_slide2.left+actualwidth+slideshowgap

if (ns_slide2.left>(actualwidth*(-1)+8))
ns_slide2.left-=copyspeed
else
ns_slide2.left=ns_slide.left+actualwidth+slideshowgap
}
}

function fillup(){
if (iedom){
cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2
cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3
cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide
actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth
cross_slide2.style.left=actualwidth+slideshowgap+"px"
}
else if (document.layers){
ns_slide=document.ns_slidemenu.document.ns_slidemenu2
ns_slide2=document.ns_slidemenu.document.ns_slidemenu3
ns_slide.document.write(leftrightslide)
ns_slide.document.close()
actualwidth=ns_slide.document.width
ns_slide2.left=actualwidth+slideshowgap
ns_slide2.document.write(leftrightslide)
ns_slide2.document.close()
}
lefttime=setInterval("slideleft()",500)
}



function process_slide_show(id){

document.write('<div id="'+id+'">');

  if (iedom)
document.write('<span id="temp" style="visibility:hidden; position:absolute; top:-100px; left:-9000px">'+leftrightslide+'</span>')
window.onload=fillup
if (iedom||document.layers){
with (document){
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
if (iedom){
write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed">')
write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>')
write('<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>')
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>')
write('<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('</ilayer>')
}
document.write('</td></table>')
}
}
leftrightslide='<nobr>'+leftrightslide.join(imagegap)+'</nobr>'
document.write('</div>');
}

//############################################################################################################################################################################
//##########################################################################################################################################################################
//########################  NEW SLIDER



function run_BEAK_banner(x, y)
{
  document.write('<div style="position:relative; left:'+x+'px; top:'+y+'px;"id="BEAK_banners"><div id="BEAK_banner1"><img id="BEAK" src="BEAK_1.JPG">');
  document.write('<span>Durable housing made of ABS/polycarb blend mates directly with the Anderson SB50 connector. </span></div>');
  document.write('<div id="BEAK_banner2"><img id="BEAK" src="BEAK_LANYARD_2.JPG"><span>Attractive lanyard keeps the Beak secure.</span></div><div id="BEAK_banner3"><img id="SPLASH" src="Splash_zoom.JPG">');
  document.write('<span>High resolution OLED display is bright, efficient and visible in all levels of ambient light.</span></div><div id="BEAK_banner4"><img id="SPLASH" src="Test_view.JPG"><span>Displays voltage at 0, 1 and 18 amps of load.  Also displays state of charge, internal resistance and battery quality.</span></div>');
  document.write('<div id="BEAK_banner5"><img id="SPLASH" src="Menu_view.JPG"><span>Simple one button interface allows the user to select between chemistries and a variety of voltage and amphour combinations.</span></div>');
  document.write('<ul><li>1 &nbsp;</li><li>&nbsp; 2 &nbsp;</li><li>&nbsp; 3 &nbsp;</li><li>&nbsp; 4 &nbsp;</li><li>&nbsp; 5 &nbsp;</li></ul></div>');
  bannertime = 4000;
  BEAK_banner_init();
}

function run_banner(x, y)
{
  document.write('<div style="position:relative; left:'+x+'px; top:'+y+'px;"id="banners"><div id="banner1"><img id="UCAN" src="uCANdrive1.png">');
  document.write('<span>2 Arcade 4 buttons configuration.</span></div>');
  document.write('<div id="banner2"><img id="UCAN" src="uCANdrive2.png"><span>2 Buttons one arcade configuration.</span></div><div id="banner3"><img id="UCAN" src="uCANdrive3.png">');
  document.write('<span>2 buttons with 2 sliders configuration.</span></div><div id="banner4"><img id="UCAN" src="uCANdrive4.png"><span>6 buttons with three sliders configuration.</span></div>');
  document.write('<div id="banner5"><img id="UCAN" src="uCANdrive5.png"><span>Accelerometer with two buttons configuration.</span></div>');
 // document.write('<ul><li><a href="/1/">1</a></li><li><a href="/2/">2</a></li><li><a href="/3/">3</a></li><li><a href="/4/">4</a></li><li><a href="/5/">5</a></li></ul></div>');
  document.write('<ul><li>1 &nbsp;</li><li>&nbsp; 2 &nbsp;</li><li>&nbsp; 3 &nbsp;</li><li>&nbsp; 4 &nbsp;</li><li>&nbsp; 5 &nbsp;</li></ul></div>');
  bannertime = 4000;
  banner_init();
}

var current_banner = 1;
var total_banners = 0;
var wait = 0;

function BEAK_banner_init()
{
  //stop banner change if mouse over one banner
  elements = document.getElementById('BEAK_banners').getElementsByTagName('div');
  total_banners = elements.length;
  for (var i = 0; i < elements.length; i++)
  {
    elements[i].onmouseover = function ()
    {
      clearTimeout(wait);
    }
    elements[i].onmouseout = function ()
    {
      clearTimeout(wait);
      wait = setTimeout('BEAK_nextBanner()',bannertime);
    }
  }

  //set navigation
  elements = document.getElementById('BEAK_banners').getElementsByTagName('ul')[0].getElementsByTagName('li');
  total_banners = elements.length;
  for (var i = 0; i < elements.length; i++)
  {
    elements[i].title = i + 1;
    elements[i].onmouseover = function ()
   {
     BEAK_banner(this.title);
     clearTimeout(wait);
   }
   elements[i].onmouseout = function ()
   {
     clearTimeout(wait);
     wait = setTimeout('BEAK_nextBanner()',bannertime);
   }
  }
  wait = setTimeout('BEAK_nextBanner()',bannertime);
}

 function BEAK_banner(nr)
{
   clearTimeout(wait);
   elements = document.getElementById('BEAK_banners').getElementsByTagName('div');
   //hide all divs
   for (var i = 0; i < elements.length; i++)
   {
     if (nr == (i + 1))
     {
       //show selected banner
       elements[i].style.display = "block";
     } else
     {       //hide everything else
      elements[i].style.display = "none";
     }
   }
   wait = setTimeout('BEAK_nextBanner()',bannertime);
}

 function BEAK_nextBanner()
{
  if(current_banner < total_banners)
  {
    current_banner ++;
  }
  else
  {
    current_banner = 1;
  }
  BEAK_banner(current_banner);
}



function banner_init()
{
  //stop banner change if mouse over one banner
  elements = document.getElementById('banners').getElementsByTagName('div');
  total_banners = elements.length;
  for (var i = 0; i < elements.length; i++)
  {
    elements[i].onmouseover = function ()
    {
      clearTimeout(wait);
    }
    elements[i].onmouseout = function ()
    {
      clearTimeout(wait);
      wait = setTimeout('nextBanner()',bannertime);
    }
  }

  //set navigation
  elements = document.getElementById('banners').getElementsByTagName('ul')[0].getElementsByTagName('li');
  total_banners = elements.length;
  for (var i = 0; i < elements.length; i++)
  {
    elements[i].title = i + 1;
    elements[i].onmouseover = function ()
   {
     banner(this.title);
     clearTimeout(wait);
   }
   elements[i].onmouseout = function ()
   {
     clearTimeout(wait);
     wait = setTimeout('nextBanner()',bannertime);
   }
  }
  wait = setTimeout('nextBanner()',bannertime);
}

 function banner(nr)
{
   clearTimeout(wait);
   elements = document.getElementById('banners').getElementsByTagName('div');
   //hide all divs
   for (var i = 0; i < elements.length; i++)
   {
     if (nr == (i + 1))
     {
       //show selected banner
       elements[i].style.display = "block";
     } else
     {       //hide everything else
      elements[i].style.display = "none";
     }
   }
   wait = setTimeout('nextBanner()',bannertime);
}

function nextBanner()
{
  if(current_banner < total_banners)
  {
    current_banner ++;
  }
  else
  {
    current_banner = 1;
  }
  banner(current_banner);
}




/***************************************************************************************************************************************************
*****************************************************Below is the java script for the menu slideout ******************************************************
****************************************************************************************************************************************************/



//** All Levels Navigational Menu- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com
//** Script Download/ instructions page: http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/
//** Usage Terms: http://www.dynamicdrive.com/notice.htm

//** Current version: 3.01 See changelog.txt for details

if (typeof dd_domreadycheck=="undefined") //global variable to detect if DOM is ready
	var dd_domreadycheck=false

var ddlevelsmenu={
enableshim: true, //enable IFRAME shim to prevent drop down menus from being hidden below SELECT or FLASH elements? (tip: disable if not in use, for efficiency)

arrowpointers:{
	downarrow: ["ddlevelsfiles/arrow-down.gif", 11,7], //[path_to_down_arrow, arrowwidth, arrowheight]
	rightarrow: ["ddlevelsfiles/arrow-right.gif", 12,12], //[path_to_right_arrow, arrowwidth, arrowheight]
	showarrow: {toplevel: true, sublevel: true} //Show arrow images on top level items and sub level items, respectively?
},
hideinterval: 200, //delay in milliseconds before entire menu disappears onmouseout.
effects: {enableswipe: true, enableslide: true, enablefade: true, duration: 200},
httpsiframesrc: "blank.htm", //If menu is run on a secure (https) page, the IFRAME shim feature used by the script should point to an *blank* page *within* the secure area to prevent an IE security prompt. Specify full URL to that page on your server (leave as is if not applicable).

///No need to edit beyond here////////////////////

topmenuids: [], //array containing ids of all the primary menus on the page
topitems: {}, //object array containing all top menu item links
subuls: {}, //object array containing all ULs
lastactivesubul: {}, //object object containing info for last mouse out menu item's UL
topitemsindex: -1,
ulindex: -1,
hidetimers: {}, //object array timer
shimadded: false,
nonFF: !/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent), //detect non FF browsers
ismobile:navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i) != null, //boolean check for popular mobile browsers

getoffset:function(what, offsettype){
	return (what.offsetParent)? what[offsettype]+this.getoffset(what.offsetParent, offsettype) : what[offsettype]
},

getoffsetof:function(el){
	el._offsets={left:this.getoffset(el, "offsetLeft"), top:this.getoffset(el, "offsetTop")}
},

getwindowsize:function(){
	this.docwidth=window.innerWidth? window.innerWidth-10 : this.standardbody.clientWidth-10
	this.docheight=window.innerHeight? window.innerHeight-15 : this.standardbody.clientHeight-18
},

gettopitemsdimensions:function(){
	for (var m=0; m<this.topmenuids.length; m++){
		var topmenuid=this.topmenuids[m]
		for (var i=0; i<this.topitems[topmenuid].length; i++){
			var header=this.topitems[topmenuid][i]
			var submenu=document.getElementById(header.getAttribute('rel'))
			header._dimensions={w:header.offsetWidth, h:header.offsetHeight, submenuw:submenu.offsetWidth, submenuh:submenu.offsetHeight}
		}
	}
},

isContained:function(m, e){
	var e=window.event || e
	var c=e.relatedTarget || ((e.type=="mouseover")? e.fromElement : e.toElement)
	while (c && c!=m)try {c=c.parentNode} catch(e){c=m}
	if (c==m)
		return true
	else
		return false
},

addpointer:function(target, imgclass, imginfo, BeforeorAfter){
	var pointer=document.createElement("img")
	pointer.src=imginfo[0]
	pointer.style.width=imginfo[1]+"px"
	pointer.style.height=imginfo[2]+"px"
	if(imgclass=="rightarrowpointer"){
		pointer.style.left=target.offsetWidth-imginfo[2]-2+"px"
	}
	pointer.className=imgclass
	var target_firstEl=target.childNodes[target.firstChild.nodeType!=1? 1 : 0] //see if the first child element within A is a SPAN (found in sliding doors technique)
	if (target_firstEl && target_firstEl.tagName=="SPAN"){
		target=target_firstEl //arrow should be added inside this SPAN instead if found
	}
	if (BeforeorAfter=="before")
		target.insertBefore(pointer, target.firstChild)
	else
		target.appendChild(pointer)
},

css:function(el, targetclass, action){
	var needle=new RegExp("(^|\\s+)"+targetclass+"($|\\s+)", "ig")
	if (action=="check")
		return needle.test(el.className)
	else if (action=="remove")
		el.className=el.className.replace(needle, "")
	else if (action=="add" && !needle.test(el.className))
		el.className+=" "+targetclass
},

addshimmy:function(target){
	var shim=(!window.opera)? document.createElement("iframe") : document.createElement("div") //Opera 9.24 doesnt seem to support transparent IFRAMEs
	shim.className="ddiframeshim"
	shim.setAttribute("src", location.protocol=="https:"? this.httpsiframesrc : "about:blank")
	shim.setAttribute("frameborder", "0")
	target.appendChild(shim)
	try{
		shim.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'
	}
	catch(e){}
	return shim
},

positionshim:function(header, submenu, dir, scrollX, scrollY){
	if (header._istoplevel){
		var scrollY=window.pageYOffset? window.pageYOffset : this.standardbody.scrollTop
		var topgap=header._offsets.top-scrollY
		var bottomgap=scrollY+this.docheight-header._offsets.top-header._dimensions.h
		if (topgap>0){
			this.shimmy.topshim.style.left=scrollX+"px"
			this.shimmy.topshim.style.top=scrollY+"px"
			this.shimmy.topshim.style.width="99%"
			this.shimmy.topshim.style.height=topgap+"px" //distance from top window edge to top of menu item
		}
		if (bottomgap>0){
			this.shimmy.bottomshim.style.left=scrollX+"px"
			this.shimmy.bottomshim.style.top=header._offsets.top + header._dimensions.h +"px"
			this.shimmy.bottomshim.style.width="99%"
			this.shimmy.bottomshim.style.height=bottomgap+"px" //distance from bottom of menu item to bottom window edge
		}
	}
},

hideshim:function(){
	this.shimmy.topshim.style.width=this.shimmy.bottomshim.style.width=0
	this.shimmy.topshim.style.height=this.shimmy.bottomshim.style.height=0
},


buildmenu:function(mainmenuid, header, submenu, submenupos, istoplevel, dir){
	header._master=mainmenuid //Indicate which top menu this header is associated with
	header._pos=submenupos //Indicate pos of sub menu this header is associated with
	header._istoplevel=istoplevel
	if (istoplevel){
		this.addEvent(header, function(e){
		ddlevelsmenu.hidemenu(ddlevelsmenu.subuls[this._master][parseInt(this._pos)])
		}, "click")
	}
	this.subuls[mainmenuid][submenupos]=submenu
	header._dimensions={w:header.offsetWidth, h:header.offsetHeight, submenuw:submenu.offsetWidth, submenuh:submenu.offsetHeight}
	this.getoffsetof(header)
	submenu.parentNode.style.left=0
	submenu.parentNode.style.top=0
	submenu.parentNode.style.visibility="hidden"
	submenu.style.visibility="hidden"
	this.addEvent(header, function(e){ //mouseover event
		if (ddlevelsmenu.ismobile || !ddlevelsmenu.isContained(this, e)){
			var submenu=ddlevelsmenu.subuls[this._master][parseInt(this._pos)]
			if (this._istoplevel){
				ddlevelsmenu.css(this, "selected", "add")
				clearTimeout(ddlevelsmenu.hidetimers[this._master][this._pos])
			}
			ddlevelsmenu.getoffsetof(header)
			var scrollX=window.pageXOffset? window.pageXOffset : ddlevelsmenu.standardbody.scrollLeft
			var scrollY=window.pageYOffset? window.pageYOffset : ddlevelsmenu.standardbody.scrollTop
			var submenurightedge=this._offsets.left + this._dimensions.submenuw + (this._istoplevel && dir=="topbar"? 0 : this._dimensions.w)
			var submenubottomedge=this._offsets.top + this._dimensions.submenuh
			//Sub menu starting left position
			var menuleft=(this._istoplevel? this._offsets.left + (dir=="sidebar"? this._dimensions.w : 0) : this._dimensions.w)
			if (submenurightedge-scrollX>ddlevelsmenu.docwidth){
				menuleft+= -this._dimensions.submenuw + (this._istoplevel && dir=="topbar" ? this._dimensions.w : -this._dimensions.w)
			}
			submenu.parentNode.style.left=menuleft+"px"
			//Sub menu starting top position
			var menutop=(this._istoplevel? this._offsets.top + (dir=="sidebar"? 0 : this._dimensions.h) : this.offsetTop)
			if (submenubottomedge-scrollY>ddlevelsmenu.docheight){ //no room downwards?
				if (this._dimensions.submenuh<this._offsets.top+(dir=="sidebar"? this._dimensions.h : 0)-scrollY){ //move up?
					menutop+= - this._dimensions.submenuh + (this._istoplevel && dir=="topbar"? -this._dimensions.h : this._dimensions.h)
				}
				else{ //top of window edge
					menutop+= -(this._offsets.top-scrollY) + (this._istoplevel && dir=="topbar"? -this._dimensions.h : 0)
				}
			}
			submenu.parentNode.style.top=menutop+"px"
			if (ddlevelsmenu.enableshim && (ddlevelsmenu.effects.enableswipe==false || ddlevelsmenu.nonFF)){ //apply shim immediately only if animation is turned off, or if on, in non FF2.x browsers
				ddlevelsmenu.positionshim(header, submenu, dir, scrollX, scrollY)
			}
			else{
				submenu.FFscrollInfo={x:scrollX, y:scrollY}
			}
			ddlevelsmenu.showmenu(header, submenu, dir)
			if (e.preventDefault)
				e.preventDefault()
			if (e.stopPropagation)
				e.stopPropagation()
		}
	}, (this.ismobile)? "click" : "mouseover")
	this.addEvent(header, function(e){ //mouseout event
		var submenu=ddlevelsmenu.subuls[this._master][parseInt(this._pos)]
		if (this._istoplevel){
			if (!ddlevelsmenu.isContained(this, e) && !ddlevelsmenu.isContained(submenu.parentNode, e)) //hide drop down div if mouse moves out of menu bar item but not into drop down div itself
				ddlevelsmenu.hidemenu(submenu.parentNode)
		}
		else if (!this._istoplevel && !ddlevelsmenu.isContained(this, e)){
			ddlevelsmenu.hidemenu(submenu.parentNode)
		}

	}, "mouseout")
},

setopacity:function(el, value){
	el.style.opacity=value
	if (typeof el.style.opacity!="string"){ //if it's not a string (ie: number instead), it means property not supported
		el.style.MozOpacity=value
		try{
			if (el.filters){
				el.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity="+ value*100 +")"
			}
		} catch(e){}
	}
},

showmenu:function(header, submenu, dir){
	if (this.effects.enableswipe || this.effects.enablefade){
		if (this.effects.enableswipe){
			var endpoint=(header._istoplevel && dir=="topbar")? header._dimensions.submenuh : header._dimensions.submenuw
			submenu.parentNode.style.width=submenu.parentNode.style.height=0
			submenu.parentNode.style.overflow="hidden"
		}
		if (this.effects.enablefade){
			submenu.parentNode.style.width=submenu.offsetWidth+"px"
			submenu.parentNode.style.height=submenu.offsetHeight+"px"
			this.setopacity(submenu.parentNode, 0) //set opacity to 0 so menu appears hidden initially
		}
		submenu._curanimatedegree=0
		submenu.parentNode.style.visibility="visible"
		submenu.style.visibility="visible"
		clearInterval(submenu._animatetimer)
		submenu._starttime=new Date().getTime() //get time just before animation is run
		submenu._animatetimer=setInterval(function(){ddlevelsmenu.revealmenu(header, submenu, endpoint, dir)}, 10)
	}
	else{
		submenu.parentNode.style.visibility="visible"
		submenu.style.visibility="visible"
	}
},

revealmenu:function(header, submenu, endpoint, dir){
	var elapsed=new Date().getTime()-submenu._starttime //get time animation has run
	if (elapsed<this.effects.duration){
		if (this.effects.enableswipe){
			if (submenu._curanimatedegree==0){ //reset either width or height of sub menu to "auto" when animation begins
				submenu.parentNode.style[header._istoplevel && dir=="topbar"? "width" : "height"]=(header._istoplevel && dir=="topbar"? submenu.offsetWidth : submenu.offsetHeight)+"px"
			}
			submenu.parentNode.style[header._istoplevel && dir=="topbar"? "height" : "width"]=(submenu._curanimatedegree*endpoint)+"px"
			if (this.effects.enableslide){
				submenu.style[header._istoplevel && dir=="topbar"? "top" : "left"]=Math.floor((submenu._curanimatedegree-1)*endpoint)+"px"
			}
		}
		if (this.effects.enablefade){
			this.setopacity(submenu.parentNode, submenu._curanimatedegree)
		}
	}
	else{
		clearInterval(submenu._animatetimer)
		if (this.effects.enableswipe){
			submenu.parentNode.style.width=submenu.offsetWidth+"px"
			submenu.parentNode.style.height=submenu.offsetHeight+"px"
			submenu.parentNode.style.overflow="visible"
			if (this.effects.enableslide){
				submenu.style.top=0;
				submenu.style.left=0;
			}
		}
		if (this.effects.enablefade){
			this.setopacity(submenu.parentNode, 1)
			submenu.parentNode.style.filter=""
		}
		if (this.enableshim && submenu.FFscrollInfo) //if this is FF browser (meaning shim hasn't been applied yet
			this.positionshim(header, submenu, dir, submenu.FFscrollInfo.x, submenu.FFscrollInfo.y)
	}
	submenu._curanimatedegree=(1-Math.cos((elapsed/this.effects.duration)*Math.PI)) / 2
},

hidemenu:function(submenu){
	if (typeof submenu._pos!="undefined"){ //if submenu is outermost DIV drop down menu
		this.css(this.topitems[submenu._master][parseInt(submenu._pos)], "selected", "remove")
		if (this.enableshim)
			this.hideshim()
	}
	clearInterval(submenu.firstChild._animatetimer)
	submenu.style.left=0
	submenu.style.top="-1000px"
	submenu.style.visibility="hidden"
	submenu.firstChild.style.visibility="hidden"
},


addEvent:function(target, functionref, tasktype) {
	if (target.addEventListener)
		target.addEventListener(tasktype, functionref, false);
	else if (target.attachEvent)
		target.attachEvent('on'+tasktype, function(){return functionref.call(target, window.event)});
},

domready:function(functionref){ //based on code from the jQuery library
	if (dd_domreadycheck){
		functionref()
		return
	}
	// Mozilla, Opera and webkit nightlies currently support this event
	if (document.addEventListener) {
		// Use the handy event callback
		document.addEventListener("DOMContentLoaded", function(){
			document.removeEventListener("DOMContentLoaded", arguments.callee, false )
			functionref();
			dd_domreadycheck=true
		}, false )
	}
	else if (document.attachEvent){
		// If IE and not an iframe
		// continually check to see if the document is ready
		if ( document.documentElement.doScroll && window == window.top) (function(){
			if (dd_domreadycheck){
				functionref()
				return
			}
			try{
				// If IE is used, use the trick by Diego Perini
				// http://javascript.nwbox.com/IEContentLoaded/
				document.documentElement.doScroll("left")
			}catch(error){
				setTimeout( arguments.callee, 0)
				return;
			}
			//and execute any waiting functions
			functionref();
			dd_domreadycheck=true
		})();
	}
	if (document.attachEvent && parent.length>0) //account for page being in IFRAME, in which above doesn't fire in IE
		this.addEvent(window, function(){functionref()}, "load");
},


init:function(mainmenuid, dir){
	this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
	this.topitemsindex=-1
	this.ulindex=-1
	this.topmenuids.push(mainmenuid)
	this.topitems[mainmenuid]=[] //declare array on object
	this.subuls[mainmenuid]=[] //declare array on object
	this.hidetimers[mainmenuid]=[] //declare hide entire menu timer
	if (this.enableshim && !this.shimadded){
		this.shimmy={}
		this.shimmy.topshim=this.addshimmy(document.body) //create top iframe shim obj
		this.shimmy.bottomshim=this.addshimmy(document.body) //create bottom iframe shim obj
		this.shimadded=true
	}
	var menubar=document.getElementById(mainmenuid)
	var alllinks=menubar.getElementsByTagName("a")
	this.getwindowsize()
	for (var i=0; i<alllinks.length; i++){
		if (alllinks[i].getAttribute('rel')){
			this.topitemsindex++
			this.ulindex++
			var menuitem=alllinks[i]
			this.topitems[mainmenuid][this.topitemsindex]=menuitem //store ref to main menu links
			var dropul=document.getElementById(menuitem.getAttribute('rel'))
			var shelldiv=document.createElement("div") // create DIV which will contain the UL
			shelldiv.className="ddsubmenustyle"
			dropul.removeAttribute("class")
			shelldiv.appendChild(dropul)
			document.body.appendChild(shelldiv) //move main DIVs to end of document
			shelldiv.style.zIndex=2000 //give drop down menus a high z-index
			shelldiv._master=mainmenuid  //Indicate which main menu this main DIV is associated with
			shelldiv._pos=this.topitemsindex //Indicate which main menu item this main DIV is associated with
		  	this.addEvent(shelldiv, function(){ddlevelsmenu.hidemenu(this)}, "click")
			var arrowclass=(dir=="sidebar")? "rightarrowpointer" : "downarrowpointer"
			var arrowpointer=(dir=="sidebar")? this.arrowpointers.rightarrow : this.arrowpointers.downarrow
			if (this.arrowpointers.showarrow.toplevel)
				this.addpointer(menuitem, arrowclass, arrowpointer, (dir=="sidebar")? "before" : "after")
			this.buildmenu(mainmenuid, menuitem, dropul, this.ulindex, true, dir) //build top level menu
			shelldiv.onmouseover=function(){
				clearTimeout(ddlevelsmenu.hidetimers[this._master][this._pos])
			}
			this.addEvent(shelldiv, function(e){ //hide menu if mouse moves out of main DIV element into open space
				if (!ddlevelsmenu.isContained(this, e) && !ddlevelsmenu.isContained(ddlevelsmenu.topitems[this._master][parseInt(this._pos)], e)){
					var dropul=this
					if (ddlevelsmenu.enableshim)
						ddlevelsmenu.hideshim()
					ddlevelsmenu.hidetimers[this._master][this._pos]=setTimeout(function(){
						ddlevelsmenu.hidemenu(dropul)
					}, ddlevelsmenu.hideinterval)
				}
			}, "mouseout")
			var subuls=dropul.getElementsByTagName("ul")
			for (var c=0; c<subuls.length; c++){
				this.ulindex++
				var parentli=subuls[c].parentNode
				var subshell=document.createElement("div")
				subshell.appendChild(subuls[c])
				parentli.appendChild(subshell)
				if (this.arrowpointers.showarrow.sublevel)
					this.addpointer(parentli.getElementsByTagName("a")[0], "rightarrowpointer", this.arrowpointers.rightarrow, "before")
				this.buildmenu(mainmenuid, parentli, subuls[c], this.ulindex, false, dir) //build sub level menus
			}
		}
	} //end for loop
	this.addEvent(window, function(){ddlevelsmenu.getwindowsize(); ddlevelsmenu.gettopitemsdimensions()}, "resize")
},

setup:function(mainmenuid, dir){
	this.domready(function(){ddlevelsmenu.init(mainmenuid, dir)})
}

}

