var http = createRequestObject();
if (navigator.appVersion.indexOf("MSIE") != -1)
{
var version = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (version < 8)
{
document.write('Warning: Your browser is not fully supported, certain functions may not work as expected. Please upgrade to the latest Internet Explorer or Firefox version (free on internet)');
}
}
function createRequestObject() {
var ro;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
ro = new ActiveXObject("Microsoft.XMLHTTP");
}else{
ro = new XMLHttpRequest();
}
return ro;
}
function go_to(step_no)
{
var step_to_show;
var titles = Array("-","Client information","Neck Length","Neck Thickness","Bone Structure","Horizontal Body Shape","Vertical body shape","Shoulders Type","Face Shape","Prominent features");
for (i=1; i<10; i++)
{
step_to_show = "step"+i;
if (i == step_no)
{
document.getElementById("StepTitle").innerHTML = titles[i];
document.getElementById(step_to_show).style.display = "block";
}
else
document.getElementById(step_to_show).style.display = "none";
}
}
function go_to_update(step_no)
{
var step_to_show;
var titles = Array("-","Client information","Neck Thickness","Horizontal Body Shape","Face Shape","Prominent features");
for (i=1; i<6; i++)
{
step_to_show = "step"+i;
if (i == step_no)
{
document.getElementById("StepTitle").innerHTML = titles[i];
document.getElementById(step_to_show).style.display = "block";
}
else
document.getElementById(step_to_show).style.display = "none";
}
}
function go_to_sub(step_no)
{
var step_to_show;
for (i=1; i<5; i++)
{
step_to_show = "step9_"+i;
if (i == step_no)
document.getElementById(step_to_show).style.display = "block";
else
document.getElementById(step_to_show).style.display = "none";
}
}
function check_form(check,return_me)
{
var errors = '';
var stepToShow = '';
if (check.FirstName.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter your First name in step 1';
}
if (check.LastName.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter your Last name in step 1';
}
if (check.StreetAddress.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter your Street Address in step 1';
}
if (check.City.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter your City/Town in step 1';
}
if (check.Client_Country.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Select your Country in step 1';
}
if (check.Postcode.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter your Postcode in step 1';
}
if (validatePhone(check.Phone.value) == false)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter a valid Phone number in step 1..';
}
if (check.email.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter your Email address in step 1';
}
else
{
if (checkemail(check.email.value) != true)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter a valid Email address in step 1';
}
}
if (check.Ht_pick.value == "-")
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Select your Height in step 1';
}
if (check.Wt_pick.value == "-")
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Select your Weight in step 1';
}
if (check.Age.value == "-")
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Select your Age in step 1';
}
if (check.BraCup.value == "-")
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Select your Bra Cup Size in step 1';
}
if (getCheckedValue(check.NL_pick) == "")
{
if (stepToShow == '')
stepToShow = 2;
errors = errors + ' - Select your Neck Length in step 2';
}
if (getCheckedValue(check.Neck_Type) == "")
{
if (stepToShow == '')
stepToShow = 3;
errors = errors + ' - Select your Neck Thickness in step 3';
}
if (getCheckedValue(check.BS_pick) == "")
{
if (stepToShow == '')
stepToShow = 4;
errors = errors + ' - Select your Bone Structure in step 4';
}
if (getCheckedValue(check.HorT) == "")
{
if (stepToShow == '')
stepToShow = 5;
errors = errors + ' - Select your Horizontal Body Shape in step 5';
}
if (getCheckedValue(check.VerT) == "")
{
if (stepToShow == '')
stepToShow = 6;
errors = errors + ' - Select your Vertical Body Shape in step 6';
}
if (getCheckedValue(check.ShldT) == "")
{
if (stepToShow == '')
stepToShow = 7;
errors = errors + ' - Select your Shoulders Type in step 7';
}
if (getCheckedValue(check.FaceS) == "")
{
if (stepToShow == '')
stepToShow = 8;
errors = errors + ' - Select your Face Shape in step 8';
}
if ((check.NL_pick.value == 'Long') && (check.Neck_Type.value == 'Thick'))
{
if (stepToShow == '')
stepToShow = 2;
errors = errors + ' - Long and Thick Neck is not a valid combination. Please change one of these selections';
}
if ((check.NL_pick.value == 'Short') && (check.Neck_Type.value == 'Thin'))
{
if (stepToShow == '')
stepToShow = 2;
errors = errors + ' - Short and Thin Neck is not a valid combination. Please change one of these selections';
}
if ((getCheckedValue(check.HorT) == 'Oval' || getCheckedValue(check.HorT) == 'Diamond') && check.Wt_pick.value != "Substancially Overweight")
{
if (stepToShow == '')
stepToShow = 5;
errors = errors + ' - Oval or Diamond Horizontal body shape is only possible with Substancially Overweight weight selection. Please change one of these selections';
}
if ((getCheckedValue(check.HorT) == 'Rectangle') && (getCheckedValue(check.ShldT) == 'Average Tapered'))
{
if (stepToShow == '')
stepToShow = 7;
errors = errors + ' - Rectangle Body Type and Average Tapered Shoulders is not a valid combination. Please change one of these selections';
}
if ((getCheckedValue(check.HorT) == 'Rectangle') && (getCheckedValue(check.ShldT) == 'Average Sloped'))
{
if (stepToShow == '')
stepToShow = 7;
errors = errors + ' - Rectangle Body Type and Average Sloped Shoulders is not a valid combination. Please change one of these selections';
}
if ((getCheckedValue(check.HorT) == 'Triangle') && (check.ShldT.value == 'Broad Square'))
{
if (stepToShow == '')
stepToShow = 7;
errors = errors + ' - Triangle Horizontal Body Shape and Broad Squuare Shoulders are not a valid combination. Please change one of these selections';
}
if ((getCheckedValue(check.HorT) == 'Triangle') && (check.ShldT.value == 'Broad Tapered'))
{
if (stepToShow == '')
stepToShow = 7;
errors = errors + ' - Triangle Horizontal Body Shape and Broad Tapered Shoulders are not a valid combination. Please change one of these selections';
}
if (getCheckedValue(check.none3) == "")
{
if (check.Heavy_Legs.checked)
{
if (check.Thin_Legs.checked)
{
if (stepToShow == '')
stepToShow = 9;
errors = errors + ' - Heavy Lower Legs and Thin Legs is not a valid combination. Please change one of these selections';
}
}
}
if (getCheckedValue(check.none3) == "")
{
if (check.Saddle_Bags.checked)
{
if (check.Thick_Thighs.checked)
{
if (stepToShow == '')
stepToShow = 9;
errors = errors + ' - Saddle Bags and Thick Thighs is not a valid combination. Please change one of these selections';
}
}
}
if (getCheckedValue(check.none1) == "")
{
if ((check.Thin_Arms.checked == true) && (check.Heavy_Arms.checked == true))
{
if (stepToShow == '')
stepToShow = 9;
errors = errors + ' - Heavy Arms and Aged Arms is not a valid combination. Please change one of these selections';
}
}
if (getCheckedValue(check.none2) == "")
{
if ((check.Large_Bottom.checked == true) && (check.Flat_Bottom.checked == true))
{
if (stepToShow == '')
stepToShow = 9;
errors = errors + ' - Flat Bottom and Large Bottom is not a valid combination. Please change one of these selections';
}
}
if (getCheckedValue(check.none3) == "")
{
if ((check.Thin_Legs.checked == true) && (check.Thick_Thighs.checked == true))
{
if (stepToShow == '')
stepToShow = 9;
errors = errors + ' - Thin Legs and Thick Thighs is not a valid combination. Please change one of these selections';
}
}
if (errors != '')
{
go_to(stepToShow);
$.prompt("Please correct the following errors to continue" + errors);
if (return_me == '1')
return false;
}
else
check_Email(check.email.value);
}
function check_update_form(check,updated)
{
var errors = '';
var stepToShow = '';
if (check.StreetAddress.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter your Street Address in step 1';
}
if (check.City.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter your City/Town in step 1';
}
if (check.Client_Country.value < 1)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Select your Country in step 1';
}
if (check.Postcode.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter your Postcode in step 1';
}
if (validatePhone(check.Phone.value) == false)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter a valid Phone number in step 1..';
}
if (check.new_password.value != '')
{
if (check.new_password.value.length < 6)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Password to short';
}
if (check.new_password.value != check.confirm_password.value)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - The entered passwords don\'t match';
}
}
if (check.email.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter your Email address in step 1';
}
else
{
if (checkemail(check.email.value) != true)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter a valid Email address in step 1';
}
}
if (check.Wt_pick.value == "-")
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Select your Weight in step 1';
}
if (check.Age.value == "-")
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Select your Age in step 1';
}
if (check.BraCup.value == "-")
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Select your Bra Cup Size in step 1';
}
if (getCheckedValue(check.Neck_Type) == "")
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Select your Neck Thickness in step 3';
}
if (getCheckedValue(check.HorT) == "")
{
if (stepToShow == '')
stepToShow = 2;
errors = errors + ' - Select your Horizontal Body Shape in step 5';
}
if (getCheckedValue(check.FaceS) == "")
{
if (stepToShow == '')
stepToShow = 3;
errors = errors + ' - Select your Face Shape in step 8';
}
if ((check.NL_pick.value == 'Long') && (check.Neck_Type.value == 'Thick'))
errors = errors + ' - Long and Thick Neck is not a valid combination. Please change one of these selections';
if ((check.NL_pick.value == 'Short') && (check.Neck_Type.value == 'Thin'))
errors = errors + ' - Short and Thin Neck is not a valid combination. Please change one of these selections';
if ((getCheckedValue(check.HorT) == 'Rectangle') && (check.ShldT.value == 'Average Tapered'))
errors = errors + ' - Rectangle Body Type and Average Tapered Shoulders is not a valid combination. Please change one of these selections';
if ((getCheckedValue(check.HorT) == 'Rectangle') && (check.ShldT.value == 'Average Sloped'))
errors = errors + ' - Rectangle Body Type and Average Sloped Shoulders is not a valid combination. Please change one of these selections';
if ((getCheckedValue(check.HorT) == 'Triangle') && (check.ShldT.value == 'Broad Square'))
errors = errors + ' - Triangle Horizontal Body Shape and Broad Squuare Shoulders are not a valid combination. Please change one of these selections';
if ((getCheckedValue(check.HorT) == 'Triangle') && (check.ShldT.value == 'Broad Tapered'))
errors = errors + ' - Triangle Horizontal Body Shape and Broad Tapered Shoulders are not a valid combination. Please change one of these selections';
if (getCheckedValue(check.none1) == "")
{
if ((check.Thin_Arms.checked == true) && (check.Heavy_Arms.checked == true))
errors = errors + ' - Heavy Arms and Aged Arms is not a valid combination. Please change one of these selections';
}
if (getCheckedValue(check.none2) == "")
{
if ((check.Large_Bottom.checked == true) && (check.Flat_Bottom.checked == true))
errors = errors + ' - Flat Bottom and Large Bottom is not a valid combination. Please change one of these selections';
}
if (getCheckedValue(check.none3) == "")
{
if ((check.Thin_Legs.checked == true) && (check.Thick_Thighs.checked == true))
errors = errors + ' - Thin Legs and Thick Thighs is not a valid combination. Please change one of these selections';
}
if (getCheckedValue(check.none3) == "")
{
if (check.Heavy_Legs.checked)
{
if (check.Thin_Legs.checked)
errors = errors + ' - Heavy Lower Legs and Thin Legs is not a valid combination. Please change one of these selections';
}
}
if (getCheckedValue(check.none3) == "")
{
if (check.Saddle_Bags.checked)
{
if (check.Thick_Thighs.checked)
errors = errors + ' - Saddle Bags and Thick Thighs is not a valid combination. Please change one of these selections';
}
}
if (errors != '')
$.prompt("Please correct the following errors to continue:" + errors);
else
document.data_form.submit();
}
function checkemail(str)
{
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
return true;
else
return false;
}
function getCheckedValue(radioObj)
{
if(!radioObj)
return "";
var radioLength = radioObj.length;
if(radioLength == undefined)
if(radioObj.checked)
return radioObj.value;
else
return "";
for(var i = 0; i < radioLength; i++)
{
if(radioObj[i].checked) {
return radioObj[i].value;
}
}
return "";
}
function get_discount(coupon_code)
{
http.open('get', '/get_discount.php?coupon_code='+coupon_code);
http.onreadystatechange = handleDiscountResponse;
http.send(null);
}
function handleDiscountResponse()
{
if(http.readyState == 4)
{
var response = http.responseText;
if (response != "")
{
document.getElementById('your_price').innerHTML = "Your Style Solutions Price: " + response;
}
}
}
function activate_me()
{
var license_key = document.getElementById('license_key').value;
http.open('get', '/check_key.php?license_key='+license_key);
http.onreadystatechange = handleLicenseResponse;
http.send(null);
}
function handleLicenseResponse()
{
if(http.readyState == 4)
{
var response = http.responseText;
if (response != 'ok')
$.prompt("You have entered an invalid license key.");
else
document.activate.submit();
}
}
function LogIn()
{
var username = document.getElementById('username-field').value;
var password = document.getElementById('password-field').value;
if (document.getElementById('remember_me').checked)
var remember= 1;
else
var remember= 0;
http.open('get', '/check_user.php?username='+username+'&password='+password+'&remember='+remember);
http.onreadystatechange = handleLoginResponse;
http.send(null);
}
function handleLoginResponse()
{
if(http.readyState == 4)
{
var response = http.responseText;
if (response == 'error')
$.prompt("You have entered an invalid username or password. Please try again.");
else
window.location = response;
//
// window.location = response;
}
}
function LogInPage()
{
var username = document.getElementById('Paymentusername').value;
var password = document.getElementById('Paymentpassword').value;
var remember = 0;
http.open('get', '/check_user.php?username='+username+'&password='+password+'&remember='+remember);
http.onreadystatechange = handleLogInPageResponse;
http.send(null);
}
function handleLogInPageResponse()
{
if(http.readyState == 4)
{
var response = http.responseText;
if (response == 'error')
$.prompt("You have entered an invalid username or password. Please try again.");
else
window.location = response;
}
}
function addToFavorites(my_favorites)
{
//full list submited
http.open('get', '/add_to_favorites.php?favorites='+my_favorites);
http.onreadystatechange = handleFavoritesResponse;
http.send(null);
}
function handleFavoritesResponse()
{
//Empty
}
function showDescription(cat)
{
http.open('get', '/getGarmentDescription.php?cat='+cat);
http.onreadystatechange = handleDescriptionResponse;
http.send(null);
}
function handleDescriptionResponse()
{
if(http.readyState == 4)
{
document.getElementById('overview_loading').style.display = "none";
var Overviews = http.responseText.split('|');
if (Overviews[4] == "m12_1")
{
document.getElementById('OverviewTable').style.display = "none";
document.getElementById('Paragraphs').style.display = "block";
}
else
{
document.getElementById('OverviewTable').style.display = "block";
document.getElementById('Paragraphs').style.display = "none";
}
document.getElementById('PersonalTitle').innerHTML = Overviews[0];
document.getElementById('PersonalOverview').innerHTML = Overviews[1];
document.getElementById('GeneralTitle').innerHTML = Overviews[2];
document.getElementById('GeneralOverview').innerHTML = Overviews[3];
}
if(http.readyState == 1)
{
document.getElementById('OverviewTable').style.display = "none";
document.getElementById('overview_loading').style.display = "block";
}
}
function check_Email(email)
{
http.open('get', '/check_registered_mail.php?email='+email);
http.onreadystatechange = handlecheck_EmailResponse;
http.send(null);
}
function handlecheck_EmailResponse()
{
if(http.readyState == 4)
{
if (http.responseText == "error")
$.prompt("A user with the given email address is already registered. If you have forgotten your password please use the link Retrive Password in the left menu.");
else
document.data_form.submit();
}
}
function setMerchatType(doSignUp)
{
http.open('get', '/setMerchatType.php?doSignUp='+doSignUp);
http.onreadystatechange = handlesetMerchatTypeResponse;
http.send(null);
}
function handlesetMerchatTypeResponse()
{
if(http.readyState == 4)
{
temp = http.responseText.split('|');
if (temp[0] == "error")
{
if (temp[2] == "doSignUp")
{
checkSignUp(document.data_form);
}
else
{
$.prompt("You have entered an invalid authorisation code");
document.getElementById('ResellerType').innerHTML = temp[1];
document.getElementById('Email').readOnly = false;
}
}
else
{
if (temp[0] != "")
{
var email = temp[0];
var merchant_type = temp[1];
document.getElementById('Email').readOnly = false;
document.getElementById('Email').value = email;
document.getElementById('Email').readOnly = true;
document.getElementById('ResellerType').innerHTML = merchant_type;
if (temp[2] == "doSignUp")
checkSignUp(document.data_form);
}
}
}
}
function checkSignUp(check)
{
var errors = '';
if (check.FirstName.value.length < 2)
errors = errors + ' - Enter your First Name';
if (check.LastName.value.length < 2)
errors = errors + ' - Enter your Last Name';
if (check.StreetAddress.value.length < 2)
errors = errors + ' - Enter your Street Address';
if (check.City.value.length < 2)
errors = errors + ' - Enter your City/Town';
if (check.Client_Country.value == "-")
errors = errors + ' - Select your Country';
if (validatePhone(check.Phone.value) == false)
errors = errors + ' - Enter a valid Phone number.';
if (check.Email.value.length < 2)
errors = errors + ' - Enter your Email address';
else
{
if (checkemail(check.Email.value) != true)
errors = errors + ' - Enter a valid Email address';
}
if (check.paypal.value.length < 2)
errors = errors + ' - Enter your Email address for the paypal account';
else
{
if (checkemail(check.paypal.value) != true)
errors = errors + ' - Enter a valid Email address for the paypal account';
}
if (errors != '')
$.prompt("Please correct the following errors to continue with the sign up:" + errors);
else
checkMerchantEmail(check.Email.value);
}
function checkAskQuestion(check)
{
var errors = '';
if (check.Name.value.length < 2)
errors = errors + ' - Enter your Name';
if (check.Email.value.length < 2)
errors = errors + ' - Enter your Email address';
else
{
if (checkemail(check.Email.value) != true)
errors = errors + ' - Enter a valid Email address';
}
if (check.Enquery.value.length < 2)
errors = errors + ' - Enter your Enquery';
if (errors != '')
$.prompt("Please correct the following errors to send us a question:" + errors);
else
check.submit();
}
function checkMerchantEmail(email)
{
var captcha_code = document.getElementById("captcha_code").value;
http.open('get', '/checkMerchantEmail.php?email='+email+'&captcha_code='+captcha_code);
http.onreadystatechange = handlecheckMerchantEmailResponse;
http.send(null);
}
function handlecheckMerchantEmailResponse()
{
if(http.readyState == 4)
{
if (http.responseText != "ok")
$.prompt(http.responseText);
else
document.data_form.submit();
}
}
function submit_form(f_action, cart_id)
{
document.getElementById("submit_type").value = f_action;
document.getElementById("cart_id").value = cart_id;
document.cart.submit();
}
function copy_form_values(radio_val)
{
if (radio_val == "yes")
{
document.getElementById("show_table").style.display = "none";
}
else
{
document.getElementById("show_table").style.display = "inline";
document.getElementById("sfirst_name").value = '';
document.getElementById("slast_name").value = '';
document.getElementById("semail").value = '';
document.getElementById("saddress").value = '';
document.getElementById("ssuburb").value = '';
document.getElementById("spostcode").value = '';
document.getElementById("sphone").value = '';
document.getElementById("scountry").selectedIndex = 0;
document.getElementById("sstate").selectedIndex = 0;
document.getElementById("sstate").value = '';
}
}
function RetrievePass()
{
var txt = document.getElementById("RetrivePassMessage1").innerHTML + ':
';
function mysubmitfunc(v,m,f){
an = m.children('#emailAddress');
if(f.emailAddress == ""){
an.css("border","solid #ff0000 1px");
return false;
}
http.open('get', '/SendPassReset.php?email='+f.emailAddress);
http.onreadystatechange = handlecheckResetResponse;
http.send(null);
return true;
}
$.prompt(txt,{
submit: mysubmitfunc,
buttons: { Ok:true }
});
}
function handlecheckResetResponse()
{
if(http.readyState == 4)
{
if (http.responseText == "error")
$.prompt(document.getElementById("RetrivePassError"));
else
$.prompt(document.getElementById("RetrivePassSuccess"));
}
}
function updateRegions(country,text_width)
{
http.open('get', '/getRegions.php?country='+country+'&text_width='+text_width);
http.onreadystatechange = handleupdateRegionsResponse;
http.send(null);
}
function handleupdateRegionsResponse()
{
if(http.readyState == 4)
{
if (document.getElementById("RegionsHolder"))
document.getElementById("RegionsHolder").innerHTML = http.responseText;
}
}
function updateBillingStates()
{
var country = document.getElementById("country").value;
http.open('get', '/getCheckoutRegions.php?country='+country+'&field=state');
http.onreadystatechange = handleupdateBillingStatesResponse;
http.send(null);
}
function handleupdateBillingStatesResponse()
{
if(http.readyState == 4)
document.getElementById("RegionsHolder").innerHTML = http.responseText;
}
function updateShippingStates()
{
var country = document.getElementById("scountry").value;
http.open('get', '/getCheckoutRegions.php?country='+country+'&field=sstate');
http.onreadystatechange = handleupdateShippingStatesResponse;
http.send(null);
}
function handleupdateShippingStatesResponse()
{
if(http.readyState == 4)
document.getElementById("SRegionsHolder").innerHTML = http.responseText;
}
function validateNumeric(strValue)
{
var objRegExp = /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;
return objRegExp.test(strValue);
}
function validatePhone(strValue)
{
// var objRegExp = /[0-9\.\-\+\/ ]$/;
// return objRegExp.test(strValue);
return true;
}
function popitup(url) {
newwindow=window.open(url,'name','toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=0,width=640,height=498,left = 320,top = 263');
if (window.focus) {newwindow.focus()}
return false;
}
function check_help_form(check,return_me)
{
var errors = '';
var stepToShow = '';
if (check.FirstName.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter your First name in step 1';
}
if (check.LastName.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter your Last name in step 1';
}
if (check.StreetAddress.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter your Street Address in step 1';
}
if (check.City.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter your City/Town in step 1';
}
if (check.Client_Country.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Select your Country in step 1';
}
if (check.Postcode.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter your Postcode in step 1';
}
if (validatePhone(check.Phone.value) == false)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter a valid Phone number in step 1';
}
if (check.email.value.length < 2)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter your Email address in step 1';
}
else
{
if (checkemail(check.email.value) != true)
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Enter a valid Email address in step 1';
}
}
if (check.Age.value == "-")
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Select your Age in step 1';
}
if (check.BraCup.value == "-")
{
if (stepToShow == '')
stepToShow = 1;
errors = errors + ' - Select your Bra Cup Size in step 1';
}
if (check.head_and_neck.value == "")
{
if (stepToShow == '')
stepToShow = 2;
errors = errors + ' - Please select a head and neck photo in step 2';
}
if (check.full_length_front.value == "")
{
if (stepToShow == '')
stepToShow = 2;
errors = errors + ' - Please select a full length photo: front in step 2';
}
if (check.full_length_back_1.value == "")
{
if (stepToShow == '')
stepToShow = 2;
errors = errors + ' - Please select a full Length photo: back 1 in step 2';
}
if (check.full_length_back_2.value == "")
{
if (stepToShow == '')
stepToShow = 2;
errors = errors + ' - Full Length photo: back 2 in step 2';
}
if (check.full_length_side.value == "")
{
if (stepToShow == '')
stepToShow = 2;
errors = errors + ' - Full Length photo: side in step 2';
}
if (errors != '')
{
help_go_to(stepToShow);
$.prompt("Please correct the following errors to continue" + errors);
}
else
{
var step_to_show;
for (i=1; i<4; i++)
{
step_to_show = "step"+i;
document.getElementById(step_to_show).style.display = "none";
}
// $.fn.colorbox({width:"50%", inline:true, href:"#popup"});
if (navigator.appVersion.indexOf("MSIE") != -1)
{
var version = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (version < 9)
{
document.getElementById("main_containerIE").style.display = "inline";
document.ubr_upload_form.submit();
}
else
{
document.getElementById("main_container").style.display = "inline";
UberUpload.linkUpload();
}
}
else
{
document.getElementById("main_container").style.display = "inline";
UberUpload.linkUpload();
}
}
}
function check_Help_Email(email)
{
http.open('get', '/check_registered_mail.php?email='+email);
http.onreadystatechange = handlecheck_Help_EmailResponse;
http.send(null);
}
function handlecheck_Help_EmailResponse()
{
if(http.readyState == 4)
{
if (http.responseText == "error")
$.prompt("A user with the given email address is already registered. If you have forgotten your password please use the link Retrive Password in the left menu.");
else
{
var step_to_show;
for (i=1; i<4; i++)
{
step_to_show = "step"+i;
document.getElementById(step_to_show).style.display = "none";
}
$.fn.colorbox({width:"50%", inline:true, href:"#popup"});
}
}
}
function help_go_to(step_no)
{
var step_to_show;
for (i=1; i<4; i++)
{
step_to_show = "step"+i;
if (i == step_no)
document.getElementById(step_to_show).style.display = "block";
else
document.getElementById(step_to_show).style.display = "none";
}
}
function submit_help(addStyleGuide)
{
document.getElementById("addstyleguide").value = addStyleGuide;
$.fn.colorbox.close();
if (navigator.appVersion.indexOf("MSIE") != -1)
{
document.getElementById("main_containerIE").style.display = "inline";
document.ubr_upload_form.submit();
}
else
{
document.getElementById("main_container").style.display = "inline";
UberUpload.linkUpload();
}
}
function goToHelp()
{
document.data_form.action = '/saveHelpData.php';
document.data_form.onsubmit = '';
document.data_form.submit();
}
function help_go_to_sub(step_no)
{
var step_to_show;
for (i=1; i<5; i++)
{
step_to_show = "step6_"+i;
if (i == step_no)
document.getElementById(step_to_show).style.display = "block";
else
document.getElementById(step_to_show).style.display = "none";
}
}
function signUp()
{
var errors = '';
if (document.getElementById("newsletter-field").value.length < 2)
errors = errors + ' - Enter your Email address';
else
{
if (checkemail(document.getElementById("newsletter-field").value) != true)
errors = errors + ' - Enter a valid Email address';
}
if (errors != '')
$.prompt("Please correct the following errors to continue:" + errors);
else
{
http.open('get', '/NewsletterSignup.php?email='+document.getElementById("newsletter-field").value);
http.onreadystatechange = handlesignUpResponse;
http.send(null);
}
}
function handlesignUpResponse()
{
if(http.readyState == 4)
$.prompt(http.responseText);
}
function CheckFrienForm()
{
var errors = '';
var check = document.tellAfriend;
if (check.YourName.value.length < 2)
errors = errors + ' - Enter your Name';
if (check.FriendsFirstName.value.length < 2)
errors = errors + ' - Enter your Friends First Name';
if (check.FriendsEmail.value.length < 2)
errors = errors + ' - Enter your Friends Email';
else
{
if (checkemail(check.FriendsEmail.value) != true)
errors = errors + ' - Enter a valid Email address';
}
if (errors != '')
$.prompt("Please correct the following errors to continue:" + errors);
else
{
check.submit();
}
}
function CheckGiftForm()
{
var check = document.giftVoucher;
var errors = '';
if (check.GiftRecepentName.value.length < 2)
errors = errors + ' - Enter the Gift Recepents Name';
if (check.GiftRecepientEmail.value.length < 2)
errors = errors + ' - Enter the Gift Recepients Email';
else
{
if (checkemail(check.GiftRecepientEmail.value) != true)
errors = errors + ' - Enter a valid Gift Recepients Email address';
}
if (check.GiftName.value.length < 2)
errors = errors + ' - Enter your Name';
if (check.GiftTitle.value == "-" && check.GiftTitleManual.value.length < 2)
errors = errors + ' - Select or enter a title for the Voucher';
if (check.GiftEmail.value.length < 2)
errors = errors + ' - Enter Your Email';
else
{
if (checkemail(check.GiftEmail.value) != true)
errors = errors + ' - Enter a valid Email address';
}
if (check.GiftDay.value == '-' || check.GiftMonth.value == '-' || check.GiftYear.value == '-')
{
errors = errors + ' - Please select a valid date';
}
else
{
var SelectedDate = check.GiftDay.value + "/" + check.GiftMonth.value + "/" +check.GiftYear.value;
if (isDate(SelectedDate)==false)
errors = errors + ' - Please select a valid date';
if (checkDateNotInPast(SelectedDate) == false)
errors = errors + ' - Please don\'t select a date in the past';
}
if (errors != '')
$.prompt("Please correct the following errors to order the gift voucher:" + errors);
else
checkGiftEmail(check.GiftRecepientEmail.value);
}
function checkGiftEmail(email)
{
http.open('get', '/check_registered_mail.php?email='+email);
http.onreadystatechange = handlecheckGiftEmailResponse;
http.send(null);
}
function handlecheckGiftEmailResponse()
{
if(http.readyState == 4)
{
if (http.responseText == "error")
$.prompt("A user with the given email address is already registered.");
else
document.giftVoucher.submit();
}
}
function ChristmasCheckForm()
{
var check = document.ChristmasVoucher;
var errors = '';
if (check.ChristmasName.value.length < 2)
errors = errors + ' - Enter the Christmas voucher recepents Name';
if (check.ChristmasEmail.value.length < 2)
errors = errors + ' - Enter the Christmas voucher recepients Email';
else
{
if (checkemail(check.ChristmasEmail.value) != true)
errors = errors + ' - Enter a valid recepients email address';
}
if (check.ChristmasYourName.value.length < 2)
errors = errors + ' - Enter your Name';
if (check.ChristmasYourEmail.value.length < 2)
errors = errors + ' - Enter Your Email';
else
{
if (checkemail(check.ChristmasYourEmail.value) != true)
errors = errors + ' - Enter a valid Email address';
}
if (check.ChristmasDay.value == '-' || check.ChristmasMonth.value == '-' || check.ChristmasYear.value == '-')
{
errors = errors + ' - Please select a valid date';
}
else
{
var SelectedDate = check.ChristmasDay.value + "/" + check.ChristmasMonth.value + "/" +check.ChristmasYear.value;
if (isDate(SelectedDate)==false)
errors = errors + ' - Please select a valid date';
if (checkDateNotInPast(SelectedDate) == false)
errors = errors + ' - Please don\'t select a date in the past';
}
if (errors != '')
$.prompt("Please correct the following errors to order the Christams gift voucher:" + errors);
else
checkChristmasEmail(check.ChristmasEmail.value);
}
function checkChristmasEmail(email)
{
http.open('get', '/check_registered_mail.php?email='+email);
http.onreadystatechange = handlecheckChristmasEmailResponse;
http.send(null);
}
function handlecheckChristmasEmailResponse()
{
if(http.readyState == 4)
{
if (http.responseText == "error")
$.prompt("A user with the given email address is already registered.");
else
document.ChristmasVoucher.submit();
}
}
function isInteger(s){
var i;
for (i = 0; i < s.length; i++){
// Check that current character is number.
var c = s.charAt(i);
if (((c < "0") || (c > "9"))) return false;
}
// All characters are numbers.
return true;
}
function stripCharsInBag(s, bag){
var i;
var returnString = "";
// Search through string's characters one by one.
// If character is not in bag, append to returnString.
for (i = 0; i < s.length; i++){
var c = s.charAt(i);
if (bag.indexOf(c) == -1) returnString += c;
}
return returnString;
}
function daysInFebruary (year){
// February has 29 days in any year evenly divisible by four,
// EXCEPT for centurial years which are not also divisible by 400.
return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
for (var i = 1; i <= n; i++) {
this[i] = 31
if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
if (i==2) {this[i] = 29}
}
return this
}
function isDate(dtStr){
var daysInMonth = DaysArray(12)
var pos1=dtStr.indexOf("/")
var pos2=dtStr.indexOf("/",pos1+1)
var strMonth=dtStr.substring(0,pos1)
var strDay=dtStr.substring(pos1+1,pos2)
var strYear=dtStr.substring(pos2+1)
strYr=strYear
if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
for (var i = 1; i <= 3; i++) {
if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
}
month=parseInt(strMonth)
day=parseInt(strDay)
year=parseInt(strYr)
if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
return false
}
if (dtStr.indexOf("/",pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, "/"))==false){
return false
}
return true
}
function DisableSelect(enteredText)
{
if (enteredText != '')
{
document.getElementById("GiftTitle").selectedIndex = 0;
document.getElementById("GiftTitle").disabled = true;
}
else
document.getElementById("GiftTitle").disabled = false;
}
function checkDateNotInPast(obj)
{
var vDate = Date.parse(obj);
var today = new Date().getTime();
if(vDate < today)
return false;
else
return true;
}
function UpdateForm(selectedVal)
{
if (getCheckedValue(selectedVal) == "newUser")
{
document.getElementById("ExistingUserForm").style.display = "none";
document.getElementById("NewUserForm").style.display = "block";
document.getElementById("SignUpHref").href = "javascript:setMerchatType('doSignUp');";
document.getElementById("send_it").value = "1";
}
if (getCheckedValue(selectedVal) == "existingUser")
{
document.getElementById("ExistingUserForm").style.display = "block";
document.getElementById("NewUserForm").style.display = "none";
document.getElementById("SignUpHref").href = "javascript:CheckExistingUser();";
document.getElementById("send_it").value = "existing";
}
}
function CheckExistingUser()
{
var username = document.getElementById("EmailUsername").value;
var password = document.getElementById("LoginImPassword").value;
http.open('get', '/checkExistingImUser.php?username='+username+'&password='+password);
http.onreadystatechange = handleCheckExistingUserResponse;
http.send(null);
}
function handleCheckExistingUserResponse()
{
if(http.readyState == 4)
{
response = http.responseText.split('|');
if (response[0] == "error")
$.prompt(response[1]);
else
document.data_form.submit();
}
}