﻿// JScript File

    //This method was causing the page to re-fresh so I am not using it anymore.
    //instead I created the DIV on the Default.aspx page 
	function createDiv(){
		if (document.getElementById("divDetail") == null){
			var div;
			div =  " <div style='display:none;'  id='divDetail' style='background-color:white' >"
			div += " <table class='winDetail' cellpadding='0' cellspacing='0' >"
			div += "      <tr>"
			div += "            <td heigth='30' class='titleDetail'>"
			div += "                <a onclick='closeDetail();' class='closeLink'>Click Here to CLOSE</a> &nbsp;&nbsp;"
			div += "            </td>"
			div += "      </tr>"
			div += "      <tr>"
			div += "            <td class='mainDetail'>"
			div += "                <iframe frameborder='0' width='100%' height='100%' style='overflow:hidden' id='detailFrame'></iframe> "
			div += "            </td>"
			div += "      </tr>"
			div += " </table>"
			div += " </div>"
			document.body.innerHTML += div;
		}
	}
	
	function closeDetail(){
		document.getElementById("divDetail").style.display = "none" ;
	}

	function showDetail(productID){
	    createDiv();
	    scrollPos = f_scrollTop();
	    document.getElementById("divDetail").style.position = "absolute";
	    if (scrollPos < 73) {
	        document.getElementById("divDetail").style.top = 73;
	    } else {
	        document.getElementById("divDetail").style.top = scrollPos;
	    }
		document.getElementById("divDetail").style.left = (getWidth() / 2 ) - 460;		
		document.getElementById("detailFrame").src = "\imageDetail.aspx?ProductId=" + productID;
		document.getElementById("divDetail").style.display = "";
    }
	
	function f_clientWidth() {
	    return f_filterResults(
		    window.innerWidth ? window.innerWidth : 0,
		    document.documentElement ? document.documentElement.clientWidth : 0,
		    document.body ? document.body.clientWidth : 0
	    );
	}
	function f_clientHeight() {
	    return f_filterResults(
		    window.innerHeight ? window.innerHeight : 0,
		    document.documentElement ? document.documentElement.clientHeight : 0,
		    document.body ? document.body.clientHeight : 0
	    );
	}
	function f_scrollLeft() {
	    return f_filterResults(
		    window.pageXOffset ? window.pageXOffset : 0,
		    document.documentElement ? document.documentElement.scrollLeft : 0,
		    document.body ? document.body.scrollLeft : 0
	    );
	}
	function f_scrollTop() {
	    return f_filterResults(
		    window.pageYOffset ? window.pageYOffset : 0,
		    document.documentElement ? document.documentElement.scrollTop : 0,
		    document.body ? document.body.scrollTop : 0
	    );
	}
	function f_filterResults(n_win, n_docel, n_body) {
	    var n_result = n_win ? n_win : 0;
	    if (n_docel && (!n_result || (n_result > n_docel)))
	        n_result = n_docel;
	    return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
	}

