$(document).ready(function(){
$('#prRotater').cycle({ 
    timeout:  8000,
    pause:  1,
    speed:  3000});
});

$(document).ready(function(){
$('#columnOne').cycle({ 
    timeout:  3700,
    pause:  1,
    speed:  2000});
});

$(document).ready(function(){
$('#columnTwo').cycle({ 
    timeout:  8000,
    pause:  1,
    speed:  3000});
});

/*  SEARCH BOX CLEAR Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net)
  * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
  * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
  *
  * $LastChangedDate$
  * $Rev$
  *
  * Version 0.2
  *
  * Usage:
  *   $("input[name=q]")
  *      .val("Search")    // set an initial value if it doesn't already exist
  *      .clearonfocus();  // prepare the element for clearing on focus
  */
 jQuery.fn.clearonfocus = function() {
     return this
         .bind('focus', function() {
             // Set the default value if it isn't set
             if ( !this.defaultValue ) this.defaultValue = this.value;
             // Check to see if the value is different
             if ( this.defaultValue && this.defaultValue != this.value ) return;
             // It isn't, so remove the text from the input
             this.value = '';
         })
         .bind('blur', function() {
             // If the value is blank, return it to the defaultValue
             if ( this.value.match(/^\s*$/) )
                 this.value = this.defaultValue;
         });
 };

$(document).ready(function(){
$('#s').val("Search Site").clearonfocus();
});


/* DROP DOWN MENU - The following 2 items call the dropdown menu behaviors. First up is a function that expands the dropdown to the largest sub item. Must come first. After that is the SuperFish menu call itself. */
$(document).ready(function(){ 
        $("ul.sf-menu").supersubs({ 
            minWidth:    9,   // minimum width of sub-menus in em units 
            maxWidth:    27,   // maximum width of sub-menus in em units 
            extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                               // due to slight rounding differences and font-family 
        }).superfish();  // call supersubs first, then superfish, so that subs are 
                         // not display:none when measuring. Call before initialising 
                         // containing tabs for same reason. 
    }); 

jQuery(function(){
	jQuery('ul.sf-menu').superfish();
});


/* IMAGE SWAPS  example of usage: give img the .buttonswap class and make sure to get the on (mouse on) and off (mouse off) */
$(document).ready(function(){
	$(".buttonSwap").hover(
	 function()
	 {this.src = this.src.replace("_off","_on");},
	 function()
	 {this.src = this.src.replace("_on","_off");}
	);
});


/* TABLE ZEBRA STRIPE */
$(document).ready(function(){
$(".eventTable tr:nth-child(even)").addClass("alt");
});

/* PRODUCT LIST ZEBRA STRIPE */
$(document).ready(function(){
$(".productList li:nth-child(even)").addClass("alt");
});

/* TRANSLATION CODE */
// $(document).ready(function(){
// $('body').translate	( 'en', 'fr', {
// 	not: '.actualAddress', 
// 	async:  true,
// 	toggle: true,
// 	fromOriginal: true
// 	                        });
// 
// });




/* POP UP   http://www.djsipe.com/2008/07/04/doing-pop-ups-the-right-way-with-jquery/   */
// Create a namespace for our utilities
var UTIL = UTIL || {};
UTIL.popup = UTIL.popup || {};

/**
* Open popup window
*
* Opens a popup window using as little as a URL. An optional params object can
* be passed.
*
* @param {String} href
* @param {Object} params
* @return {WindowObjectReference}
*/
UTIL.popup.open = function (href, params)
{
   // Defaults (don't leave it to the browser)
   var defaultParams = {
       "width":       "800",   // Window width
       "height":      "600",   // Window height
       "top":         "0",     // Y offset (in pixels) from top of screen
       "left":        "0",     // X offset (in pixels) from left side of screen
       "directories": "no",    // Show directories/Links bar?
       "location":    "no",    // Show location/address bar?
       "resizeable":  "yes",   // Make the window resizable?
       "menubar":     "no",    // Show the menu bar?
       "toolbar":     "no",    // Show the tool (Back button etc.) bar?
       "scrollbars":  "no",   // Show scrollbars?
       "status":      "no"     // Show the status bar?
   };

    var windowName = params["windowName"] || "new_window";

    var i, useParams = "";

    // Override defaults with custom values while we construct the params string
   for (i in defaultParams)
   {
       useParams += (useParams === "") ? "" : ",";
       useParams += i + "=";
       useParams += params[i] || defaultParams[i];
   }

    return window.open(href, windowName, useParams);
};


$(function(){ // Run this code when the document's done loading    

    // Apply this code to each link with class="popup"
   $("a.popup").each(function (i){

  // Add an onClick behavior to this link
       $(this).click(function(event) {

      // Prevent the browser's default onClick handler
           event.preventDefault();

      // Grab parameters using jQuery's data() method
           var params = $(this).data("popup") || {};            

      // Use the target attribute as the window name
           if ($(this).attr("target"))
           {
               params.windowName = $(this).attr("target");
           }

      // Pop up the window
           var windowObject = UTIL.popup.open(this.href, params);

      // Save the window object for other code to use
           $(this).data("windowObject", windowObject);
       });
   });
});

