// max num of pics from each array
pieces= new Array();
pieces[0] = 4; // Array a
pieces[1] = 4; // Array b
pieces[2] = 4; // Array c
pieces[3] = 4; // Array d
pieces[4] = 4; // Array e
pieces[5] = 4; // Array f
pieces[6] = 4; // Array g

function create() {
        this.src = ''
        this.href = ''
}
//Pendants
a = new Array()
for(var i=0; i<=pieces[0]; i++) { a[i] = new create() }
//start image list here
a[0].src     = "random/a/a_001.jpg"
a[0].href    = "http://www.auraimports.com/catalog/index.php?cPath=22"
a[1].src     = "random/a/a_002.jpg"
a[1].href    = "http://www.auraimports.com/catalog/index.php?cPath=22"
a[2].src     = "random/a/a_003.jpg"
a[2].href    = "http://www.auraimports.com/catalog/index.php?cPath=22"
a[3].src     = "random/a/a_004.jpg"
a[3].href    = "http://www.auraimports.com/catalog/index.php?cPath=22"
//Traditional Style
b = new Array()
for(var i=0; i<=pieces[1]; i++) { b[i] = new create() }
//start image list here
b[0].src     = "random/b/b_001.jpg"
b[0].href    = "http://www.auraimports.com/catalog/index.php?cPath=26"
b[1].src     = "random/b/b_002.jpg"
b[1].href    = "http://www.auraimports.com/catalog/index.php?cPath=26"
b[2].src     = "random/b/b_003.jpg"
b[2].href    = "http://www.auraimports.com/catalog/index.php?cPath=26"
b[3].src     = "random/b/b_004.jpg"
b[3].href    = "http://www.auraimports.com/catalog/index.php?cPath=26"
//Bracelets
c = new Array()
for(var i=0; i<=pieces[2]; i++) { c[i] = new create() }
//start image list here
c[0].src     = "random/c/c_001.jpg"
c[0].href    = "http://www.auraimports.com/catalog/index.php?cPath=23"
c[1].src     = "random/c/c_002.jpg"
c[1].href    = "http://www.auraimports.com/catalog/index.php?cPath=23"
c[2].src     = "random/c/c_003.jpg"
c[2].href    = "http://www.auraimports.com/catalog/index.php?cPath=23"
c[3].src     = "random/c/c_004.jpg"
c[3].href    = "http://www.auraimports.com/catalog/index.php?cPath=23"
//Earrings
d = new Array()
for(var i=0; i<=pieces[3]; i++) { d[i] = new create() }
//start image list here
d[0].src     = "random/d/d_001.jpg"
d[0].href    = "http://www.auraimports.com/catalog/index.php?cPath=24"
d[1].src     = "random/d/d_002.jpg"
d[1].href    = "http://www.auraimports.com/catalog/index.php?cPath=24"
d[2].src     = "random/d/d_003.jpg"
d[2].href    = "http://www.auraimports.com/catalog/index.php?cPath=24"
d[3].src     = "random/d/d_004.jpg"
d[3].href    = "http://www.auraimports.com/catalog/index.php?cPath=24"
//Craftsmen
e = new Array()
for(var i=0; i<=pieces[4]; i++) { e[i] = new create() }
//start image list here
e[0].src     = "random/e/e_001.jpg"
e[0].href    = "http://www.auraimports.com/catalog/index.php"
e[1].src     = "random/e/e_002.jpg"
e[1].href    = "http://www.auraimports.com/catalog/index.php"
e[2].src     = "random/e/e_003.jpg"
e[2].href    = "http://www.auraimports.com/catalog/index.php"
e[3].src     = "random/e/e_004.jpg"
e[3].href    = "http://www.auraimports.com/catalog/index.php"
//Travel
f = new Array()
for(var i=0; i<=pieces[5]; i++) { f[i] = new create() }
//start image list here
f[0].src     = "random/f/f_001.jpg"
f[0].href    = "http://www.auraimports.com/catalog/newsdesk_index.php?newsPath=12"
f[1].src     = "random/f/f_002.jpg"
f[1].href    = "http://www.auraimports.com/catalog/newsdesk_index.php?newsPath=12"
f[2].src     = "random/f/f_003.jpg"
f[2].href    = "http://www.auraimports.com/catalog/newsdesk_index.php?newsPath=12"
f[3].src     = "random/f/f_004.jpg"
f[3].href    = "http://www.auraimports.com/catalog/newsdesk_index.php?newsPath=12"
//Sponsorships
g = new Array()
for(var i=0; i<=pieces[6]; i++) { g[i] = new create() }
//start image list here
g[0].src     = "random/g/g_001.jpg"
g[0].href    = "http://www.auraimports.com/catalog/newsdesk_index.php?newsPath=11"
g[1].src     = "random/g/g_002.jpg"
g[1].href    = "http://www.auraimports.com/catalog/newsdesk_index.php?newsPath=11"
g[2].src     = "random/g/g_003.jpg"
g[2].href    = "http://www.auraimports.com/catalog/newsdesk_index.php?newsPath=11"
g[3].src     = "random/g/g_004.jpg"
g[3].href    = "http://www.auraimports.com/catalog/newsdesk_index.php?newsPath=11"

