﻿/// <reference path="jquery-1.3.2-vsdoc2.js" />


$(document).ready(function() {
    browserfix();
    styling();
});

  


function styling() {    
        var $required = $('input.required, textarea.required, select.required');
        $required.prev('label, .label').addClass('required-label');
        //$required.parent('form, .form').prepend("<span class='reqnote'>Required Fields</span>");
        $("input:first.required").parent('div').prepend("<span class='reqnote'>Required Fields</span>");
        var $buttons = $("'input[type=submit]").addClass('submit button');
}


function browserfix() {
        
    var msiex = $.browser.msie;
    var msie6 = $.browser.msie && $.browser.version < 7;
    if (msie6) { //ie6 specific javascript fixes.
        try {            
            $('#content > ul, div.section > ul').addClass('list');
            $('#custom-logo').addClass('ie6custom-logo');
            $("input[type='text']").addClass('textbox');
            $("input[type='radio']").addClass('radiobutton');
            $("input[type='checkbox']").addClass('checkbox');
            $("input[type='button']").addClass('button');
            $("input[type='submit']").addClass('submit button');


            
            $("ul").delegate("li", "hover", function () {
                $(this).toggleClass("hover");
            });


            $("#nav").find("li").hover(function () {
                $(this).find('ul').addClass("show");
            }, function () {
                $(this).find('ul').removeClass("show");
            });


//            $("#header").delegate("div#nav", "mouseleave", function () {
//                $(this).find("ul.show").removeClass("show");
//            });



        }
        catch (err) {
            //alert('uh oh');
            return false; //alert('framework not properly loaded.  err: ' + err.description);
        
        }

        //fix png transparency problem 
        if (document.body.filters) {
            for (var i = 0; i < document.images.length; i++) {
                var img = document.images[i]
                var imgName = img.src.toUpperCase()
                if (imgName.substring(imgName.length - 3, imgName.length) == "PNG") {
                    var imgID = (img.id) ? "id='" + img.id + "' " : ""
                    var imgClass = (img.className) ? "class='" + img.className + "' " : ""
                    var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
                    var imgStyle = "display:inline-block;" + img.style.cssText
                    if (img.align == "left") imgStyle = "float:left;" + imgStyle
                    if (img.align == "right") imgStyle = "float:right;" + imgStyle
                    if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
                    var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
                    img.outerHTML = strNewHTML
                    i = i - 1
                }
            }
        }
    
    
    
    
    }
    if (msiex) { //ie specific fixes
        try {
            $('#top-nav li:last-child a').css({ 'border-right': 'none' });            
            $("input[disabled], input[disabled='disabled'], textarea[disabled], select[disabled]").addClass('disabled');
        } catch (err) {
            return false;
        }
    }  
}


function notDefault(value, element) {
    if (value == 'Select...') { return false }
    if (value == 'ENTER NAME or /"M/" #') { return false }
    return true;
}


