
//JK Popup Window Script (version 3.0)- By JavaScript Kit (http://www.javascriptkit.com)
//Visit JavaScriptKit.com for free JavaScripts
//This notice must stay intact for legal use

function openpopup(popurl){
var winpops=window.open(popurl,"","width=500,height=400,toolbar,location,status,scrollbars,menubar,resizable")
}

function AWGtoMM(awg)
{
	return 25.4*(.005*Math.pow(92,(36-awg)/39));
}

function FTtoM(ft)
{
	return ft*0.3048;
}

function MtoFT(m)
{
	return m/0.3048;
}

function roundDecimal(num)
{
	return Math.round(num*100)/100;
}
function al_calc(){

var a= document.formx.a.value;
var b= document.formx.b.value;
var c= document.formx.c.value;
var d= document.formx.d.value;

var loadCurrentAmp= document.formx.a.value;
var gaugeAWG=document.formx.b.value;
var wireDiameterMM=AWGtoMM(gaugeAWG);
var cableRunFt= document.formx.c.value;
var cableRunM=FTtoM(cableRunFt);
var voltageDropV=document.formx.d.value;

if (loadCurrentAmp==0)
{
	loadCurrentAmp=(voltageDropV*Math.pow(wireDiameterMM,2)*3.14)/(0.018*8*cableRunM);
	document.formx.a.value=roundDecimal(loadCurrentAmp);
}

else if (voltageDropV==0)
{
	voltageDropV=(0.018*8*cableRunM*loadCurrentAmp)/(Math.pow(wireDiameterMM,2)*3.14);
	voltageDropV=voltageDropV*100;
	voltageDropV=Math.round(voltageDropV)/100;
	document.formx.d.value=voltageDropV;
}

else if (cableRunFt==0)
{
	cableRunM=(voltageDropV*Math.pow(wireDiameterMM,2)*3.14)/(0.018*8*loadCurrentAmp);
	cableRunFt=MtoFT(cableRunM);
	document.formx.c.value=roundDecimal(cableRunFt);
}

else if (gaugeAWG==0)
{

	wireDiameterMM=Math.pow(((0.018*8*cableRunM*loadCurrentAmp)/(voltageDropV*3.14)), 0.5);
	a=wireDiameterMM/(25.4*0.005);
	gaugeAwg=36-39*(Math.log(a)/Math.log(92));
	document.formx.b.value=Math.round(gaugeAwg);
}
else alert ("Please leave one value at zero.")
}

function al_calc2(){
var p= document.form2.p.value
var i= document.form2.i.value
var v= document.form2.v.value
var r= document.form2.r.value

if (p==0 && i==0){
z=v/r
y=z*100
i=Math.round(y)/100


x=Math.pow(v,2)/r
w=x*100
p=Math.round(w)/100


document.form2.p.value=p
document.form2.i.value=i
}

else if (v==0 && p==0){
z=Math.pow(i,2)*r
y=z*100
p=Math.round(y)/100

x=i*r
w=x*100
v=Math.round(w)/100

document.form2.p.value=p
document.form2.v.value=v

}

else if (p==0 && r==0){
z=v/i
y=z*100
r=Math.round(y)/100

x=v*i
w=x*100
p=Math.round(w)/100

document.form2.p.value=p
document.form2.r.value=r
}

else if (i==0 && v==0){
z=Math.sqrt(p*r)
y=z*100
v=Math.round(y)/100

x=Math.sqrt(p/r)
w=x*100
i=Math.round(w)/100

document.form2.i.value=i
document.form2.v.value=v
}

else if (i==0 && r==0){
z=Math.pow(v,2)/p
y=z*100
r=Math.round(y)/100

x=p/v
w=x*100
i=Math.round(w)/100

document.form2.i.value=i
document.form2.r.value=r
}

else if (v==0 && r==0){
z=p/i
y=z*100
v=Math.round(y)/100

x=p/Math.pow(i,2)
w=x*100
r=Math.round(w)/100

document.form2.v.value=v
document.form2.r.value=r
}

else alert ("Please leave two values at zero.")
}

function al_calc3(){
var ah=	document.form3.ah.value
var amps=	document.form3.amps.value
var min=	document.form3.min.value

if (min==0){
x=((1+Math.log(ah)*0.434)/0.75)-(1.34*Math.log(amps)*0.434)
y=Math.pow(10,x)/60
z=y*10
min=Math.round(z)/10
document.form3.min.value=min
}
else if (amps==0){
min=min*60
x=(((1+Math.log(ah)*0.434)/0.75)-Math.log(min)*0.434)/1.34
y=Math.pow(10,x)
z=y*100
amps=Math.round(z)/100
document.form3.amps.value=amps
}
else if (ah==0){
min=min*60
x=0.75*Math.log(min)*0.434+1.005*Math.log(amps)*0.434-1
y=Math.pow(10,x)
ah=Math.round(y)
document.form3.ah.value=ah
}
}

