
var errorMsgs = {
'1' : 'Please provide a valid Username and Password combination.',
'2' : 'The specified Username was not found in our system.',
'3' : 'The specified Password is invalid.',
'4' : 'Account has been deactivated. Please contact us for more information.'
};
var loginBumps = {
'Admin' : '/ClientLogin/',
'Partner' : '/ClientLogin/',
'End User' : '/ClientLogin/'
};
function ClientLogin()
{
new Ajax.Request('/ClientLogin/login.php', {
method: 'post',
parameters: {
Username: $F('Username'),
Password: $F('Password')
},
onCreate:function()
{$('LoginBtn').src = '/images/button_lgn_wait.gif';
},
onComplete:function(transport)
{HandleLogin(transport.responseText);
}
});
}
function HandleLogin(response)
{respPts = response.split("_");
if (response.indexOf("OK") != -1)
{parent.location.href = loginBumps[respPts[1]];
} else {$('LoginBtn').src = '/images/button_lgn.gif';
$('LoginMsg').innerHTML = errorMsgs[respPts[1]];
}
}function CalculatePrice(Product_id)
{
var VariationIds = '';
var OptColl = $$('select[id^=Option_]');
var ChkColl = $$('input[id^=Option_]');
var ValCtr = 0;
var OptCtr = 0;OptColl.each(function(o){ OptCtr++; if (o.value) { ValCtr++; } VariationIds += o.value + "::"; } );
ChkColl.each(function(o){ if (o.checked == true) { VariationIds += o.value + "::"; } } );if (OptCtr != 0 && ValCtr < OptCtr)
{
alert("If you wish to customize this product, you will need to select a choice from each of the dropdown menus.");if ($('CartButton').style.display != 'none')
{
Effect.Fade('CartButton', { duration : 0.25 }); 
}
} else {
new Ajax.Request('/Products/CalcPrice.php', {
method : 'post',
parameters : {
Product_id : Product_id,
VariationIds : VariationIds.substring(0, (VariationIds.length)-2)
},
onComplete:function(transport){
var respPts = transport.responseText.split('::');$('AdjustedPrice').innerHTML = '<b>$</b>' + respPts[1];new Effect.Highlight($('AdjustedPrice'), {
startcolor: '#ffff99',
endcolor: '#ffffff'
});Effect.Appear('CartButton', { duration : 0.5 });
Effect.Appear('QtyLabel', { duration : 0.5 });
Effect.Appear('QtyAmount', { duration : 0.5 });
}
});
}}function CheckForSelection(selectObj)
{
if ($(selectObj).options.selectedIndex == 0)
{
HideCartBtn();
HideQty();
}
}function HideCartBtn()
{
if ($('CartButton').style.display != 'none')
{
Effect.Fade('CartButton', { duration : 0.25 }); 
}
}function HideQty()
{
if ($('QtyLabel').style.display != 'none')
{
Effect.Fade('QtyLabel', { duration : 0.25 }); 
}
if ($('QtyAmount').style.display != 'none')
{
Effect.Fade('QtyAmount', { duration : 0.25 }); 
}
}function ToggleOpsView(show)
{
if ($(show))
{
if ($(show).style.display == 'none')
{
$(show).style.display = 'inline';
}switch(show)
{
case 'AvailOpsDat' :
$('AvailOpsCart').style.display = 'none';
break;case 'AvailOpsCart' :
$('AvailOpsDat').style.display = 'none';
break;
}
}
}
function AutoFillBilling()
{
if ($('SameAsShipping').checked == true)
{
$('Bill_FirstName').value = $F('Ship_FirstName');
$('Bill_LastName').value = $F('Ship_LastName');
$('Bill_Company').value = $F('Ship_Company');
$('Bill_Address1').value = $F('Ship_Address1');
$('Bill_Address2').value = $F('Ship_Address2');
$('Bill_City').value = $F('Ship_City');
$('Bill_State').value = $F('Ship_State');
$('Bill_Zip').value = $F('Ship_Zip');
}
}function TogglePayOps()
{
if ($('PaymentMethod'))
{
if ($F('PaymentMethod'))
{
if ($F('PaymentMethod') == 'E-Check' || $F('PaymentMethod') == 'Cost Center')
{
$('AccountNumber').value = '';
$('CostCenter').value = '';
$('CardExp_M').options.selectedIndex = 0;
$('CardExp_M').disabled = true;
$('CardExp_Y').options.selectedIndex = 0;
$('CardExp_Y').disabled = true;
$('CardExpDD').style.display='none';
} else {
$('CostCenter').value = '';
$('CardExpDD').style.display='inline';
$('CardExp_M').disabled = false;
$('CardExp_Y').disabled = false;
}
}
}
}function AutoFillShipping()
{
if ($('SameAsBilling').checked == true)
{
$('Address1').value = $F('Bill_Address1');
$('Address2').value = $F('Bill_Address2');
$('City').value = $F('Bill_City');
$('State').value = $F('Bill_State');
$('Zip').value = $F('Bill_Zip');
}
}