// JavaScript Document

function callAll() {
setTheDivStyle();
moveImage();
}

//pop up code
function newwindow() { //popup in new window behind current window

document.cookie = 'later=later;'
TheNewWin = window.open("http://www.acssw.org/GetConnected.taf",'TheNewpop','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width=1000,height=700');

TheNewWin.blur()[0].focus();
}

var poptext = "";

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function closeDiv() {
	moveBack()
}

function SetCookie() {
	var theDate = new Date();
	var oneMonth = new Date( theDate.getTime() + 2536000000 );
	var expiryDate = oneMonth.toGMTString();
	document.cookie = 'setCookie=No; expires='+expiryDate;
	moveBack()
}

function setTheDivStyle()
{
if(!readCookie('setCookie'))
{
document.getElementById("ACSSWPop").style.display="block";
}
else
{
document.getElementById("ACSSWPop").style.display="none";
}
}

//animation code
var screenW = '';
var screenH = '';

 screenW = (screen.width/2)-250;
 screenH = (screen.height/2)-300;

var x = screenW; //Starting Location - left
var y = -320; //Starting Location - top

var dest_x = screenW; //Ending bottom Location - left
var dest_y = screenH; //Ending bottom Location - top

var i = screenW+1; //Ending top Location - left
var z = -320; //Ending top location - top

//Check browser to change speed of popup for differnt browsers
if (navigator.appName=="Microsoft Internet Explorer" || navigator.appName=="Opera")
 {
var intervalB = 55;
var intervalI = 15;
var microsecondsB = 2;
var microsecondsI = 2;
 }
 else
  {
var intervalB = 30;
var intervalI = 10;
var microsecondsB = 15;
var microsecondsI = 20;
   }
//end browser check

function moveBack() {
	var interval = intervalB; //Move n px every initialization
	
		//Keep on moving the image till the target is achieved
	if(dest_x>=i) dest_x = dest_x - interval;
	if(dest_y>=z) dest_y = dest_y - interval;
	
	//Move the image to the new location
	document.getElementById("ACSSWPop").style.top  = dest_y+'px';
	document.getElementById("ACSSWPop").style.left = dest_x+'px';

	if ((dest_x-interval >= i) || (dest_y-interval >= z)) {
		//Keep on calling this function every n microsecond 
		//	till the target location is reached
		window.setTimeout('moveBack()',microsecondsB);
	}
		else
	{
	document.getElementById("ACSSWPop").style.display="none";
	}
}

function moveImage() {

	var interval = intervalI; //Move n px every initialization
	
	//Keep on moving the image till the target is achieved
	if(x<dest_x) x = x + interval; 
	if(y<dest_y) y = y + interval;
	
	//Move the image to the new location
	document.getElementById("ACSSWPop").style.top  = y+'px';
	document.getElementById("ACSSWPop").style.left = x+'px';

	if ((x+interval < dest_x) || (y+interval < dest_y)) {
		//Keep on calling this function every n microsecond 
		//	till the target location is reached
		window.setTimeout('moveImage()',microsecondsI);
	}
}



