	var ajax = new sack();
	var ajax2 = new sack();

	function getRackList(sel)
	{
		var datacenter_id = sel.options[sel.selectedIndex].value;
		document.getElementById('rack_id').options.length = 0;	// Empty rack select box
		
		ajax.requestFile = 'ajax.php?action=list_racks&datacenter_id='+datacenter_id;	// Specifying which file to get
		ajax.onCompletion = createRacks;	// Specify function that will be executed after file has been found
		ajax.runAJAX();		// Execute AJAX function
	}

	function getSWPort_List(sel)
	{
		var switch_id = sel.options[sel.selectedIndex].value;
		document.getElementById('switch_port_id').options.length = 0;	// Empty pdu select box
		ajax.requestFile = 'ajax.php?action=list_switch_ports&switch_id='+switch_id;	// Specifying which file to get
		ajax.onCompletion = createSWPorts;	// Specify function that will be executed after file has been found
		ajax.runAJAX();		// Execute AJAX function
	}

	function getPDUPort_List(sel)
	{
		var pdu_id = sel.options[sel.selectedIndex].value;
		document.getElementById('pdu_port_id').options.length = 0;	// Empty pdu select box
		ajax.requestFile = 'ajax.php?action=list_pdu_ports&pdu_id='+pdu_id;	// Specifying which file to get
		ajax.onCompletion = createPDUPorts;	// Specify function that will be executed after file has been found
		ajax.runAJAX();		// Execute AJAX function

	}

	function createRacks()
	{
		var obj = document.getElementById('rack_id');
		eval(ajax.response);	// Executing the response from Ajax as Javascript code	
	}

	function createSWPorts()
	{
		var obj = document.getElementById('switch_port_id');
		eval(ajax.response);	// Executing the response from Ajax as Javascript code	
	}

	function createPDUPorts()
	{
		var obj = document.getElementById('pdu_port_id');
		eval(ajax.response);	// Executing the response from Ajax as Javascript code	
	}

	function createIPAddresses()
        {
                var obj = document.getElementById('ip_address');
                eval(ajax.response);    // Executing the response from Ajax as Javascript code
        }

	function populateCIDR(allocation)
	{
		var splitAllocation = allocation.split('/');  
		var cidrOptions = new Array();
  
		for (var x=32; x>=splitAllocation[1]; x--)
		{
    			cidrOptions.push('/'+x);
  		}
  		document.forms['subnet_form'].subnet_type.options.length = 0; // clear select box first
  		for (var i = 0; i < cidrOptions.length; i++)
		{ 
    			document.forms['subnet_form'].subnet_type.options[i] = new Option(cidrOptions[i],cidrOptions[i]);
  		}   
	}

	function getIpAddresses(sel)
	{
		var subnet_id = sel.options[sel.selectedIndex].value;
                document.getElementById('ip_address').options.length = 0;      // Empty pdu select box
                ajax.requestFile = 'ajax.php?action=list_ip_addresses&subnet_id='+subnet_id;     // Specifying which file to get
                ajax.onCompletion = createIPAddresses;     // Specify function that will be executed after file has been found
                ajax.runAJAX();         // Execute AJAX function
	}

