<!-- Copyright (c) 2005 by Cisco Systems, Inc. -->
// discover.js for Cat3750 devices and mirage devices.

// Mirage models.

// NME-XD-48ES-2S-P, NME-X-23ES-1G-P
// NME-XD-24ES-1S-P, NME-16ES-1G-P

function NMEXD24ES2ST(int_status, media_type) {
//24 FastEthernet Ports
//2 Gig Ports (Gi1/0/2 is internal).
	
	var dev = new top.device();

	dev.noofports = 26; // 25 + 1 internal.
	dev.x=0;
	dev.y=0;
	dev.image = "images/nmexd24es2st.gif";

	drawLedsForMirage(dev, 634, 66, 7, 2);
	
	// Create the Mode Btn
	var modeBtn = new top.modebtn("images/nme_mode.gif");
	modeBtn.x = 616;
	modeBtn.y = 54;
	modeBtn.id = "mode_btn";
	modeBtn.device = dev;
	dev.modebtn = modeBtn;		

	// Create System LEDs
	var ledImages = top.ledImages();
	var tempLed = new top.led(ledImages);
	tempLed.x = 605;
	tempLed.y = 66;
	tempLed.id = "system_led";
	tempLed.device = dev;
	dev.sysleds["SYSTEM"] = tempLed;

	tempLed = new top.led(ledImages);
	tempLed.x = 594;
	tempLed.y = 66;
	tempLed.id = "master_led";
	tempLed.device = dev;
	dev.sysleds["MASTER"] = tempLed;
		
	tempLed = new top.led(ledImages);
	tempLed.x = 583;
	tempLed.y = 66;
	tempLed.id = "status_led";
	tempLed.device = dev;
	dev.sysleds["STATUS"] = tempLed;

	tempLed = new top.led(ledImages);
	tempLed.x = 572;
	tempLed.y = 66;
	tempLed.id = "duplex_led";
	tempLed.device = dev;
	dev.sysleds["DUPLEX"] = tempLed;

	tempLed = new top.led(ledImages);
	tempLed.x = 561;
	tempLed.y = 66;
	tempLed.id = "speed_led";
	tempLed.device = dev;
	dev.sysleds["SPEED"] = tempLed;
	
	tempLed = new top.led(ledImages);
	tempLed.x = 550;
	tempLed.y = 66;
	tempLed.id = "stack_led";
	tempLed.device = dev;
	dev.sysleds["STACK"] = tempLed;
	
	tempLed = new top.led(ledImages);
	tempLed.x = 539;
	tempLed.y = 66;
	tempLed.id = "power_led";
	tempLed.device = dev;
	dev.sysleds["POWER"] = tempLed;

	// Create the ports
	var port;
	var portWidth = 19;
	var portImages = top.rj45portImages();
	var portInvImages = top.rj45portInvImages();
	var xPortGap = 3;
	var xPortGroupGap = 17;
	var xPortStartPos = 292;
	var xPortCoord = xPortStartPos;
	var yPortCoord = 22;

	// Add the 24 FastEthernet ports in two groups of 12 each
	// from right to left
	for(var i=0; i<24; i++) {
		if(i%2 == 0) {
			yPortCoord = 22;
			port = new top.rj45portInv(portInvImages);
		} else {
			yPortCoord = 40;
			port = new top.rj45port(portImages);
		}
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 != 0) {
			xPortCoord -= (portWidth + xPortGap);	
		}
		if(i == 11) {
			xPortCoord -= (xPortGroupGap - xPortGap);
		}
		dev.addPort(port);
    }

	// Add the 1st GBIC port - Gi1/0/1, Gi1/0/2 is internal
	xPortCoord = 326;
	yPortCoord = 54;
	var i = 24;
	port = new top.SFPport(int_status[i][6], portImages); // pass the module type plugged-in the SFP slot
	port.index = i;
	port.x = xPortCoord;
	port.y = yPortCoord;
	port.id = "port_" + i;

	dev.addPort(port);
	dev.modeAliases = new Array ("STATUS", "DUPLEX", "SPEED", "STACK", "PoE");	
	return dev;
}


