// This file contains all the javascript functions that are needed for the application.


// this function will be populated from the database eventually



function displayFeaturedImage() {

	var imglist = new Array(29); 
	imglist[0]='featured_dolls/lady_umbrella_9_tn.gif';
	imglist[1]='featured_dolls/flower_girl_tn.gif';
	imglist[2]='featured_dolls/lady_blue_basket_10_tn.gif';
	imglist[3]='featured_dolls/lady_fan_2_tn.gif';
	imglist[4]='featured_dolls/lady_performer_tn.gif';
	imglist[5]='featured_dolls/lady_sitting_3_tn.gif';
	imglist[6]='featured_dolls/lady_sitting_block_1_tn.gif';
	imglist[7]='featured_dolls/lady_standing_4_tn.gif';
	imglist[8]='featured_dolls/lady_standing_5_tn.gif';
	imglist[9]='featured_dolls/lady_standing_6_tn.gif';
	imglist[10]='featured_dolls/lady_standing_7_tn.gif';
	imglist[11]='featured_dolls/lady_umbrella_8_tn.gif';
	
	imglist[12]='/oyama_dolls/O-002-T.jpg';
	imglist[13]='/oyama_dolls/O-011-T.jpg';
	imglist[14]='/oyama_dolls/O-012-T.jpg';
	imglist[15]='/oyama_dolls/O-020-T.jpg';
	imglist[16]='/oyama_dolls/O-057-T.jpg';
	imglist[17]='/oyama_dolls/O-059-T.jpg';
	imglist[18]='/oyama_dolls/O-061-T.jpg';
	imglist[19]='/oyama_dolls/O-062-T.jpg';
	imglist[20]='/oyama_dolls/O-063-T.jpg';
	imglist[21]='/oyama_dolls/O-067-T.jpg';
	imglist[22]='/oyama_dolls/O-069-T.jpg';
	imglist[23]='/oyama_dolls/O-071-T.jpg';
	imglist[24]='/oyama_dolls/O-076-T.jpg';
	imglist[25]='/oyama_dolls/O-077-T.jpg';
	imglist[26]='/oyama_dolls/O-078-T.jpg';
	imglist[27]='/oyama_dolls/O-080-T.jpg';
	imglist[28]='/oyama_dolls/O-081-T.jpg';

	
	var imglist1 = new Array(29); 
	imglist1[0]='featured_dolls/lady_umbrella_9.gif';
	imglist1[1]='featured_dolls/flower_girl.gif';
	imglist1[2]='featured_dolls/lady_blue_basket_10.gif';
	imglist1[3]='featured_dolls/lady_fan_2.gif';
	imglist1[4]='featured_dolls/lady_performer.gif';
	imglist1[5]='featured_dolls/lady_sitting_3.gif';
	imglist1[6]='featured_dolls/lady_sitting_block_1.gif';
	imglist1[7]='featured_dolls/lady_standing_4.gif';
	imglist1[8]='featured_dolls/lady_standing_5.gif';
	imglist1[9]='featured_dolls/lady_standing_6.gif';
	imglist1[10]='featured_dolls/lady_standing_7.gif';
	imglist1[11]='featured_dolls/lady_umbrella_8.gif';

	imglist1[12]='/oyama_dolls/O-002.jpg';
	imglist1[13]='/oyama_dolls/O-011.jpg';
	imglist1[14]='/oyama_dolls/O-012.jpg';
	imglist1[15]='/oyama_dolls/O-020.jpg';
	imglist1[16]='/oyama_dolls/O-057.jpg';
	imglist1[17]='/oyama_dolls/O-059.jpg';
	imglist1[18]='/oyama_dolls/O-061.jpg';
	imglist1[19]='/oyama_dolls/O-062.jpg';
	imglist1[20]='/oyama_dolls/O-063.jpg';
	imglist1[21]='/oyama_dolls/O-067.jpg';
	imglist1[22]='/oyama_dolls/O-069.jpg';
	imglist1[23]='/oyama_dolls/O-071.jpg';
	imglist1[24]='/oyama_dolls/O-076.jpg';
	imglist1[25]='/oyama_dolls/O-077.jpg';
	imglist1[26]='/oyama_dolls/O-078.jpg';
	imglist1[27]='/oyama_dolls/O-080.jpg';
	imglist1[28]='/oyama_dolls/O-081.jpg';



	// Get a random number between the given limit.
	var n = getRandomNumbers();
	
	// Select the Array image from that list.
	
	var clickline = "onClick=openWindow('../images/"+ imglist1[n] + "')";

	

	var line = "<a href='#' " +clickline + "><img src='../images/" + imglist[n] + "'></a><br>";
	document.write(line);

	
	line = "<span class='textRegB'><a href='#' "+ clickline +">Click here to see <br> more detailed picture..</a></span>";
	document.write(line);
	
	
	
			
}

function openWindow(url) {
	// Detemine the size later.
	
	window.open(url, 'dollWin', 'resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes;width=100;height=100;');
	
}

function getRandomNumbers() {
  var i, rannum;

    // Math.random() returns a decimal number between
    // 0 and 1.  You multiple the result by the range
    // of numbers you want.

    // This will generate 0-10.
    rannum = Math.random()* 28;

    // This would generate 145-200
    // rannum = Math.random()*55 + 145;

    // rannum is now a decimal value, to turn it into
    // an integer use Math.round to round it to the nearest
    // integer.  Math.floor(rannum) to always round down and
    // Math.ceil(rannum) to round up.
    
    rannum = Math.round(rannum);

    // If options[i] hasn't been created yet, create it.
    
    return rannum;
  
}
