/* Begin show/hide Flash navigation function */
function flashNavigation(state) {		


	if (state == "visible"){
		document.getElementById('flashNav').style.height="400px";
	}
	
	else {
		document.getElementById('flashNav').style.height="36px";
	}
}

function fromFlash(page) {
	window.location=page;
}

/* End show/hide Flash navigation function */

/* Begin preload images function */
var loadImg = new Array();
loadImg[0] = 'gloves_pitcher_up_on.png';
loadImg[1] = 'gloves_catcher_up_on.png';
loadImg[2] = 'gloves_infield_up_on.png';
loadImg[3] = 'gloves_outfield_up_on.png';
loadImg[4] = 'gloves_1B_up_on.png';
loadImg[5] = 'gloves_pitcher_down_on.png';
loadImg[6] = 'gloves_catcher_down_on.png';
loadImg[7] = 'gloves_infield_down_on.png';
loadImg[8] = 'gloves_outfield_down_on.png';
loadImg[9] = 'gloves_1B_down_on.png';
loadImg[10] = 'gloves_pitcher_down_off.png';
loadImg[11] = 'gloves_catcher_down_off.png';
loadImg[12] = 'gloves_infield_down_off.png';
loadImg[13] = 'gloves_outfield_down_off.png';
loadImg[14] = 'gloves_1B_down_off.png';

function preloadImages() {
	for (i=0; i<loadImg.length; i++) {
		var images = new Array();
		images[i] = new Image;
		images[i].src = 'http://www.wilson.com/baseball/patterntitles/' + loadImg[i];
	}
}
/* End preload images function */

/* Begin expandable table function */

function glovesImageSwap(mouseevent,arrowstate,id) {
	if (mouseevent == 'over'){
		document.getElementById(id+'_img').setAttribute('src','http://www.wilson.com/baseball/patterntitles/'+ id +'_'+arrowstate+'_on.png');
	}
	
	else if (mouseevent == 'out') {
		document.getElementById(id+'_img').setAttribute('src','http://www.wilson.com/baseball/patterntitles/'+ id +'_'+arrowstate+'_off.png');
	}	
	else {
		return;
	}
}

 function gloveExpand(mousestate,headerID) {
	var h3Expand = document.getElementById(headerID);
	var tblExpand = document.getElementById(headerID+'_table');
	var alt;
	
	switch(headerID) {
		case "gloves_pitcher":
			alt = "Pitcher Patterns"
			break
		case "gloves_catcher":
			alt = "Catcher Patterns"
			break
		case "gloves_infield":
			alt = "Infield Patterns"
			break
		case "gloves_outfield":
			alt = "Outfield Patterns"
			break
		case "gloves_1B":
			alt = "First Base Patterns"
			break
		default:
			alt="OTHER"		
	}
	
	if (tblExpand.style.display == "block") {
		tblExpand.style.display = "none";
		h3Expand.setAttribute('class','glovesExpandHeader');
		//IE needs to set 'className'
		h3Expand.setAttribute('className','glovesExpandHeader');
		h3Expand.onmouseover = function(){glovesImageSwap('over','up',headerID);};
		h3Expand.onmouseout = function(){glovesImageSwap('out','up',headerID);};
		h3Expand.innerHTML = "<img src=\"http://www.wilson.com/baseball/patterntitles/"+ headerID+"_up_"+mousestate+".png\" id=\""+headerID+"_img\" width=\"218\" height=\"10\" alt=\""+alt+"\" title=\""+alt+"\" />";
		
	}
	
	else {
		tblExpand.style.display = "block";
		h3Expand.setAttribute('class','glovesExpandedHeader');
		//IE needs to set 'className'
		h3Expand.setAttribute('className','glovesExpandedHeader');
		h3Expand.onmouseover = function(){glovesImageSwap('over','down',headerID);};
		h3Expand.onmouseout = function(){glovesImageSwap('out','down',headerID);};
		h3Expand.innerHTML = "<img src=\"http://www.wilson.com/baseball/patterntitles/"+ headerID+"_down_"+mousestate+".png\" id=\""+headerID+"_img\" width=\"218\" height=\"10\" alt=\""+alt+"\" title=\""+alt+"\" />";
		
	}
}

function gloveExpandOnload() {
	var params = getURLParameters('split');
	var openTbl = "gloves_" + params;
	
	/*******************
	If there is no query string, no parameter value, or the wrong parameter name has been used, do nothing. - KM
	*******************/
	if ((params == null) || (params == '')) {
		;
	}
	
	/*******************
	Flash can't use "1B" as an instance name, so we must use "firstbase" in the query string. "1B" is already used in image names and ID's for the patterns page, 
	so it can't be changed easily. When the parameter position=firstbase is grabbed from the query string, it is being changed to "1B". - KM
	*******************/
	else if (params == "firstbase"){
		openTbl = "gloves_1B"
		gloveExpand('off',openTbl);
	}
	
	else {
		gloveExpand('off',openTbl);
	}	
}
/* End expandable table function */

/* Begin pop up function */
function popWindow(href,title,parameters) {
 window.open(href,title,parameters);
}
/* End pop up function */

/* Begin Flash detection and loading */


/* End Flash detection and loading  */

/* Begin international popup function */
function open_intl(url){
    screenwidth = window.screen.width;
    screenheight = window.screen.height;

    windowleft = (screenwidth - 600)/2;
    windowtop = (screenheight - 500)/2;

    contacts = window.open(url,'open_contacts','width=630,height=500,history=no,resizable=no,status=no,scrollbars=yes,menubar=no,top=' + windowtop + ',left=' + windowleft);
}
/* End international popup function */

/* Begin registratio popup function */
function open_reg(url){
    screenwidth = window.screen.width;
    screenheight = window.screen.height;

    windowleft = (screenwidth - 630)/2;
    windowtop = (screenheight - 610)/2;

    contacts = window.open(url,'open_contacts','width=630,height=610,history=no,resizable=no,status=no,scrollbars=yes,menubar=no,top=' + windowtop + ',left=' + windowleft);
}
/* End registration popup function */
