// print screen Function

function varitext(text)
{
text=document
print(text)
}


//Simple Show Layer Function

function showLayer(theLayer)

{

	document.getElementById(theLayer).style.display = "block"

}



//Simple Show Layer Function

function hideLayer(theLayer)

{

	document.getElementById(theLayer).style.display = "none"

}



//Simple Show/Hide Layer Function

function showHideLayer(theShowLayer, theHideLayer)

{

	document.getElementById(theShowLayer).style.display = "block"

	document.getElementById(theHideLayer).style.display = "none"

}



//Set Corporate Type Label Function

function setLabel(theLabel){



	if(theLabel=='CRP'){

	document.getElementById('companyLabel').firstChild.data = 'Corporate Status';

	document.getElementById('formation').style.display = "none";

	document.getElementById('incorporation').style.display = "block";	

	}

	

	if(theLabel=='LLC'){

	document.getElementById('companyLabel').firstChild.data = 'L.L.C. Status';

	document.getElementById('formation').style.display = "block";

	document.getElementById('incorporation').style.display = "none";

	}

	

	if(theLabel=='LLP'){

	document.getElementById('companyLabel').firstChild.data = 'L.L.P. Status';

	document.getElementById('formation').style.display = "block";

	document.getElementById('incorporation').style.display = "none";

	}

	

	if(theLabel=='LP'){

	document.getElementById('companyLabel').firstChild.data = 'L.P. Status';

	document.getElementById('formation').style.display = "block";

	document.getElementById('incorporation').style.display = "none";

	}

	

	if(theLabel=='GP'){

	document.getElementById('companyLabel').firstChild.data = 'G.P. Status';

	document.getElementById('formation').style.display = "block";

	document.getElementById('incorporation').style.display = "none";

	}

	

	if(theLabel=='NFP'){

	document.getElementById('companyLabel').firstChild.data = 'Not For Profit Status';

	document.getElementById('formation').style.display = "block";

	document.getElementById('incorporation').style.display = "none";

	}

	

	if(theLabel=='PRT'){

	document.getElementById('companyLabel').firstChild.data = 'Partnership Status';

	document.getElementById('formation').style.display = "block";

	document.getElementById('incorporation').style.display = "none";

	}

	

	if(theLabel=='OTH'){

	document.getElementById('companyLabel').firstChild.data = 'Corporate Status';

	document.getElementById('formation').style.display = "block";

	document.getElementById('incorporation').style.display = "none";

	}

}



/* Auto Focus First Text Form Field */

function autoFocusField(fieldName)

{
   if (fieldName != "")
  {
	if((eval("document.forms[0]." + fieldName)) && (!eval("document.forms[0]." + fieldName + ".disabled")))

	{

		currentField = eval("document.forms[0]." + fieldName)

		currentField.focus();

	}
   }

}



/* Open Browser Window */

function openWindow(theURL){

	window.open (theURL,"StateCapital","location=0,status=1,scrollbars=1,width=600,height=500"); 

}



/* Select All Text */

function selectAllText(theTextbox){

	theTextbox.select();

}



function clearAllText(theTextbox){

	theTextbox.value = "";

	theTextbox.focus();	

}



//Submit form on using enter key

function checkEnter(evt,theURL) {

  	var keyCode =

  	document.layers ? evt.which :

  	document.all ? event.keyCode :

  	document.getElementById ? evt.keyCode : 0;

	if (keyCode == 13)

  	{

		parent.location=theURL

	}

}



//Check to see if a radiobutton has been selected.  If so, go to theURL

function checkSelectedRadio(radioname)

{

	radioButtonSelected = false;

	numRadios = 0;

	theRadio = eval("document.forms[0]." + radioname)

	//Check if first item is selected

	for(i=0; i < document.forms[0].elements.length; i++){

		if(document.forms[0].elements(i).name == 'wtype'){

		numRadios = numRadios + 1;

		}

	}

	

	for(i=0; i < numRadios; i++){

		if(theRadio[i].checked){

			radioButtonSelected = true;

		}

	}

	

	if(radioButtonSelected){

		return true;

	}

	else{

		alert('Please select an order to perform this action.');

	}

}



//Show Date Range under Judgment Search if the user selects "Other" in drop-down - No longer in use

function showDateRange(theValue, theNumber){



	if(theValue=='select'){

	eval("document.getElementById('jdgdates" + theNumber + "').style.display = 'none'");

	}

	if(theValue=='20'){

	eval("document.getElementById('jdgdates" + theNumber + "').style.display = 'none'");

	}

	if(theValue=='15'){

	eval("document.getElementById('jdgdates" + theNumber + "').style.display = 'none'");

	}

	if(theValue=='10'){

	eval("document.getElementById('jdgdates" + theNumber + "').style.display = 'none'");

	}

	if(theValue=='5'){

	eval("document.getElementById('jdgdates" + theNumber + "').style.display = 'none'");

	}

	if(theValue=='other'){

	eval("document.getElementById('jdgdates" + theNumber + "').style.display = 'block'");

	}

		

}



