var snapDivToCenter=false;
var rightOffset=0;
// set up fscommand infrastructure for Flash to JavaScript
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('Sub faeSwfObject032007_FSCommand(ByVal command, ByVal args)\n');
	document.write(' call faeSwfObject032007_DoFSCommand(command, args)\n');
	document.write('end sub\n');
	document.write('</SCRIPT\> \n');
}
function faeSwfObject032007_DoFSCommand(command, args){
	if(command=="getInnerWidth") {
		getInnerWidth(args);
	}
  	if(command=="windowResize") {
  		argArray = new Array();
  		argArray = args.split(",");
		faeWindowResize(argArray[0], argArray[1], argArray[2]);
	}
}
function getInnerWidth(divId) {
	var faeDivObj = document.getElementById(divId);
	var faeInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
	//var faeSwfObjPointer = faeInternetExplorer ? faeSwfObject032007 : window.document.faeSwfObject032007;
	// BUGFIX: shorthand code causes strange IE browser stops
	if( true == faeInternetExplorer ) {
			faeSwfObjPointer = faeSwfObject032007;
	} else {
			faeSwfObjPointer = window.document.faeSwfObject032007;
	}
	if(parseInt(navigator.appVersion)>3) {
		if(navigator.appName=="Netscape") {
			winW = parseInt(window.innerWidth)-20-parseInt(faeDivObj.style.width); //-20 for scrollbar width
			winH = parseInt(window.innerHeight);
		}
		if(navigator.appName.indexOf("Microsoft")!=-1) {
			 winW = parseInt(document.body.offsetWidth)-20-parseInt(faeDivObj.style.width); //-20 for scrollbar width
			 winH = parseInt(document.body.offsetHeight);
		 }
	}	
	//window.document.faeSwfObject032007.SetVariable("innerWidth", winW);
	faeSwfObjPointer.SetVariable("innerWidth", winW);
}
function faeWindowResize(divId, deltaX, yPos) {
	var faeDivObj = document.getElementById(divId);
	if(parseInt(navigator.appVersion)>3) {
		if(navigator.appName=="Netscape") {
			winW = parseInt(window.innerWidth)-20-parseInt(faeDivObj.style.width); //-20 for scrollbar width
			winH = parseInt(window.innerHeight);
		}
		if(navigator.appName.indexOf("Microsoft")!=-1) {
			 winW = parseInt(document.body.offsetWidth)-20-parseInt(faeDivObj.style.width); //-20 for scrollbar width
			 winH = parseInt(document.body.offsetHeight);
		 }
	}
	if(snapDivToCenter!=true) {
		positionFaeDiv(divId, winW+parseInt(deltaX)+parseInt(rightOffset), yPos);
	}else{
		positionFaeDiv(divId, winW/2+parseInt(deltaX), yPos);
	}
}
// end fscommand infrastructure set up and functions
function positionFaeDiv(divId, xPos, yPos){
	var faeDivObj = document.getElementById(divId);
	faeDivObj.style.left=xPos+"px";
	faeDivObj.style.top=yPos+"px";
}
function resizeDiv(divId, resizeWidth, resizeHeight){
	var faeDivObj = document.getElementById(divId);
	faeDivObj.style.width=resizeWidth+"px";
	faeDivObj.style.height=resizeHeight+"px";
}
function shiftDiv(divId, deltaX, deltaY){
	var faeDivObj = document.getElementById(divId);
	faeDivObj.style.left=parseInt(faeDivObj.style.left)+deltaX+"px";
}
function resizeAndShiftDiv(divId, resizeWidth, resizeHeight, deltaX, deltaY){
	var faeDivObj = document.getElementById(divId);
	faeDivObj.style.width=parseInt(resizeWidth)+"px";
	faeDivObj.style.height=parseInt(resizeHeight)+"px";
	faeDivObj.style.left=parseInt(faeDivObj.style.left)+parseInt(deltaX)+"px";
	faeDivObj.style.top=parseInt(faeDivObj.style.top)+parseInt(deltaY)+"px";
}
function resizeHorizontal(divId, deltaX, yPos, rightOffsetValue) {
	var faeDivObj = document.getElementById(divId);
	rightOffset = rightOffsetValue;
	if(parseInt(navigator.appVersion)>3) {
		if(navigator.appName=="Netscape") {
			winW = parseInt(window.innerWidth)-20; //-20 for scrollbar width
			winH = parseInt(window.innerHeight);
		}
		if(navigator.appName.indexOf("Microsoft")!=-1) {
			 winW = parseInt(document.body.offsetWidth)-20; //-20 for scrollbar width
			 winH = parseInt(document.body.offsetHeight);
		 }
	}
	if(snapDivToCenter!=true) {
		positionFaeDiv(divId, winW+parseInt(deltaX)+parseInt(rightOffset), yPos);
	}else{
		positionFaeDiv(divId, winW/2+deltaX-parseInt(faeDivObj.style.width)/2, yPos);
	}
}
function setCenterSnapValue(snapValue, divIdValue, centerOffsetValue, divTopValue) {
	snapDivToCenter = snapValue;
	resizeHorizontal(divIdValue, centerOffsetValue, divTopValue, 0);
}