function al_calc4(){

var a= document.form7.a.value;
var w= document.form7.b.value;
var l= document.form7.c.value;
var v= document.form7.d.value;

if (a==0){
{z=(3.14*w*w*v)/(0.018*8*l)}
y=z*100
a=Math.round(y)/100
document.form7.a.value=a
}

else if (v==0){
{z=(0.018*8*l*a)/(w*w*3.14)}
y=z*100
v=Math.round(y)/100
document.form7.d.value=v
}

else if (l==0){
{z=(v*w*w*3.14)/(0.018*8*a)}
y=z*100
l=Math.round(y)/100
document.form7.c.value=l
}

else if (w==0){
{z=Math.pow(((0.018*8*l*a)/(v*3.14)), 0.5)}
y=z*100
w=Math.round(y)/100
document.form7.b.value=w
}
else alert ("Please leave one value at zero.")
}


CSStopExecution = false;
CSInit = new Array;
function CSScriptInit() {
if(typeof(skipPage) != "undefined") { if(skipPage) return; }
idxArray = new Array;
for(var i=0;i<CSInit.length;i++)
	idxArray[i] = i;
CSAction2(CSInit, idxArray);
}
CSAg = window.navigator.userAgent; CSBVers = parseInt(CSAg.charAt(CSAg.indexOf("/")+1),10);
function IsIE() { return CSAg.indexOf("MSIE") > 0;}
function CSIEStyl(s) { return document.all.tags("div")[s].style; }
function CSNSStyl(s) { return CSFindElement(s,0); }
function CSFindElement(n,ly) { if (CSBVers < 4) return document[n];
	var curDoc = ly ? ly.document : document; var elem = curDoc[n];
	if (!elem) { for (var i=0;i<curDoc.layers.length;i++) {
		elem = CSFindElement(n,curDoc.layers[i]); if (elem) return elem; }}
	return elem;
}
function CSClickReturn () {
	var bAgent = window.navigator.userAgent; 
	var bAppName = window.navigator.appName;
	if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
		return true; // dont follow link
	else return false; // dont follow link
}
function CSButtonReturn () {
	var bAgent = window.navigator.userAgent; 
	var bAppName = window.navigator.appName;
	if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
		return false; // follow link
	else return true; // follow link
}
CSIm = new Object();
function CSIShow(n,i) {
	if (document.images) {
		if (CSIm[n]) {
			var img = (!IsIE()) ? CSFindElement(n,0) : document[n];
			if (img && typeof(CSIm[n][i].src) != "undefined") {img.src = CSIm[n][i].src;}
			if(i != 0)
				self.status = CSIm[n][3];
			else
				self.status = " ";
			return true;
		}
	}
	return false;
}
function CSILoad(action) {
	im = action[1];
	if (document.images) {
		CSIm[im] = new Object();
		for (var i=2;i<5;i++) {
			if (action[i] != '') { CSIm[im][i-2] = new Image(); CSIm[im][i-2].src = action[i]; }
			else CSIm[im][i-2] = 0;
		}
		CSIm[im][3] = action[5];
	}
}
CSStopExecution = false;

function CSAction(array) { 
	return CSAction2(CSAct, array);
}
function CSAction2(fct, array) { 
	var result;
	for (var i=0;i<array.length;i++) {
		if(CSStopExecution) return false; 
		var actArray = fct[array[i]];
		if(actArray == null) return false; 
		var tempArray = new Array;
		for(var j=1;j<actArray.length;j++) {
			if((actArray[j] != null) && (typeof(actArray[j]) == "object") && (actArray[j].length == 2)) {
				if(actArray[j][0] == "VAR") {
					tempArray[j] = CSStateArray[actArray[j][1]];
				}
				else {
					if(actArray[j][0] == "ACT") {
						tempArray[j] = CSAction(new Array(new String(actArray[j][1])));
					}
				else
					tempArray[j] = actArray[j];
				}
			}
			else
				tempArray[j] = actArray[j];
		}			
		result = actArray[0](tempArray);
	}
	return result;
}
CSAct = new Object;


CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button',/*URL*/'../images/off1.gif',/*URL*/'../images/on1.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button2',/*URL*/'../images/off2.gif',/*URL*/'../images/on2.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button3',/*URL*/'../images/off3.gif',/*URL*/'../images/on3.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button4',/*URL*/'../images/off4.gif',/*URL*/'../images/on4.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button5',/*URL*/'../images/off5.gif',/*URL*/'../images/on5.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button6',/*URL*/'../images/off6.gif',/*URL*/'../images/on6.gif',/*URL*/'','');


//JK Popup Window Script (version 3.0)- By JavaScript Kit (http://www.javascriptkit.com)
//Visit JavaScriptKit.com for free JavaScripts
//This notice must stay intact for legal use

function openpopup(popurl){
var winpops=window.open(popurl,"","width=500,height=400,toolbar,location,status,scrollbars,menubar,resizable")
}



