﻿$(function() {
    var el = $('#content');

    if (typeof (el.attr('class')) == 'undefined') {
        el.addClass('copy1');
    }

    $('#font1').click(function() {
        el.switchClass(el.attr('class'), 'copy1', 250);
    });

    $('#font2').click(function() {
        el.switchClass(el.attr('class'), 'copy2', 250);
    });

    $('#font3').click(function() {
        el.switchClass(el.attr('class'), 'copy3', 250);
    });

    $('img.pointer').hover(
        function() {
            dC(true);
        },
        function() {
            dC(false);
        }
    );
});

//window.addEvent('domready', function() {
//    if ($('font1') == null)
//        return;
//        
//    var el = $('content');
//    var morph = new Fx.Morph('content');

//    $('font1').addEvent('click', function(e) {
//        e.stop();
//        el.morph('.copy1');
//    });

//    $('font2').addEvent('click', function(e) {
//        e.stop();
//        el.morph('.copy2');
//    });

//    $('font3').addEvent('click', function(e) {
//        e.stop();
//        el.morph('.copy3');
//    });
//});

//window.addEvent('domready', function() {
//    $$('img.pointer').addEvents({
//        mouseenter: function() {
//            dC(true);
//        },
//        mouseleave: function() {
//            dC(false);
//        }
//    });
//});

function initPrint() {
    var html = gE('printzone').innerHTML;
//    var html = gE('content').innerHTML;
    var logo = frames['ifrPrint'].document.getElementById('companylogo');
    var company = frames['ifrPrint'].document.getElementById('companynameprint');
    var content = frames['ifrPrint'].document.getElementById('content');
    var showLogo = false;
    var showCompanyName = false;

    html = html.replace('src="tml/upload/', 'src="http://www.aggregatesandminingtoday.com/tml/upload/');

    if (typeof (companyName) != 'undefined') {
        if (companyName != '') {
            company.innerHTML = companyName;
            showCompanyName = true;
        }
    }

    if (typeof (imageCompanyLogoPath) != 'undefined') {
        if (imageCompanyLogoPath != '') {
            logo.src = imageCompanyLogoPath;
            showLogo = true;
        }
    }
    
    content.innerHTML = html;
//    content.className = gE('content').className;
    frames['ifrPrint'].doPrint(showCompanyName, showLogo);
}
