﻿$(document).ready(function() {
    $('a[rel=new-window]').click(function() {
        window.open($(this).attr('href'));
        return false;
    });

    $('.ro').hover(function() {
        $(this).attr('src', $(this).attr('src').replace('.jpg', '_o.jpg'));
    }, function() {
        $(this).attr('src', $(this).attr('src').replace('_o.jpg', '.jpg'));
    });

//    $('.print').click(function() {
//        var page = window.open('', '', 'scrollbars=yes,width=740,height=600');
//        page.document.open("text/html");
//        page.document.write('<html><head><title>FrogTape</title><link rel="stylesheet" type="text/css" href="/css/main.css" /><style type="text/css">.dont-print{ display:none; }h1{ display:inline;padding-left:16px; }body{ background-color:#fff;background-image:none;color:#333; }.content-wide-left{ width:100%; }</style></head><body>');
//        page.document.write('<img src="/images/frogtape-logo-print.jpg" alt="" /><h1>' + $('.content-full h1').text() + '</h1><br /><br />');
//        page.document.write(document.getElementById('print').innerHTML);
//        page.document.write('</body></html>');
//        page.document.close();
//        page.print();
//        return false;
//    });
    $("span.validation-error").bind("DOMAttrModified propertychange", function(e) {
        if (e.originalEvent.propertyName && e.originalEvent.propertyName != "isvalid") return;

        var controlToValidate = $("#" + this.controltovalidate);
        var validators = controlToValidate.attr("Validators");
        if (validators == null) return;

        var isValid = true;
        $(validators).each(function() {
            if (this.isvalid !== true) {
                isValid = false;
            }
        });

        if (isValid) {
            controlToValidate.removeClass("error");
        } else {
            controlToValidate.addClass("error");
        }
    });

});
