//----------------------------------------------------------------------------
// Global vars
//----------------------------------------------------------------------------
var fieldActive = '-1';
var changeFieldClass = false;


//----------------------------------------------------------------------------
// Code for deactivating currently active faq item.
// Hides answer and (optionally, depending on changeFieldClass) resets class of
// question div.
//----------------------------------------------------------------------------

function swapSection( id )
{
	enable = false;
	
	if( document.layers )
    if( document.layers[id].display != 'block' )
			enable = true;

  if (document.all) 
  	if( document.all[id].style.display != 'block' )
			enable = true;	
			

  if (document.getElementById) 
  	if( document.getElementById(id).style.display != 'block' )
			enable = true;
	
	toggleSection( id, enable );
}
		

function toggleSection( id, enable )
{
	if( enable )
	{
		if (document.layers)
      document.layers[id].display = 'block';

   	if (document.all) 
      document.all[id].style.display = 'block';

   	if (document.getElementById) 
      document.getElementById(id).style.display = 'block';
	}
	else
	{
		if (document.layers)
      document.layers[id].display = 'none';

   	if (document.all) 
      document.all[id].style.display = 'none';

   	if (document.getElementById) 
      document.getElementById(id).style.display = 'none';
	}
}
			
function toggleField( id, enabled ) {

	
  if ( enabled ) /* (fieldActive != '-1') && (fieldActive != id) ) */
  {
   	if (document.layers)
    {
      document.layers[id].display = 'none';
/*      if (changeFieldClass == true) { document.layers["faq" + fieldActive].className = 'faq_question' }; */
    }
   	if (document.all) {
      document.all[id].style.display = 'none';
/*      if (changeFieldClass == true) { document.all["faq" + fieldActive].className = 'faq_question' }; */
    }
   	if (document.getElementById) {
      document.getElementById(id).style.display = 'none';
 /*     if (changeFieldClass == true) { document.getElementById("faq" + fieldActive).className = 'faq_question' }; */
    }
  }


//----------------------------------------------------------------------------
// Code for activating clicked faq item.
// Shows answer and (optionally, depending on changeFieldClass) sets class of
// question div.
//----------------------------------------------------------------------------

	if (document.layers)
  {
		currentDisplay = (document.layers[id].display == 'block') ? 'none' : 'block';
		document.layers[id].display = currentDisplay;
/*
    if (changeFieldClass == true) {
      currentClass = (currentDisplay == 'block') ? 'faq_question_active' : 'faq_question';
      document.layers["faq" + id].className = currentClass;
    }
*/
	}
	else if (document.all)
  {
		currentDisplay = (document.all[ id].style.display == 'block') ? 'none' : 'block';
		document.all[id].style.display = currentDisplay;
/*
    if (changeFieldClass == true) {
      currentClass = (currentDisplay == 'block') ? 'faq_question_active' : 'faq_question';
      document.all["faq" + id].className = currentClass;
    }
*/
	}
	else if (document.getElementById) {
		currentDisplay = (document.getElementById(id).style.display == 'block') ? 'none' : 'block';
		document.getElementById(id).style.display = currentDisplay;
/*
    if (changeFieldClass == true) {
      currentClass = (currentDisplay == 'block') ? 'faq_question_active' : 'faq_question';
      document.getElementById("faq" + id).className = currentClass;
    }
*/
	}
/*
  fieldActive = id;
	*/

}

	function swapCheckBox( field_name )
	{
		if( document.getElementById( field_name ).checked == true )
			document.getElementById( field_name ).checked = false;
		else
			document.getElementById( field_name ).checked = true;
	}

	/*
	* multiply
	* 42
	& 120
	* 2
	* 0
	* 6
	*/

 function popupDhcp( cid, oid )
 {
		windowFeatures = 'toolbar=no, directories=no, location=no, menubar=no,status=no, height=400, width=500,scrollbars=yes';
		window.open( '/index/private/dsl/dhcp?popup&oid=' + oid + '&cid=' + cid , 'DHCP_Log', windowFeatures );
}

 function popupPortcheck( cid, oid )
 {
		windowFeatures = 'toolbar=no, directories=no, location=no, menubar=no,status=no, height=420, width=340';
		window.open( '/index/private/dsl/portcheck?popup&oid=' + oid + '&cid=' + cid , 'Portcheck', windowFeatures );
}

