
<!---- The Buick Club of Germany: scripts ----->

	<!-- defining variables to use -->


<!----  picture "look-upper" -------------------->
    // creates picture ref no matter where referring file is
    function PictureRef( imageFile, altTextD, altTextE )
    {
        var picBase = BaseURL( ) + "images/";
        var pictureRef;
		
        // same alt text ?!
		if(( altTextE == "" ) && ( altTextD != "" ))
		    altTextE = altTextD; 

        pictureRef = "<a href='" + ImageRef( imageFile ) + "'>"
		           + "<img src ='" + picBase + ThumbNail( imageFile ) + "' border='0' "
				   + "alt=\"" + ( LanguageIs( '?' ) == 'D' ? altTextD : altTextE ) + "\"></a><br>";

        return ( pictureRef );
    }
	//------------------------------------------------------------------
	// end function PictureRef 				   	  




<!----  image "look-upper" -------------------->
    // creates image ref no matter where referring file is
    function ImageRef( imageFile )
    {
        return( BaseURL( ) + "images/" + imageFile );
    }
	//------------------------------------------------------------------
	// end function ImageRef 				   	  



	
<!---- home page picture ---------------------->
    // display a random title picture
    function TitlePic( )
    {
        var picArray = new Array( );
        var idx4Now;
		
        picArray[ 0] = "Apple Valley CA.jpg";
        picArray[ 1] = "Ashland OR.jpg";
        picArray[ 2] = "Austin MN 1.jpg";
        picArray[ 3] = "Austin MN 2.jpg";
        picArray[ 4] = "Balboa Island CA.jpg";
        picArray[ 5] = "Big Bear Lake CA.jpg";
        picArray[ 6] = "Branson MO.jpg";
        picArray[ 7] = "Burbank CA.jpg";
        picArray[ 8] = "CAN SAS.jpg";
        picArray[ 9] = "Carmel CA.jpg";
        picArray[10] = "Crescent City CA.jpg";
        picArray[11] = "Daytona Beach FL.jpg";
        picArray[12] = "El Monte CA.jpg";
        picArray[13] = "El Reno OK.jpg";
        picArray[14] = "Empire MI.jpg";
        picArray[15] = "Fort Worth TX.jpg";
        picArray[16] = "Ft. Pierce FL.jpg";
        picArray[17] = "Gaylord MI.jpg";
        picArray[18] = "Gillette WY.jpg";
        picArray[19] = "Harlan KY.jpg";
        picArray[20] = "Hyannis MA.jpg";
        picArray[21] = "Jacksonville Beach FL.jpg";
        picArray[22] = "Jacksonville FL.jpg";
        picArray[23] = "Jesup GA.jpg";
        picArray[24] = "Kingsland GA.jpg";
        picArray[25] = "Lake Tahoe CA Squaw Valley.jpg";
        picArray[26] = "Las Vegas NV 1.jpg";
        picArray[27] = "Las Vegas NV 2.jpg";
        picArray[28] = "Mackinac Bridge MI.jpg";
        picArray[29] = "Mackinaw City MI 1.jpg";
        picArray[30] = "Mackinaw City MI 2.jpg";
        picArray[31] = "Mason City IA .jpg";
        picArray[32] = "Milwaukee WI.jpg";
        picArray[33] = "Monarch Pass CO.jpg";
        picArray[34] = "Munising MI.jpg";
        picArray[35] = "Neptune Beach FL.jpg";
        picArray[36] = "New Braunfels TX.jpg";
        picArray[37] = "Ocean City MD.jpg";
        picArray[38] = "Old Orchard Beach ME.jpg";
        picArray[39] = "Petoskey MI.jpg";
        picArray[40] = "Princeton MA.jpg";
        picArray[41] = "Renton WA.jpg";
        picArray[42] = "Rutland VT.jpg";
        picArray[43] = "San Luis Obispo CA.jpg";
        picArray[44] = "Sandusky OH.jpg";
        picArray[45] = "Saugatuck MI.jpg";
        picArray[46] = "Shenandoah National Park VA.jpg";
        picArray[47] = "St Petersburg FL.jpg";
        picArray[48] = "Stateline NV.jpg";
        picArray[49] = "Tacoma WA.jpg";
        picArray[50] = "Worthington MN.jpg";
        picArray[51] = "Yuba City CA.jpg";




        idx4Now = ( Math.round( Math.random( ) * ( picArray.length -1 )));
        document.getElementById("Postkarten").src="images/TitleBuicks/" + picArray[idx4Now]; 
	t=setTimeout("TitlePic()",10000);

	}			
	//------------------------------------------------------------------
	// end function TitlePic 				   	  
		
