window.onunload = function() {
     window["__flash__removeCallback"] = function (instance, name) {
     return;
     };
} 

function launchProductFind()
{
	var currentUrl = window.location ;
	var html = '<div id="ovucalcForm"><object id="opt-finder"><embed id="opt" width="950" height="800" type="application/x-shockwave-flash" src="http://ovulation-calculator.com/ttc-product-finder/main.swf" allowScriptAccess="always" name="ept-products" wmode="transparent" quality="high" flashVars="currentUrl='+currentUrl+'" /></object></div>' ;
	popup(html) ;
}
function popup(html) {
	//screen width 
	//IE
		if(!window.innerWidth)
		{
			//strict mode
			if(!(document.documentElement.clientWidth == 0))
			{
				var w = document.documentElement.clientWidth;
			}
			//quirks mode
			else
			{
				var w = document.body.clientWidth;
			}
		}
		//w3c
		else
		{
			var w = window.innerWidth;
		}
	
	var left = ((w / 2) - 500).toString()  + "px"  ;
	div1 = document.createElement('div') ;
	div1.id = 'popup-translucent' ;
	div1.style.width = '100%' ;
	div1.style.height = '2000px' ;
	div1.onclick = function() {closePopup()}
	div1.style.position = 'absolute' ;
	div1.style.display = 'block' ;
	div1.style.cssfloat = 'left' ;
	div1.style.top = '0' ;
	div1.style.left = '0' ;
	div1.style.backgroundColor = "#ffffff" ;
	div1.style.padding = '25px' ;
	div1.style.zIndex = 2000 ;
	document.body.appendChild(div1) ;
	div2 = document.createElement('div') ;
	div2.id = 'popup-window' ;
	div2.style.width = "950" ;
	div2.style.height = "800" ;
	div2.style.cssFloat = "left" ;
	div2.style.position = 'absolute' ;
	div2.style.display = 'block' ;
	div2.style.top = '0' ;
	div2.style.left = left ;
	div2.style.padding = '15px' ;
	div2.style.fontSize = '18px' ;
	div2.style.zIndex = 3000 ;
	div2.innerHTML = html ;
	document.body.appendChild(div2) ;
	SetOpacity(div1, 80) ;
	//document.getElementById('ovucalcForm').style.visibility = 'hidden' ;
}
function closePopup() {
	

    var reMove = document.getElementById('popup-window');
    reMove.parentNode.removeChild(reMove);
    var reMove = document.getElementById('popup-translucent');
    reMove.parentNode.removeChild(reMove);
	document.getElementById('ovucalcForm').style.visibility = 'visible' ;
	
}
function SetOpacity(elem, opacityAsInt)
{
     var opacityAsDecimal = opacityAsInt;
     
     if (opacityAsInt > 100)
         opacityAsInt = opacityAsDecimal = 100; 
     else if (opacityAsInt < 0)
         opacityAsInt = opacityAsDecimal = 0; 
    
    opacityAsDecimal /= 100;
    if (opacityAsInt < 1)
        opacityAsInt = 1; // IE7 bug, text smoothing cuts out if 0
   
    elem.style.opacity = (opacityAsDecimal);
    elem.style.filter  = "alpha(opacity=" + opacityAsInt + ")";
}