var halfX;
var halfY;
var fullX;
var fullY;
var invMain;
var arrFabrics = new Array();
var nAlpha = 0;
var objFly;
var nLeft = 0;

function initial() {
	IE = document.all ? true : false;
	fox = new RegExp("Firefox","i");
	chrome = new RegExp("Chrome","i");
	safari = new RegExp("Safari","i");
	opera = new RegExp("Opera","i");
	if (IE) {
		halfX = document.body.clientWidth / 2;
		halfY = document.body.clientHeight / 2;
		fullX = document.body.clientWidth;
		fullY = document.body.clientHeight;
	}
	else if (fox.test(navigator.userAgent) || chrome.test(navigator.userAgent) || safari.test(navigator.userAgent) || opera.test(navigator.userAgent)) {
		halfX = document.body.clientWidth / 2;
		halfY = document.body.clientHeight / 2;
		fullX = document.body.clientWidth;
		fullY = document.body.clientHeight;
	}
	else if (document.all) {
		halfX = document.body.clientWidth / 2;
		halfY = document.body.clientHeight / 2;
		fullX = document.body.clientWidth;
		fullY = document.body.clientHeight;
	}
	else {
		halfX = pageXOffset / 2 - 9;
		halfY = pageYOffset / 2 - 9;
		fullX = pageXOffset;
		fullY = pageYOffset;
	}
}

function setAlpha(obj,per) {
	inone = per / 100;
	if (inone >= 1) inone = 0.99;
	obj.style.opacity = inone;
	obj.style.MozOpacity = inone;
	obj.style.KhtmlOpacity = per / 100;
	obj.style.filter = "alpha(opacity=" + per + ")";
}

function showFabric1(n) {
	nAlpha += 20;
	if (nAlpha > 100) nAlpha = 100;
	nLeft -= 3;
	objFly.style.left = nLeft;
	setAlpha(objFly,nAlpha);
	if (nAlpha == 100) {
		clearInterval(invMain);
		return;
	}
	//setTimeout("showFabric1(" + n + ")",100);
}
function showFabric0(n) {
	objFly = document.getElementById("divMain");
	nAlpha = 0;
	setAlpha(objFly,nAlpha);
	document.getElementById("divPic").innerHTML = "<img src=\"" + arrFabrics[n].src + "\">";
	document.getElementById("divStr").innerHTML = arrFabNames[n];
	nLeft = halfX - 55;
	objFly.style.left = nLeft;
	showFabric1(n);
	clearInterval(invMain);
	invMain = setInterval("showFabric1(" + n + ")",100);
}
function hideFabric0() {
	nAlpha = 100;
	clearInterval(invMain);
	invMain = setInterval("hideFabric1()",100);	
}
function hideFabric1() {
	nAlpha -= 20;
	if (nAlpha < 0) nAlpha = 0;
	nLeft -= 3;
	objFly.style.left = nLeft;
	setAlpha(objFly,nAlpha);
	if (nAlpha == 0) {
		clearInterval(invMain);
		objFly.style.left = -1000;
		return;
	}
}

