function getTheWindowSize(){
	
	var myXscroll;
	var myYscroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
				myXscroll = document.body.scrollWidth;
				myYscroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){
			myXscroll = document.body.scrollWidth;
			myYscroll = document.body.scrollHeight;
	} else { // code for Mac IE... but also works in Explorer 6 Strict, Mozilla and Safari
			myXscroll = document.body.offsetWidth;
			myYscroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
			currentWindowWidth = self.innerWidth;
			currentWindowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			currentWindowWidth = document.documentElement.clientWidth;
			currentWindowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
			currentWindowWidth = document.body.clientWidth;
			currentWindowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(myYscroll < windowHeight){
			currentPageHeight = windowHeight;
	} else { 
			currentPageHeight = myYscroll;
	}

	// for small pages with total width less then width of the viewport
	if(myXscroll < windowWidth){	
			currentPageWidth = windowWidth;
	} else {
			currentPageWidth = myXscroll;
	}


	arrayWindowSize = new Array(currentPageWidth,currentPageHeight,currentWindowWidth,currentWindowHeight) 
	return arrayWindowSize;
}

function buildFreeTrial(){
	//target the objects on the page
	var objSurround = document.getElementById('surround');
	var objApp = document.getElementById('app');
	var objAppBG = document.createElement('div');
		objAppBG.setAttribute('id','appBG');
	objSurround.appendChild(objAppBG);
	
	//grab the current window height
	var arrayPageSize = getTheWindowSize();
	
	//size the ghosted BG to the window height
	objSurround.style.height = (arrayPageSize[1] + 'px');
	objSurround.style.display = 'block';
	
	//turn the app and sppBG div on and center in the window
	objApp.style.display = 'block';
	objApp.style.left = (((arrayPageSize[0]/2)-437) + 'px')
	objAppBG.style.left = (((arrayPageSize[0]/2)-437) + 'px')
	
	var currentURL = location.href;
	var targetVars = currentURL.split("?");
	/*alert(targetVars[1]);*/

	//var targetURL = "http://visusjawebdevel.na.jnj.com/ftpc/Acuvue.do?"+targetVars[1];
	//var targetURL = "http://promo.acuvue.com/ftpc/Acuvue.do?"+targetVars[1];
	/* SERVERPATH BELOW DEFINED IN SEPARATE .js FILE - NEW METHODS IMPLEMENTED TO CONTROL QA BEGIN PUSHED TO PROD */
	var targetURL = serverPath+"ftpc/Acuvue.do?"+targetVars[1];
	/* alert(targetURL); */

	/* BUILD OUT THE INNER PARTS OF THE APP */
	objApp.innerHTML="<div id='closeEmUp'></div>";
	objApp.innerHTML+="<div id='closeDIV'></div>";
	objApp.innerHTML+="<div id='verifyDIV'><h3>Are you sure you want to quit?</h3><input type='button' value='NO' class='get-started' onClick='hideConfirm();' /><input type='button' value='YES' class='get-started' onClick='closeEmUp();' /></div>";
	objApp.innerHTML+="<iframe id='FTCapp' src='"+targetURL+"' frameborder='0' name='FTCapp' scrolling='no' scrolling='false' width='877' height='650' allowtransparency='true'></iframe>";
	/* EOF INNER PARTS OF THE APP */
	
	var objCLOSEdiv = document.getElementById('closeDIV');
			var objCLOSElink = document.createElement('a');
				objCLOSElink.setAttribute('id','closeApp');
				objCLOSElink.setAttribute('href', 'javascript:showConfirm();');
				objCLOSElink.innerHTML += '';
		objCLOSEdiv.appendChild(objCLOSElink);
	
	}

function buildAcuminderApp(){
	//target the objects on the page
	var objSurround = document.getElementById('surround');
	var objApp = document.getElementById('app');
	
	//grab the current window height
	var arrayPageSize = getTheWindowSize();
	
	//size the ghosted BG to the window height
	objSurround.style.height = (arrayPageSize[1] + 'px');
	objSurround.style.display = 'block';
	
	//turn the app and sppBG div on and center in the window
	objApp.style.width = "800px";
	objApp.style.height = "600px";
	objApp.style.display = "block";
	objApp.style.backgroundColor = "#FFF";
	objApp.style.left = (((arrayPageSize[0]/2)-400) + 'px')
	
	/*var targetURL = "https://www.acuvue.com/acuminder/main.jsp";*/
	var targetURL = "https://www.jnjvision.com/acuminder/main.jsp";
	
	/* BUILD OUT THE INNER PARTS OF THE APP */
	objApp.innerHTML="<div id='closeEmUp'></div>";
	objApp.innerHTML+="<div id='closeDIV'></div>";
	objApp.innerHTML+="<iframe id='Acuminder' src='"+targetURL+"' frameborder='0' name='Acuminder' scrolling='true' style='width:800px;height:600px;margin:0;background:#FFF;'></iframe>";
	/* EOF INNER PARTS OF THE APP */
	
	var objCLOSEdiv = document.getElementById('closeDIV');
	var objCLOSEemUp = document.getElementById('closeEmUp');
	objCLOSEdiv.style.marginLeft = '730px';
	objCLOSEdiv.style.marginTop = '-20px';
	objCLOSEemUp.style.marginLeft = '730px';
	objCLOSEemUp.style.marginTop = '-20px';
			var objCLOSElink = document.createElement('a');
				objCLOSElink.setAttribute('id','closeApp');
				objCLOSElink.setAttribute('href', 'javascript:closeEmUp();');
				objCLOSElink.innerHTML += '';
		objCLOSEdiv.appendChild(objCLOSElink);
	
	scroll(0,0);
	
	}
	
	
function closeEmUp(){
	//alert(removeThis);
	window.location="http://www.acuvue.com";
}


function hideConfirm(){
	document.getElementById('verifyDIV').style.display="none";
}

function showConfirm(){
	var objApp = document.getElementById('app');
	var objConfirm = document.getElementById('verifyDIV');
	objConfirm.style.left = (objApp.offsetWidth/2)-150 + 'px';
	objConfirm.style.display="block";
}

function reposition(){
	//target the application on the page
	var objAppBG = document.getElementById('appBG');
	var objApp = document.getElementById('app');
	
	//grab the current window height
	var arrayPageSize = getTheWindowSize();
		
	//set the app to float in the middle of the current window
	objApp.style.left = (((arrayPageSize[0]/2)-437) + 'px');
	objAppBG.style.left = (((arrayPageSize[0]/2)-437) + 'px');
}