//***************************
// Author: James Everett
// Company: Black List Software
// Purpose: Swaps Menu Images
// Comment: A low-cost solution!
//***************************
function swap(pname, pnew) 
{
	var preload = new Image();
	preload.src = pnew;
	document[pname].src = pnew;
}
//***************************
// Author: James Everett
// Company: Black List Software
// Purpose: Toggles Input Default
// Comment: Never be left blank!
//***************************
function c_clear(id,txt) 
{
	if (document.getElementById(id).value == txt) 
	{
		document.getElementById(id).value = "";
		document.getElementById(id).style.color="#000000";
	}
}
function c_recall(id,txt) 
{
	if (document.getElementById(id).value == "") 
	{
		document.getElementById(id).value = txt;
		document.getElementById(id).style.color="#60666a";
	}
}
//***************************
// Author: James Everett
// Company: Black List Software
// Purpose: Product's Sub-Menu
// Comment: Hey, nice sub-menu!
//***************************
function show_menu()
{
	document.getElementById('menu0').style.visibility = "visible";
	document.getElementById('menu1').style.visibility = "visible";
}
function close_menu()
{
	document.getElementById('menu0').style.visibility = "hidden";
	document.getElementById('menu1').style.visibility = "hidden";
}
//***************************
// Author: James Everett
// Company: Black List Software
// Purpose: Pop-up Launch Pad
// Comment: Cool, they adjust!
//***************************
function launch(which_form) 
{
	switch(which_form)
	{
	case 0:
		newwindow=window.open('popups/main.html','name','height=235,width=515,status=1,resizable=1');
	break;
	case 1:
		newwindow=window.open('popups/dirty.html','name','height=235,width=515,status=1,resizable=1');
	break;
	case 2:
		newwindow=window.open('popups/clean.html','name','height=235,width=515,status=1,resizable=1');
	break;
	case 3:
		newwindow=window.open('popups/contacts.html','name','height=225,width=515,status=1,resizable=1');
	break;
	}
	if (window.focus) { newwindow.focus(); }
	newwindow.moveTo((screen.width/2)-(520/2),(screen.height/2)-(500/2));
	return false;
}
//***************************
// Author: James Everett
// Company: Black List Software
// Purpose: Lightbox Replacement
// Comment: Lightbox Sucks!
//***************************
var curimgid=0;
var glob_width=0;
var glob_height=0;
//preload omega pics
var omgArray=new Array();
omgArray[0]=new Image();
omgArray[0].src="img/somp.png";
omgArray[1]=new Image();
omgArray[1].src="img/soma.png";
omgArray[2]=new Image();
omgArray[2].src="img/somb.png";
var omgArrText=new Array("<b>Comment:</b> Main Display","<b>Comment:</b> Viewing Records","<b>Comment:</b> Found malware.exe");
//preload assassin pics
var aceArray=new Array();
aceArray[0]=new Image();
aceArray[0].src="img/sasp.png";
aceArray[1]=new Image();
aceArray[1].src="img/sasa.png";
aceArray[2]=new Image();
aceArray[2].src="img/sasb.png";
aceArray[3]=new Image();
aceArray[3].src="img/sasc.png";
var aceArrText=new Array("<b>Comment:</b> Main Display","<b>Comment:</b> Module Sniffing","<b>Comment:</b> Update Manager","<b>Comment:</b> About Dialog");
//helper functions
function swap_pic(id,dir)
{
	switch(id)
	{
		case 0:
			if(dir==0)
			{
				if(curimgid-1>=0) { curimgid=curimgid-1; }
			} else {
				if(curimgid+1<3) { curimgid=curimgid+1; }
			}
			//set new image
			document.getElementById('cimgs').src=omgArray[curimgid].src;
			document.getElementById('mpage').innerHTML=(curimgid+1)+" of 3 | "+omgArrText[curimgid];
		break;
		case 1:
			if(dir==0)
			{
				if(curimgid-1>=0) { curimgid=curimgid-1; }
			} else {
				if(curimgid+1<4) { curimgid=curimgid+1; }
			}
			//set new image
			document.getElementById('cimgs').src=aceArray[curimgid].src;
			document.getElementById('mpage').innerHTML=(curimgid+1)+" of 4 | "+aceArrText[curimgid];
		break;
	}
}
//newsletter prompt box
function do_prompt()
{
	var email=prompt("BLS Newsletter Signup","sample@hotmail.com");
	if(email==null || email=="") { return; }
	document.getElementById('news').value=email;
	document.x1.submit(); 
}
//limit textarea characters
function limit(mid,cid,maxlimit) 
{
	if (document.getElementById(mid).value.length > maxlimit)
	{
		document.getElementById(mid).value = document.getElementById(mid).value.substring(0, maxlimit);
	} else {
		document.getElementById(cid).innerHTML = maxlimit - document.getElementById(mid).value.length;
	}
}
//**********************************
//central.js was written by James Everett
//Copyright © 2009 Black List Software
//**********************************