//showLayer(whichlayer)
//This function is used to change the CSS style of the specified DIV to "block" instead of "none"
//It is used in the 1-6 selection dropdown currently

function samecustadd()
{
	document.forms["registration"].elements["Ship to Address-Alternative Name"].value=document.forms["registration"].elements["Customer Address-Alternate Name"].value;
	document.forms["registration"].elements["Ship to Address-Street Address 1"].value=document.forms["registration"].elements["Customer Address-Street Address 1"].value;
	document.forms["registration"].elements["Ship to Address-Street Address 2"].value=document.forms["registration"].elements["Customer Address-Street Address 2"].value;
	document.forms["registration"].elements["Ship to Address-City"].value=document.forms["registration"].elements["Customer Address-City"].value;
	document.forms["registration"].elements["Ship to Address-State"].value=document.forms["registration"].elements["Customer Address-State"].value;
	document.forms["registration"].elements["Ship to Address-Zip Code"].value=document.forms["registration"].elements["Customer Address-Zip Code"].value;
	document.forms["registration"].elements["Ship to Address-Country"].value=document.forms["registration"].elements["Customer Address-Country"].value;
}

function sameshipto()
{
	document.forms["registration"].elements["shipname"].value=document.forms["registration"].elements["custname"].value;
	document.forms["registration"].elements["shipstreetaddr"].value=document.forms["registration"].elements["custstreetaddr"].value;
	document.forms["registration"].elements["shipcity"].value=document.forms["registration"].elements["custcity"].value;
	document.forms["registration"].elements["shipstate"].value=document.forms["registration"].elements["custstate"].value;
	document.forms["registration"].elements["shipzip"].value=document.forms["registration"].elements["custzip"].value;
}

function showLayer(whichLayer)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = "block";
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = "block";
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = "block";
	}
	return 0;
}


//hideLayer(whichLayer)
//This function will hide a layer specified by the passed DIV by changing it's CSS display style to "None" using ""
function hideLayer(whichLayer)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = "none";
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = "none";
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = "none";
	}
	return 0;
}


//clearValue(formname, formelement)
//This function will take a form name and input element and will set its value to ''
//it is used to clear textboxes
function clearValue(formname,formelement)
{
		document.forms[formname].elements[formelement].value='';
		return 0;
}

//countOutputs()
//This function shows and hides rows of input boxes for the number specified in the outputs dropdown
function countOutputs()
{
	var numouts = window.document.Configure.outputs; 
	var optionCounter;
	for (optionCounter = 1; optionCounter <=6; optionCounter++)
	{
		showLayer('output'+optionCounter);
	}
	
	for (optionCounter = 6; optionCounter > numouts.value; optionCounter--) 
	{
		hideLayer('output'+optionCounter);
		clearValue('Configure','vout'+optionCounter);
		clearValue('Configure','iout'+optionCounter);
	}
	
}

//showApplication()
//This function shows and hides rows of input boxes for the number specified in the outputs dropdown
function showApplication()
{
	var appl = window.document.Configure.CMBApplication.value; 
	hideLayer('Flyback');
	hideLayer('Forward');
	//hideLayer('pushpull');
	showLayer(appl);
	
}




//checkNumber(objec)
//this function takes a passed object and forces one to enter just a number, no alpha characters allowed.

function checkNumber(objec)
{
	if (isNaN(objec.value) && (objec.value!=""))
	{
		alert("The value: "+objec.value+"\nis not a number.\n\nPlease correct by entering only a numerical value.");
		setTimeout("document.Configure."+objec.name+".focus();",1);
		setTimeout("document.Configure."+objec.name+".select();",1);

		}
}
