
//Just a useful little javascript function which will get a URL parameter 
//and return it to you. For example if the current URL is 
//"...?opendocument&id=testid" then calling getURLParam("id") will 
//return "testid".
function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if (
aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return strReturn;
}

function getIndexBasedOnPlink (plink)
{
  for (i=0;i<splashimage_url.length;i++)
  {
    if (splashimage_url[i].indexOf(plink)!=-1) {return i;}
  }
  return -1;
}

function randomizearray() {

        var i = splashimage_url.length;
        while(i--){
                var j = Math.floor(Math.random() * ( i + 1 ));
                var splashimage_url_tempi = splashimage_url[i];
                var splashimage_url_tempj = splashimage_url[j];
                splashimage_url[i] = splashimage_url_tempj;
                splashimage_url[j] = splashimage_url_tempi;
                var bigsplashimage_image_tempi = bigsplashimage_image[i];
                var bigsplashimage_image_tempj = bigsplashimage_image[j];
                bigsplashimage_image[i] = bigsplashimage_image_tempj;
                bigsplashimage_image[j] = bigsplashimage_image_tempi;
                var smallsplashimage_image_tempi = smallsplashimage_image[i];
                var smallsplashimage_image_tempj = smallsplashimage_image[j];
                smallsplashimage_image[i] = smallsplashimage_image_tempj;
                smallsplashimage_image[j] = smallsplashimage_image_tempi;
        }
}

function two_roads () // either ie or other browser
{
     if (index=getIndexBasedOnPlink (getURLParam("plink")))
     {
        document.write('<div id="random-large"><a href="' +splashimage_url[index]+ '" id="largelink"><img src="' +bigsplashimage_image[index]+ '" width="400" height="223" alt="" id="largesplashimage" /></a></div><div id="random-comment"><a href="' +splashimage_url[index]+ '" id="smalllink"><img src="'+img_comment_url+'" width="300" height="130" alt="" id="smallsplashimage" /></a><div id="comment_comment"><a href="' +splashimage_url[index]+ '">' +smallsplashimage_image[index]+ '</a></div></div>');
        return 1; // STOP THE SCRIPT HERE IF SPECIFIC URL
     }



  /* not sure why we need this :P */
  if(navigator.appVersion.indexOf("Win")>=0 && parseFloat(navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE ")+5), 10)>=4){
          for(rtt_sc_nLoop=0;rtt_sc_nLoop<30;rtt_sc_nLoop++){
                  rtt_sc_aImagesLarge[rtt_sc_nLoop] = new Image();
                  rtt_sc_aImagesLarge[rtt_sc_nLoop].src = bigsplashimage_image[rtt_sc_nLoop];
                  rtt_sc_aImagesSmall[rtt_sc_nLoop] = new Image();
                  rtt_sc_aImagesSmall[rtt_sc_nLoop].src = smallsplashimage_image[rtt_sc_nLoop];
          }
          document.write('<div id="random-large"><a href="' +splashimage_url[rtt_sc_iBan]+ '" id="largelink"><img src="' +bigsplashimage_image[rtt_sc_iBan]+ '" width="400" height="223" alt="" id="largesplashimage" /></a></div><div id="random-comment"><a href="' +splashimage_url[rtt_sc_iBan]+ '" id="smalllink"><img src="'+img_comment_url+'" width="300" height="130" alt="" id="smallsplashimage" /></a><div id="comment_comment"><a href="' +splashimage_url[rtt_sc_iBan]+ '">' +smallsplashimage_image[rtt_sc_iBan]+ '</a></div></div>');
          ourtimer = window.setTimeout('displaysplashes();', timeout);
  }
  else
  {
    index = Math.floor(Math.random() * splashimage_url.length);
    images = '<div id="random-large"><a href="'+splashimage_url[index]+'"><img src="'+bigsplashimage_image[index]+'" width"400" height="223" alt="" /></a></div><div id="random-comment"><a href="'+splashimage_url[index]+'"><img src="'+img_comment_url+'" width="300" height="130" alt="" /></a><div id="comment_comment"><a href="'+splashimage_url[index]+'">'+smallsplashimage_image[index]+'</a></div></div>';
    document.write(images);
    ourtimer = window.setTimeout('displaysplashes_notIE();', timeout);
  }
}

// if we don't have IE then we can't do the nice fade trick with the image
// we still have to change the image in some other browser
function displaysplashes_notIE()
{
  if (splashimage_url.length==counter)
  {
    counter = 0;
  }

  var img_bigsplash = document.getElementById('random-large').getElementsByTagName('img');
  var img_comment = document.getElementById('random-comment').getElementsByTagName('img');
  var url_img_bigsplash = document.getElementById('random-large').getElementsByTagName('a');
  var url_img_comment = document.getElementById('random-comment').getElementsByTagName('a');

  url_img_bigsplash[0].href = splashimage_url[counter];
  url_img_comment[0].href = splashimage_url[counter];
  img_bigsplash[0].src = bigsplashimage_image[counter];
  img_comment[0].src = img_comment_url;
  document.getElementById("comment_comment").innerHTML = '<a href="'+splashimage_url[counter]+'">'+smallsplashimage_image[counter]+'</a>';

  counter++;  
  ourtimer = window.setTimeout('displaysplashes_notIE();', timeout);
}

function displaysplashes(){
        rtt_sc_iBan++;

        if(rtt_sc_iBan >= splashimage_url.length){rtt_sc_iBan=0;}
        if(!rtt_sc_aImagesLarge[rtt_sc_iBan].complete){ourtimer = window.setTimeout('rtt_sc_DisplaySM1();', 1000);rtt_sc_iBan--;return;}
        if(navigator.userAgent.indexOf("MSIE 4.0") > 1){
                largesplashimage.style.filter = 'revealTrans(transition=7,duration=2)';
                smallsplashimage.style.filter = 'revealTrans(transition=7,duration=2)';
        } else {
//              largesplashimage.style.filter = 'progid:DXImageTransform.Microsoft.Fade(Duration=2)';
                largesplashimage.style.filter = 'progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=1.00,wipestyle=0,motion=reverse)';
                smallsplashimage.style.filter = 'progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=1.00,wipestyle=0,motion=reverse)';
        }

        largesplashimage.filters[0].Apply();
        largesplashimage.style.display = 'block';
        largesplashimage.filters[0].Play();
        largesplashimage.src = rtt_sc_aImagesLarge[rtt_sc_iBan].src;
        largelink.href = splashimage_url[rtt_sc_iBan];

        smallsplashimage.filters[0].Apply();
        smallsplashimage.style.display = 'block';
        smallsplashimage.filters[0].Play();
        smallsplashimage.src = img_comment_url;
        smalllink.href = splashimage_url[rtt_sc_iBan];
        document.getElementById("comment_comment").innerHTML = '<a href="'+splashimage_url[rtt_sc_iBan]+'">'+smallsplashimage_image[rtt_sc_iBan]+'</a>';
       
    
        ourtimer = window.setTimeout('displaysplashes();', timeout);
}