<!---- horizontal sub menu -------------------->
    // create a sub menu depending on the currently selected page
    function SubMenu( page )
    {

        // get/set current language
		var currentLanguage = LanguageIs( "?" );	
		var text ="<br>";
        // display page / language dependent menus 	 
        switch( page )
        {

            case "Archive":
			//   --------------
		text += SubMenuItem(1, "cntArchiveGallery.php",  	"Galerie",             	"Gallery" );
		text += SubMenuItem(1, "cntArchiveBBB.php",      	"Big Beautiful Buick", 	"Big Beautiful Buick" );
		text += SubMenuItem(0, "cntArchiveNews.php",     	"\"Old News\"",        	"\"Old News\"" );
                break;

            case "Links":
			//   --------------
		text += SubMenuItem(1, "cntHomeLinks.php",          	"Mehr zum Thema Buick",   "More to Buick" );
		text += SubMenuItem(1, "cntLinksBuickclubs.php",    	"Buick Clubs",  	"Buick Clubs" );
		text += SubMenuItem(1, "cntLinksBuickOnTheWeb.php", 	"Buick im WWW", 	"Buick on the WWW" );
		text += SubMenuItem(0, "cntLinksEuroUSCars.php",    	"US Cars",      	"US Cars" );
                break;

            case "Membership":
			//   --------------
		text += SubMenuItem(1, "cntHomeMembership.php",  	"Mitgliedschaft", 	 "Membership" );
		text += SubMenuItem(0, "cntMembershipForm.html",  	"Antragsformular", 	"Application" );
                break;

            case "Fahrzeuge":
			//   ---------------------
		text += SubMenuItem(1, "cntFahrzeuge.php?Year=0", "1900'", "1900-1910" );
		text += SubMenuItem(1, "cntFahrzeuge.php?Year=1", "10'", "10'" );
		text += SubMenuItem(1, "cntFahrzeuge.php?Year=2", "20'", "20'" );
		text += SubMenuItem(1, "cntFahrzeuge.php?Year=3", "30'", "30'" );
		text += SubMenuItem(1, "cntFahrzeuge.php?Year=4", "40'", "40'" );
		text += SubMenuItem(1, "cntFahrzeuge.php?Year=5", "50'", "50'" );
		text += SubMenuItem(1, "cntFahrzeuge.php?Year=6", "60'", "60'" );
		text += SubMenuItem(1, "cntFahrzeuge.php?Year=7", "70'", "70'" );
		text += SubMenuItem(1, "cntFahrzeuge.php?Year=8", "80'", "80'" );
		text += SubMenuItem(0, "cntFahrzeuge.php?Year=9", "90'", "90'" );
                break;

            case "Shopping":
			//   ---------------------
		text += SubMenuItem(1, "cntHomeShopping.html#books",	"Bücher", 		"Books" );
		text += SubMenuItem(1, "cntHomeShopping.html#auctions",	"Auktionen",		"Auctions" );
		text += SubMenuItem(0, "Anzeigen.php",			"Inserate",		"Trading Ads");
                break;

            default:
				// no sub menu
                break;

        } 		// end switch

        // complete and close frame document
		top.frames["menuFrame"].document.getElementById("submenubody").innerHTML = text;
    
	}			
	//------------------------------------------------------------------
	// end function SubMenu 


	
<!----  SubMenu Item    ----------------------->
	function SubMenuItem(separator, sourceFile, textD, textE )
	{
		var textsub = "";
		textsub += "<a class='sub' href='" + BaseURL( ) + sourceFile + "' target=\"contentsFrame\">	\n";
		if(LanguageIs( "?" ) == "D"){
			textsub += textD;
		}else{
			textsub += textE;
		} 
		textsub += "</a>"
		if(separator == 1){
			textsub += "&nbsp;|&nbsp;";
		}
		return textsub;
	}	
	//------------------------------------------------------------------
	// end function SubMenuItem			   	  


var docLang = top.frames["languagePickerFrame"].document;

<!----  "language manager" -------------------->
    // manage current language selection cookie
    function LanguageIs( currentLanguage )
    {
      //  var docLang = top.frames["languagePickerFrame"].document;
//      docLang.write( currentLanguage );  

        switch( currentLanguage )
        {
            // *store* language selection 	 
            case 'D':
            case 'E':
                docLang.cookie = currentLanguage;
			        // reload pages
                top.frames["navigationFrame"].location.reload();		
                top.frames["contentsFrame"].location.reload();	
				break;

            // *return* language selection	 
            case '?':
            default:
				if( docLang.cookie )
				    currentLanguage = docLang.cookie;
				else{
					if(docLang.title == "Deutsch")
						currentLanguage = "D";
					else
						currentLanguage = "E";
				}
				break;
        }
		
//      alert( "=>" + currentLanguage );  
        return currentLanguage;
    }
	//------------------------------------------------------------------
	// end function LanguageIs 				   	  