// end of image lists
//Beginning of random nubers

var ra= new Array();
var max=0;

rnum();

function rnum(){
	ra= new Array();
	max = pieces.length; //total number of random numbers and pic locations to generate
	for (x=0; x<max; x++){
		ra[x]=Math.random()
		ra[x]=ra[x]*pieces[x]
		ra[x]=Math.round(ra[x])
	}
	check();
	}

	function again(x){
		ra[x]=Math.random()
		ra[x]=ra[x]*pieces[x]
		ra[x]=Math.round(ra[x])
		check();
	}

	function check(){
		for (x=0; x<max; x++){
			if (ra[x]>=pieces[x]){
				again(x);
			}
		}
	}
// Preload images
imageA = new Image();
imageA.src = a[ra[0]].src;
imageB = new Image();
imageB.src = a[ra[1]].src;
imageC = new Image();
imageC.src = a[ra[2]].src;
imageD = new Image();
imageD.src = a[ra[3]].src;
imageE = new Image();
imageE.src = a[ra[4]].src;
imageF = new Image();
imageF.src = a[ra[5]].src;
imageG = new Image();
imageG.src = a[ra[6]].src;

//begining of page variables

var picA = "";
picA += '<a href="'+a[ra[0]].href+'">';
picA += '<img src="'+a[ra[0]].src+'" height="340"';
picA += ' width="375" border="0" alt="Pendants">';
picA += '</a>';

var picB = "";
picB += '<a href="'+b[ra[1]].href+'">';
picB += '<img src="'+b[ra[1]].src+'" height="190"';
picB += ' width="185" border="0" alt="Traditional Style">';
picB += '</a>';

var picC = "";
picC += '<a href="'+c[ra[2]].href+'">';
picC += '<img src="'+c[ra[2]].src+'" height="190"';
picC += ' width="285" border="0" alt="Bracelets">';
picC += '</a>';

var picD = "";
picD += '<a href="'+d[ra[3]].href+'">';
picD += '<img src="'+d[ra[3]].src+'" height="190"';
picD += ' width="180" border="0" alt="Earings">';
picD += '</a>';

var picE = "";
picE += '<a href="'+e[ra[4]].href+'">';
picE += '<img src="'+e[ra[4]].src+'" height="180"';
picE += ' width="150" border="0" alt="Our Artisans ">';
picE += '</a><br>';

var picF = "";
picF += '<a href="'+f[ra[5]].href+'">';
picF += '<img src="'+f[ra[5]].src+'" height="160"';
picF += ' width="150" border="0" alt="Asian Journals">';
picF += '</a><br>';

var picG = "";
picG += '<a href="'+g[ra[6]].href+'">';
picG += '<img src="'+g[ra[6]].src+'" height="190"';
picG += ' width="150" border="0" alt="Seeking Sponsorship">';
picG += '</a>';

var debug ="";
debug += ra[0]+'|'+ra[1]+'|'+ra[2]+'|'+ra[3]+'|'+ra[4]+'|'+ra[5]+'|'+ra[6];

