// Copyright 2007 ShopSite, Inc. All Rights Reserved.

// Random Order list of Partners
function sort_partners(partnertype) {
  var thistype = partnertype;
  var mypartners = new Array();
  
  // Add the partners to the array
  if (thistype == "hostingpartners") {
    mypartners[0] = "verio";
    mypartners[1] = "bizland";
    mypartners[2] = "lexiconn";
    mypartners[3] = "yourhost";
    mypartners[4] = "pair";
//    mypartners[5] = "broadspire";
  }
  else if (thistype == "paymentpartners") {
    mypartners[0] = "paypal";
    mypartners[1] = "google_checkout";
  }
  else if (thistype == "livestores") {
    mypartners[0] = "cableorg";
/* Replaced with Maidenform
    mypartners[1] = "bensherman"; */
    mypartners[1] = "maidenform";
    mypartners[2] = "aviadirect";
    mypartners[3] = "kitchenshop";
    mypartners[4] = "gettytrust";
  }
  else {
    document.write('fail: ' + thistype);
  }
  
  
  var i = 0;
  while ( i < mypartners.length) {
    var rand = Math.round(Math.random()*(mypartners.length - 1));
    if (mypartners[rand]!="done") {
      //document.write(rand);
      print_partners(mypartners[rand]);
      mypartners[rand]="done";
      i ++;
    }
  }  
}

// Display a single random partner
function random_partners(partnertype) {
  var thistype = partnertype;
  var mypartners = new Array();
  
  // Add the partners to the array
  if (thistype == "imghostpartners") {
    mypartners[0] = "imgverio";
    mypartners[1] = "imgbizland";
    mypartners[2] = "imglexiconn";
    mypartners[3] = "imgyourhost";
    mypartners[4] = "imgpair";
//    mypartners[5] = "imgbroadspire";
  }
  else if (thistype == "imglivestores") {
    mypartners[0] = "imgcableorg";
/* Replaced with Maidenform
    mypartners[1] = "imgbensherman"; */
    mypartners[1] = "imgmaidenform";
    mypartners[2] = "imgaviadirect";
    mypartners[3] = "imgkitchenshop";
    mypartners[4] = "imggettytrust";
  }
  else if (thistype == "marketpartners") {
    mypartners[0] = "buysafe";
    mypartners[1] = "doba";
  }
  else {
    document.write('fail: ' + thistype);
  }

  var rand = Math.round(Math.random()*(mypartners.length - 1));
  if (mypartners[rand] == undefined) {
    document.write("stupid");
  }
  else {
    print_partners(mypartners[rand]);
  }
}

