var helpWindow = null;
var submitcount=0;
function adobeWarning() {
return confirm('This will download a file to your computer that you can view or print at your convenience. Click OK to download the document.');
}
function blockDoubleClick(x) {
if (submitcount === 0) {
submitcount++;
return true;
} else {
if (x != 'silent') {
alert("Your information is being sent. It may take a moment (or two). Thanks for your patience.");
}
return false;
}
}
function checkSearchBox(x) {
var searchValue = document.mainMenuForm.search.value;
if (x === 0) {
if (searchValue == 'Search') {document.mainMenuForm.search.value = '';}
} else if (x == 1) {
if (searchValue.length === 0) {document.mainMenuForm.search.value = 'Search';}
} else {
if (searchValue.length === 0 || searchValue == 'Search') {
document.mainMenuForm.search.focus();
alert ('Please enter something for which to search.');
return false;
//return false;
} else {
document.mainMenuForm.submit();
}
}
return true;
}
function resetClickBlock() {
submitcount = 0;
return true;
}
function gotoUrl(url) {
if (url !== "") {
// if (url.indexOf('rosariesAndKits') >= 0) {
// customWindow=window.open('http://www.rosaryshop.com/rosariesAndKits.php/id/service@rosaryshop.com','CustomWindow','resizable,width=600,height=400,screenX=20,screenY=20,left=20,top=20,scrollbars,dependent');
// customWindow.focus();
// } else if (url.indexOf('express') >= 0) {
// expressWindow=window.open("http://www.rosaryshop.com/expressOrder.php/","ExpressOrder","resizable,width=300,height=200,screenX=20,screenY=20,left=20,top=20,scrollbars,dependent");
// expressWindow.focus();
// } else if (url.indexOf('fx') >= 0) {
// fxWindow=window.open("http://www.rosaryshop.com/fx.php/","ExpressOrder","resizable,width=300,height=200,screenX=20,screenY=20,left=20,top=20,scrollbars,dependent");
// fxWindow.focus();
// } else
var finalURL;
if (url.indexOf('http') >= 0) {
finalURL = url;
location = finalURL;
} else {
finalURL = 'http://www.rosaryshop.com'+url;
location = finalURL;
}
}
}
function helpWindow(url) {
if (!helpWindow || helpWindow.closed) {
helpWindow = window.open(url,"helpWindow","width=200,height=400");
} else {
helpWindow.focus();
}
}
function OpenCertDetails()
{
thewindow = window.open('https://www.thawte.com/cgi/server/certdetails.exe?code=USTHER230', 'anew', config='height=400,width=450,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=yes');
}
//
//
// AJAX javascript debugging based on routine from Jim Plush http://www.litfuel.net/plush/?postid=94
// Modified by SHM
window.onerror = function(msg, err_url, line) {
// create the post data string
var POSTData = 'msg=' + msg + '&err_url=' + encodeURI(err_url) + '&line=' + line + '&href=' + encodeURI(window.location.href) + '&browser=' + navigator.userAgent;
var s = new XMLHTTP("error_server.php?");
// var xmlDoc = s.call(POSTData, processReqChange);
var xmlDoc = s.call(POSTData, function() {return true;});
};
function XMLHTTP(url)
{
this.url = url;
this.headers = new Array();
this.async = true;
this.method = "POST";
this.req = null;
this.debug_flag = false;
this.deb_str = ''; // debug string for application debugging
return this;
}
XMLHTTP.prototype.debug = function(str)
{
if(this.debug_flag){
document.write( str + "
" );
}
};
// xmlhttp wrapper method
/**
*@param string methodName this is the FSService method you want to call on the engine
*@param mixed arguments passed as an array that contain the options you're passing to the methodName
*@responseHandler string the name of the javascript function you want to handle the response back from the server
*@useSOAP bool whether to use a SOAP request or to use regular POST/GET request
*/
XMLHTTP.prototype.call = function(arguments, responseHandler)
{
this.request = arguments;
// moz XMLHTTPRequest object
if (window.XMLHttpRequest)
{
this.req = new XMLHttpRequest();
this.deb_str += "Mozilla Version of XMLHTTPRequest\r\n";
}
// IE/Windows ActiveX version
else if (window.ActiveXObject)
{
this.req = new ActiveXObject("Microsoft.XMLHTTP");
this.deb_str += "Microsoft Version of XMLHTTPRequest\r\n";
}
// set response handler
this.req.onreadystatechange = responseHandler;
// open connection
this.req.open(this.method, this.url, this.async);
// set headers
if(this.headers.length > 0)
{
for(var i in this.headers)
{
this.req.setRequestHeader( i, this.headers[i]);
}
}
this.req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
// send request
if(this.method == 'POST')
{
this.req.send(arguments);
}
else
{
this.req.send(null);
}
if(this.async == false)
{
return this.req.responseXML;
}
return true;
};
// DEBUG METHOD
XMLHTTP.prototype.debugTransaction = function()
{
var req = document.getElementById("request");
if(req) {
req.value = this.request;
}
var resp = document.getElementById("response");
if(resp) {
resp.value = this.req.responseText;
}
var deb = document.getElementById("debug");
if(deb) {
deb.value = this.deb_str;
}
};
// Custom Rosary Design Page Code
// Except where noted otherwise, all code is the work product of The Rosary Shop and protected by copyright
// I like the indexOf extension for arrays, but some browsers don't support it
// From Mozilla
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(elt /*, from*/) {
var len = this.length;
var from = Number(arguments[1]) || 0;
from = (from < 0) ? Math.ceil(from) : Math.floor(from);
if (from < 0) {from += len;}
for (; from < len; from++) {
if (from in this && this[from] === elt) {return from;}
}
return -1;
};
}
function activeRowIndexes() {
var form = document.partsForm;
var i;
var filterText;
var resultsArray = [];
for (i=0; i
Reviewing the selections....<\/p>';
checkLocation('messageDiv');
// Check selected materials
// Classes are OX,NS,SP ; GP ; GF,VM ; SS ; KT
var metalNames = {
OX_NS_SP : 'Silver Plated',
GP : 'Gold Plated',
GF_VM : 'Gold Filled / Vermeil',
SS : 'Sterling Silver',
KT : 'Solid Gold'
};
var metalSelected = {
OX_NS_SP : 0,
GP : 0,
GF_VM : 0,
SS : 0,
KT : 0
};
var itemMetal;
var re = /(OX|SP|NS|GP|SS|GF|VM|KT)/;
var match;
var key;
var pn;
var form = document.partsForm;
var rowIndexes = Array('connectors').concat(activeRowIndexes());
// For each selected row
for (var i=0; i You have selected differing metal materials for your items. These include:<\/p>\n The metal is indicated by a two letter code in the item names as follows:<\/p>\n';
messageOut += ' SP, OX or NS = Silver Plated You are welcome to go back and make changes, or proceed and add your design to the shopping basket.<\/p>\n';
messageOut += '';
e.innerHTML = messageOut;
checkLocation('messageDiv');
return false;
}
addToBasket2(x);
}
function addToBasket2(x) {
var e = document.getElementById('messageDiv');
var highestFlag = checkAllInputs();
if (highestFlag <= 2) {
e.innerHTML = ' Adding your custom chaplet to your shopping basket....<\/p>';
checkLocation('messageDiv');
addToBasket3(x);
return true;
}
if (provision == 'kit') {
e.innerHTML = ' A little warning here.<\/p> Your design is missing items that you\'ll need to complete the chaplet. They are noted with red marks next to them.<\/p> You can proceed with the order as it is, or go back and make some changes.<\/p>';
} else {
e.innerHTML = ' One or more required items are missing.<\/p> Please make selections for any red-flagged items and then you will be able to complete this purchase.<\/p>';
}
checkLocation('messageDiv');
}
function addToBasket3(x) {
updateMainVars();
var basketPost = updateTotalPrices();
var e = document.getElementById('messageDiv');
if (x >= 0) {
basketPost += 'replaces=' + x;
e.innerHTML = ' Saving the changes to your shopping basket...<\/p>';
} else {
e.innerHTML = ' Adding the chaplet to your shopping basket...<\/p>';
}
checkLocation('messageDiv');
// alert(basketPost);
var http = GetXmlHttpObject();
var url = 'http://www.rosaryshop.com/ezshop.php';
http.open('POST',url,true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", basketPost.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = function() {
if(http.readyState == 4 && http.status == 200) {
// OpenWindow=window.open("", "newwin", "height=250, width=250,toolbar=no,scrollbars="+scroll+",menubar=no");
// OpenWindow.document.write(http.responseText);
var message = '';
if (x >= 0) {
replaces = -1; // reset
message = ' The changes have been saved';
} else {
message = '\n' + messageOut;
messageOut += '<\/ul>\nThere is nothing "wrong" with this, but most people like to use the same metal for the various metal components.<\/p>\n';
messageOut += '
GP = Gold Plated
SS = Sterling Silver
VM = Vermeil
GF = Gold Filled
KT = 14kt Gold<\/p>\n';
messageOut += '