/* GENERAL FUNCTIONS
-----------------------------------------------------*/
var loc = String(window.location).split('/');
var baseHref = loc[0]+'//'+loc[2];
var currentPage = loc[3];

function changeTeams(sID, pID, n) {
	var test = $('product-image').style.height;
	if (!test) {
		var h = $('main').height;
		var w = $('main').width;
		var myFx = new Fx.Styles('product-image', {duration:600});
		myFx.start({ height:h, width:w });
	}
	var url = "../ajax-get-data.php";
	var myAjax = new Ajax( url, { postBody:'sID='+sID+'&pID='+pID+'&n='+n, update:'teams', onComplete:animateTeams }).request();
}

function animateTeams() {
	var myFx = new Fx.Styles('teams', {duration:400});
	myFx.start({ height: 150 });	
}

function changeImage(team, name) {
	if (!team) {
		team = document.product.team.value;
	}
	if (!name) name = 'none';
	var url = "../ajax-get-data.php";
	var newAjax = new Ajax( url, { postBody:'image='+team+'&name='+name, onComplete:test }).request();
}

function test(el) {
	var im = $('main');
	im.setStyle('display', 'none');
	im.addEvent('load', Resize);
	im.src=el;
}

function Resize(el) {
	$('main').setStyle('display', 'block');
	var h = this.height;
	var w = this.width;
	var myFx = new Fx.Styles('product-image', {duration:600});
	myFx.start({ height:h, width:w });
}

function checkLength() {
	var minh = $('minor').offsetHeight;
	var majh = $('major').offsetHeight;
	if (minh > majh) $('major').style.height = minh+'px';
}

function pickTeam(id) {
	window.location.href=baseHref+"/products.php?t="+id;
}

window.onload = function() {
	sIFR.replaceElement(named({sSelector:".header", sFlashSrc:"/flash/bosox.swf", sWmode:"transparent", sFlashVars:'w=445'}));
	checkLength();
}