function popupRecordEdit( recordID, recordType, orderID, customerID )
{
	windowFeatures = 'toolbar=no, directories=no, location=no, menubar=no,status=no, height=300, width=470';
	window.open( '/index/private/domain/edit?popup&cid=' + customerID + '&oid=' + orderID + '&rid=' + recordID + '&rtype=' + recordType, 'Record_Eigenschappen', windowFeatures );
}

function popupRecordDelete( recordID, recordType, orderID, customerID )
{
	windowFeatures = 'toolbar=no, directories=no, location=no, menubar=no,status=no, height=300, width=470';
	window.open( '/index/private/domain/delete?popup&cid=' + customerID + '&oid=' + orderID + '&rid=' + recordID + '&rtype=' + recordType, 'Record_Eigenschappen', windowFeatures );
}

function popupMailboxEdit( recordID, orderID, customerID )
{
		windowFeatures = 'toolbar=no, directories=no, location=no, menubar=no,status=no, height=800, width=440';
		window.open( '/index/private/email/mailbox?popup&cid=' + customerID +'&oid=' + orderID + '&mid=' + recordID,  'Mailbox_Eigenschappen', windowFeatures );
}

function popupMailboxDelete( recordID, orderID, customerID )
{
	windowFeatures = 'toolbar=no, directories=no, location=no, menubar=no,status=no, height=800, width=440';
	window.open( '/index/private/email/mailbox_delete?popup&cid=' + customerID +'&oid=' + orderID + '&mid=' + recordID,  'Mailbox_Verwijderen', windowFeatures );
}

function popupAliasEdit( aliasID, orderID, customerID )
{
	windowFeatures = 'toolbar=no, directories=no, location=no, menubar=no,status=no, height=400, width=440';
	window.open( '/index/private/email/alias?popup&cid=' + customerID + '&oid=' + orderID + '&aid=' + aliasID,  'Alias_Eigenschappen', windowFeatures );
}

function popupAliasDelete( aliasID, orderID, customerID )
{
	windowFeatures = 'toolbar=no, directories=no, location=no, menubar=no,status=no, height=400, width=440';
	window.open( '/index/myspeedxs/email/alias_delete?popup&cid=' + customerID +'&oid=' + orderID + '&aid=' + aliasID,  'Alias_Eigenschappen', windowFeatures );
}

//
// New stuff
//

function popupGuide( guideID )
{
	windowFeatures = 'toolbar=no, directories=no, location=no, menubar=no,status=no, height=500, width=740';
	window.open( '/index/support/guideview?popup&id=' + guideID, 'Guide_View', windowFeatures );
}

function popupPaymentPhone( packageID )
{
	windowFeatures = 'toolbar=no, directories=no, location=no, menubar=no,status=no,scrollbars=yes, height=486, width=382';
	window.open( 'http://mollie.services.speedxs.nl/transaction.php?req=' + packageID, 'Aanvragen', windowFeatures );
}

function adslDhcpLog( orderID )
{
	orderID = encodeURIComponent( orderID );

	windowFeatures = 'toolbar=no, directories=no, location=no, menubar=no,status=no, height=400, width=700,scrollbars=yes';
	window.open( '/index/myspeedxs/adsl/dhcp?popup&id=' + orderID, 'DHCP_Log', windowFeatures );
}

function reverseHostname( orderID, ipAddress )
{
	 orderID = encodeURIComponent( orderID );
	 ipAddress = encodeURIComponent( ipAddress );


	windowFeatures = 'toolbar=no, directories=no, location=no, menubar=no,status=no, height=320, width=382';
	window.open( '/index/myspeedxs/adsl/hostname?popup&id=' +  orderID + '&ip4=' + ipAddress , 'Hostnaam', windowFeatures );
}