function NMEXD48ES2GE(int_status, media_type) {
//48 FastEthernet Ports.
//4 Gig Ports (Gi1/0/3 and Gi 1/0/4 are internal).
	
	var dev = new top.device();

	dev.noofports = 52; // 50 + 2 internal.
	dev.x=0;
	dev.y=0;
	dev.image = "images/nmexd48es2ge.gif";

	drawLedsForMirage(dev, 634, 71, 7, 2);
	
	// Create the ports
	var port;
	var portWidth = 19;
	var portImages = top.rj45portImages();
	var portInvImages = top.rj45portInvImages();
	var xPortGap = 3;
	var xPortGroupGap = 13;
	var xPortStartPos = 559;
	var xPortCoord = xPortStartPos;
	var yPortCoord = 22;

	// Add the 48 FastEthernet ports in three groups of 16 each from
	// right to left
	for(var i=0; i<48; i++) {       
		if(i%2 == 0) {
			yPortCoord = 22;
			port = new top.rj45portInv(portInvImages);
		} else {
			yPortCoord = 40;
			port = new top.rj45port(portImages);
		}
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 != 0) {
			xPortCoord -= (portWidth + xPortGap);	
		}
		if(i == 15 || i == 31) {
			xPortCoord -= (xPortGroupGap - xPortGap);
		}
		dev.addPort(port);
    }

	// Add the 2 GBIC ports - Gi1/0/1, Gi1/0/2
	// Gi1/0/3 and Gi1/0/4 are internal
	xPortCoord = 617;
	xPortGap = 8;
	yPortCoord = 49;
	portWidth = 21;
	for(i=48; i<50; i++) {
		port = new top.SFPport(int_status[i][6], portImages); // pass the module type plugged-in the SFP slot
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 == 0) {
			xPortCoord -= (portWidth + xPortGap);
		}
		dev.addPort(port);
	}
	
	dev.modeAliases = new Array ("STATUS", "DUPLEX", "SPEED", "STACK", "PoE");	
	return dev;
}

function NMEX24ES1GE(int_status, media_type) {
// 23 FastEthernet Ports (Starts with Fa1/0/2 and ends with Fa1/0/24).
// 2 Gig Ports (Gi1/0/2 is internal).
	var dev = new top.device();

	dev.noofports = 25; // 24 + 1 internal.
	dev.x=137;
	dev.y=0;
	dev.image = "images/nmex24es1ge.gif";

	drawLedsForMirage(dev, 353, 56, 4, 3);
	
	// Create the ports
	var port;
	var portWidth = 19;
	var portImages = top.rj45portImages();
	var portInvImages = top.rj45portInvImages();
	var xPortGap = 3;
	var xPortGroupGap = 17;
	var xPortStartPos = 308;
	var xPortCoord = xPortStartPos;
	var yPortCoord = 22;

	// Add the 23 FastEthernet ports in two groups of 11 and 12
	// from right to left. First port in the first group is Gi1/0/1
	for(var i=0; i<23; i++) {       
		if(i%2 != 0) {
			yPortCoord = 22;
			port = new top.rj45portInv(portInvImages);
		} else {
			yPortCoord = 40;
			port = new top.rj45port(portImages);
		}
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 == 0) {
			xPortCoord -= (portWidth + xPortGap);	
		}
		if(i == 10) {
			xPortCoord -= (xPortGroupGap - xPortGap);
		}
		dev.addPort(port);
    }

	// Add the 1st GBIC port - Gi1/0/1, Gi1/0/2 is internal
	xPortCoord = 308;
	yPortCoord = 22;
	var i = 23;
	port = new top.rj45port(portInvImages);
	port.index = i;
	port.x = xPortCoord;
	port.y = yPortCoord;
	port.id = "port_" + i;

	dev.addPort(port);
	dev.modeAliases = new Array ("STATUS", "DUPLEX", "SPEED", "STACK", "PoE");	
	return dev;
}

function NME16ES1GE(int_status, media_type) {
// 16 Fast Ethernet ports
// 2 Gig Ports (Gi1/0/2 is internal).
	var dev = new top.device();

	dev.noofports = 18;
	dev.x=147;
	dev.y=0;
	dev.image = "images/nme16es1ge.gif";
	
	drawLedsForMirage(dev, 36, 61, 4, 3);

	// Create the ports
	var port;
	var portWidth = 19;
	var portImages = top.rj45portImages();
	var portInvImages = top.rj45portInvImages();
	var xPortGap = 3;
	var xPortGroupGap = 0;
	var xPortStartPos = 246;
	var xPortCoord = xPortStartPos;
	var yPortCoord = 22;

	// Add the 16 FastEthernet ports from right to left
	for(var i=0; i<16; i++) {       
		if(i%2 == 0) {
			yPortCoord = 22;
			port = new top.rj45portInv(portInvImages);
		} else {
			yPortCoord = 40;
			port = new top.rj45port(portImages);
		}
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 != 0) {
			xPortCoord -= (portWidth + xPortGap);	
		}
		dev.addPort(port);
    }

	// Add the 1st GBIC port - Gi1/0/1, Gi1/0/2 is internal
	xPortCoord = 303;
	yPortCoord = 39;
	var i = 16;
	port = new top.rj45port(portInvImages);
	port.index = i;
	port.x = xPortCoord;
	port.y = yPortCoord;
	port.id = "port_" + i;
	dev.addPort(port);

	dev.modeAliases = new Array ("STATUS", "DUPLEX", "SPEED", "STACK", "PoE");	
	return dev;
}

function drawLedsForMirage(dev, x, y, width, height) {
	var ledImages = top.ledImages();
	var tempLed = new top.led(ledImages);
	tempLed.x = x;
	tempLed.y = y;
	tempLed.width = width;
	tempLed.height = height;
	tempLed.id = "en_led";
	tempLed.device = dev;
	dev.sysleds["EN"] = tempLed;
}

