///////////////////////////
// SMALL ADVERTS GO HERE //
///////////////////////////
urls = new Array(
  "http://www.chaletfinder.co.uk",    
  "http://www.findmeavilla.com",      
  "http://www.clickgamer.com",        
  "history_cranford_walk.htm",        // Cranford Walk Ad
  "heritagecentre.htm",               // Heritage Centre
  "archaeology/index.htm",          // Archaeology Ad
  "rhs/index.htm",                      // rhs 2001 flower show
  "http://www.thehungersite.com",       // hungersite

  "h"http://www.waresofknutsford.co.uk",  // wares
  "ettp://www.cosrecruitment.co.uk",    // cos
//  eatingout/index.htm" // eatingout
)
pix=new Array(
  "1_chaletfinder.gif",       // Chaletfinder
  "1_findmeavilla.gif",       // Findmeavilla
  "1_clickgamer.gif",       // Clickgamer
  "ad_cranford_walk_small.gif",       // Cranford Walk
  "ad_heritage_centre_small.gif",     // Heritage Centre
  "ad_archaeology_small.gif",         // Archaeology Ad
  "ad_rhs_flower_show_small.gif",     // rhs 2001 flower show
  "ad_hungersite_small.gif",          // hungersite

  "ad_cos_small.gif",                 // cos
//  "ad_wares_small_anim.gif",          // wares
  "ad_eatingout_small.gif" // eating out
)
targ=new Array(
  "_blank",  // Chaletfinder
  "_blank",  // Findmeavilla
  "_blank",  // Clickgamer
  "main",    // Cranford Walk
  "main",    // Heritage Centre
  "_parent",    // Archaeology Ad
  "main",    // rhs 2001 flower show
  "_blank",  // hungersite

  "_blank",  // cos
//  "_blank",  // wares
  "main"  // eatingout
)
type=new Array(
  "still",   // Chaletfinder
  "still",   // Findmeavilla
  "anim",   // Clickgamer
  "still",   // Cranford Walk
  "still",   // Heritage Centre
  "still",   // Archaeology Ad
  "anim",    // rhs 2001 flower show
  "still",   // hungersite

  "anim",    // cos
//  "anim",    // wares
  "still"   // eating out
)
alts=new Array(
  "Chaletfinder.com No.1 for Ski Holidays!",                 // Chaletfinder
  "Findmeavilla.com No.1 for Villa Holidays",                 // Findmeavilla
  "Clickgamer.com games for your mobile",                 // Clickgamer
  "check out the Cranford Guided Tour!",                 // Cranford Walk Ad
  "All about Knutsfords Heritage...",                    // Heritage Centre
  "Druids in Knutsford?",                          // Archaeology Ad
  "Click here to see images from the RHS show",          // rhs 2001 flower show
  "click here to donate free food",                      // hungersite
  
  "COS Recruitment - visit us for the best jobs",        // cos
//  "buy traditional kitchen and household goods from Wares Of Knutsford",  // wares
  "eating out reviews for Knutsford" // eatingout
)
wide=new Array(
  "140",  // Chaletfinder
  "140",  // Findmeavilla
  "125",  // Clickgamer
  "140",  // Cranford Walk Ad
  "140",  // Heritage Centre
  "140",  // Archaeology Ad
  "140",  // rhs 2001 flower show
  "140",  // hungersite

  "140",  // cos
//  "140",  // wares
  "140"  // eating out
)
high=new Array(
  "70",  // Chaletfinder
  "70",  // Findmeavilla
  "125",  // Clickgamer
  "60",  // Cranford Walk Ad
  "60",  // Heritage Centre
  "60",  // Archaeology Ad
  "60",  // rhs 2001 flower show
  "60",  // hungersite

  "60",  // cos
//  "60",  // wares
  "60"  // eating out
)


array_sel_banner_nos = new Array;

