// jdpowerpanel.net JS

// lightweight popup JQ no plugin - MB

var divJDAbout = document.createElement("div");        
divJDAbout.id = "jdPopup";
divJDAbout.setAttribute("align","center");
divJDAbout.style.display="none";
divJDAbout.style.opacity="0";
divJDAbout.style.position="fixed";
divJDAbout.style.top="0px";
divJDAbout.style.left="0px";
divJDAbout.style.width="100%";
divJDAbout.style.height="100%";
divJDAbout.style.backgroundImage="url(http://www.jdpowerpanel.net/images/jq_bq.png)";
divJDAbout.style.backgroundRepeat = "repeat";
divJDAbout.innerHTML = "<img src='http://www.jdpowerpanel.net/images/about.png' />";
//document.body.appendChild(divJDAbout);


//AMR: IE-BUG workaround. Append nodes/html to closed tags only

var allHTMLTags = new Array();

function getElementByClass(theClass) {

	//Create Array of All HTML Tags
	var allHTMLTags=document.getElementsByTagName('*');

	//Loop
	for (i=0; i<allHTMLTags.length; i++) {

		//Get all tags with the specified class name.
		var donemodding = 0;
		if (allHTMLTags[i].className==theClass && donemodding==0) {

		allHTMLTags[i].appendChild(divJDAbout);
		donemodding = 1;
		
		}
	}
} 

getElementByClass("headerContainer");

//---
        
$('#aboutUSPanelLink').click(function() {
    document.getElementById("jdPopup").style.display="block";
    document.getElementById("jdPopup").style.width=$(window).width();
    document.getElementById("jdPopup").style.height=$(window).height();
    document.getElementById("jdPopup").style.paddingTop=($(window).height()/2)-130;
    $("#jdPopup").animate({ opacity: 1.0 }, "slow");
});

$('#jdPopup').click(function() {
    $("#jdPopup").animate({ opacity: 0 }, "slow", function() {
        document.getElementById("jdPopup").style.display="none";
    });
});

//Google Analytics
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-23251450-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
