﻿// <script>
/******************************************************************************
Name:       getSearchAsArray
Parameters: None.
Return:     new Array() 
            An array of parameters read from the url.
Desc:       Parses the URL looking for parameters that define how the page 
            should display.
******************************************************************************/
function getSearchAsArray() 
{
   // Browser-sniffing variables.
   var minNav3 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 3);
   var minIE4  = (navigator.appName.indexOf("Microsoft") >= 0 && parseInt(navigator.appVersion) >= 4);
   
   // Baseline DOM required for this function
   var minDOM = minNav3 || minIE4 ; 
   
   // Initialize array to be returned.
   var results = new Array();
   
   if (minDOM) 
   {
      // Unescape and strip away leading question mark.
      var input = unescape(location.search.substring(1));
      
      if (input) 
      {
         // Divide long string into array of name/value pairs.
         var srchArray = input.split("&");
         
         var tempArray = new Array();
         
         for (i = 0; i < srchArray.length; i++) 
         {
            // Divide each name/value pair temporarily into a two-entry array.
            tempArray = srchArray[i].split("=");
           
            // Use temp array values as index identifier and value.
            results[tempArray[0]] = tempArray[1];
         }
      }
   }
   
   // return the result array
   return results;
}

/******************************************************************************
Global Variable Name:   srchData
Description:            This is the global result from calling the above 
                        function.
******************************************************************************/
var srchData = getSearchAsArray();

/******************************************************************************
Name:       WriteImage
Parameters: None.
Return:     None.
Desc:       Generate the image for the page
******************************************************************************/
function WriteImage()
{
	if(srchData['content'] == null) {
		document.write("&nbsp;");
	} else {
		document.write("<img src='" + srchData['content'] + ".jpg' border='1' alt=''>");
	}
}

/******************************************************************************
Name:       WriteCaption
Parameters: None.
Return:     None.
Desc:       Generate the caption for the image
******************************************************************************/
function WriteCaption()
{		
   // generate the index
   if(srchData['content'] == null) {                
		document.write("&nbsp;");
	} 
   
   else if(srchData['content'] == "bigair") {
		document.write("Me at the Toyota Big Air 1999 - Sapporo, Japan.");
	} 
   
   else if(srchData['content'] == "bikes") {
		document.write("Yes and No Bikes! - huh?");
	} 

   
   else if(srchData['content'] == "indoor_japan") {
		document.write("Indoor ski hill! - Tokyo, Japan.");
	} 
   
   else if(srchData['content'] == "japan") {
		document.write("Ishi, my judging friend in Tokyo. Gas is way expensive!");
	} 
   
   else if(srchData['content'] == "launchramp") {
		document.write("1986 Lunch Break...");
	} 
   
   else if(srchData['content'] == "palmer") {
		document.write("Me and Palmer - X Games 1999.");
	} 
   
   
   else if(srchData['content'] == "rollin") {
		document.write("Toyota Big Air 1999 - Sapporo, Japan. This is the in run...");
	} 
   
   else if(srchData['content'] == "shop_tokyo") {
		document.write("A snowboard shop in Tokyo, Japan.");
	} 
   
   else if(srchData['content'] == "switzerland1") {
		document.write("Above the tram at Les Diableretes, Switzerland.");
	}
	
	else if(srchData['content'] == "jayolympics") {
		document.write("Me at the Olympics in Salt Lake City, Utah.");
	}
	
	else if(srchData['content'] == "hosoi_and_me") {
		document.write("Me and Hosoi.");
	}
	
	else if(srchData['content'] == "jimtough") {
		document.write("&quot;Do you want me to talk to 'em?&quot;");
	}
	
	else if(srchData['content'] == "rampburried2") {
		document.write("What happened to this ramp?");
	}
	
	else if(srchData['content'] == "rexstep") {
		document.write("Size definitely matters");
	}
	
	else if(srchData['content'] == "wbchalk") {
		document.write("Nice.");
	}
}