//Function to return random number

function rnd(n) 

 { 

 return Math.floor(Math.random() * n) + 1; 

 } 

 

//Return random image path for homepage branding image

function returnPath(){

		var picPath="../images/branding"+rnd(5)+".jpg"; 

		return picPath;

}



//This function sets a hidden field called "pageaction" which would tell the backend system the action that the user wishes to perform (e.g. View, Place Order, Add More Names).  System should then process the corresponding request.

function setPageAction(theAction){

		document.forms[0].$pageaction.value = theAction;

		//The following line can be used to submit the form through JavaScript

		//document.forms[0].submit();

}



/* Check for Asterisk.  If so, remove and do not add to available. For Add Remove List Box */

function isAsterisk(theItem, theException){

if ((eval("document.forms[0]." + theException + ".selectedIndex") > -1)){

		if (eval("document.forms[0]." + theException + ".options[document.forms[0]." + theException + ".selectedIndex].value.charAt(0)") == "*")

		{

		alert('gotcha');

		eval("document.forms[0]." + theException + ".options[document.forms[0]." + theException + ".selectedIndex] = null;")

//		document.forms[0].selecteditems1.options[document.forms[0].selecteditems1.selectedIndex]=null;

		return false;

		}

		else

		{

		return true;

		}

}

}



/* Add Remove List Box */

function addremove(themenu1, themenu2) {

currentlength = eval("document.forms[0]." + themenu1 + ".length");

for (i=0; i <= currentlength; i++)

{

	if (themenu1.match("selecteditems")){isAsterisk(i, themenu1);}

		if (eval("document.forms[0]." + themenu1 + ".selectedIndex") > -1)

		{

		eval("document.forms[0]." + themenu2 + ".options[document.forms[0]." + themenu2 + ".length] = new Option(document.forms[0]." + themenu1 + ".options[document.forms[0]." + themenu1 + ".selectedIndex].value," + "document.forms[0]." + themenu1 + ".options[document.forms[0]." + themenu1 + ".selectedIndex].value)");

		eval("document.forms[0]." + themenu1 + ".options[document.forms[0]." + themenu1 + ".selectedIndex]=null");

		}

}

listdisp();

}



/* Return all values from List Box*/

function listtohidden(themenu1) {

currentlength = eval("document.forms[0]." + themenu1 + ".length");

var allfields;

allfields = ""

for (i=0; i <= currentlength-1; i++)

  allfields = allfields + "," + eval("document.forms[0]." + themenu1 + ".options["+ i +"].value");



allfields=allfields.substring(1,allfields.length);

return allfields;

//eval("document.forms[0]."+ themenu2 +".value") = allfields

}



//Select All Checkboxes or Clear All Checkboxes

function selectAllNone(theAction, checkboxSetID)

{

	for(i=0; i < document.forms[0].length; i++)

	{

		current = document.forms[0].elements[i]

		if (current.type == "checkbox")

		{

			if (current.id.match(checkboxSetID))

			{

				if (theAction == 1)

				{

					current.checked = true

				}

				else

				{

					current.checked = false

				}

			}

		}

	}

}



//Same as Mailing Address

<!-- Begin

var BillAddressLine1 = "";

var BillAddressLine2 = "";

var BillAddressLine3 = "";

var BillCity = "";

var BillState = "";

var BillZip = "";





function InitSaveVariables(form) {

BillAddressLine1 = form.$csdescaddr12.value;

BillAddressLine2 = form.$csdescaddr22.value;

BillAddressLine3 = form.$csdescaddr32.value;

BillCity = form.$csdesccity2.value;

BillState = form.$csdescstate2.value;

BillZip = form.$csdesczip2.value;

}



function ShipToBillPerson(form) {

if (form.copy.checked) {

InitSaveVariables(form);

form.$csdescaddr12.value = form.$csdescaddr1.value;

form.$csdescaddr22.value = form.$csdescaddr2.value;

form.$csdescaddr32.value = form.$csdescaddr3.value;

form.$csdesccity2.value = form.$csdesccity.value;

form.$csdescstate2.value = form.$csdescstate.value;

form.$csdesczip2.value = form.$csdesczip.value;



}

else {

form.$csdescaddr12.value = BillAddressLine1;

form.$csdescaddr22.value = BillAddressLine2;

form.$csdescaddr32.value = BillAddressLine3;

form.$csdesccity2.value = BillCity;

form.$csdescstate2.value = BillState;

form.$csdesczip2.value = BillZip;

   }

}

//  End -->