<!----  "language checker" -------------------->
    // alerts if a page is available in one language only
    function OneLanguage( pageLanguage )
    {
        if( LanguageIs( "?" ) != pageLanguage )
        {
            if( LanguageIs( "?" ) == "D" )
                alert ( "Sorry!\nDiese Seite gibt's bisher nur in Englisch." )
            else
                alert ( "Sorry!\nThis page currently is available in German only." )
        }				
    }
    // ------------------------------------------------></script>
	
	

<!----  Navigation Item    -------------------->
    function NavigationItem( sourceFile, textD, textE )
    {
	    document.write ( "<a href='" + BaseURL( ) + sourceFile + "' target='contentsFrame'>"
		               + ( LanguageIs( "?" ) == "D" ? textD : textE ) 
                       + "</a><br>" );
	}	
	//------------------------------------------------------------------
	// end function NavigationItem 				   	  

	
<!----  find out thumbnail picture name ----------->
    // atttaches '_tn' to file name before extension
    function ThumbNail( imageFile )
    {
        var idx;
        var thumbNail;

        // last index of dot = file extension
        idx = imageFile.lastIndexOf( "." )

        thumbNail = imageFile.substring( 0, idx )
                  + "_tn"
                  + imageFile.substring( idx, imageFile.length );

        return( thumbNail );
    }
	//------------------------------------------------------------------
	// end function ThumbNail 				   	  

	
<!----  make up picture alt text out of file name ---->
    function AltText( imageFile )
    {
        // cut off extension	
        var altText = "";
        var currentChar;
        var wasNaN;
        var text = imageFile.substring( 0, imageFile.lastIndexOf( "." ));

        for( var idx = 0; idx <= text.length; idx++ )
		{
            currentChar = text.substring( idx, idx+1 );
            if( isNaN( currentChar ))
            {   // insert blank before new word
                wasNaN = 1; 			
                if( currentChar == currentChar.toUpperCase( ))
                {
			        altText = altText + " ";
                }
            }
            else
            {   // insert blank before number
			 	if( wasNaN )
                {
			        altText = altText + " ";
                }
                wasNaN = 0; 			
            }

            altText = altText + currentChar;
        }    													  
        return( altText );
    }
	//------------------------------------------------------------------
	// end function AltText 				   	  



	
<!----  copyright info -------------------->
// produces page trailer in current document
    function CopyRight( )
    {
        document.write( "<br><br><br><br><br><br>" );
        document.write( "<font face='Verdana, Arial, Helvetica, Sans-Serif' size='1'>" );
        document.write( "<hr size='1' align='center' noshade>" );
        document.write( "&copy; 2000-2005 Buick Club of Germany -- <img src=\'" + ImageRef( 'BCGMail.gif' ) + "\' border=0>&nbsp;" );
        document.write( "<a href='mailto:info@felix-linden.de'>webmaster</a>" );
    }
<!---- copyright info with Text ---------->
    function CopyRightPlusText( moreTextD, moreTextE )
    {
        document.write( "<br><br><br><br><br><br>" );
        if ( moreTextD != "" )
		{ 
            document.write( "<font face='Garamond, Times New Roman' size='-1'>" );
			document.write(( LanguageIs( '?' ) == 'D' ? moreTextD : moreTextE ) + "</font>" );
        }	
        document.write( "<font face='Verdana, Arial, Helvetica, Sans-Serif' size='1'>" );
        document.write( "<hr size='1' align='center' noshade>" );
        document.write( "&copy; 2000-2005 Buick Club of Germany -- <img src=\'" + ImageRef( 'BCGMail.gif' ) + "\' border=0>&nbsp;" );
        document.write( "<a href='mailto:info@felix-linden.de'>webmaster</a>" );
    }
	//------------------------------------------------------------------
	// end function CopyRight 				   	  

	
	

<!----  find base address  -------------------->
    // extracts base address for relative addressing 
    function BaseURL( )
    {
        var doc     = top.frames["logoFrame"].document; 
        var idx     = doc.length;
        var baseURL = "" + doc.location; 

        idx = baseURL.lastIndexOf( "/" )
		
		if( idx < 7 )      // "http://"
		    return null;
        else
            return( baseURL.substring( 0, idx+1 ));
    }
	//------------------------------------------------------------------
	// end function BaseURL 				   	  

	
