
EMX_BASE_PATH = 'http://www.aspiderplatform.com/emx/syndicator/js/';

// Display variables

emxCols = 1;
emxRows = 10;
emxNoPaging = 0;
emxShowPos = 0;
emxTitleOnly = 0;
emxMaxRows = '';

// Popup variables
emxLanguageId = 31;

function emxGetParameter( strParamName, strDefault )
   {
   var s = new String( document.location );
   var intStart  = s.indexOf ( strParamName );   
   if (intStart != -1)
      {
      s = s.substring ( intStart );
      intStart = s.indexOf( '=' );
      s = s.substring( intStart+1 );
      intEnd = s.indexOf( '&' );
      if (intEnd == -1)
         {
         intEnd = s.length;
         }
      s = s.replace( /\+/g, ' ' );
      var s = unescape( s.substring( 0, intEnd ) );
      }
   else
      {
      s = strDefault
      }
   return s;
   }
   
function emxListSubcategories( p_intCategoryId )
   {   
   intSelectedSubcat = emxGetParameter( 'emxSubcat', -1 );
   strUrl = EMX_BASE_PATH + 'list_subcat.aspx?emxCat=' + p_intCategoryId + '&emxSubcat=' + intSelectedSubcat + '&emxGroup=' + emxGroup;   
   if ( emxGetParameter( 'emxDebug', 0 ) != 0 )
      {
      document.writeln( strUrl + '<BR><BR>' );
      }
   else
      {
      document.writeln( '<SCRIPT LANGUAGE="JavaScript" SRC="' + strUrl + '">' + '</SCRIPT>' );
      }   
   }

   
function emxListItems( p_intSubcategoryId, p_intCategoryId )
   {
   
   intSelectedSubcat = emxGetParameter( 'emxSubcat', p_intSubcategoryId );
   //emxNoPaging = emxGetParameter( 'emxNoPaging', emxNoPaging );
   //emxShowPos = emxGetParameter( 'emxShowPos', emxShowPos );
   //emxTitleOnly = emxGetParameter( 'emxTitleOnly', emxTitleOnly );   
   intPage = 1
   if ( emxGetParameter( 'emxGroup', -1 ) == emxGroup ) {   
      intPage = emxGetParameter( 'emxPage', 1 );
      }
   if ( emxGetParameter( 'emxGroup', -1 ) != emxGroup ) {
      intSelectedSubcat = p_intSubcategoryId;       
      }

   if ( p_intCategoryId == 'new' )
      {
      strUrl = EMX_BASE_PATH + 'list_items.aspx?emxListType=new&emxPropertyId=' + p_intSubcategoryId + '&emxGroup=' + emxGroup + '&emxCols=' + emxCols + '&emxPage=' + intPage + '&emxRows=' + emxRows + '&emxNoPaging=' + emxNoPaging + '&emxShowPos=' + emxShowPos + '&emxTitleOnly=' + emxTitleOnly;
      }
   else if ( p_intCategoryId == 'top' )
      {
      strUrl = EMX_BASE_PATH + 'list_items.aspx?emxListType=top&emxPropertyId=' + p_intSubcategoryId + '&emxGroup=' + emxGroup + '&emxCols=' + emxCols + '&emxPage=' + intPage + '&emxRows=' + emxRows + '&emxNoPaging=' + emxNoPaging + '&emxShowPos=' + emxShowPos + '&emxTitleOnly=' + emxTitleOnly;
      }   
   else if ( p_intSubcategoryId != -1 )
      {
      strUrl = EMX_BASE_PATH + 'list_items.aspx?emxSubcat=' + intSelectedSubcat + '&emxGroup=' + emxGroup + '&emxCols=' + emxCols + '&emxPage=' + intPage + '&emxRows=' + emxRows + '&emxNoPaging=' + emxNoPaging + '&emxShowPos=' + emxShowPos + '&emxTitleOnly=' + emxTitleOnly;
      }
   else
      {
      strUrl = EMX_BASE_PATH + 'list_items.aspx?emxSubcat=-1&emxCat=' + p_intCategoryId + '&emxGroup=' + emxGroup + '&emxCols=' + emxCols + '&emxPage=' + intPage + '&emxRows=' + emxRows + '&emxNoPaging=' + emxNoPaging + '&emxShowPos=' + emxShowPos + '&emxTitleOnly=' + emxTitleOnly;
      }
   if ( emxMaxRows != '' )
      {
      strUrl = strUrl + '&emxMaxRows=' + emxMaxRows;
      }
      
   strUrl = strUrl + '&emxAccountId=' + emxAccountId;
      
   if ( emxGetParameter( 'emxDebug', 0 ) != 0 )
      {
      document.writeln( strUrl + '<BR><BR>' );   
      }
   else
      {
      document.writeln( '<SCRIPT LANGUAGE="JavaScript" SRC="' + strUrl + '">' + '</SCRIPT>' );
      }
   }

   
function emxPopup( p_intItemId )
    {
    PopupWindow( EMX_BASE_PATH + 'popup.aspx?LanguageId=' + emxLanguageId + '&AccountId=' + emxAccountId + '&ItemId=' + p_intItemId + '&Skin=' + emxPopupSkin + '&Style=' + emxPopupStyle, 400, 300 )
    }


function PopupWindow( p_strUrl, p_intWidth, p_intHeight )
    {

    if (document.all || document.layers)
        {
        var w = screen.availWidth;
        var h = screen.availHeight;
        }

    var leftPos = (w-p_intWidth)/2
    var topPos = (h-p_intHeight)/2;

    emxPopupWin = window.open( p_strUrl,'emxPopupWin','width=' + p_intWidth + ',height=' + p_intHeight + ',top=' + topPos + ',left=' + leftPos +", toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
    emxPopupWin.focus()

    }

function emxListDevices( p_bitRelevant )
   {   
   strUrl = EMX_BASE_PATH + 'list_devices.asp?emxRelevant=' + p_bitRelevant;
   if ( emxGetParameter( 'emxDebug', 0 ) != 0 )
      {
      document.writeln( strUrl + '<BR><BR>' );
      }
   else
      {
      document.writeln( '<SCRIPT LANGUAGE="JavaScript" SRC="' + strUrl + '">' + '</SCRIPT>' );
      }   
   }

function emxListDevicesByProperty( p_intPropertyId, p_bitRelevant )
   {   
   strUrl = EMX_BASE_PATH + 'list_devices.asp?emxProperty=' + p_intPropertyId + '&emxRelevant=' + p_bitRelevant
   if ( emxGetParameter( 'emxDebug', 0 ) != 0 )
      {
      document.writeln( strUrl + '<BR><BR>' );
      }
   else
      {
      document.writeln( '<SCRIPT LANGUAGE="JavaScript" SRC="' + strUrl + '">' + '</SCRIPT>' );
      }   
   }

function emxListDevicesByManufacturer( p_intManufacturer, p_bitRelevant )
   {   
   strUrl = EMX_BASE_PATH + 'list_devices.asp?emxManufacturer=' + p_intPropertyId + '&emxRelevant=' + p_bitRelevant;
   if ( emxGetParameter( 'emxDebug', 0 ) != 0 )
      {
      document.writeln( strUrl + '<BR><BR>' );
      }
   else
      {
      document.writeln( '<SCRIPT LANGUAGE="JavaScript" SRC="' + strUrl + '">' + '</SCRIPT>' );
      }   
   }