function RandomSmallAdvert(p_banners_req, p_dir_modifier) 
{
// OLD RANDOMISER
// random = Math.round(Math.random()*(urls.length-1))

 var banners_got_so_far = 0;

 // Make it random whether the initial banner is ANIM or STILL
 if ((Math.round((1)*Math.random())+1)==1)
    next_req_type = "anim";
 else
    next_req_type = "still";

 
 if ((!p_dir_modifier) || (p_dir_modifier == null) || (p_dir_modifier == ''))
   p_dir_modifier = '';


 if ((!p_banners_req) || (p_banners_req == null) || (p_banners_req == 0))
   p_banners_req = 1;



 if (p_banners_req > (pix.length))
   document.write('Error, '+p_banners_req+' banners requested. '+(pix.length)+' available');
 else {
   do {
     next_banner_num = Math.round(Math.random()*(pix.length-1))
     skip_this_banner = false;

     if (type[next_banner_num] != next_req_type)
        skip_this_banner = true;
     else {
        if (array_sel_banner_nos.length > 0) {
           for (var l=0; l < array_sel_banner_nos.length; l++) {
               if (array_sel_banner_nos[l] == next_banner_num) {
                   skip_this_banner = true; break;
               }
           }
        }
     }

     if (!skip_this_banner) {
       array_sel_banner_nos[banners_got_so_far++] = next_banner_num;
       if (next_req_type == "anim")
          next_req_type = "still"
       else
          next_req_type = "anim"
     }
   } while (banners_got_so_far < p_banners_req);


   for (var l=0; l < array_sel_banner_nos.length; l++) {
      // this is the index to use: "array_sel_banner_nos[l]"

      if (urls[array_sel_banner_nos[l]] == 'NO_LINK')
      {
        document.write('<IMG BORDER="0" SRC="'+p_dir_modifier+'images/adverts_random_small/' +
                        pix[array_sel_banner_nos[l]] +
                       '" WIDTH="'  + wide[array_sel_banner_nos[l]] +
                       '" HEIGHT="' + high[array_sel_banner_nos[l]] +
                       '" ALT="'    + alts[array_sel_banner_nos[l]] +
                       '">');
        document.write('<br><br>');
      }
      else
      {
        document.write('<A HREF="'+p_dir_modifier+'imgtarget.php?type=banner&img='+pix[array_sel_banner_nos[l]]+'&url='+urls[array_sel_banner_nos[l]]+
                       '" TARGET="'+targ[array_sel_banner_nos[l]]+'">');
        document.write('<IMG BORDER="0" SRC="'+p_dir_modifier+'images/adverts_random_small/' +
                       pix[array_sel_banner_nos[l]] +
                       '" WIDTH="'  + wide[array_sel_banner_nos[l]] +
                       '" HEIGHT="' + high[array_sel_banner_nos[l]] +
                       '" ALT="'    + alts[array_sel_banner_nos[l]] +
                       '">');
        document.writeln('</A>');

        // write out a double break (only if NOT the last banner)
        if (l != ((array_sel_banner_nos.length)-1))
          document.write('<br><br>');

      } 

    } // end document.write

  } // end is there enough banners?

} // end RandomSmallAdvert


