/*
$(document).ready(function (){
if(!IsIE8Browser()){
DD_roundies.addRule('#upper-navigation ul.group1', '0 0 5px 5px');
DD_roundies.addRule('#upper-navigation ul.group2', '0 0 5px 5px');
DD_roundies.addRule('#upper-navigation ul.group3', '0 0 5px 5px');
DD_roundies.addRule('#buttons a', '5px');
DD_roundies.addRule('ul.users', '5px');
DD_roundies.addRule('.overlay-txt', '0 0 5px 5px');
DD_roundies.addRule('#testimonials p.openion', '5px');
}
});
function IsIE8Browser() {
var rv = -1;
var ua = navigator.userAgent;
var re = new RegExp("Trident\/([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null) {
rv = parseFloat(RegExp.$1);
}
return (rv == 4);
}*/
function livechat(dep){
mywindow = window.open ("http://www.shiftplanning.com/support/chat/phplive.php?d="+(dep?dep:''),"LiveChat","location=1,status=1,scrollbars=1,width=490,height=410");
mywindow.moveTo(200,200);
}
/* MENU FUNCTIONS */
function ScrollTo(Name){
$.scrollTo($('#'+Name),800);
}
function LoginUser(){
/* MISSING DETAILS */
if(!$('#email').val() || !$('#password').val()){
$('#LoginTitle').html('Missing Details').show();
return false;
}
/* SEND */
$('#LoginTitle').html('Processing..');
$.post("/process/sales.php", { Action: 'LoginUser', email: $('#email').val(), password: $('#password').val(), redirect_url: $('#redirect_url').val() },
function(data){
$('#LoginTitle').html(data);
return false;
}
);
return false;
}
/* REGISTER */
function SignUpVerify(){
$('#submit').html('Validating..').unbind('click');
$('.Notice').html('');
var err = 0;
/* IS FORM COMPLETE */
var Req = ['name', 'business', 'email', 'domain', 'phone'];
for (i in Req){
if(!$('#'+Req[i]).val()){
$('#'+Req[i]+'_').html(' *Required').show();
err = 1;
}
}
/* IS EMAIL VALID */
if($('#email').val() && !isValidEmail($('#email').val())){
$('#email_').html(' *Invalid').show();
err = 1;
}
/* LEGAL BOX CHECKED */
if(err == 0){
if(!$('#legal').is(':checked') ){
$('.terms_label').effect('highlight', {}, 500);
err = 1;
}
}
/* IS DUPLICATE EMAIL OR DOMAIN */
if(err == 0){
$('#submit').html('Creating Account..');
$.post("/process/sales.php", { Action: 'CreateAccount', name: $('#name').val(), business: $('#business').val(), phone: $('#phone').val(), email: $('#email').val(), domain: $('#domain').val() },
function(data){
$('#submit').html('Create my ShiftPlanning Account').bind('click', function(){ DomainClean(); SignUpVerify(); });
if (data=='1'){
$('#email_').html(' *Already Taken').show();
} else if (data=='2'){
$('#domain_').html(' *Already Taken').show();
} else if (data=='3'){
$('#domain_').html(' *Already Taken').show();
} else if (data=='4'){
$('#email_').html(' *Temp. Email Accounts Not Allowed').show();
} else if (data=='5'){
alert('Flood Protection: Another account has been registered from this i.p. within 30mins. Please wait and try again.');
} else {
pageTracker._trackPageview("/tracksignup");
$('#JoinContainer').html(data);
return;
}
}
);
} else {
$('#submit').effect('shake', {times: 2}, 'fast').html('Create my ShiftPlanning Account').bind('click', function(){ DomainClean(); SignUpVerify(); });
}
}
function monthly_cost(Size){
if(Size<15){
return 25;
} else if(Size<30){
return 50;
} else if(Size<60){
return 75;
} else if(Size<101){
return 100;
}
}
function set_calc(Employees, Hours){
$('#calc_num').val(Employees);
$('#calc_hrs').val(Hours);
calculate_savings();
}
function calculate_savings(){
var employees = $('#calc_num').val();
var hours = $('#calc_hrs').val();
var wage = $('#calc_wage').val();
wage = wage.replace('$', '');
if(employees && hours && wage){
if(employees<101){
var time_saved = Math.round(hours*.8);
var money_saved = Math.round(((hours*wage*.8)-monthly_cost(employees)));
$('#savings').html(time_saved+'hrs and $'+money_saved+' per month saved with ShiftPlanning!');
} else {
$('#savings').html('That\'s a big business! Please contact us for pricing details.');
}
} else {
$('#savings').html('Missing Details..');
}
}
function isValidEmail(str) {
return (str.lastIndexOf(".") > 2) && (str.indexOf("@") > 0);
}
function CleanComment(comment) {
var reg = new RegExp("<([^<>\s]*)(\s[^<>]*)?>", "g");
return comment.replace(reg,"");
}
function DomainName(){
if(!$('#domain').val()){
$('#domain').val( $('#business').val() );
DomainClean();
}
}
function DomainClean(){
var Domain = $('#domain').val();
Domain = Domain.split(' ').join('');
Domain = Domain.toLowerCase();
Domain = Domain.replace(/[^a-zA-Z 0-9]+/g,'');
$('#domain').val(Domain);
}
function CheckActivation(){
$('#Results').load('/activation.php?check='+$('#email').val()).show();
}
function SendMessage(){
$('#submit').val('Sending Message..').attr("disabled", true);
$('.Notice').html('');
var err = 0;
/* IS FORM COMPLETE */
var Req = ['name', 'email', 'message', 'subject'];
for (i in Req){
if(!$('#'+Req[i]).val()){
$('#'+Req[i]+'_').html(' *Required').show();
err = 1;
}
}
if(err == 0){
$.post("http://www.shiftplanning.com/process/sales.php", { Action: 'SendMessage', name: $('#name').val(), email: $('#email').val(), subject: $('#subject').val(), message: $('#message').val(), csrf_token: '1429c384e0b1e85e44d3c68e64ea6df665920c19' },
function(data){
$('#SendMessage').html(data);
});
} else {
$('#SubmitButton').effect('shake', {times: 2}, 'fast').val('Send Message').attr("disabled", false);
}
}
function GetCarriers(){
$.getJSON("/sms.php",{country: $('#country').val()}, function(j){
var options = '';
for (var i = 0; i < j.length; i++) {
options += '';
}
$("select#carrier").html(options);
})
}
function SendSMS(){
var Carrier = $('#carrier').val();
var Number = $('#number').val();
if(Carrier && Number.length>7){
$('#Results').load('/sms.php?carrier='+Carrier+'&number='+Number).show();
} else {
$('#Results').html('Missing Details. Please select a carrier and enter a phone number above.').show();
}
}
var LastSearchFor = '';
function SearchSupport(){
var SearchFor = $('#searchsupport').val();
if(SearchFor.length>1){
if(SearchFor!=LastSearchFor){
LastSearchFor = SearchFor;
$('#results').load('/support/?topics=1&q='+SearchFor, function(){
$('#support').hide();
$('#STopic').html('').hide();
}).show();
}
} else {
$('#results').html('').hide();
$('#STopic').html('').hide();
$('#support').show();
}
}
var LastLoaded = '';
function LoadTopic(ID){
if(ID!=LastLoaded){
LastLoaded = ID;
$('#STopic').load('/support/?topic='+ID).show();
$('#STopic2').remove();
}
}