//////////////////////// c3750 devices start ////////////////////////////////

// c3750 models.

// WS-C3750-24TS, WS-C3750-48TS, WS-C3750-24P, WS-C3750-48P,
// WS-C3750G-12S, WS-C3750G-24T, WS-C3750G-24TS
// WS-C3750G-16TD, WS-C3750G-48PS, WS-C3750G-48TS, WS-C3750G-24PS,
// WS-C3750G-24TS-1U, WS-C3750-24FS, WS-C3750G-12S-D

function WSC375024FS(int_status, media_type) {
	var dev = new top.device();

	dev.noofports = 26;
	dev.x=0;
	dev.y=0;
	dev.image = "images/c375024FX_2.gif";

	drawLeds(dev);

	// Create the ports
	var port;
	var portWidth = 19;
	var portImages = top.fxportImages();
	var xPortGap = 1;
	var xPortGroupGap = 14;
	var xPortStartPos = 71;
	var xPortCoord = xPortStartPos;
	var yPortCoord = 51;

	// Add the 24 FastEthernet ports in 3 groups of 8 each.
	for(i=0; i<24; i++) {       
		port = new top.fxport(portImages);
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i ==7 || i == 15 ) {
			xPortCoord += ( portWidth + xPortGroupGap);
		}
		else {
			xPortCoord += (portWidth + xPortGap);	
		}
		dev.addPort(port);
    }

	// Add the 2 GBIC ports.
	xPortCoord = 591;
	xPortGap = 11;
	yPortCoord = 50;
	portWidth = 21;
	for(i=24; i<26; i++) {       
		port = new top.SFPport(int_status[i][6], portImages); // pass the module type plugged-in the SFP slot
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		xPortCoord += (portWidth + xPortGap);
		dev.addPort(port);
	}	
	
	return dev;
}


function WSC375024TS(int_status, media_type) {
	var dev = new top.device();

	dev.noofports = 26;
	dev.x=0;
	dev.y=0;
	dev.image = "images/c375024_2.gif";

	drawLeds(dev);

	// Create the ports
	var port;
	var portWidth = 19;
	var portImages = top.rj45portImages();
	var portInvImages = top.rj45portInvImages();
	var xPortGap = 1;
	var xPortGroupGap = 30;
	var xPortStartPos = 110;
	var xPortCoord = xPortStartPos;
	var yPortCoord;

	// Add the 24 FastEthernet ports in 2 groups of 12 each.
	for(i=0; i<24; i++) {       
		if(i%2 == 0) {
			yPortCoord = 25;
			port = new top.rj45portInv(portInvImages);
		} else {
			yPortCoord = 41;
			port = new top.rj45port(portImages);
		}
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 != 0) {
			xPortCoord += (portWidth + xPortGap);
		}
		if(i==11 || i == 23) {
			xPortCoord += (xPortGroupGap - xPortGap);
		}
		dev.addPort(port);
    }

	// Add the 2 GBIC ports.
	xPortCoord = 469;
	xPortGap = 45;
	for(i=24; i<26; i++) {       
		yPortCoord = 39;		
		port = new top.SFPport(int_status[i][6], portImages); // pass the module type plugged-in the SFP slot
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		xPortCoord += (portWidth + xPortGap);
		dev.addPort(port);
	}	
	
	return dev;
}


function WSC375048TS(int_status, media_type) {
	var dev = new top.device();
	dev.noofports = 52;
	dev.x=0;
	dev.y=0;
	dev.image = "images/c375048_4.gif";	

    drawLeds(dev);	

	var port;
	var portWidth = 19;
	var portImages = top.rj45portImages();
	var portInvImages = top.rj45portInvImages();
	var xPortGap = 1;
	var xPortGroupGap = 11;
	var xPortStartPos = 72;
	var xPortCoord = xPortStartPos;
	var yPortCoord;

	// Add the 48 FastEthernet ports in 4 groups of 12 each.
	for(i=0; i<48; i++) {       
		if(i%2 == 0) {
			yPortCoord = 26;
			port = new top.rj45portInv(portInvImages);
		} else {
			yPortCoord = 42;
			port = new top.rj45port(portImages);
		}
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 != 0) {
			xPortCoord += (portWidth + xPortGap);
		}
		if(i==15 || i == 31) {
			xPortCoord += (xPortGroupGap - xPortGap);
		}
		dev.addPort(port);
    }

	// Add the 4 SFP ports.
	xPortCoord = 589;
	xPortGap = 12;
	yPortCoord = 25;
	portWidth = 21;
	for(i=48; i<52; i++) {
		port = new top.SFPport(int_status[i][6], portImages); // pass the module type plugged-in the SFP slot
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 == 0) {
			yPortCoord = 47;			
		} else {
			yPortCoord = 25;
			xPortCoord += (portWidth + xPortGap);
		}

		dev.addPort(port);
	}	

	return dev;
}


