
function ShowOffersA()
{
 ShowSlidesA("http://www.encouragesoftware.com/iframe/easy-child-front-page.htm",30,"http://www.encouragesoftware.com/iframe/how-easy-child-works-front.htm",20,"http://www.encouragesoftware.com/iframe/child-behavior-video-front.htm",15);
}

function ShowOffersB()
{
 ShowSlidesB("http://www.encouragesoftware.com/iframe/ad1.htm",5,"http://www.encouragesoftware.com/iframe/ad2.htm",5,"http://www.encouragesoftware.com/iframe/ad3.htm",5);
}

function ShowWebSiteA(val)
{
 
 	
 	  var iframeElement = document.getElementById("FrameA");
	  iframeElement.src=val;
	  iframeElement.style.visibility="visible";
    /*
	 document.all.FrameA.src=val;
      document.all.FrameA.style.visibility="visible";
	*/
}

function ShowWebSiteB(val)
{
	  var iframeElement = document.getElementById("FrameB");
	  iframeElement.src=val;
	  iframeElement.style.visibility="visible";
     /* document.all.FrameB.src=val;
      document.all.FrameB.style.visibility="visible";
	*/
}


function LoadCheckA() 
{
	var iframe = document.all.FrameA;
	iframe.load;
/*	if (iframe.contentWindow) (	
							   iFrame.load;	
							  }	
*/
}
/*
var IFrame = new Native({
 			}
 			onload.call(iframe.contentWindow, iframe.contentWindow.document);
 		};
-		(window.frames[props.id]) ? onFrameLoad() : iframe.addListener('load', onFrameLoad);
+		(iframe.contentWindow && iframe.contentWindow.document.body) ? onFrameLoad() : iframe.addListener('load', onFrameLoad);
 		return iframe;
 	}

*/
// JavaScript Document
var win;
var intervalID;
var x = 200, y = 200, w=200, h=200;  // Window position and size
var dx = 200, dy = 200;              // Window velocity   
var interval = 5000;              // Milliseconds between updates
var t=0
var v1="";
var v2="";
var v3="";
var t1=0;
var t2=0;
var t3=0;
var pstop=0;
var speed=100;
var ts;
var at;

function NextTimeA() 
{ 
 if (pstop==0) 
 	{
	 t=(t+1); 
 if (t==4) {
	t=1;
 }
 if (t==1)  {
 	ShowWebSiteA(v1); 
 	ts= t1*100/speed;
	at=setTimeout("NextTimeA();",ts);
 }
 if (t==2) {
 	ShowWebSiteA(v2); 
	ts = t2*100/speed;
	at=setTimeout("NextTimeA();",ts);
	}
 if (t==3) {
 	ShowWebSiteA(v3); 
	ts = t3*100/speed;
	at=setTimeout("NextTimeA();",ts);
	}
 }
}



function PauseA()
{
	if (at!=0) { clearTimeout(at); }
	if (pstop==0) 
		{
		pstop=1;
		document.all.Pause.innerHTML =  "Continue->"
		}
	else if (pstop==1) 
		{
		pstop=0;
		NextTimeA();
		document.all.Pause.innerHTML = "|| Pause ||"	
		}
}

function ContinueA()
{
	pstop=0;
	NextTimeA();
}

function NextA()
{
	if (at!=0) { clearTimeout(at); }
	NextTimeA();
}

function PreviousA()
{
	t=t-2;
	if (t==-1) { 
		t=2;
	}
	NextA();					
	
}

function FasterA()
	{
	speed=(speed*2);	
	ShowSpeed();
	NextA()
	}

function SlowerA()
	{
	speed=(speed*.50);
	ShowSpeed();
	if (pstop==0) { PauseA(); }
	}

function ShowSpeed()
	{
	document.all.Speed.innerHTML ="Speed " +String(speed.toFixed(0)/10)+"x";	
	}

function ShowSlidesA(val1,time1,val2,time2,val3,time3)
{
	v1 = val1;
	v2 = val2;
	v3 = val3;
	t1 = (time1*1000);
	t2 = (time2*1000);
	t3 = (time3*1000);
	t = 0;
	NextTimeA();
}

// **************************************************************************************************************************************


var Bwin;
var BintervalID;
var Bx = 200, By = 200, Bw=200, Bh=200;  // Window position and size
var dx = 200, dy = 200;              // Window velocity   
var Binterval = 5000;              // Milliseconds between updates
var Bt=0
var Bv1="";
var Bv2="";
var Bv3="";
var Bt1=0;
var Bt2=0;
var Bt3=0;

function NextTimeB() 
{ 
 Bt=(Bt+1); 
 if (Bt==4) {
	Bt=1;
 }
 if (Bt==1)  {
 	ShowWebSiteB(Bv1); 
 	BintervalID=setTimeout("NextTimeB();",Bt1);
 }
 if (Bt==2) {
 	ShowWebSiteB(Bv2); 
	BintervalID=setTimeout("NextTimeB();",Bt2);
	}
 if (Bt==3) {
 	ShowWebSiteB(Bv3); 
	BintervalID=setTimeout("NextTimeB();",Bt3);
	}
}


function ShowSlidesB(val1,time1,val2,time2,val3,time3)
{
	Bv1 = val1;
	Bv2 = val2;
	Bv3 = val3;
	Bt1 = (time1*1000);
	Bt2 = (time2*1000);
	Bt3 = (time3*1000);
	Bt = 0;
	NextTimeB();
}


					 
function pageWidth() {return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?       document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;} 
function pageHeight() {return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;} 
function posLeft() {return typeof window.pageXOffset != 'undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;} 
function posTop() {return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;} 
function posRight() {return posLeft()+pageWidth();} 
function posBottom() {return posTop()+pageHeight();}

closetime = 120; // Close window after __ number of seconds?
function Start(URL, WIDTH, HEIGHT) {
windowprops = "resizable=yes,scrollbars=yes,left=200,top=200,width=" + WIDTH + ",height=" + HEIGHT;
win = window.open(URL, "win", windowprops);
if (closetime) setTimeout("win.close();", closetime*1000);
win.moveTo(x,y);
// Use setInterval() to call the bounce() method every interval 
//intervalID  = window.setInterval("bounce()", interval);
}
function DoPopup() {
url = "http://www.easychild.com/professional-opinion.htm";
width = 400;  // width of window in pixels
height = 500; // height of window in pixels
delay = 2;    // time in seconds before popup opens
//timer = setTimeout("Start(url,width, height)", delay*1000);
}

function DoExitPopup() {
if (win.open) { win.close(); }
url = "http://www.store.encouragestore.com";
closetime=0;
width = 700;  // width of window in pixels
height = 500; // height of window in pixels
delay = 0;    // time in seconds before popup opens
window.open(url)
timer = setTimeout("Start(url,width, height)", delay*1000);
}

// This function moves the window by (dx, dy) every interval ms.
// It bounces whenever the window reaches the edge of the screen.
function bounce() {
    // If the user closed the window, stop the animation.
    if (win.closed) {
        clearInterval(intervalID);
        return;
    }

    // Bounce if we have reached the right or left edge.
    if ((x+dx > (screen.availWidth - w)) || (x+dx < 0)) dx = -dx;

    // Bounce if we have reached the bottom or top edge.
    if ((y+dy > (screen.availHeight - h)) || (y+dy < 0)) dy = -dy;

    // Update the current position of the window.
    x += dx;
    y += dy;

    // Finally, move the window to the new position.
    win.moveTo(x,y);
}
