/**
* SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
*
* SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
*/
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="
';
return false;
}
}
function checkInvoiceNum(invoice, invoiceChecked) {
if (invoiceChecked) {
if (invoice == '') {
invoiceErrors += 'Please enter an invoice number. ';
} else {
if (invoice.length != 4) {
invoiceErrors += 'Invoice number - ' + invoice + ' is the incorrect length. ';
}
var re = new RegExp('^(0)$|^([1-9][0-9]*)$');
var m = re.exec(invoice);
if (m == null) {
invoiceErrors += 'Invalid invoice number - ' + invoice + '. ';
}
}
} else {
if (invoice == '') {
invoiceErrors += 'Please enter a service request number. ';
} else {
if (invoice.length != 6) {
invoiceErrors += 'Service request number - ' + invoice + ' is the incorrect length. Please ensure you are including the r#. ';
}
var re = new RegExp('^(0)$|^([1-9][0-9]*)[r][0-9]$');
var m = re.exec(invoice);
if (m == null) {
invoiceErrors += 'Invalid service request number - ' + invoice + '. ';
}
}
}
}
function changeCurrency(currency) {
$('currencyType').innerHTML = currency;
}
function directPaymentVerifyCheck(checkbox) {
if (checkbox.checked) {
$('directPaymentSubmit').enable();
$('directPaymentSubmit').src = '/fend/images/btn-submitpayment.png';
} else {
$('directPaymentSubmit').disable();
$('directPaymentSubmit').src = '/fend/images/btn-submitpayment-inactive.png';
}
}
function directPaymentCheck() {
$('errorbox').innerHTML = '';
directPaymentErrors = '';
var emailRegEx = new RegExp('^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$');
var emailTest = emailRegEx.exec($('customer_email').value);
if (emailTest == null || $('customer_email').value == '') {
directPaymentErrors += '
Please enter a valid email address.<\/li>';
}
if ($('customer_first_name').value == '') {
directPaymentErrors += '
Please enter a first name.<\/li>';
}
if ($('customer_last_name').value == '') {
directPaymentErrors += '
Please enter a last name.<\/li>';
}
var country = $RF('directPaymentForm', 'customer_country');
if (country == 'CA') {
$('currency').value = 'CAD';
} else if (country == 'US') {
$('currency').value = 'USD';
} else {
directPaymentErrors +='
Please choose a country.<\/li>';
}
if ($('customer_address1').value == '') {
directPaymentErrors += '
Please enter an address.<\/li>';
}
if ($('customer_city').value == '') {
directPaymentErrors += '
Please enter a city.<\/li>';
}
/*
var stateSel = $('customer_state');
if (stateSel.options[stateSel.selectedIndex].value == '') {
directPaymentErrors += '
Please choose a province\/state.<\/li>';
}
*/
if (country == 'CA') {
var zipRegEx = new RegExp('^[ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]{1}\\d{1}[A-Za-z]{1}[ ]{0,1}\\d{1}[A-Za-z]{1}\\d{1}$');
var zipTest = zipRegEx.exec($('customer_zip').value);
if (zipTest == null || $('customer_zip').value == '') {
directPaymentErrors += '
Invalid postal code.<\/li>';
}
} else if (country == 'US') {
var zipRegEx = new RegExp('^\\d{5}$');
var zipTest = zipRegEx.exec($('customer_zip').value);
if (zipTest == null || $('customer_zip').value == '') {
directPaymentErrors += '
Invalid zip code.<\/li>';
}
}
var ccRegEx = new RegExp('^((4\\d{3})|(5[1-5]\\d{2}))(-?|\\040?)(\\d{4}(-?|\\040?)){3}|^(3[4,7]\\d{2})(-?|\\040?)\\d{6}(-?|\\040?)\\d{5}');
var ccTest = ccRegEx.exec($('customer_credit_card_number').value);
if (ccTest == null) {
directPaymentErrors += '
Please enter a valid amount.<\/li>';
}
if (directPaymentErrors == '') {
//alert('submitting');
return true;
} else {
$('errorbox').innerHTML += '
Please correct the following errors and resubmit the payment.
' + directPaymentErrors + '<\/ul>';
$('errorbox').scrollTo();
return false;
}
}
/**
* Returns the value of the selected radio button in the radio group, null if
* none are selected, and false if the button group doesn't exist
*
* @param {radio Object} or {radio id} el
* OR
* @param {form Object} or {form id} el
* @param {radio group name} radioGroup
*/
function $RF(el, radioGroup) {
if($(el).type && $(el).type.toLowerCase() == 'radio') {
var radioGroup = $(el).name;
var el = $(el).form;
} else if ($(el).tagName.toLowerCase() != 'form') {
return false;
}
var checked = $(el).getInputs('radio', radioGroup).find(
function(re) {return re.checked;}
);
return (checked) ? $F(checked) : null;
}
var mousex = 0; var mousey = 0;
function getMouseXY(e) {
// works on IE6,FF,Moz,Opera7
var algor;
if (!e) e = window.event; // works on IE, but not NS (we rely on NS passing us the event)
if (e) {
if (e.pageX || e.pageY) {
// this doesn't work on IE6!! (works on FF,Moz,Opera7)
mousex = e.pageX;
mousey = e.pageY;
algor = '[e.pageX]';
if (e.clientX || e.clientY) algor += ' [e.clientX] '
} else if (e.clientX || e.clientY) {
// works on IE6,FF,Moz,Opera7
// Note: I am adding together both the "body" and "documentElement" scroll positions
// this lets me cover for the quirks that happen based on the "doctype" of the html page.
// (example: IE6 in compatibility mode or strict)
// Based on the different ways that IE,FF,Moz,Opera use these ScrollValues for body and documentElement
// it looks like they will fill EITHER ONE SCROLL VALUE OR THE OTHER, NOT BOTH
// (from info at http://www.quirksmode.org/js/doctypes.html)
mousex = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
mousey = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
algor = '[e.clientX]';
if (e.pageX || e.pageY) algor += ' [e.pageX] '
}
}
}
document.onmousemove = getMouseXY;
function assignPosition(d) {
if ((document.body.clientWidth - mousex) <= 300) {
$(d).setStyle({
left: mousex - 300 + 'px',
top: mousey + 'px'
});
} else {
$(d).setStyle({
left: mousex + 'px',
top: mousey + 'px'
});
}
}
Event.observe(document, 'click', function(event) {
if ($('cvv2box')) {
var element = Event.element(event);
if ('A' != element.tagName && 'IMG' != element.tagName) {
var elt = Event.findElement(event, 'DIV');
if (elt) {
if (elt != document) {
if (elt.id != 'cvv2box') {
$('cvv2box').hide();
}
}
}
}
}
});
function cvvPop() {
assignPosition('cvv2box');
$('cvv2box').show();
}
var mouseOverViewerState = 'off';
var currentMousePosition = 'off';
var viewerInfoStateChangeComplete = 'true';
Event.observe(window, 'load', function () {
if ($('viewer-image')) {
Event.observe('viewer-image', 'mouseenter', function (event) {
currentMousePosition = 'on'
toggleViewerInfo('on');
})
Event.observe('viewer-image', 'mouseleave', function (event) {
currentMousePosition = 'off'
toggleViewerInfo('off');
})
}
});
function toggleViewerInfo(state) {
if (viewerInfoStateChangeComplete == 'true' && currentMousePosition != mouseOverViewerState) {
if (state == 'on' && mouseOverViewerState == 'off') {
viewerInfoStateChangeComplete = 'false';
new Effect.Move(($('viewer-info')), { x: 0, y: -50, mode: 'relative', duration: 0.25 });
setViewerInfoComplete.delay(0.25);
mouseOverViewerState = 'on';
}
if (state == 'off') {
viewerInfoStateChangeComplete = 'false';
new Effect.Move(($('viewer-info')), { x: 0, y: 50, mode: 'relative', duration: 0.25 });
setViewerInfoComplete.delay(0.25);
mouseOverViewerState = 'off';
}
}
}
function setViewerInfoComplete(state) {
viewerInfoStateChangeComplete = 'true';
toggleViewerInfo(currentMousePosition);
}