function WSC375024P(int_status, media_type) {
	var dev = new top.device();

	dev.noofports = 26;
	dev.x=0;
	dev.y=0;
	dev.image = "images/c375024_2p.gif";

	drawLedsForPowerSwitch(dev);
	
	// Create the ports
	var port;
	var portWidth = 19;
	var portImages = top.rj45portImages();
	var portInvImages = top.rj45portInvImages();
	var xPortGap = 1;
	var xPortGroupGap = 30;
	var xPortStartPos = 110;
	var xPortCoord = xPortStartPos;
	var yPortCoord;

	// Add the 24 FastEthernet ports in 2 groups of 12 each.
	for(i=0; i<24; i++) {       
		if(i%2 == 0) {
			yPortCoord = 25;
			port = new top.rj45portInv(portInvImages);
		} else {
			yPortCoord = 41;
			port = new top.rj45port(portImages);
		}
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 != 0) {
			xPortCoord += (portWidth + xPortGap);
		}
		if(i==11 || i == 23) {
			xPortCoord += (xPortGroupGap - xPortGap);
		}
		dev.addPort(port);
    }

	// Add the 2 GBIC ports.
	xPortCoord = 469;
	xPortGap = 45;
	for(i=24; i<26; i++) {       
		yPortCoord = 39;		
		port = new top.SFPport(int_status[i][6], portImages); // pass the module type plugged-in the SFP slot
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		xPortCoord += (portWidth + xPortGap);
		dev.addPort(port);
	}	

	dev.modeAliases = new Array ("STATUS", "DUPLEX", "SPEED", "STACK", "PoE");	
	return dev;
}


function WSC3750G12S(int_status, media_type) {
	var dev = new top.device();

	dev.noofports = 12;
	dev.x=0;
	dev.y=0;
	dev.image = "images/c3750g_12s.gif";

    drawLeds(dev);
	
	// Create the ports
	var port;
	var portWidth = 21;
	var xPortGap = 1;
	var xPortGroupGap = 14;
	var xPortStartPos = 319;
	var xPortCoord = xPortStartPos;
	var yPortCoord = 40;

	// Add the 12 GBIC ports in 3 groups of 4 each.
	for(i=0; i<12; i++) {    
		port = new top.SFPport(int_status[i][6]); // pass the module type plugged-in the SFP slot
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.index = i;
		port.id = "port_" + i;
		xPortCoord += (portWidth + xPortGap);
		if (i==3 || i==7) {
			xPortCoord += (xPortGroupGap - xPortGap);
		}

		dev.addPort(port);
	}	
	
	return dev;
}

function WSC375048P(int_status, media_type) {
	var dev = new top.device();

	dev.noofports = 52;
	dev.x=0;
	dev.y=0;
	dev.image = "images/c375048_4p.gif";

    drawLedsForPowerSwitch(dev);	
	
	// Create the ports
	var port;
	var portWidth = 19;
	var portImages = top.rj45portImages();
	var portInvImages = top.rj45portInvImages();
	var xPortGap = 1;
	var xPortGroupGap = 11;
	var xPortStartPos = 72;
	var xPortCoord = xPortStartPos;
	var yPortCoord;

	// Add the 48 FastEthernet ports in 4 groups of 12 each.
	for(i=0; i<48; i++) {       
		if(i%2 == 0) {
			yPortCoord = 26;
			port = new top.rj45portInv(portInvImages);
		} else {
			yPortCoord = 42;
			port = new top.rj45port(portImages);
		}
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 != 0) {
			xPortCoord += (portWidth + xPortGap);
		}
		if(i==15 || i == 31) {
			xPortCoord += (xPortGroupGap - xPortGap);
		}
		dev.addPort(port);
    }

	// Add the 4 SFP ports.
	xPortCoord = 587;
	xPortGap = 12;
	yPortCoord = 25;
	portWidth = 21;
	for(i=48; i<52; i++) {
		port = new top.SFPport(int_status[i][6], portImages); // pass the module type plugged-in the SFP slot
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 == 0) {
			yPortCoord = 46;			
		} else {
			yPortCoord = 25;
			xPortCoord += (portWidth + xPortGap);
		}

		dev.addPort(port);
	}	

	dev.modeAliases = new Array ("STATUS", "DUPLEX", "SPEED", "STACK", "PoE");	
	return dev;
}



