var ProgressGIF = "";
/**************************************************************************************************************************/
/* Javascript Window Popup thingy */
var winMaxWidth = 0,
winMaxHeight = 0,
winTitle = "",
winContent = "",
winIncrements = 0,
winTimer = 0,
winLoops = 0,
winTimerMethod;
function OpenWindowAnimate(wWidth, wHeight, wTitle, wContent) {
//OpenWindow(wWidth,wHeight,wTitle,wContent,300,10);
OpenWindow(768, 561, wTitle, wContent, 300, 10);
}
var getItem = 0;
function itemWindow(i) {
OpenWindow(768, 556, "", ProgressGIF + " Loading...", 300, 10);
getItem = i;
itemWindow_Title();
}
function itemWindow_Title() {
var i = getItem;
var thr = getAjax(); // force local variable
thr.onreadystatechange = function() {
if (thr.readyState == 4) {
if (thr.status == 200) { //ok result
var r = thr.responseText; // get web data
winTitle = r;
if (document.getElementById('iTitle')) {
document.getElementById('iTitle').innerHTML = winTitle;
}
itemWindow_Body();
}
}
};
thr.open("GET", "https://" + homeDomain + "/pages/include_74_ajax.php?getItemTitleForCatalogue=" + i, true);
thr.send(null);
}
function itemWindow_Body() {
var i = getItem;
var bhr = getAjax(); // force local variable
bhr.onreadystatechange = function() {
if (bhr.readyState == 4) {
if (bhr.status == 200) { //ok result
var r = bhr.responseText; // get web data
winContent = r;
if (document.getElementById('iBody')) {
document.getElementById('iBody').innerHTML = winContent;
}
}
}
};
bhr.open("GET", "https://" + homeDomain + "/pages/include_74_ajax.php?getItemBodyForCatalogue=" + i, true);
bhr.send(null);
}
function OpenWindow(wWidth, wHeight, wTitle, wContent, wHowLongMS, wIncrements) {
winMaxWidth = 0;
winMaxHeight = 0;
winTitle = "";
winContent = "";
winIncrements = 0;
winTimer = 0;
winLoops = 0;
// turn on background
DoBackground();
// save variables
winMaxWidth = wWidth;
winMaxHeight = wHeight, winTitle = wTitle;
winContent = wContent;
// calculate timer and increments
winIncrements = wIncrements;
winTimer = Math.floor(wHowLongMS / wIncrements);
winLoops = 1;
var nWidth = Math.floor((winMaxWidth / winIncrements) * winLoops);
var nHeight = Math.floor((winMaxHeight / winIncrements) * winLoops);
OpenWindow_Dummy(nWidth, nHeight, "", "");
winTimerMethod = setTimeout(OpenWindow_Timer, winTimer);
}
function OpenWindow_Timer() {
clearTimeout(winTimerMethod); // stop timer
winLoops++;
if (winLoops == winIncrements) { // we have full window at this time
OpenWindow_Dummy_New(winMaxWidth, winMaxHeight, winTitle, winContent);
} else {
var nWidth = Math.floor((winMaxWidth / winIncrements) * winLoops);
var nHeight = Math.floor((winMaxHeight / winIncrements) * winLoops);
OpenWindow_Dummy(nWidth, nHeight, "", "");
winTimerMethod = setTimeout(OpenWindow_Timer, winTimer);
}
}
function OpenWindow_Dummy(wWidth, wHeight, wTitle, wContent) { /* old window */
// width, height, title, content
var w = document.getElementById('PopupWindow');
w.innerHTML = '';
w.style.display = 'none';
// set window dimensions, center it on screen
var extraPadding = 3;
var newWidth = 0,
newHeight = 0;
newWidth = (wWidth + (extraPadding * 2));
newHeight = (wHeight + 16 + 1 + (extraPadding * 3)); // window area + 16[top] + 1[border between top/bottom] + 3 pads [top,middle,bottom]
w.style.width = newWidth + "px";
w.style.height = newHeight + "px";
w.style.marginTop = "-" + (newHeight / 2) + "px";
w.style.marginLeft = "-" + (newWidth / 2) + "px";
// contents
var wrapper = "";
wrapper = "
" + wTitle + "
" + "" + "" + "" + wContent + "
";
w.innerHTML = wrapper;
w.style.display = 'block';
}
function OpenWindow_Dummy_New(wWidth, wHeight, wTitle, wContent) {
// width, height, title, content
var popupWindow = document.getElementById('PopupWindow');
popupWindow.innerHTML = '';
popupWindow.style.display = 'none';
// set window dimensions, center it on screen
wWidth = 768;
wHeight = 22 + 512 + 22; // top, mid, bottom
popupWindow.style.border = "0"; // turn off outside border
popupWindow.style.width = wWidth + "px";
popupWindow.style.height = wHeight + "px";
popupWindow.style.marginTop = "-" + Math.floor(wHeight / 2) + "px";
popupWindow.style.marginLeft = "-" + Math.floor(wWidth / 2) + "px";
// She's got it like this, with specific padding and such, no borders
// [title] [close]
// [ content ]
// contents
var wContainer = "";
// top, "Title"
wContainer = "" + "
" + "
" + wTitle + "
" + "
" + "
" + "
" + "
" + wContent + "
" + "
";
popupWindow.innerHTML = wContainer;
popupWindow.style.display = 'block';
}
/**************************************************************************************************************************/
function Undo3DPreview2() {
var w = document.getElementById('tdPreviewArea').innerHTML = "";
}
function CloseWindow2() {
var w = document.getElementById('PopupWindow2');
w.innerHTML = '';
w.style.display = 'none';
document.getElementById('popupBackground2').style.display = 'none';
}
function DoBackground2() {
var w = document.getElementById('popupBackground2');
wWidth = document.body.scrollWidth;
wHeight = document.body.scrollHeight;
w.style.width = wWidth + "px";
w.style.height = wHeight + "px";
w.style.marginTop = "-" + (wHeight / 2) + "px";
w.style.marginLeft = "-" + (wWidth / 2) + "px";
w.style.display = 'block';
if (document.getElementById('swfUploader')) {
document.getElementById('swfUploader').style.visibility = 'hidden';
}
}
function OpenWindow2(wWidth, wHeight, wContent) { /* old window */
// width, height, title, content
var w = document.getElementById('PopupWindow2');
w.innerHTML = '';
w.style.display = 'none';
// set window dimensions, center it on screen
w.style.width = wWidth + "px";
w.style.height = wHeight + "px";
w.style.marginTop = "-" + (wHeight / 2) + "px";
w.style.marginLeft = "-" + (wWidth / 2) + "px";
// contents
w.innerHTML = wContent;
w.style.display = 'block';
}
function doGiftProcess(i) {
var xhr = getAjax(); // force local variable
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status == 200) { //ok result
var r = xhr.responseText; // get web data
OpenWindow2(400, 167, r);
}
}
};
xhr.open("GET", "https://" + homeDomain + "/pages/include_74_ajax.php?inquireGift=" + i, true);
xhr.send(null);
Undo3DPreview2();
DoBackground2();
}
function iGiveAPropGift(i) {
// check for giftee in gifteeSelect
var giftee = document.getElementById('gifteeSelect').options[document.getElementById('gifteeSelect').selectedIndex].value;
if (giftee == "0") {
alert("You need to search and select a person to send a gift to.");
return;
}
CloseWindow2();
DoBackground2();
var xhr = getAjax(); // force local variable
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status == 200) { //ok result
var r = xhr.responseText; // get web data
OpenWindow2(400, 167, r);
}
}
};
xhr.open("GET", "https://" + homeDomain + "/pages/include_74_ajax.php?makeGiftHorseInMouth=" + i + "&for=" + giftee, true);
xhr.send(null);
}
function searchGifteeName() {
// input: gifteeSearch
// output: gifteeSelect
var q = document.getElementById('gifteeSearch').value;
if (q.length > 1) {
document.getElementById('gifteeSearch').disabled = true;
var xhr = getAjax(); // force local variable
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status == 200) { //ok result
// clear select, add blank element
document.getElementById('gifteeSelect').innerHTML = "";
var cnt = 0;
document.getElementById('gifteeSearch').disabled = false;
document.getElementById('gifteeSearch').focus();
var r = xhr.responseText; // get web data
var names = JSON.parse(r);
for (var id in names) {
if (names.hasOwnProperty(id)) {
// add some DOM
new_option = document.createElement('option');
new_option.text = names[id];
new_option.value = id;
document.getElementById('gifteeSelect').add(new_option);
cnt++;
}
}
if (cnt == 0) {
var new_option = document.createElement('option');
new_option.text = "-- None Found --";
new_option.value = "0";
new_option.selected = true;
document.getElementById('gifteeSelect').add(new_option);
}
}
}
};
xhr.open("GET", "https://" + homeDomain + "/pages/include_74_ajax.php?gifteeNameSearch=" + q + "&r=" + Math.random(), true);
xhr.send(null);
} else {
document.getElementById('gifteeSelect').innerHTML = "";
var new_option = document.createElement('option');
new_option.text = "-- Type to search --"; new_option.value = "0";
document.getElementById('gifteeSelect').add(new_option);
}
}
function doBuyProcess(i) {
var xhr = getAjax(); // force local variable
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status == 200) { //ok result
var r = xhr.responseText; // get web data
OpenWindow2(400, 167, r);
}
}
};
xhr.open("GET", "https://" + homeDomain + "/pages/include_74_ajax.php?inquirePurchase=" + i, true);
xhr.send(null);
Undo3DPreview2();
DoBackground2();
}
function gimmieItemFoMyMoneh(i) {
CloseWindow2();
DoBackground2();
var xhr = getAjax(); // force local variable
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status == 200) { //ok result
var r = xhr.responseText; // get web data
OpenWindow2(400, 167, r);
}
}
};
xhr.open("GET", "https://" + homeDomain + "/pages/include_74_ajax.php?makePurchase=" + i, true);
xhr.send(null);
}
function categoriesToggle() {
var c = document.getElementById('categoryHeader').className;
if (c.indexOf('catCategoriesOn_228x43') == -1) {
ReplaceClass('categoryHeader', 'catCategoriesOff_228x43', 'catCategoriesOn_228x43');
document.getElementById('categoryArea').style.display = 'block';
} else {
ReplaceClass('categoryHeader', 'catCategoriesOn_228x43', 'catCategoriesOff_228x43');
document.getElementById('categoryArea').style.display = 'none';
}
}
function filterToggle() {
if (document.getElementById('filterShow').style.display == 'block') {
document.getElementById('filterShow').style.display = 'none';
} else {
document.getElementById('filterShow').style.display = 'block';
}
}
function doSearchEvnt(evnt) {
if (evnt.keyCode == 13) {
doSearch();
}
}
function doSearch() {
var propmasterURI = "",
categoryURI = "",
queryURI = "",
priceURI = "";
if (globalPropmaster != "0") {
propmasterURI = "&propmaster=" + globalPropmaster;
}
if (globalCategory.length != "") {
categoryURI = "&category=" + globalCategory;
}
if (document.getElementById('priceSome').checked) {
priceURI = "&price=" + document.getElementById('priceMin').value + ":" + document.getElementById('priceMax').value;
}
var q = document.getElementById('searchText').value;
if (q.length > 0) {
queryURI = "&query=" + encodeURIComponent(q);
}
document.location = "https://" + homeDomain + "/?page=74" + propmasterURI + categoryURI + priceURI + queryURI;
}
function gotoPropmaster() {
id = document.getElementById('propmasterSelect').options[document.getElementById('propmasterSelect').selectedIndex].value;
if (id != 0) {
document.location = "https://" + homeDomain + "/?page=74&propmaster=" + id;
}
}
function startReportOnItem(item) {
CloseWindow();
DoBackground2();
var itemReport;
itemReport = "";
itemReport += "";
itemReport += "";
itemReport += "
";
itemReport += "";
OpenWindow2(400, 350, itemReport);
}
function submitReportOnItem() {
var item = document.getElementById('some_item').value;
var report = document.getElementById('some_complaint').value;
document.getElementById('complaint_area').innerHTML = ProgressGIF + " Working...";
// make an ajax post
var xhr = getAjax(); // force local variable
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status == 200) { // "done"
CloseWindow2();
}
}
};
var p = "postReport=1&reportItem=" + item + "&reportData=" + encodeURIComponent(report);
xhr.open("POST", "https://" + homeDomain + "/pages/include_74_ajax.php", true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("Content-length", p.length);
xhr.send(p);
}