///--- CHECK FORM FIELDS ---//
function checkInputs()
{
	var inputsPassed = 0;
	loginsMatch = true;
	var loginsMatch = true;

	//CHECKS FOR EMPTY INPUTS
	for(i = 0; i < arguments.length; i++)
	{
		var theFormInfo = arguments[i].split("#");
		
		if(eval("document.theForm." + theFormInfo[0] + ".value") == "")
		{
			if(theFormInfo[1] == "")
			{
				theFormInfo[1] = theFormInfo[0];
			}
			alert("Please enter a valid " + theFormInfo[1]);
			i = arguments.length;
		}
		
		/*
		else if((eval("document.theForm." + theFormInfo[0] + ".value") == "name") || (eval("document.theForm." + theFormInfo[0] + ".value") == "email address"))
		{
			alert("Please enter a valid " + theFormInfo[1]);
			i = arguments.length;
			return false;
		}
		*/
		
		else
		{
			inputsPassed++;
		}
	}
	
	//RETURN ACCCORDING TO OUTCOME
	if((inputsPassed == arguments.length) && (loginsMatch != false))
	{
		document.theForm.submit();
	}
	else
	{
		return false;
	}
}


//--- OPEN AND RESIZE WINDOW ---//
function openWindow(websiteAddress, newWindowName, desiredWidth, desiredHeight)
{
	var height = window.screen.availHeight;
	var width = window.screen.availWidth;
	var leftPoint = parseInt(width / 2) - parseInt(desiredWidth / 2);
	var topPoint = parseInt(height / 2) - parseInt(desiredHeight / 2);
	
	windowOptions = "width=" + desiredWidth + ", height=" + desiredHeight + ", " + "menubar=no, status=no, location=no, toolbar=no, scrollbars=yes, resizable=yes, top=" + topPoint + ", left=" + leftPoint;
	window.open(websiteAddress, newWindowName, windowOptions);
}

//Arrays of topics
var selectData = new Array();
selectData["presales"] = new Array("I need help choosing a package", "Other");
selectData["sales"] = new Array("Upgrade Account", "Downgrade Account", "Cancel Account", "Login Retrieval", "Other");
selectData["technical"] = new Array("DNS/Nameserver Problems", "Web site inactive", "Can't log into c-Panel", "FTP Problems", "Other");
	
function populateSelect(triggerSelect, targetArray)//targetArray is the array you want the select be filled with
{
	var targetSelect = document.theForm.topic;//target select which will be swaped with information
	targetSelect.options.length = 1;//deletes all options in target except first, which is usually instructional
	for(i = 0; i < selectData[targetArray].length; i++)
	{
		newOption = new Option(selectData[targetArray][i], selectData[targetArray][i]);//creates new Option object
		targetSelect.options[i + 1] = newOption;//assigns new option to target
	}
	targetSelect.disabled = false;
	targetSelect.options[0].selected = true;
	targetSelect.options[0].disabled = true;
	triggerSelect.options[0].disabled = true;
}

//IMAGE SWAP
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function newWindow(url, windowName, w, h)
{
  var parameters="top=15,left=120,width=" + w + ",height=" + h + ",scrollbars=yes,menubar=no,resizable=yes"
  mywin=window.open(url, windowName, parameters);
  return false;
}  