function print_partners(thispartner) {
  // Hosting Partners
  if (thispartner == 'verio') {
    document.write('<li><a href="http://www.verio.com/ecommerce-hosting-solutions/" target="_blank">');
    document.write('Verio');
    document.write('</a></li>');
  }
  else if (thispartner == 'bizland') {
    document.write('<li><a href="http://www.bizland.com/bizland/ecommerce-services.bml" target="_blank">');
    document.write('BizLand');
    document.write('</a></li>');
  }
  else if (thispartner == 'lexiconn') {
    document.write('<li><a href="http://www.lexiconn.com/ecommerce/shopsite/index.html" target="_blank">');
    document.write('lexiconn');
    document.write('</a></li>');
  }
  else if (thispartner == 'yourhost') {
    document.write('<li><a href="http://www.yourhost.com/shopsite/index.html" target="_blank">');
    document.write('YourHost');
    document.write('</a></li>');
  }
  else if (thispartner == 'pair') {
    document.write('<li><a href="http://www.pair.com/services/e-commerce/shopping_carts/" target="_blank">');
    document.write('pair&nbsp;Networks');
    document.write('</a></li>');
  }
/*  else if (thispartner == 'broadspire') {
    document.write('<li><a href="http://www.broadspire.com/smallbusiness/ecommercehosting" target="_blank">');
    document.write('BroadSpire');
    document.write('</a></li>');
  } */
  
  // Payment Partners
  else if (thispartner == 'paypal') {
    document.write('<td><a href="paypal.html">');
    document.write('<img src="http://shopsite.com/banner08media/logo_paypal.png" alt="PayPal">');
    document.write('</a></td>');
  }
  else if (thispartner == 'google_checkout') {
    document.write('<td><a href="google.html">');
    document.write('<img src="http://shopsite.com/banner08media/logo_google_checkout.png" alt="Google Checkout">');
    document.write('</a></td>');
  }
  
  // Marketing Partners
  else if (thispartner == 'buysafe') {
    document.write('<td><a href="buysafe.html">');
    document.write('<img src="http://shopsite.com/banner08media/logo_buysafe.png" alt="buysafe">');
    document.write('</a></td>');
  }
  else if (thispartner == 'doba') {
    document.write('<td><a href="doba.html" target="_blank">');
    document.write('<img src="http://shopsite.com/banner08media/logo_doba.png" alt="Doba drop shipping">');
    document.write('</a></td>');
  }

  // Hosting Partner Images
  else if (thispartner == 'imgverio') {
    document.write('<img src="http://shopsite.com/banner08media/logo_verio.png" alt="Verio">');
  }
  else if (thispartner == 'imgbizland') {
    document.write('<img src="http://shopsite.com/banner08media/logo_bizland.png" alt="BizLand">');
  }
  else if (thispartner == 'imglexiconn') {
    document.write('<img src="http://shopsite.com/banner08media/logo_lexiconn.png" alt="lexiconn">');
  }
  else if (thispartner == 'imgyourhost') {
    document.write('<img src="http://shopsite.com/banner08media/logo_yourhost.png" alt="YourHost">');
  }
  else if (thispartner == 'imgpair') {
    document.write('<img src="http://shopsite.com/banner08media/logo_pair.png" alt="pair Networks">');
  }
/*  else if (thispartner == 'imgbroadspire') {
    document.write('<img src="http://shopsite.com/banner08media/logo_broadspire.png" alt="BroadSpire">');
  } */
  
  // Live Stores
  else if (thispartner == 'cableorg') {
    document.write('<li><a href="http://www.cableorganizer.com/" target="_blank">');
    document.write('Cable Organizer');
    document.write('</a></li>');
  }
/* Replaced with Maidenform
  else if (thispartner == 'bensherman') {
    document.write('<li><a href="http://www.benshermanusa.com/shop/index.php" target="_blank">');
    document.write('Ben Sherman');
    document.write('</a></li>');
  } */
  else if (thispartner == 'maidenform') {
    document.write('<li><a href="http://www.maidenform.co.uk/" target="_blank">');
    document.write('Maidenform UK');
    document.write('</a></li>');
  }
  else if (thispartner == 'aviadirect') {
    document.write('<li><a href="http://www.aviadirect.com/" target="_blank">');
    document.write('Avia Direct');
    document.write('</a></li>');
  }
  else if (thispartner == 'kitchenshop') {
    document.write('<li><a href="http://kitchenshop.com/" target="_blank">');
    document.write('Kitchen Shop');
    document.write('</a></li>');
  }
  else if (thispartner == 'gettytrust') {
    document.write('<li><a href="http://www.getty.edu/bookstore/" target="_blank">');
    document.write('Getty Trust Foundation');
    document.write('</a></li>');
  }
  
  // Screenshot Images
  else if (thispartner == 'imgcableorg') {
    document.write('<img src="http://shopsite.com/banner08media/screenshot_cableorganizer.png" alt="www.cableorganizer.com">');
  }
/* Replaced with Maidenform
  else if (thispartner == 'imgbensherman') {
    document.write('<img src="http://shopsite.com/banner08media/screenshot_bensherman.png" alt="http://www.benshermanusa.com/shop">');
  } */
  else if (thispartner == 'imgmaidenform') {
    document.write('<img src="http://shopsite.com/banner08media/screenshot_maidenform.png" alt="www.maidenform.co.uk">');
  }
  else if (thispartner == 'imgaviadirect') {
    document.write('<img src="http://shopsite.com/banner08media/screenshot_aviadirect.png" alt="www.aviadirect.com">');
  }
  else if (thispartner == 'imgkitchenshop') {
    document.write('<img src="http://shopsite.com/banner08media/screenshot_kitchenshop.png" alt="www.kitchenshop.com">');
  }
  else if (thispartner == 'imggettytrust') {
    document.write('<img src="http://shopsite.com/banner08media/screenshot_gettytrust.png" alt="www.getty.edu/bookstore">');
  }
  
  // Failure Test
  else {
    document.write('No Partner');
  }
}



