// check to make sure that the browser can
// handle window.addEventListener
if (window.addEventListener) {
    // create the keys and konami variables
    var keys = [],
        konami = "38,38,40,40,37,39,37,39,66,65";
 
    // bind the keydown event to the Konami function
    window.addEventListener("keydown", function(e){
        // push the keycode to the 'keys' array
        keys.push(e.keyCode);
 
        // and check to see if the user has entered
        // the Konami code
        if (keys.toString().indexOf(konami) >= 0) {

            // do something such as:
$.getScript('http://www.cornify.com/js/cornify.js', function(){ 
 cornify_add(); 
 $(document).keydown(cornify_add); 
}); 

$.getScript('http://www.speccedforawesome.com/zombify.js',function(){
      zombify_add();
      $(document).keydown(zombify_add);
    });

						document.getElementById("konami").style.display="block"
            
						// and finally clean up the keys array
            keys = [];
        };
    }, true);
};

function Show(sId)
{
 var oNode = document.getElementById(sId)
 if (oNode.style.display=="block")
 		oNode.style.display="none"
 else if (oNode.style.display=="none")
 		oNode.style.display="block"
 else
 		 oNode.style.display="block"
}

var sFilter="";
var sMoz="";
var sOpacity="";
function NoFilter(sId)
{
 var oNode = document.getElementById(sId)

 if (oNode)
 {

  sFilter=oNode.style.filter;
  sMoz=oNode.style.opacity;

 oNode.style.filter="alpha(opacity=100)"
 oNode.style.opacity="1"
// oNode.style.-moz-opacity="1"
 
 }

}

function ReFilter(sId,sVal)
{
 var oNode = document.getElementById(sId)
 if (oNode)
 {

 oNode.style.filter="alpha(opacity="+sVal+")"
 oNode.style.opacity="."+sVal
// oNode.style.-moz-opacity=".100"
 
 }

}

/*
onerror=handleErr
var txt=""

function handleErr(msg,url,l)
{
txt="There was an error on this page.\n\n"
txt+="Error: " + msg + "\n"
txt+="URL: " + url + "\n"
txt+="Line: " + l + "\n\n"
txt+="Click OK to continue.\n\n"
alert(txt)
return true
}
*/

function ShowHideById(elementID,bDrag) {
  if (document.getElementById(elementID).style.display=='none'||document.getElementById(elementID).style.display=='')
  {document.getElementById(elementID).style.display='block'}
  else
  {document.getElementById(elementID).style.display='none'}

	//also inits the drag and drop!
	if (bDrag!=null&&bDrag==true)
	Drag.init(document.getElementById(elementID));

}


function expandById(elementID){
document.getElementById(elementID).style.display='none'
}

function expandById(elementID){
document.getElementById(elementID).style.display='block'
}

var newwindow;
function OpenInNewWindow(img,title,lheight,lwidth)
{
	newwindow=window.open("",'name','left=40,top=60,height=1,width=1,scrollbars=1');
	if (window.focus) {newwindow.focus()}

	newwindow.document.write("<HTML>")
	newwindow.document.write("<TITLE>"+title+"</TITLE>")
	newwindow.document.write("<BODY>")
	newwindow.document.write("<p align='center'><img src='"+img+"'></p>")
	newwindow.document.write("</BODY>")
	newwindow.document.write("</HTML>")
	newwindow.resizeBy(lwidth-60,lheight-76)

}

var newwindow2;
function OpenInNewWindow2(text,title)
{
	newwindow2=window.open("",'name','left=40,top=60,height=200,width=300,scrollbars=1');
	if (window.focus) {newwindow2.focus()}

	newwindow2.document.write("<HTML>")
	newwindow2.document.write("<TITLE>"+title+"</TITLE>")
	newwindow2.document.write("<BODY>")
	newwindow2.document.write("<h3>"+title+"</h3>")
	newwindow2.document.write("<p>"+text+"</p>")
	newwindow2.document.write("</BODY>")
	newwindow2.document.write("</HTML>")
}

var urlwindow;
function OpenUrlInNewWindow(url,lheight,lwidth)
{
	urlwindow=window.open(url,'name','height=1,width=1,scrollbars=1');
	urlwindow.resizeTo(lwidth,lheight);
	if (window.focus) {urlwindow.focus()}
}

function help_popup(form,context)
{
var file="help_popup.php?form=" + form+"&context="+context;
window.open(file,"Help","top=5,left=30,toolbars=no,maximize=yes,resize=yes,width=550,height=200,location=no,directories=no,scrollbars=yes");
}

