/* Common Javscript Functions */

// create image array for preload
function createImgArray() {
  var imgArray = new Array('/x/global/media/img/nav/reebok_logo.gif','/x/global/media/img/nav/classic_off.gif','/x/global/media/img/nav/classic_on.gif','/x/global/media/img/nav/rbk_off.gif','/x/global/media/img/nav/rbk_on.gif','/x/global/media/img/nav/vector_off.gif','/x/global/media/img/nav/vector_on.gif');
	preload(imgArray);
}

createImgArray();

// preload images
function preload(arg_imgArray) {
  for (var i = 0; i < arg_imgArray.length; i ++) {
	  var newImage = new Image();
		newImage.src = arg_imgArray[i];
	}
}

// roll over
function chgImg(arg_img, arg_src) {
    document.images[arg_img].src = arg_src;
  }

// open window
function openWin(arg_url, arg_name, arg_width, arg_height, arg_scroll, arg_resize, arg_move) {
  
  if ((arg_resize == "") || (arg_resize == null)) {
    arg_resize = "no";
  }
  
  if ((arg_scroll == "") || (arg_scroll == null)) {
    arg_scroll = "auto";
  }
  
  if ((arg_move == "") || (arg_move == null)) {
    arg_move = "no";
  }
  
  var win = window.open(arg_url,arg_name,'scrollbars=' + arg_scroll + ',resizable=' + arg_resize + ',width=' + arg_width +  ',height=' + arg_height);

  if (arg_move != "no") {
    win.moveTo(0,0);
  }
}

// close window
function closeWin() {
  window.close();
}

// Netscape resize
/*
function resizeFix() {
   if (innerWidth != origWidth || innerHeight != origHeight) {
    location.reload();
   }
}
*/
// checks white space for form submissions
function checkWhiteSpace(arg_string) {
  var found = false;
  if (arg_string.length > 0)  {
    for (i = 0; i < arg_string.length; i ++) {
      if (arg_string.charAt(i) != " ") {
	    found = true;
  	  }
    }
	return found;
  }
  else return false;
}

// show link in status bar for flash
function showFlashLink(arg_link) {
  window.status = arg_link;
}

//Zugara for RbK window launcher feature Feb 24, 2004
function MeetTheFamilyWindow(URL) {
  if (screen.width>1024) {
  w = 1200;
  h = 800;
  sx = screen.Width/2-600;
  sy = screen.height/2-400;
  } else {
  w = screen.availWidth-16;
  h = screen.availHeight-32;
  sx = 0;
  sy = 0;
  }
MyWindow=window.open(URL,'RBKSound','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left='+sx+',top='+sy+',screenX='+sx+',screenY='+sy+',width='+w+',height='+h);
}
