var imageDivIds = new Array("img1", "img2", "img3", "img4", "img5", "img6", "img7", "img8");
var copyImageDivIds = imageDivIds.slice(0);
var imageUrls;
var copyImageUrls;
var t;
var isDialogBoxOpen = false;
var currentReadMoreId;
var currentDialogBoxId;
function setupImages(){
var imageListJson = getUrlString('/db.aspx?t=homepageimages&enabledop=%3D&enabledquery=Y&selectcolumns=image&vid=35');
while(imageListJson .indexOf(", }") > 0){
imageListJson = imageListJson .replace(", }","}");
}
while(imageListJson .indexOf(",]}") > 0){
imageListJson = imageListJson .replace(",]}","]}");
}
try {
var imageList = YAHOO.lang.JSON.parse(imageListJson);
}
catch (e) {
alert("(Error Retrieving Home Page Images) -- " + e);
}
imageUrls = imageList.homepageimages;
copyImageUrls = imageUrls.slice(0);
for (var i = 0; i < imageDivIds.length; i++) {
imageUrlLocation = Math.floor((copyImageUrls.length) * Math.random());
selectedImageUrl = copyImageUrls.splice(imageUrlLocation, 1)[0];
document.getElementById(imageDivIds[i]).innerHTML = "";
}
// startRotatingImages();
}
function startRotatingImages(){
YAHOO.util.Dom.removeClass("dialog", "dialog_div_open");
if (copyImageDivIds.length == 0)
copyImageDivIds = imageDivIds.slice(0);
if (copyImageUrls.length == 0)
copyImageUrls = imageUrls.slice(0);
divIdLocation = Math.floor((copyImageDivIds.length) * Math.random());
imageUrlLocation = 0; //Math.floor((copyImageUrls.length) * Math.random());
selectedDivId = copyImageDivIds.splice(divIdLocation, 1);
selectedImageUrl = copyImageUrls.splice(imageUrlLocation, 1)[0];
fadeOut = new YAHOO.util.Anim(selectedDivId, {
opacity: {
to: 0
}
}, 0.5);
fadeIn = function(){
document.getElementById(selectedDivId).innerHTML = "";
fadeInImage = new YAHOO.util.Anim(selectedDivId, {
opacity: {
to: 1
}
}, 3);
fadeInImage.animate();
}
fadeOut.animate();
fadeOut.onComplete.subscribe(fadeIn);
t = setTimeout("startRotatingImages()", 3000);
}
function stopRotatingImages(){
clearTimeout(t);
}
function openDialogBox(readMoreId, dialogBoxId, onfocusId){
if (isDialogBoxOpen) {
closeDialogBox();
}
stopRotatingImages();
currentDialogBoxId = dialogBoxId;
currentReadMoreId = readMoreId;
YAHOO.util.Dom.setStyle(dialogBoxId, 'display', 'inline');
if (readMoreId) {
YAHOO.util.Dom.setStyle(readMoreId, 'color', 'gray');
YAHOO.util.Dom.setStyle(readMoreId + "_link", 'display', 'none');
}
if (onfocusId) document.getElementById(onfocusId).focus();
isDialogBoxOpen = true;
}
function closeDialogBox(){
YAHOO.util.Dom.setStyle(currentDialogBoxId, 'display', 'none');
if (currentReadMoreId) {
YAHOO.util.Dom.setStyle(currentReadMoreId, 'color', '');
YAHOO.util.Dom.setStyle(currentReadMoreId + "_link", 'display', 'block');
}
// startRotatingImages();
isDialogBoxOpen = false;
}
function doLogin(){
var serializedForm = AjaxRequest.serializeForm(document.loginForm);
serializedForm = serializedForm + "&return=uid";
var xmlHttp;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp = new XMLHttpRequest();
//alert(xmlHttp)
}
catch (e) {
// Internet Explorer
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
alert("Your browser does not support AJAX!");
return false;
}
}
}
var arui = new Date();
xmlHttp.open("POST", "/login.aspx?" + serializedForm + '&AjaxRequestUniqueId=' + arui.getTime(), false);
xmlHttp.send(null);
var responseText = xmlHttp.responseText;
if (responseText.indexOf("Error:") > -1) {
document.getElementById("loginError").innerHTML = "Invalid Username or Password
";
document.getElementById("txtPassword").value = "";
return false;
}
else
return true;
}