///////////////////////////
// LARGE ADVERTS GO HERE //
///////////////////////////
urls_large = new Array(
  "whatson_cinema.htm",                             // See stars - Studio Cinema
  "mappage.htm",                                    // Town Map (We've got Knutsford Town Covered)
  "http://www.amazon.co.uk/exec/obidos/redirect-home?tag=wwwvirtuaknutsfc&site=dvd",  // Amazon
  "services.htm?cat=services_CAT_fashion.htm",        // Bottega Ad
  "services.htm?cat=services_CAT_webdesign.htm",      // Avoid the .con
  "whatson_clubssocs.htm",                            // Squash Club
  "http://www.amazon.co.uk/exec/obidos/ASIN/189794957X/wwwvirtuaknutsfc", // Mark Olly
  "http://www.linkdragon.com",                        // linkdragon
  "http://www.virtualbuxton.co.uk",                   // vbuxton
  "http%3A%2F%2Ftracker.tradedoubler.com%2Ftracker.asp%3Fcode%3D215465%26URL%3Dhttp%3A%2F%2Fwww.waterstones.co.uk%2Fcgi-bin%2Fwat01prd.storefront%2F0%2FUserTemplate%2F12%3Fsource%3DTD", // waterstones
  "http://www.travel2florida.co.uk",                  // travel2florida
//  "services.htm?cat=services_CAT_gifts.htm",          // wares
  "services.htm?cat=services_CAT_webdesign.htm",      // web design happy ending
  "services.htm?cat=services_CAT_confectionery.htm",  // cromwells chocs
  "http://www.theukexperience.com",                   // ukexperience.com
  "http://www.cambridge-tutors.co.uk"                 // Cambridge Tutors Ad
)
pix_large =new Array(
  "ad_cinema_expect_unexpected.gif",   // Studio Cinema - expected unexpected
  "ad_townmap_large.gif",        // Town Map (We've got Knutsford Town Covered)
  "ad_amazon_dvdpromo_anim_large.gif",    // Amazon dvd
  "ad_bottega_large.gif",        // Bottega Ad
  "ad_avoid_dot_con_large.gif",  // Avoid the .con
  "ad_squash_club_large.gif",    // Squash Club
  "ad_mark_olly_large.jpg",      // Mark Olly Book Ad
  "advert_linkdragon_large.gif", // linkdragon
  "ad_virtualbuxton_large.gif",  // virtual buxton
  "ad_waterstones_large.gif",    // waterstones
  "ad_travel2florida_large.gif", // travel2florida
//  "ad_waresofknutsford_large.gif",   // wares of knutsford
  "ad_web_design_happy_ending.gif",  // web design happy ending
  "ad_cromwells_large.gif",      // cromwells chocs
  "ad_uk_experience.gif",        // ukexperience.com
  "ad_cambridgetutor_large.gif"  // Cambridge Tutors Ad
)
targ_large =new Array(
  "main",    // Studio Cinema - expected unexpected
  "main",    // Town Map (We've got Knutsford Town Covered)
  "_blank",  // Amazon dvd Ad
  "main",    // Bottega
  "main",    // Avoid the .con
  "main",    // Squash Club
  "_blank",  // Mark Olly Go to Amazon Book Ad
  "_blank",  // linkdragon
  "_blank",  // virtual buxton
  "_blank",  // waterstones
  "_blank",  // travel2florida
//  "main",    // wares of knutsford
  "main",    // web design happy ending
  "main",    // cromwells chocs
  "_blank",  // ukexperience.com
  "_blank"   // Cambridge Tutors Ad
)
alts_large =new Array(
  "Studio Cinema Knutsford - click here",                      // Studio Cinema - expected unexpected
  "find shops and restaurants at a glance...",                 // Town Map
  "save big on DVD titles at www.amazon.co.uk",                // Amazon Ad
  "clothing for the woman of today",                           // Bottega Ad
  "dynamic web sites for your business",                       // Avoid the .con
  "call Raymond Dragonetti for details on how to join",        // Squash Club
  "buy Book 2 from Amazon now",                                // Mark Olly Book Ad
  "its FREE and its EASY - click here to try linkdragon now",  // linkdragon
  "check out whats going on in Buxton",                        // virtual buxton
  "Waterstones Online",                                        // waterstones
  "design your own tailormade holiday with travel2florida.co.uk",  // travel2florida
//  "visit wares and discover traditional and modern gifts",     // wares of knutsford
  "call us first for internet services",                       // web design happy ending
  "click for more information",                                // cromwells chocs
  "Travel brochures and websites for holidays in the UK",      // ukexperience.com
  "call now on 0161 233 0188"                                  // Cambridge Tutors Ad
)

function RandomLargeAdvert(p_dir_modifier) {
  random = Math.round(Math.random()*(urls_large.length-1))

  if ((!p_dir_modifier) || (p_dir_modifier == null) || (p_dir_modifier == ''))
    p_dir_modifier = '';


//  document.write('<?php if (!stristr($PATH_TRANSLATED, "/staging/")) {include ("../php/vk.inc"); log_new_vk_banner("'+pix_large[random]+'"); }?>');


  if (urls_large[random] == 'NO_LINK')
  {
    document.write('<IMG BORDER="0" SRC="'+p_dir_modifier+'images/adverts_random_large/'+pix_large[random]+'" WIDTH="468" HEIGHT="60" ALT="'+alts_large[random]+'">');
  }
  else {

    document.write('<A HREF="'+p_dir_modifier+'imgtarget.php?type=banner&img='+pix_large[random]+'&url='+urls_large[random]+'" TARGET="'+targ_large[random]+'">');
    document.write('<IMG BORDER="0" SRC="'+p_dir_modifier+'images/adverts_random_large/'+pix_large[random]+'" WIDTH="468" HEIGHT="60"    ALT="'+alts_large[random]+'">');
    document.writeln('</A>');
  }
}