function WSC3750G24T(int_status, media_type) {
	var dev = new top.device();

	dev.noofports = 24;
	dev.x=0;
	dev.y=0;
	dev.image = "images/c3750g_24_0.gif";

    drawLeds(dev);
	
	// Create the ports
	var port;
	var portWidth = 19;
	var portImages = top.rj45portImages();
	var portInvImages = top.rj45portInvImages();
	var xPortGap = 1;
	var xPortGroupGap = 84;
	var xPortStartPos = 159;
	var xPortCoord = xPortStartPos;
	var yPortCoord;

	// Add the 24 FastEthernet ports in 2 groups of 12 each.
	for(i=0; i<24; i++) {       
		if(i%2 == 0) {
			yPortCoord = 25;
			port = new top.rj45portInv(portInvImages);
		} else {
			yPortCoord = 41;
			port = new top.rj45port(portImages);
		}
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 != 0) {
			xPortCoord += (portWidth + xPortGap);
		}
		if(i==11 || i == 23) {
			xPortCoord += (xPortGroupGap - xPortGap);
		}
		dev.addPort(port);
    }

	return dev;
}



function WSC3750G24TS(int_status, media_type) {
	var dev = new top.device();

	dev.noofports = 28;
	dev.x=0;
	dev.y=0;
	dev.image = "images/c3750g_24_4.gif";

	// Create the Mode Btn
	var modeBtn = new top.modebtn("images/c375024_2_mode.gif");
	modeBtn.x = 33; 
	modeBtn.y = 83;
	modeBtn.id = "mode_btn";
	modeBtn.device = dev;
	dev.modebtn = modeBtn;		

	// Create System LEDs
	var ledImages = top.ledImages();
	var tempLed = new top.led(ledImages);
	tempLed.x = 11; 
	tempLed.y = 41; 
	tempLed.id = "system_led";
	tempLed.device = dev;
	dev.sysleds["SYSTEM"] = tempLed;

	tempLed = new top.led(ledImages);
	tempLed.x = 11; 
	tempLed.y = 47; 
	tempLed.id = "rps_led";
	tempLed.device = dev;
	dev.sysleds["RPS"] = tempLed;
	
	tempLed = new top.led(ledImages);
	tempLed.x = 11; 
	tempLed.y = 53; 
	tempLed.id = "master_led";
	tempLed.device = dev;
	dev.sysleds["MASTER"] = tempLed;
	
	tempLed = new top.led(ledImages);
	tempLed.x = 11; 
	tempLed.y = 59; 
	tempLed.id = "status_led";
	tempLed.device = dev;
	dev.sysleds["STATUS"] = tempLed;

	tempLed = new top.led(ledImages);
	tempLed.x = 11;
	tempLed.y = 65; 
	tempLed.id = "duplex_led";
	tempLed.device = dev;
	dev.sysleds["DUPLEX"] = tempLed;

	tempLed = new top.led(ledImages);
	tempLed.x = 11; 
	tempLed.y = 71; 
	tempLed.id = "speed_led";
	tempLed.device = dev;
	dev.sysleds["SPEED"] = tempLed;
	
	tempLed = new top.led(ledImages);
	tempLed.x = 11; 
	tempLed.y = 77;
	tempLed.id = "stack_led";
	tempLed.device = dev;
	dev.sysleds["STACK"] = tempLed;
	
	// Create the ports
	var port;
	var portWidth = 19;
	var portImages = top.rj45portImages();
	var portInvImages = top.rj45portInvImages();
	var xPortGap = 1;
	var xPortGroupGap = 55;
	var xPortStartPos = 128; 
	var xPortCoord = xPortStartPos;
	var yPortCoord;

	// Add the 24 FastEthernet ports in 2 groups of 12 each.
	for(i=0; i<24; i++) {       
		if(i%2 == 0) {
			yPortCoord = 40; 
			port = new top.rj45portInv(portInvImages);
		} else {
			yPortCoord = 56; 
			port = new top.rj45port(portImages);
		}
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 != 0) {
			xPortCoord += (portWidth + xPortGap);
		}
		if(i==11 || i == 23) {
			xPortCoord += (xPortGroupGap - xPortGap);
		}
		dev.addPort(port);
    }

	// Add the 4 GBIC ports.
	xPortCoord = 498;
	xPortGap = 1;
	portWidth = 21;
	for(i=24; i<28; i++) {       
		yPortCoord = 55; 		
		port = new top.SFPport(int_status[i][6], portImages); // pass the module type plugged-in the SFP slot
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		xPortCoord += (portWidth + xPortGap);
		dev.addPort(port);
	}	
	
	return dev;
}



function WSC3750G16TD(int_status, media_type) {
	var dev = new top.device();

	dev.noofports = 17;
	dev.x=0;
	dev.y=0;
	dev.image = "images/c3750g_16td.gif";

    drawLeds(dev);

	// Create the ports
	var port;
	var portWidth = 19;
	var portImages = top.rj45portImages();
	var portInvImages = top.rj45portInvImages();
	var xPortGap = 1;
	
	var xPortStartPos = 165;
	var xPortCoord = xPortStartPos;
	var yPortCoord;

	// Add the 24 FastEthernet ports in 2 groups of 12 each.
	for(i=0; i<16; i++) {       
		if(i%2 == 0) {
			yPortCoord = 25;
			port = new top.rj45portInv(portInvImages);
		} else {
			yPortCoord = 41;
			port = new top.rj45port(portImages);
		}
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 != 0) {
			xPortCoord += (portWidth + xPortGap);
		}
		dev.addPort(port);
    }

	// Add the 1 10 Gig port.
	xPortCoord = 569;
	i=16;	     
	yPortCoord = 49;
	port = new top.tenGigport(int_status[i][6], portImages); // pass the module type plugged-in the SFP slot
	port.index = i;   
	port.x = xPortCoord;
	port.y = yPortCoord;
	port.id = "port_" + i;
	dev.addPort(port);	
	
	return dev;
}



