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(){

	var appwidth=878;
	var appheight=559;
	
	/* REMOVE ANY EXISTING DIVs FROM THE STAGE TO START A CLEAN SLATE */
	$(document).ready(function(){
		$("#surround").remove();
		$("#app").remove();
		$("#appBG").remove();
		$("#appExtraContentBG").remove();
		$("#appExtraContent").remove();
		$("#closeEm").remove();
		$("#closeEmToo").remove();
	});
	
	var objSurround = document.createElement('div');
		objSurround.setAttribute('id','surround');
		objSurround.style.display = 'inline';
	document.body.appendChild(objSurround);

	var objAppBG = document.createElement('div');
		objAppBG.setAttribute('id','appBG');
	objSurround.appendChild(objAppBG);

	var objApp = document.createElement('div');
		objApp.setAttribute('id','app');
		objApp.style.width = appwidth+'px';
		objApp.style.height = appheight+'px';
		objApp.style.display = 'block';
	document.body.appendChild(objApp);

	//grab the current window height
	var arrayPageSize = getTheWindowSize();
	
	//size the ghosted BG to the window height
	var curHeight = $(document).height();
	//alert(curHeight);
	$("#surround").height(curHeight);
	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='closeEmUpToo(true);' /></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(){

	var appwidth=878;
	var appheight=559;
	
	/* REMOVE ANY EXISTING DIVs FROM THE STAGE TO START A CLEAN SLATE */
	$(document).ready(function(){
		$("#surround").remove();
		$("#app").remove();
		$("#appBG").remove();
		$("#appExtraContentBG").remove();
		$("#appExtraContent").remove();
		$("#closeEm").remove();
		$("#closeEmToo").remove();
	});
	
	var objSurround = document.createElement('div');
		objSurround.setAttribute('id','surround');
		objSurround.style.display = 'inline';
	document.body.appendChild(objSurround);

	var objApp = document.createElement('div');
		objApp.setAttribute('id','app');
		objApp.style.width = appwidth+'px';
		objApp.style.height = appheight+'px';
		objApp.style.display = 'block';
	document.body.appendChild(objApp);

	//grab the current window height
	var arrayPageSize = getTheWindowSize();
	
	//size the ghosted BG to the window height
	var curHeight = $(document).height();
	//alert(curHeight);
	$("#surround").height(curHeight);
	$("#surround").css("display","block");
	
	//turn the app and sppBG div on and center in the window
	$("#app").width(800);;
	$("#app").height(600);
	$("#app").css("display","block");
	$("#app").css("background-color","#FFF");
	$("#app").css("left", ((arrayPageSize[0]/2)-437) + 'px');
	
	/*var targetURL = "https://www.acuvue.com/acuminder/main.jsp";*/
	var targetURL = serverPath+"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:closeEmUpToo(true);');
				objCLOSElink.innerHTML += '';
		objCLOSEdiv.appendChild(objCLOSElink);
	
	scroll(0,0);
	
	}
	
/**
 * page to setting up new CAP Account. my acuvue application will be opended from here - Narendra 12/11/09
 * pass url through parameter.
 */
function buildGenericWindow(urlParam){
	var appwidth=878;
	var appheight=559;
	
	/* REMOVE ANY EXISTING DIVs FROM THE STAGE TO START A CLEAN SLATE */
	$(document).ready(function(){
		$("#surround").remove();
		$("#app").remove();
		$("#appBG").remove();
		$("#appExtraContentBG").remove();
		$("#appExtraContent").remove();
		$("#closeEm").remove();
		$("#closeEmToo").remove();
	});
	
	var objSurround = document.createElement('div');
		objSurround.setAttribute('id','surround');
		objSurround.style.display = 'inline';
	document.body.appendChild(objSurround);

	var objAppBG = document.createElement('div');
		objAppBG.setAttribute('id','appBG');
	objSurround.appendChild(objAppBG);

	var objApp = document.createElement('div');
		objApp.setAttribute('id','app');
		objApp.style.width = appwidth+'px';
		objApp.style.height = appheight+'px';
		objApp.style.display = 'block';
	document.body.appendChild(objApp);
	
	var objClose = document.createElement('div');
		objClose.setAttribute('id','closeEmToo');
		objClose.innerHTML = "<a href='javascript:showConfirm();' style='position:relative;'></a>";
	document.body.appendChild(objClose);
	
	//grab the current window height
	var arrayPageSize = getTheWindowSize();
	
	//size the ghosted BG to the window height
	var curHeight = $(document).height();
	//alert(curHeight);
	$("#surround").height(curHeight);
	objSurround.style.display = 'block';
		
	//turn the app and sppBG div on and center in the window
	objApp.style.display = 'block';
	$("#app").css("left", ((arrayPageSize[0]/2)-437) + 'px');
	$("#appBG").css("left", ((arrayPageSize[0]/2)-437) + 'px');
	$("#closeEmToo").css("left", ((arrayPageSize[0]/2)+410) + 'px');
	
	var currentURL = location.href;
	var targetVars = currentURL.split("?");
	//var targetURL = "http://visusjawebdevel.na.jnj.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+urlParam+"?"+targetVars[1];

	/* BUILD OUT THE INNER PARTS OF THE APP */
	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='closeEmUpToo(true);' /></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 */
	
}
	
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
	$("#app").css("left", ((arrayPageSize[0]/2)-437) + 'px');
	$("#appBG").css("left", ((arrayPageSize[0]/2)-437) + 'px');
}