
/*   CALLING THIS PAGE:   <script type="text/javascript" src="../../includes/common.js"></script>    */



$(document).ready(function(){
	
	$('#bvLogo').fadeTo(1, .5);
	$('#bvLogo').mouseover(function()
	{
		$(this).fadeTo(200, 1);
	});
	$('#bvLogo').mouseout(function()
	{
		$(this).fadeTo(500, .5);
	});
	
	$('#rbLogo').fadeTo(1, .5);
	$('#rbLogo').mouseover(function()
	{
		$(this).fadeTo(200, 1);
	});
	$('#rbLogo').mouseout(function()
	{
		$(this).fadeTo(500, .5);
	});
	
	$('#brianvickersEmblem').fadeTo(1, .5);
	$('#brianvickersEmblem').mouseover(function()
	{
		$(this).fadeTo(200, 1);
	});
	$('#brianvickersEmblem').mouseout(function()
	{
		$(this).fadeTo(500, .5);
	});
	
});



function setZoom(img, dir, width, height, margin, zIndex, delay) {
  setTimeout(function() {
    if (img.dir==dir) {
      img.style.width=width;
      img.style.height=height;
      img.style.margin=margin;
      img.style.zIndex=zIndex;
      img.parentNode.parentNode.style.zIndex=zIndex;
    }
  }, delay);
}

function larger(img, width, height) {
  img.dir='rtl';
  now=parseInt(img.style.zIndex);
  for (i=now+1; i<=10; i++) {
    w=(width*(10+i))/20+'px';
    h=(height*(10+i))/20+'px';
    m=(-i)+'px 0 0 '+(-width*i/40)+'px';
    setZoom(img, 'rtl', w, h, m, i, 20*(i-now));
  }
}

function smaller(img, width, height) {
  img.dir='ltr';
  now=parseInt(img.style.zIndex);
  for (i=now-1; i>=0; i--) {
    w=(width*(10+i))/20+'px';
    h=(height*(10+i))/20+'px';
    m=(-i)+'px 0 0 '+(-width*i/40)+'px';
    setZoom(img, 'ltr', w, h, m, i, 20*(now-i));
  }
}





/*
Button is unclickable after pressing SUBMIT
*/
function submitonce(theform){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
//screen thru every element in the form, and hunt down "submit" and "reset"
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
//disable em
tempobj.disabled=true
}
}
}



/*
Make sure that textBox only contain number
*/
function checkNumber(textBox)
{
	while (textBox.value.length > 0 && isNaN(textBox.value)) {
		textBox.value = textBox.value.substring(0, textBox.value.length - 1)
	}
	
	textBox.value = trim(textBox.value);
/*	if (textBox.value.length == 0) {
		textBox.value = 0;		
	} else {
		textBox.value = parseInt(textBox.value);
	}*/
}



/*
Confirming before acting
*/
// SAMPLE:  <a href="#" onClick="confirmLoad('../../link.php', 'DELETE');">NAME</a>
function confirmLoad(url, action)
		{
			if (confirm('Are you sure you want to '+action+' this item?'))
			{
				window.location = url;
			}
		}



/*
Make sure that textBox only contain number
*/
// SAMPLE: <a href="javascript:popUp('/fan/members/privmsg_comp.php')">NAME</a>
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=1,width=700,height=610,left = 100,top = 50');");
}


