/**
 * Macromedia MM functions.
 */

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
   
}

function openNewWindow(URLtoOpen,windowName, windowFeatures) { 
	newWindow=window.open(URLtoOpen, windowName, windowFeatures); }

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/**
 * Screenshot common functions.
 */

// common image preload function
function ie_preload_images(img_flist) {
  img_list = new Array();
  for (i = 0; i < img_flist.length; i++) {
	  img_list[i] = new Image();
	  img_list[i].src = img_flist[i];
  }
}

// flip document image src.
var image_curr_no = 1; // current image no.
function flip_image(image, prefix, ext, no, offset, min, max) {
	// check number range.
	if (!no) { no = image_curr_no + new Number(offset); }
	else { no = new Number(no); }
	if (no < min || no > max) { return; }
	// store image number.
	image_curr_no = no;
	no = new String(no);
	no = (no.length > 1 ? "" : "0") + no;
	// show selected image.
	if (image) { image.src = (prefix + no + ext); }
}

// toggle table visible.
function toggle_wrestler_prof(type)
{
	if (type == 'prof') {
		btn_visible = document.getElementById("btn_prof");
		tbl_visible = document.getElementById("tbl_prof");
		btn_hidden  = document.getElementById("btn_hist");
		tbl_hidden  = document.getElementById("tbl_hist");
	}
	else if (type == 'hist') {
		btn_visible = document.getElementById("btn_hist");
		tbl_visible = document.getElementById("tbl_hist");
		btn_hidden  = document.getElementById("btn_prof");
		tbl_hidden  = document.getElementById("tbl_prof");
	}

	// visible setting.
	btn_visible.style.visibility = "visible";
	btn_visible.style.position   = "";
	tbl_visible.style.visibility = btn_visible.style.visibility;
	tbl_visible.style.position   = btn_visible.style.position;

	// hidden setting.
	btn_hidden.style.visibility  = "hidden";
	btn_hidden.style.position    = "absolute";
	tbl_hidden.style.visibility  = btn_hidden.style.visibility;
	tbl_hidden.style.position    = btn_hidden.style.position;
}

/**
 * Screenshot flip functions.
 */

// flip screen shot images.
function flip_scrshot(no, offset) {
	flip_image(document.img_scrshot, "img/pic", ".jpg", no, offset, 1, 30);
}



// flip gamepoint images.
function flip_gamepoint(no, offset) {
	flip_image(document.img_gamepoint, "img/p2_", "img.png", no, offset, 1, 5);
}


// flip system01 images.
function flip_system01(no, offset) {
	flip_image(document.img_system01, "img/action", ".gif", no, offset, 1, 4);
}

