// JavaScript Document

var delay = "2";  //############# How long before window appears (seconds)
var winw = "400"; //############# How wide should your window be (pixels)
var winh = "300"; //############# How tall should the window be (pixels)
var repeat = "1"; //Do you want visitor to be able to re-open window after closing?


//############# published at: scripts.tropicalpcsolutions.com


var ie=(document.all);
var ns=(document.layers);
var ns6=(document.getElementById && !ie);
var calculate=ns? "" : "px"
function loadElement(){
if(!ns && !ie && !ns6) return;
if(ie) popup=eval('document.all.elementDiv.style');
else if(ns) popup=eval('document.layers["elementDiv"]');
else if(ns6) popup=eval('document.getElementById("elementDiv").style');
if (ie||ns6) popup.visibility="visible";
else popup.visibility ="show";
displayElement()
}

function loadElement2(){
if(!ns && !ie && !ns6) return;
if(ie) popup=eval('document.all.elementDiv2.style');
else if(ns) popup=eval('document.layers["elementDiv2"]');
else if(ns6) popup=eval('document.getElementById("elementDiv2").style');
if (ie||ns6) popup.visibility="visible";
else popup.visibility ="show";
displayElement()
}

function displayElement(){
var agent=navigator.userAgent.toLowerCase();
if (ie){
	documentWidth = (centerElement().offsetWidth)/2+centerElement().scrollLeft-(winw/2);
	documentHeight = (centerElement().offsetHeight)/2+centerElement().scrollTop-(winh/2);
}
else if (ns){
	documentWidth=window.innerWidth/2+window.pageXOffset-(winw/2);
	documentHeight=window.innerHeight/2+window.pageYOffset-(winh/2);
}
else if (ns6){
	documentWidth=self.innerWidth/2+window.pageXOffset-(winw/2);
	documentHeight=self.innerHeight/2+window.pageYOffset-(winh/2);
}
popup.left = documentWidth+calculate;
popup.top = documentHeight+calculate;
setTimeout("displayElement()",100);
}
function centerElement(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function closeElement(){
	if (ie||ns6) { popup.display="none"; } 
	else { popup.visibility ="hide"; }
        if (repeat == 1) { location.replace; }
}

var timeDelay = 20; // change delay time in seconds
var Pix = new Array
("images/home7.jpg" 
,"images/home6.jpg" 
,"images/home5.jpg" 
,"images/home4.jpg" 
,"images/home3.jpg" 
,"images/home2.jpg" 
,"images/home1.jpg" 
);
var howMany = Pix.length;
timeDelay *= 200;
var PicCurrentNum = 0;
var PicCurrent = new Image();
PicCurrent.src = Pix[PicCurrentNum];
function startPix() {
setInterval("slideshow()", timeDelay);
}
function slideshow() {
PicCurrentNum++;
if (PicCurrentNum == howMany) {
PicCurrentNum = 0;
}
PicCurrent.src = Pix[PicCurrentNum];
document["ChangingPix"].src = PicCurrent.src;
}

// function to load the calendar window.
function ShowCalendar(FormName, FieldName) {
  window.open("../admin/window_datepopup.cfm?FormName=" + FormName + "&FieldName=" + FieldName, "CalendarWindow", "width=250,height=250");
}


function confirmation(msg, page) {
	var answer = confirm(msg)
	if (answer)
	{
		//alert("Bye bye!")
		window.location = page;
	}	
}
