$(document).ready(function()
{

    //textbox helptext
    $('#summary, #message, #offerhelp').labelToValue();
    //end textbox help

    //ajax thinkidation
    // single field validation
    $(".validate").think_validation({
        formId: "form",
        urlString: window.location.href, //live data
        mainMessageParentId: "primary", //append main message to this
        mainMessageId: "page_error",
        parentMessageClass: "message", // form row class containing message
        successClass: "success", // inline class for success
        errorClass: "error", // inline class for error
        validateAll: false
    });
    // entire form validation
    $(".validateAll").think_validation({
        formId: "form",
        urlString: window.location.href, //live data
        mainMessageParentId: "primary", //append main message to this
        mainMessageId: "page_error",
        parentMessageClass: "message", // form row class containing message
        successClass: "success", // inline class for success
        errorClass: "error", // inline class for error
        validateAll: false
    });
    //end validation

    //replace select boxes for cross browser support
    $('.frmSelect').selectbox(
	{
	    inputWidth: 250,
	    inputClass: 'frmSelectBox ', //css class for the input which will replace the select tag, display the background image  
	    containerClass: 'frmSelectBoxOptions', // The list container class (a div element)  
	    hoverClass: 'current', // css class for the current element  
	    currentClass: 'selected', // css class for the selected element  
	    debug: false // debug mode on/off  
	}
	);
    //end select box 

    //chk box replacement
    // ":not([safari])" is desirable but not necessary selector
    $('input:checkbox:not([safari])').checkbox();
    $('input[safari]:checkbox').checkbox({ cls: 'jquery-safari-checkbox' });
    $('input:radio').checkbox();
    //end chk box 

    //ie hack for button hover
    $(".frmBtn").mouseover(function()
    {
        $(this).parent().addClass("hover");
    }).mouseout(function()
    {
        $(this).parent().removeClass("hover");
    });
    $(".frmSelectBox").mouseover(function()
    {
        $(this).addClass("selectHover");
    }).mouseout(function()
    {
        $(this).removeClass("selectHover");
    });

    //file select 
    $(".frmFile").filestyle({
        image: "_assets/css/images/bg_browse.png",
        imageheight: 28,
        imagewidth: 34,
        width: 246,
        bgPos: "0 0",
        bgHoverPos: "0 -26px"
    });
    //fix ie hover
    $("#iFile").mouseover(function()
    {
        $(this).parent().addClass("fileHover");
    }).mouseout(function()
    {
        $(this).parent().removeClass("fileHover");
    });
    //end file select

});