var arrowon = new Image();
arrowon.src = '/images/menuarrow.gif';
var arrowoff = new Image();
arrowoff.src = '/images/invdot.gif';

for (var i=0; i<6; i++)
{
  numb = i+1;
  eval("var Icon"+numb+"a = new Image();");
  eval("Icon"+numb+"a.src = '/images/menu0"+i+"a.gif';");
  eval("var Icon"+numb+"b = new Image();");
  eval("Icon"+numb+"b.src = '/images/menu0"+i+"b.gif';");
}

function menuOn (numb)
{
  eval("document.menu0"+numb+".src = Icon"+(numb+1)+"b.src;");
  eval("document.arrow0"+numb+".src = arrowon.src;");
}

function menuOff (numb)
{
  eval("document.menu0"+numb+".src = Icon"+(numb+1)+"a.src;");
  eval("document.arrow0"+numb+".src = arrowoff.src;");
}

function changeProduct ()
{
	currentindex = document.prodform.products.selectedIndex;
	currentvalue = document.prodform.products.options[currentindex].value;
	if (currentindex != 0 && currentvalue)
	{
		currentvalue = document.prodform.products.options[currentindex].value;
		this.location = currentvalue;
	}
}

function clearMListForm ()
{
	if (document.mlistform.mlistemail.value == "enter email address")
	{
		document.mlistform.mlistemail.value = "";
	}
}

function turnon (field) {
	var ftarget = eval("document.contactform."+field+".style");
	if (ftarget) {
		ftarget.color = "#FFFFFF";
		ftarget.backgroundColor = "#6699CC";
	}
}

function turnoff (field) {
	var ftarget = eval("document.contactform."+field+".style");
	var ftarget2 = eval("document.contactform."+field);
	if (ftarget && ftarget2) {
		if (ftarget2.value) {
			ftarget.color = "#003366";
			ftarget.backgroundColor = "#CCDDEE";
		}
		else {
			ftarget.color = "#000000";
			ftarget.backgroundColor = "#FFFFFF";
		}
	}
}

var screenshot = null;
var winproperty = new Array();
winproperty[winproperty.length] = "location=false";
winproperty[winproperty.length] = "scrollbars=yes";
winproperty[winproperty.length] = "status=false";

function displayScreen (product, numb, bgcolor)
{
	var realproperty = "";
	for (i=0; i<winproperty.length; i++)
	{
		if (i > 0) { realproperty = realproperty + ","; }
		realproperty = realproperty + winproperty[i];
	}
	realproperty = "width=640,height=520," + realproperty;

	if (numb < 10) { numb = "0" + numb; }

	screenshot = window.open("/screenshot.php?product="+product+"&numb="+numb+"&bgcolor="+bgcolor, "ScreenShot", realproperty);
	screenshot.focus();
}

function displayTemplate (product, name, bgcolor)
{
	var realproperty = "";
	for (i=0; i<winproperty.length; i++)
	{
		if (i > 0) { realproperty = realproperty + ","; }
		realproperty = realproperty + winproperty[i];
	}
	realproperty = "width=640,height=520," + realproperty;

	if (numb < 10) { numb = "0" + numb; }

	screenshot = window.open("/templateshot.php?product="+product+"&name="+name+"&bgcolor="+bgcolor, "TemplateShot", realproperty);
	screenshot.focus();
}

var ccinfo = null;

function displayCCInfo ()
{
	var realproperty = "";
	for (i=0; i<winproperty.length; i++)
	{
		if (i > 0) { realproperty = realproperty + ","; }
		realproperty = realproperty + winproperty[i];
	}
	realproperty = "width=400,height=300," + realproperty;

	if (numb < 10) { numb = "0" + numb; }

	ccinfo = window.open('https://www.chumpsoft.com/buy/cvv.html', 'CC Verification', realproperty);
	ccinfo.focus();
}

function otherDetect () {
	if (document.buyform) {
		var cindex = document.buyform.refby.selectedIndex;
		var cvalue = document.buyform.refby.options[cindex].value;
		if (cvalue == 'other') {
			sectionShow('refotherid');
		}
		else {
			sectionHide('refotherid');
		}
		if (cvalue == 'partner') {
			sectionShow('refpartnerid');
		}
		else {
			sectionHide('refpartnerid');
		}
	}
}

function sectionHide (id) {
	document.getElementById(id).style.display = 'none';
}

function sectionShow (id) {
	document.getElementById(id).style.display = '';
}

var referreraddr = null;

function updateAddress () {
	var realproperty = "";
	for (i=0; i<winproperty.length; i++) {
		if (i > 0) { realproperty = realproperty + ","; }
		realproperty = realproperty + winproperty[i];
	}
	realproperty = "width=640,height=350," + realproperty;

	referreraddr = window.open("/members/addressupdate.php", "Referrer Address Update", realproperty);
	referreraddr.focus();
}

function updateAddressClose () {
	opener.location = '/members/index.php';
	window.close();
}

var viewinvoice = null;

function viewInvoice (id) {
	var realproperty = "";
	for (i=0; i<winproperty.length; i++) {
		if (i > 0) { realproperty = realproperty + ","; }
		realproperty = realproperty + winproperty[i];
	}
	realproperty = "width=400,height=220," + realproperty;

	viewinvoice = window.open("/members/viewinvoice.php?id="+id, "View Invoice", realproperty);
	viewinvoice.focus();
}

var viewcheck = null;

function viewCheck (id) {
	var realproperty = "";
	for (i=0; i<winproperty.length; i++) {
		if (i > 0) { realproperty = realproperty + ","; }
		realproperty = realproperty + winproperty[i];
	}
	realproperty = "width=620,height=275,resizable=no," + realproperty;

	viewcheck = window.open("/members/viewcheck.php?id="+id, "View Check", realproperty);
	viewcheck.focus();
}


