/// <reference path="jquery-1.3.2.js" />

//LIGHTBOX
// The following code will run once page has loaded	 
$(function() {
    //jQModal code for pop-up div, content page is set as href of link
$('#jQM').jqm({ ajax: '@href', trigger: 'a.popme', overlay: 50, toTop: true, ajaxText: 'Loading...' }).jqmAddClose('.close');
$('#jQMBN').jqm({ ajax: '@href', trigger: 'a.popmeBN', overlay: 50, toTop: true, ajaxText: 'Loading...' }).jqmAddClose('.close');
$('#jQMsurvey').jqm({ ajax: '@href', trigger: 'a.popmeSM', overlay: 50, toTop: true, ajaxText: 'Loading...' }).jqmAddClose('.close');
$('#jQMBuyNow').jqm({ ajax: '@buynowurl', trigger: 'a.buynowtrigger', overlay: 50, modal:true, toTop: true, ajaxText: 'Loading...' }).jqmAddClose('.close');
    //Dynamicly take ID and trigger class.
    //Find all a tags with a ID that begins with jqm. ex.) jqmCUS1, pull value of popme attribute and assign an a tag with that class as the trigger.
    var curID = "";
    //added code to prevent duplicate lightboxes, which we started seeing on 1/30/09
    $('[id^=jqm]').each(function() {
        var pop = $(this).attr('popme');
        //console.log(curID);
        if ($(this).attr('id') == curID) {
        } else {
            curID = $(this).attr('id');
            //console.log(pop);
            $(this).jqm({ trigger: 'a.' + pop, overlay: 50, toTop: true, ajaxText: 'Loading...' }).jqmAddClose('.close'); 
        };
    });
    //resets main page body background to original color, script was causing it to turn white without this line
    $('body').css('background', '#f2f0ed');
});