function WSC3750G24PS(int_status, media_type) {
	var dev = new top.device();

	dev.noofports = 28;
	dev.x=0;
	dev.y=0;
	dev.image = "images/c3750g24_4p.gif";

	drawLedsForPowerSwitch(dev);
	
	// Create the ports
	var port;
	var portWidth = 19;
	var portImages = top.rj45portImages();
	var portInvImages = top.rj45portInvImages();
	var xPortGap = 1;
	var xPortGroupGap = 33;
	var xPortStartPos = 288;
	var xPortCoord = xPortStartPos;
	var yPortCoord;

	// Add the 24 FastEthernet ports in 2 groups of 12 each.
	for(i=0; i<24; i++) {       
		if(i%2 == 0) { 
			yPortCoord = 28;
			port = new top.rj45portInv(portInvImages);
		} else {
			yPortCoord = 44;
			port = new top.rj45port(portImages);
		}
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 != 0) {
			xPortCoord += (portWidth + xPortGap);
		}
		if(i==11 || i == 23) {
			xPortCoord += (xPortGroupGap - xPortGap);
		}
		dev.addPort(port);
    }

	// Add the 4 SFP ports.
	xPortCoord = 584;
	xPortGap = 16;
	yPortCoord = 26;
	portWidth = 21;
	for(i=24; i<28; i++) {
		port = new top.SFPport(int_status[i][6], portImages); // pass the module type plugged-in the SFP slot
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 == 0) {
			yPortCoord = 48;			
		} else {
			yPortCoord = 26;
			xPortCoord += (portWidth + xPortGap);
		  }
                dev.addPort(port);
         }

	dev.modeAliases = new Array ("STATUS", "DUPLEX", "SPEED", "STACK", "PoE");	
	return dev;
}

function WSC3750G24TS1U(int_status, media_type) {
	var dev = new top.device();

	dev.noofports = 28;
	dev.x=0;
	dev.y=0;
	dev.image = "images/c3750g24_4.gif";

    drawLeds(dev);
	
	// Create the ports
	var port;
	var portWidth = 19;
	var portImages = top.rj45portImages();
	var portInvImages = top.rj45portInvImages();
	var xPortGap = 1;
	var xPortGroupGap = 33;
	var xPortStartPos = 288;
	var xPortCoord = xPortStartPos;
	var yPortCoord;

	// Add the 24 FastEthernet ports in 2 groups of 12 each.
	for(i=0; i<24; i++) {       
		if(i%2 == 0) {
			yPortCoord = 28;
			port = new top.rj45portInv(portInvImages);
		} else {
			yPortCoord = 44;
			port = new top.rj45port(portImages);
		}
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 != 0) {
			xPortCoord += (portWidth + xPortGap);
		}
		if(i==11 || i == 23) {
			xPortCoord += (xPortGroupGap - xPortGap);
		}
		dev.addPort(port);
    }

	// Add the 4 SFP ports.
	xPortCoord = 584;
	xPortGap = 16;
	yPortCoord = 26;
	portWidth = 21;
	for(i=24; i<28; i++) {
		port = new top.SFPport(int_status[i][6], portImages); // pass the module type plugged-in the SFP slot
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 == 0) {
			yPortCoord = 48;			
		} else {
			yPortCoord = 26;
			xPortCoord += (portWidth + xPortGap);
		  }
                dev.addPort(port);
         }

	dev.modeAliases = new Array ("STATUS", "DUPLEX", "SPEED", "STACK", "PoE");	
	return dev;

}

function WSC3750G48TS(int_status, media_type) {
	var dev = new top.device();
	dev.noofports = 52;
	dev.x=0;
	dev.y=0;
	dev.image = "images/c3750g48_4.gif";	

        drawLeds(dev);	

	var port;
	var portWidth = 19;
	var portImages = top.rj45portImages();
	var portInvImages = top.rj45portInvImages();
	var xPortGap = 1;
	var xPortGroupGap = 11;
	var xPortStartPos = 72;
	var xPortCoord = xPortStartPos;
	var yPortCoord;

	// Add the 48 FastEthernet ports in 4 groups of 12 each.
	for(i=0; i<48; i++) {       
		if(i%2 == 0) {
			yPortCoord = 27;
			port = new top.rj45portInv(portInvImages);
		} else {
			yPortCoord = 43;
			port = new top.rj45port(portImages);
		}
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 != 0) {
			xPortCoord += (portWidth + xPortGap);
		}
		if(i==15 || i == 31) {
			xPortCoord += (xPortGroupGap - xPortGap);
		}
		dev.addPort(port);
    }

	// Add the 4 SFP ports.
	xPortCoord = 587;
	xPortGap = 14;
	yPortCoord = 27;
	portWidth = 21;
	for(i=48; i<52; i++) {
		port = new top.SFPport(int_status[i][6], portImages); // pass the module type plugged-in the SFP slot
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 == 0) {
			yPortCoord = 49;			
		} else {
			yPortCoord = 27;
			xPortCoord += (portWidth + xPortGap);
		}

		dev.addPort(port);
	}	

	return dev;
}

