// Common JScript functions for the Inquirer's Web Site
//
// mericson@phillynews.com
// 12/14/00 


// Displays a random promo piece in the nav rail
function displayRandomPromo () {

	var promo = new Array(2);
	promo[0] = "xmas_quartet";
	promo[1] = "xmas_quartet";
	promo[2] = "xmas_quartet";



	var display = getRandom( promo.length - 1 );
	displayPromo( promo[display] );

	return 1;
}

// Displays a promo by name in the rail
function displayPromo( promoName ) {
	if ( promoName == "books" ) {
		document.write( "Books" );

	} else if ( promoName == "photo_frames" ) {
		document.write( "Photo Frames" );

	} else if ( promoName == "xmas_quartet" ) {
		document.write( '<a href="http://www.realcitiesstorefronts.com/catalog/S5000009/G5000031/">' );
		document.write( '<img src="http://inq.philly.com/objects/inquirer/images/promos/xmas_quartet.gif" width=100 height=135 border=0><br clear=all>' );
		document.write( '</a>' );
		document.write( '<font face="Verdana" size="1">Purchase books<br> by Inquirer<br> writers at the<br> <a href="http://www.realcitiesstorefronts.com/catalog/S5000009/G5000031/">Inquirer Store</a></font><br>' );

	
	} else if ( promoName == "flights_of_angels" ) {
		document.write( '<a href="http://inq.philly.com/content/inquirer/specials/flights_of_angels/">' );
		document.write( '<img src="http://inq.philly.com/objects/inquirer/images/promos/flights_of_angels.jpg" width=80 height=64 border=0><br clear=all>' );
		document.write( '</a>' );
		document.write( '<font face="Verdana" size="1"><b>' );
		document.write( '<a href="http://inq.philly.com/content/inquirer/specials/flights_of_angels/">Flights of Angels</a>' );
		document.write( '</b></font><br>' );

	} else if ( promoName == "battle_for_white_house" ) {
		document.write( '<a href="http://inq.philly.com/content/inquirer/2000/12/17/specials/election/">' );
		document.write( '<img src="http://inq.philly.com/objects/inquirer/images/promos/battle_for_white_house.jpg" width=80 height=60 border=0><br clear=all>' );
		document.write( '</a>' );
		document.write( '<font face="Verdana" size="1"><b>' );
		document.write( '<a href="http://inq.philly.com/content/inquirer/2000/12/17/specials/election/">The Battle for the White House</a>' );
		document.write( '</b></font><br>' );
       }	


	return 1;
}



// Random number between 0 and max
function getRandom( max )
{
    var ranNum = Math.round( Math.random() * max);
    return ranNum;
}	
		

