if (top.location != self.location) top.location = self.location;
function Menu_Select(td)
{
    document.getElementById(td).style.backgroundPosition = "0% -42px";
    document.getElementById(td).style.backgroundColor = "lawngreen";
    document.getElementById(td).style.color = "Red";
    for (var i = 0; i < document.images.length; i++)
    {
        if (document.images[i].alt.length > 0)
            document.images[i].title = document.images[i].alt;
    }    
	//var frms = document.getElementsByName("google_ads_frame");
    	//for (var i=0; i<frms.length; i++)
    	//{
    	//    frms[i].onfocus = AsLog;
    	//}
	//frms = document.getElementsByName("auctionads_ad_frame");
   	//for (var i=0; i<frms.length; i++)
   	//{
   	//    frms[i].onfocus = AaLog;
   	//}
}
var lastStatus = ""; 
function AsLog(evt)
{ 
    window.focus(); 
    if (window.status && (window.status!= lastStatus)) 
    { 
        var w = (evt) ? evt.target.width : event.srcElement.width;
        var h = (evt) ? evt.target.height : event.srcElement.height;
        lastStatus = window.status; 
        var bug = new Image(); 
        bug.src = "http://www.blocklayer.com/AsLogger.ashx?p="+ escape(document.location.href.substring(11)) +"_"+ w +"_"+ h +"&a="+ escape(window.status.substring(6));
    }
} 
var aALogged = false;
function AaLog()
{  
    if (! aALogged)
    {
        aALogged = true;
        new Image().src = "http://www.blocklayer.com/AsLogger.ashx?p=A-"+ escape(document.location.href.substring(11)) +"&a=AuctionAds";
    }
}
function Help_onclick(prog, hei)
{
	var w = window.open("Help/"+prog+".aspx",null,"height="+ hei +",width=650,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no");
	w.focus();
}
function PrintTemplate(t)
{
    if (navigator.userAgent.indexOf("IE") > -1)
    {
        alert("Internet Explorer has 'Print Picture' function\n\r\n\rRight click image and choose 'Print Picture'\n\r\n\rEnsure printer scale is set to 100%\n\r\n\rIf image does not print to scale, try 'Print Preview' from browser menu, set scale to 100% and page to Landscape");
        return;
    }
    alert("Ensure printer scale is set to 100%\n\r\n\rIf image does not print to scale, try 'Print Preview' from browser menu, set scale to 100% and page to Landscape\n\r\n\rOr use Internet Explorer and 'Print Picture' function to print just the image");
    window.print();
    return;
    
    var winFeatures = "width=1000,height=520,status=no,toolbar=no,menubar=yes,scrollbars=yes,location=no";
    var w = window.open("", null, winFeatures);
    var d = w.document.createElement("div");
    d.setAttribute("align", "center");
    var i = w.document.createElement("img");
    i.src = document.getElementById(t).src;
    i.setAttribute("src", document.getElementById(t).src);
    d.appendChild(i);
    w.document.body.appendChild(d);
    w.focus();
    w.print();
}
function Show(event)
{
	var d = document.getElementById("divShow");
	d.style.left= event.clientX+44 + document.body.scrollLeft +"px";
	d.style.top= event.clientY-40+ document.body.scrollTop +"px";
}
function Hide()
{
	document.getElementById("divShow").style.left=-1000;
}
function BookmarkPage()
{	
	var loc = document.location.href;
	if (loc.indexOf("?") >0)
		loc = loc.substring(0, loc.indexOf("?"));
	if (document.all)
		window.external.AddFavorite(loc, document.title);
	else if (window.sidebar)
		window.sidebar.addPanel(window.document.title, loc, "");
	var bug = new Image(); 
    bug.src = "http://www.blocklayer.com/Logger.ashx?p="+ escape(document.location.href.substring(11)) +"&a=Bookmarked";
}
function TellAFriend()
{
    var loc = document.location.href;
    if (loc.indexOf("?") > 0)
		loc = loc.substring(0, loc.indexOf("?"));
    var w = window.open("TellFriend.aspx?loc="+ loc,null,"height=240,width=450,scrollbars=no,resizable=no,status=no,toolbar=no,menubar=no,location=no");
	w.focus();
}
var startTime;
var runs = 0;
function CheckLimit()
{
    if (startTime == null)
    {
         startTime = new Date().getTime();
         return true;
    }
    var secondsSinceStart = (new Date().getTime() - startTime) / 1000;
    if (secondsSinceStart > 180)
    {
         startTime = new Date().getTime();
         runs = 1;
         return true;
    }
    var runIntervals = secondsSinceStart / runs; // avg seconds between runs
    if (runs > 4 && runIntervals < 10)// more than 1 every 12 seconds. or 5 per minute
    {       
        Log();
        var timeTillFree = (runs * 10) - secondsSinceStart;
        setTimeout("ReactivateButton()", timeTillFree * 1000);
        document.getElementById("btnCalculate").disabled = true;
        alert("To conserve resources, this free service limits usage frequency rates\n\r\n\rYou have used it "+ runs +" times in "+ Math.ceil(secondsSinceStart) +" seconds\n\r\n\rPlease wait "+ Math.ceil(timeTillFree) +" seconds before trying again\n\r\n\rSorry for the inconvenience");
        return false;
    }
    runs++;
    return true;	
}
function Log()
{
    var log = new Image(); 
    log.src = "http://www.blocklayer.com/Logger.ashx?p=Woodjoints&a=Limit";
}
function CalcGR()
{
    var grIn = parseFloat(document.getElementById("txtGr").value);
    var gr = 0.5 * (1 + (Math.sqrt(5)));
    var gr1 = grIn * gr;
    var gr2 = grIn / gr;
    document.getElementById("spnGr").innerHTML = gr1.toFixed(3) +" ~ "+ gr2.toFixed(3);
}
//window.onbeforeprint = LogPrint;
function LogPrint()
{    
    new Image().src = "http://www.blocklayer.com/Logger.ashx?p="+ escape(document.location.href.substring(11)) +"&a=PrintD";
}
function Twit()
{
    var loc = window.location;
    var tit = document.title;
    if (tit.length - loc.length - 1 > 140)
        tit = tit.substring(0, 137 - loc.length) + "..";
    window.open("http://twitter.com/home?status=" + tit + " " + loc);
}