Calendar View List View Reports Add New | Edit Delete Attach Files... | Previous Next
id:
27

Content:
var imageDivIds = new Array("img1", "img2", "img3", "img4", "img5", "img6", "img7", "img8");
var copyImageDivIds = imageDivIds.slice(0);
var imageUrls;
var copyImageUrls;
var stopRotating = false;
var t;
var isDialogBoxOpen = false;
var currentReadMoreId;
var currentDialogBoxId;
var paginationHtml = "";
var currentPage = 1;
var genrelist = '';
function toggleGenre(id,checked){
if (checked)
genrelist = genrelist + ',' + id + ',';
else
genrelist = genrelist.replace(',' + id + ',','');
displayPage(1);
}
function showDetail(id){
document.getElementById('itemDetail').innerHTML = '';
openDialogBox(null, "itemDetail");
getContent("db.aspx?t=inventory&id=" + id + "&vid=itemDetail&noheader=true&nofooter=true","itemDetail",true);
document.getElementById('images').scrollTop=0;
return false;

}
function createItemListFooter () {
paginationHtml = "";
var genres = '';
if (genrelist != '')
genres='&genreop=in&genrequery=' + genrelist;
paginationJson = getUrlString('db.aspx?t=inventory&noheader=true&nofooter=true&vid=inventorythumbs&_paginginfo=json&pagesize=4&sold=N&available=Y&gotopage=' + currentPage + genres);

try {
var paginationInfo = YAHOO.lang.JSON.parse(paginationJson).paginationInfo;
}
catch (e) {
alert(e);
}

numPages = paginationInfo.numPages;

currentPage = paginationInfo.currentPage;
numItems = paginationInfo.numRecords;

paginationHtml = paginationHtml + " ";

for (var i = 1; i <= paginationInfo.numPages ; i++) {
if (i == currentPage) {
paginationHtml = paginationHtml + "";
} else {
paginationHtml = paginationHtml + " ";
}
}

if (paginationInfo.numPages > 1 && currentPage < numPages)
paginationHtml = paginationHtml + "";

document.getElementById("paging").innerHTML = paginationHtml;
}

function nextPage() {
displayPage (currentPage + 1);
}

function previousPage() {
displayPage (currentPage - 1);
}

function displayPage(thepage){
closeDialogBox();
var genres = '';
if (genrelist != '')
genres='&genreop=in&genrequery=' + genrelist;
var el = document.getElementById("inventorylist");
if (el.innerHTML == '')
genres=genres+'&qid=browseinventory';

var html = getUrlString("db.aspx?t=inventory&noheader=true&pagesize=4&sold=N&available=Y&nofooter=true&vid=inventorythumbs&gotopage=" + thepage + genres);
el.innerHTML=html;
currentPage = thepage;
createItemListFooter();
}

function browseInventory(){
stopRotatingImages();
YAHOO.util.Dom.removeClass("dialog", "dialog_div_open");
clearImages(7);
copyImageDivIds = new Array();
currentPage = 1;
displayPage(currentPage);
}
function showInventory(){
document.getElementById("genrelist").style.display="block";
document.getElementById("inventorylist").style.display="block";
getContent("db.aspx?t=genre&qid=genrewithinventory&noheader=true&nofooter=true&vid=genrefilter","genrelist",true);
}
function clearImages(item){
var img = imageDivIdsitem;

fadeOut = new YAHOO.util.Anim(img, {
opacity: {
to: 0
}
}, 0.5);
removeImage = function(){
//alert(img);
document.getElementById(img).style.display="none";
}
fadeOut.onComplete.subscribe(removeImage);

fadeOut.animate();
if (item >= 0)
t = setTimeout("clearImages(" + (item - 1) + ")", 100);
else
fadeOut.onComplete.subscribe(showInventory);

} //end clearImages()

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(imageDivIdsi).innerHTML = "";
}

startRotatingImages();
}

function startRotatingImages(){
if (stopRotating)
return false;

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(){
if (stopRotating)
return false;
document.getElementById(selectedDivId).innerHTML = "";
fadeInImage = new YAHOO.util.Anim(selectedDivId, {
opacity: {
to: 1
}
}, 3);
fadeInImage.animate();
}

fadeOut.animate();
if (!stopRotating){
fadeOut.onComplete.subscribe(fadeIn);
t = setTimeout("startRotatingImages()", 3000);
}
}

function stopRotatingImages(){
stopRotating = true;
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)) 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;

}



createdate:
1/8/2009 12:16:46 PM

createid:
duston.r.mounts

Type:
JavaScript

Include Header:


Eval Square Brackets:


Replace Line Breaks: