﻿//http://dean.edwards.name/packer/
//simple Modal Popup

//NonStandard CSS Styles

	
var heightOfContent;
var heightOfPopUp;

var heightOfContentInEm;
var heightOfPopUpInEm;

var positionOfDetailLink;
var positionOfDetailLinkInEm;

     
//get the height of div all
window.onload = function()
    {
        heightOfContent = document.getElementById('all').offsetHeight;
        heightOfContentInEm = heightOfContent / 16;
 }

function showModal(obj, path, printPath)
   {
  //get the position of the detail link
    //var posX = obj.offsetLeft;
    var posY = obj.offsetTop;
        while(obj.offsetParent){
            //posX=posX+obj.offsetParent.offsetLeft;
               posY=posY+obj.offsetParent.offsetTop;
                    if(obj==document.getElementsByTagName('body')[0]){break}
                       else{obj=obj.offsetParent;}
        }
document.getElementById("modalOverlay").style.display ="block";
document.getElementById("productPopUp").style.display ="block";
document.getElementById("FillTheFrame").innerHTML = "<iframe marginheight=0 marginwidth=0 frameborder=0 src=\"" + path + "\"  scrolling=no width=660px height=250px id=DetailFrame></iframe>";
document.getElementById("printPopUp").innerHTML = "<a target=\"_blank\" href=\"" + printPath + "\">Print</a>";

//heightOfPopUp = document.getElementById('productPopUp').offsetHeight;
//heightOfPopUpInEm = heightOfPopUp / 16;

//positionOfDetailLinkInEm = posY /16;

document.getElementById("modalOverlay").style.height = heightOfContentInEm +"em";

var newYPos = positionOfDetailLinkInEm - heightOfPopUpInEm;
//document.getElementById("productPopUp").style.top = newYPos +"em";

    
 }






//hides the Overlay and PopUp
function hideModal()
   {
   document.getElementById("modalOverlay").style.display ="none";
   document.getElementById("productPopUp").style.display ="none";
}


$(document).ready(function() {
    $('.search-box input').clearonfocus();

//    if ($('div#homepage-banner').length()) {
//        $('div#homepage-banner').wrapInner("<div id=\"homepage-gallery\"></div>");


//        var fo = new FlashObject("/falcon/assets/flash/homepage-gallery.swf", "HomepageFlash", "648", "329", "9");
//        fo.addParam("quality", "high");


//        if ($('body.falconsafety-default div#homepage-banner').length()) {
//            fo.addVariable("xmlPathURL", "../assets/xml/homepage-galleries/falcon-safety.xml");
//        }


//        fo.write("homepage-gallery");

//    }


    //    var highestCol = Math.max($('#content').height(), $('#sidebar').height());
    //    $('.s-b-inner:last').height(highestCol);
    //    $('#content').height(highestCol);

});

function cacheBuster() {
    var junk = Math.floor(Math.random() * 1101);

    return "?r=" + junk;
}

function openVideoPopup() {
    window.open("http://www.dust-off.com/youtube-videos.aspx", "popup", "width=1100,'height=600,scrollbars=1");
    return false;
}