function WSC3750G48P(int_status, media_type) {
	var dev = new top.device();

	dev.noofports = 52;
	dev.x=0;
	dev.y=0;
	dev.image = "images/c3750g48_4p.gif";

    drawLedsForPowerSwitch(dev);	
	
	// Create the ports
	var port;
	var portWidth = 19;
	var portImages = top.rj45portImages();
	var portInvImages = top.rj45portInvImages();
	var xPortGap = 1;
	var xPortGroupGap = 11;
	var xPortStartPos = 72;
	var xPortCoord = xPortStartPos;
	var yPortCoord;

	// Add the 48 FastEthernet ports in 4 groups of 12 each.
	for(i=0; i<48; i++) {       
		if(i%2 == 0) {
			yPortCoord = 28;
			port = new top.rj45portInv(portInvImages);
		} else {
			yPortCoord = 44;
			port = new top.rj45port(portImages);
		}
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 != 0) {
			xPortCoord += (portWidth + xPortGap);
		}
		if(i==15 || i == 31) {
			xPortCoord += (xPortGroupGap - xPortGap);
		}
		dev.addPort(port);
    }

	// Add the 4 SFP ports.
	xPortCoord = 585;
	xPortGap = 15;
	yPortCoord = 27;
	portWidth = 21;
	for(i=48; i<52; i++) {
		port = new top.SFPport(int_status[i][6], portImages); // pass the module type plugged-in the SFP slot
		port.index = i;
		port.x = xPortCoord;
		port.y = yPortCoord;
		port.id = "port_" + i;
		if(i%2 == 0) {
			yPortCoord = 49;			
		} else {
			yPortCoord = 27;
			xPortCoord += (portWidth + xPortGap);
		}

		dev.addPort(port);
	}	

	dev.modeAliases = new Array ("STATUS", "DUPLEX", "SPEED", "STACK", "PoE");	
	return dev;
}


function drawLeds(dev) {

	// Create the Mode Btn
	var modeBtn = new top.modebtn("images/c375024_2_mode.gif");
	modeBtn.x = 35;
	modeBtn.y = 66;
	modeBtn.height = 10;
	modeBtn.width = 19;
	modeBtn.id = "mode_btn";
	modeBtn.device = dev;
	dev.modebtn = modeBtn;		

	// Create System LEDs
	var ledImages = top.ledImages();
	var tempLed = new top.led(ledImages);
	tempLed.x = 13;
	tempLed.y = 24;
	tempLed.id = "system_led";
	tempLed.device = dev;
	dev.sysleds["SYSTEM"] = tempLed;

	tempLed = new top.led(ledImages);
	tempLed.x = 13;
	tempLed.y = 30;
	tempLed.id = "rps_led";
	tempLed.device = dev;
	dev.sysleds["RPS"] = tempLed;
	
	tempLed = new top.led(ledImages);
	tempLed.x = 13;
	tempLed.y = 36;
	tempLed.id = "master_led";
	tempLed.device = dev;
	dev.sysleds["MASTER"] = tempLed;
	
	tempLed = new top.led(ledImages);
	tempLed.x = 13;
	tempLed.y = 42;
	tempLed.id = "status_led";
	tempLed.device = dev;
	dev.sysleds["STATUS"] = tempLed;

	tempLed = new top.led(ledImages);
	tempLed.x = 13;
	tempLed.y = 48;
	tempLed.id = "duplex_led";
	tempLed.device = dev;
	dev.sysleds["DUPLEX"] = tempLed;

	tempLed = new top.led(ledImages);
	tempLed.x = 13;
	tempLed.y = 54;
	tempLed.id = "speed_led";
	tempLed.device = dev;
	dev.sysleds["SPEED"] = tempLed;
	
	tempLed = new top.led(ledImages);
	tempLed.x = 13;
	tempLed.y = 60;
	tempLed.id = "stack_led";
	tempLed.device = dev;
	dev.sysleds["STACK"] = tempLed;
}


