/*
General Research javasccript library

*/


i = 99;
j = 1;
p = 3;

iFactor = -1;
jFactor = 1;

function imgSwapper () {
	if (j < 10)
		$ ('main_img1').style.opacity = ".0" + j; 
	else
		$ ('main_img1').style.opacity = "." + j; 
	$ ('main_img1').style.filter = "alpha(opacity="+j+")"; 
	if (i < 10)
		$ ('main_img2').style.opacity = ".0" + i; 
	else
		$ ('main_img2').style.opacity = "." + i; 
	$ ('main_img2').style.filter = "alpha(opacity="+i+")"; 
	i = i + iFactor;
	j = j + jFactor;
	if (i == 0) {
		if (p < 10)
			$ ('main_img2').src = "genres_00000"+p+".jpg";
		else
			$ ('main_img2').src = "genres_0000"+p+".jpg";
		iFactor = 1;
		p++;
	}
	if (j == 0) {
		if (p < 10)
			$('main_img1').src = "genres_00000"+p+".jpg";
		else
			$('main_img1').src = "genres_0000"+p+".jpg";
		jFactor = 1;
		p++;
	}
	if (i == 99)
		iFactor = -1;
	if (j == 99)
		jFactor = -1;		
	if (p > 8)
		p = 1;
}

ft_top = 70;
ft_left = 90;

imgArray = new Array ('051226-03a.jpg', '051226-16d.jpg', '051226-27c.jpg', 
				 	 		 			  '051226-29.jpg', '051226-30a.jpg', '051226-30b.jpg', 
											'051226-31a.jpg', '051226-31b.jpg', '051226-32a.jpg', 
											'051226-32b.jpg', '051226-33a.jpg', '051226-33b.jpg', 
											'051226-34a.jpg', '051226-34b.jpg', '051226-34c.jpg', 
											'051226-35a.jpg', '051226-35b.jpg', '051226-36a.jpg', 
											'051226-36b.jpg', '051226-36c.jpg', '051226-37a.jpg', 
											'051226-37b.jpg', '051226-38a.jpg', '051226-38b.jpg', 
											'051226-39a.jpg', '051226-39b.jpg');
mArray = new Array();
xArray = new Array();
yArray = new Array();

var pixList = '';

for (idx = 0; idx < imgArray.length; idx++) {
//need the correct syntax for the random function....
  mArray[idx] = Math.round(Math.random()*3)+1;
  xArray[idx] = Math.round(Math.random()*50);//+ft_left;
  yArray[idx] = Math.round(Math.random()*600);//+ft_top;
  pixList += '<img id="img'+idx+'" src="images/'+imgArray[idx];
	pixList += '" alt="" width="'+(Math.round(Math.random()*50)+80);
	pixList += '%" style="position: absolute; top: '+yArray[idx];
	pixList += 'px; left: '+xArray[idx]+'px;">';
}											 

function imgSetUp () {
//	alert (pixList);
	$('pixarea').innerHTML = pixList;
}

function imgFlyThru () {
  var mdx = 0;
  for (mdx = 0; mdx < imgArray.length; mdx++) {
	  yArray[mdx] = yArray[mdx] - mArray[mdx];
		if (yArray[mdx] < -100)
		  yArray[mdx] = 700;
	  $('img'+mdx).style.top = yArray[mdx]+'px';
  }
}

//window.setInterval('imgFlyThru()', 90);

bInspect = false;

newLeft = 0;
function scroller () {
//	if (bInspect) bInspect = confirm (newLeft + " px");
	newLeft -= 6;
	$ ("scroller").style.left = newLeft + "px";
	if (newLeft < (-8 * ($("scroller").innerHTML.length)))
		newLeft = 700;
}

initDelay = 10;

hidden = true;

function showhide () {
  if (hidden) {
	  $('leftbar').style.display='none';
	  $('pixarea').style.display='none';
	  $('bottom').style.display='none';
	  $('showhide').innerHTML = '<span style="position: relative; top: -4px">+</span>';
	  $('showhide').style.left = '10px';		
		$('logo').style.left = "100px"; 
		$('logo').style.color = "#393"; 
		$('mainarea').style.left = "-100px"; 
		$('mainContent').style.left = "-100px"; 
		hidden = false;
	} else {
	  $('leftbar').style.display='block';
	  $('pixarea').style.display='block';
	  $('bottom').style.display='block';
	  $('showhide').innerHTML = '<span style="position: relative; top: -4px">-</span>';
	  $('showhide').style.left = '108px';		
		$('logo').style.left = "-4px"; 
		$('logo').style.color = "white"; 
		$('mainarea').style.left = "4px"; 
		$('mainContent').style.left = "0px"; 
		hidden = true;
	}
}

var closeUp = '<div style="text-align: right; padding-right: 8px; cursor: pointer; cursor: hand;" onclick="$('+"'showplace').style.visibility='hidden';"+'"><span style="font-size: 60%; border: 1px solid lime; position: relative; top: -2px; padding: 1px;">X</span> Close</div><table summary="" height="100%" width="100%"><tr height="100%" width="100%"><td height="100%" width="100%" align="center" valign="middle">';

function showIt (theId) {
}

function menuOn (theMenu) {
  theMenu.style.borderBottom='lime 2px solid';
	theMenu.style.paddingBottom='0';
	theMenu.style.backgroundImage='url(gr_small.jpg)';
}	

function menuOff (theMenu) {
  theMenu.style.borderBottom='0';
	theMenu.style.paddingBottom='2px';
	theMenu.style.backgroundImage='';
}	

function showbar () {
}

function hidebar () {
}