function drawLedsForPowerSwitch(dev) {

	// Create the Mode Btn
	var modeBtn = new top.modebtn("images/c375024_2_mode.gif");
	modeBtn.x = 35;
	modeBtn.y = 67;
	modeBtn.id = "mode_btn";
	modeBtn.device = dev;
	dev.modebtn = modeBtn;		

	// Create System LEDs
	var ledImages = top.ledImages();
	var tempLed = new top.led(ledImages);
	tempLed.x = 13;
	tempLed.y = 22;
	tempLed.id = "system_led";
	tempLed.device = dev;
	dev.sysleds["SYSTEM"] = tempLed;

	tempLed = new top.led(ledImages);
	tempLed.x = 13;
	tempLed.y = 28;
	tempLed.id = "rps_led";
	tempLed.device = dev;
	dev.sysleds["RPS"] = tempLed;
	
	tempLed = new top.led(ledImages);
	tempLed.x = 13;
	tempLed.y = 34;
	tempLed.id = "master_led";
	tempLed.device = dev;
	dev.sysleds["MASTER"] = tempLed;
		
	tempLed = new top.led(ledImages);
	tempLed.x = 13;
	tempLed.y = 40;
	tempLed.id = "status_led";
	tempLed.device = dev;
	dev.sysleds["STATUS"] = tempLed;

	tempLed = new top.led(ledImages);
	tempLed.x = 13;
	tempLed.y = 46;
	tempLed.id = "duplex_led";
	tempLed.device = dev;
	dev.sysleds["DUPLEX"] = tempLed;

	tempLed = new top.led(ledImages);
	tempLed.x = 13;
	tempLed.y = 52;
	tempLed.id = "speed_led";
	tempLed.device = dev;
	dev.sysleds["SPEED"] = tempLed;
	
	tempLed = new top.led(ledImages);
	tempLed.x = 13;
	tempLed.y = 58;
	tempLed.id = "stack_led";
	tempLed.device = dev;
	dev.sysleds["STACK"] = tempLed;
	
	tempLed = new top.led(ledImages);
	tempLed.x = 13;
	tempLed.y = 64;
	tempLed.id = "power_led";
	tempLed.device = dev;
	dev.sysleds["POWER"] = tempLed;
}

/////////////////////////c3750 devices end //////////////////////////////////

function createDevice(int_status, media_type, deviceType) {
	var device = null;
	if(deviceType == null)
		return device;	
	if(deviceType == "NME-XD-48ES-2S-P") {
		device = new NMEXD48ES2GE(int_status, media_type);
		device.family = "EtherSwitch Service Module";
	} else if(deviceType == "NME-X-23ES-1G-P") {
		device = new NMEX24ES1GE(int_status, media_type);
		device.family = "EtherSwitch Service Module";
	} else if(deviceType == "NME-XD-24ES-1S-P") {
		device = new NMEXD24ES2ST(int_status, media_type);
		device.family = "EtherSwitch Service Module";
	} else if(deviceType == "NME-16ES-1G-P") {
		device = new NME16ES1GE(int_status, media_type);
		device.family = "EtherSwitch Service Module";
	} else if(deviceType == "WS-C3750-24FS") {
                device = new WSC375024FS(int_status, media_type);
				device.family = "3750";
        } else if(deviceType == "WS-C3750-24P") {
                device = new WSC375024P(int_status, media_type);
				device.family = "3750";
        } else if(deviceType == "WS-C3750G-12S" || deviceType == "WS-C3750G-12S-D") {
                device = new WSC3750G12S(int_status, media_type);
				device.family = "3750";
        } else if(deviceType == "WS-C3750-48P") {
                device = new WSC375048P(int_status, media_type);
				device.family = "3750";
        } else if(deviceType == "WS-C3750G-24T") {
                device = new WSC3750G24T(int_status, media_type);
				device.family = "3750";
        } else if(deviceType == "WS-C3750G-24TS") {
                device = new WSC3750G24TS(int_status, media_type);
				device.family = "3750";
        } else if(deviceType == "WS-C3750G-16TD") {
                device = new WSC3750G16TD(int_status, media_type);
				device.family = "3750";
        } else if(deviceType.indexOf ("WS-C3750-48") != -1) {
                device = new WSC375048TS(int_status, media_type);
				device.family = "3750";
        } else if(deviceType.indexOf ("WS-C3750-24") != -1) {
                device = new WSC375024TS(int_status, media_type);
				device.family = "3750";
        } else if(deviceType == "WS-C3750G-24PS") {
                device = new WSC3750G24PS(int_status, media_type);
				device.family = "3750";
        } else if(deviceType == "WS-C3750G-24TS-1U") {
                device = new WSC3750G24TS1U(int_status, media_type);
				device.family = "3750";
        } else if(deviceType == "WS-C3750G-48PS") {
                device = new WSC3750G48P(int_status, media_type);
				device.family = "3750";
        } else if(deviceType == "WS-C3750G-48TS") {
                device = new WSC3750G48TS(int_status, media_type);
				device.family = "3750";
        }

	if(device != null) {
		device.type = deviceType;
//		device.family = "3750";
	}

	return device;
}
