var loggedIn = false; var prevTab = ""; function addToWishList(){ url = "wishlist_update.php?Add&"; quantity = $('Order').value; colour = $('product_colour').value; size = $('product_size').value; prodID = $('prodID').value; user = ''; title = $('product_title').value; url += "quantity="+quantity+"&size="+size+"&colour="+colour+"&Title="+title+"&prodID="+prodID+"&ajax"; loadPage(url,'wishlist'); } function displayPostage(){ var size = $('product_size').value; var bits = size.split(","); var price = bits[1] * $('Order').value; var basketTotal = 0; if(basketTotal==0) msg = ""; else msg = "This item would bring your postage to:
" price += basketTotal; if(price>=180){ $('postage').innerHTML = "Postage
"+msg+ "
FREE within the UK, and
"+ "
Please call for the rest of the world
"; } if(price<180){ $('postage').innerHTML = "Postage
"+msg+ "
£7.50 within the UK, and
"+ "
£12.00 to the rest of the world
"; } if(price<75){ $('postage').innerHTML = "Postage
"+msg+ "
£5.50 within the UK, and
"+ "
£9.50 to the rest of the world
"; } if(price<50){ $('postage').innerHTML = "Postage
"+msg+ "
£4.50 within the UK, and
"+ "
£7.50 to the rest of the world
"; } if(price<30){ $('postage').innerHTML = "Postage
"+msg+ "
£3.50 within the UK, and
"+ "
£5.50 to the rest of the world
"; } if(price<15){ $('postage').innerHTML = "Postage
"+msg+ "
£2.00 within the UK, and
"+ "
£4.50 to the rest of the world
"; } } function updateDetails(){ if($('password1').value!="" && $('password1').value != $('password2').value){ displayMessage("The new passwords you have entered do not match, please try again"); } if($('pass').value==''){ alert("For security you must enter your password in order to update your details."); gotoField("pass"); return false; } else { url = 'ajax=true&'+$('details').toQueryString(); if($('checkout')){ loadPage('user_editaccount.php','details_div','main_address',url); } else { loadPage('user_editaccount.php','details_div','details_div',url); } return false; } } function checksubmit(){ //this checks to see if the old password has been entered on the edit account page //if so the submit button is enabled, otherwise it is disabled if($('pass').value!=""){ $('submitbutton').disabled = false; $('update_message').innerHTML = ""; }else{ $('submitbutton').disabled = true; $('update_message').innerHTML = "You must enter your old password before you can proceed."; } } //================================================ //registration functions //================================================ function genpassword() { var length = 6; var pass = ""; // all the chars we want to use var chars = "a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 - + * / ! @ %"; var bits = chars.split(" "); for(i=0;i"; } function checkPhoneNumber(box){ var val = box.value; var v = ""; var valid = "0 1 2 3 4 5 6 7 8 9 - + ( )"; var bits = valid.split(" "); for(var i=0; i 7) t += val.substring(0,len-7)+" "; if(len>=7) t += val.substring(len-7,len-4)+" "+val.substring(len-4,len); box.value = t; } function titleCase(box){ var temp = box.value; box.value = (temp.charAt(0)).toUpperCase()+temp.substr(1,temp.length-1); } function showHelp(div){ switch(div){ case 'thumb': alert("This setting determines whether or not you see small images beside each product when browsing the catalogue. Switching this off will speed up the time the page takes to load (ideal for those using a dial-up connection).\n\nYou can change these preferences at any time by clicking on the 'My Account' link at the top and bottom of every page when you are logged in."); break; case 'pp': alert("This setting determines how many results are displayed on each page. Lower numbers will speed up the time a page takes to load, but will result in more pages of results."); break; case 'news': alert("If you would like us to keep you informed of any Dancewear related news, i.e. new products, offers, or changes to the website, please tick this box."); break; } } function submitRegForm(){ if($('missinginfo').innerHTML!=""){ message = "You have not provided enough information to register"; alert(message); return false; } else { message = "We will send an email to "+$('email1').value+", you must follow the link in this email to confirm your account."; if($('missinginfo_Order').innerHTML!="") message = "You have not provided enough information to place an order online, if you do not intend to place an order online, select ok. Otherwise select cancel and fill in the missing information\n\n"+message; send = confirm(message); } if(send){ return true; } else { return false; } } function checkRegistration(){ $("submitbutton").disabled = false; $("missinginfo").innerHTML = ""; var requiredF = Array("forename","surname","email1","email2","password1","password2"); var order = Array("address1","city","postcode","phone"); var missing = Array(); var missingOrder = Array(); var i; var m = ""; var mo = ""; for(i=0; i"; } for(i=0; i"; } //check that the phone number is long enough if(missingOrder.indexOf("phone")==-1 && $('phone').value.length<7){ missingOrder.push("phone"); $("phoneicon").innerHTML = ""; } if(missing.length>0){ m+= "
The following issues must be resolved before you can register:
    "; for(i=0; i 0) || (domain.indexOf(".") == -1) || (domain.indexOf(".") == (domain.length-1)) || email.indexOf(" ")!=-1){ if(m == "") m += "
    The following issues must be resolved before you can register:
      "; m += "
    • The email addresses you have entered are not valid. (must be name@domain and cannot contain spaces)
    • "; $("email1icon").innerHTML = ""; $("email2icon").innerHTML = ""; $("submitbutton").disabled = true; $("loyalty").innerHTML = ""; } else { checkEmailLoyalty(); } } if($('password1').value != $('password2').value && ($('password1').value != "" || $('password2').value!="")){ if(m == "") m += "
      The following issues must be resolved before you can register:
        "; m += "
      • The passwords you have entered do not match
      • "; $("password1icon").innerHTML = ""; $("password2icon").innerHTML = ""; $("missinginfo").innerHTML += m; $("submitbutton").disabled = true; } if(m != ""){ m += "
      "; } ///decide which sections are complete //======================================== //GENERAL INFO SECTION if(missing.indexOf('forename')==-1 && missing.indexOf('surname')==-1 && m.indexOf('email')==-1 && m.indexOf('password')==-1){ $('about_section').innerHTML = " Complete"; } else { $('about_section').innerHTML = " Incomplete"; } //======================================== //======================================== //ORDERING SECTION if(missingOrder.length==0){ $('shipping_section').innerHTML = " Complete"; } else { $('shipping_section').innerHTML = " Incomplete"; } //======================================== if(missingOrder.length>0){ mo = "
      The following fields have to be completed if you wish to place an order online:
        "; for(i=0; i 0) || (domain.indexOf(".") == -1) || (domain.indexOf(".") == (domain.length-1)) || email.indexOf(" ")!=-1){ return false; } else { return true; } } function showhide(div){ if(!$(div)) return; if($(div).style.display=="none") $(div).style.display = "block"; else $(div).style.display = "none"; } function show(div){ if(!$(div)) return; $(div).style.display = "block"; } function hide(div){ if(!$(div)) return; $(div).style.display = "none"; } function gotoField(div){ if($(div)) $(div).focus(); } function loadPage(url,waitdiv,loaddiv,postvars){ if(postvars==null) vartype='get'; else { vartype='post'; } if(waitdiv==null) waitdiv = 'content_div'; if(loaddiv==null || !$(loaddiv)) loaddiv = waitdiv; if($(waitdiv)){ $(waitdiv).innerHTML='

        Please wait:

        '; } new Ajax(url, { evalScripts: true, update: loaddiv, method: vartype, postBody: postvars }).request(); } function login(){ if($('login_email').value!="" && $('login_pass').value!=""){ loadPage('/CSS/user_login.php?ajax=true&'+$('loginform').toQueryString(),'login_div','user'); } else $('login_error').innerHTML = "Please enter an email address and password"; return false; } function updateMiniBasket(){ show('basket_div'); loadPage('/CSS/cart_minibasket.php','basket_div'); } function updateRecent(){ show('recent_div'); loadPage('/CSS/cart_recent.php?ajax=true','recent_div'); } function updatePrefs(){ loadPage('/CSS/user_webPrefs.php?'+$('prefs').toQueryString(), 'prefs_div'); } function showSearchResults(){ loadPage('/CSS/catalogue_search.php?limit=5&'+$('search_form').toQueryString(), 'search_div','master_search'); } function showSearchImage(id){ $('search_image').innerHTML = ""; } function hideSearchImage(){ $('search_image').innerHTML = "
        "; } function emptyBasket(){ loadPage('/CSS/cart_updatebasket.php','main_basket_div','main_basket_div','empty=true&ajax=true'); } function updateBasket(){ loadPage('/CSS/cart_updatebasket.php','main_basket_div','main_basket_div','ajax=true&'+$('basket_form').toQueryString()); return false; } function checkout(){ if(!loggedIn){ showhide('login_div'); } else loadPage('/CSS/cart_updatebasket.php','main_basket_div','main_basket_div','ajax=true&update=true&checkout=true'+$('basket_form').toQueryString()); return false; } function addSimilar(id){ loadPage('/CSS/cart_updatebasket.php','main_basket_div','main_basket_div','ajax=true&similar=true&Add=true&ID='+id); } function addProduct(id){ loadPage('/CSS/cart_updatebasket.php','basket_div', 'basket_div' ,'redirect=true&similar=true&Add=true&ID='+id); } function insertPageLinks(noofpages, currentPage){ var HTML = "
        \n" + "Currently on page \n" + "
        "; $('pagelinks').innerHTML = HTML; $('pageNumber').value = "current"; } function gotoPage(){ if($('pageNumber').value!='current'){ window.location = 'page'+$('pageNumber').value+'.html?'+parameters; } return false; } function changepage(){ if($('pageNumber').value=="current"){ $('navtext').innerHTML = "Currently on page"; $('pagelink_go').disabled = true; } else { $('navtext').innerHTML = "Jump to page"; $('pagelink_go').disabled = false; } } function switchTab(newTab){ if(prevTab!=""){ //clear any message that may have been left by the previous tab clearMessage(); } var tabs = new Array('details','reviews','faqs','friend'); var myEffect = new Array(); for(i=0; i"; $('message_div').style.backgroundColor = colour; $('message_space').style.height = "auto"; } function clearMessage(){ $('message_space').innerHTML = ""; $('message_space').style.height = "0"; } function checkEnquiry(prodID){ if($('eName').value==""){ displayMessage("Please fill in your name in the box below"); gotoField('eName'); } else if(!validateEmail($('eEmail').value)){ displayMessage("Please enter a valid email address i.e name@emailprovider.com"); gotoField('eEmail'); } else if($('ePhone').value==""){ displayMessage("Please fill in your phone number in the box below"); gotoField('ePhone'); } else if($('eEnquiry').value==""){ displayMessage("Please enter your enquiry in the box below"); gotoField('eEnquiry'); } else { loadPage('catalogue_product_askaquestion.php?prodID='+prodID,'enquiry','enquiry',$('enquiry_form').toQueryString()); } } function setStar(prod, rating, set){ if(set=='true'){ Prating = rating; $('rating').value=Prating; } for(i=1; i<=5; i++){ if(i<=rating) image = "star.gif"; else image = "blank_star.gif"; $("product"+prod+"star"+i).src = "graphics/"+image; } } function checkContents(){ clearMessage(); if($('reviewtext').value == "Type your review of this product in here.") $('reviewtext').value = ""; else if($('reviewtext').value=="") $('reviewtext').value = "Type your review of this product in here."; } function checkReview(){ if($('reviewtext').value == "Type your review of this product in here." || $('review').value == ""){ displayMessage("You must enter your review in the space provided"); return false; } else if(Prating==0){ return confirm("Are you sure you want to give this product a rating of 0 out of 5? If not, select cancel and then select the number of stars you want to give this product"); } else { return true; } } function validateContact(){ if($('cname').value==""){ displayMessage("Please enter your name"); $('cname').focus(); return false; } if(!validateEmail($('cemail').value)){ displayMessage("Please enter a valid email address i.e name@emailprovider.com"); $('cemail').focus(); return false; } if($('cbrowser').value==""){ displayMessage("To help use solve your problem please enter your browser, i.e. Internet Explorer, Firefox, Safari etc."); $('cbrowser').focus(); return false; } if($('cplatform').value==""){ displayMessage("To help use solve your problem please enter your platform, i.e. Windows 98, Windows XP, Mac OS X etc."); $('cplatform').focus(); return false; } if($('cdetails').value==""){ displayMessage("You must supply an enquiry"); $('cdetails').focus(); return false; } if($('cproblem').value=="NULL"){ displayMessage("Please select the reason for your enquiry, so that we can pass it on to the right person."); $('cproblem').focus(); return false; } } function checkoutDetailsValidated(valid){ if(!$('terms_conditions')) return; if(!valid){ $('terms_conditions').innerHTML = "We're sorry, but your personal details, delivery address / contact phone number are not complete. In order to proceed you will need update your details"; } else { $('terms_conditions').innerHTML = "You must read and agree to our Terms and Conditions to proceed.
        " + " I agree to the Terms & Conditions
        "+ " "+ ""; } } function checkOutEditDetails(){ loadPage('user_editaccount.php?ajax=true&checkoutp=true','customer_address','main_address'); hide('terms_conditions'); return false; } function checkReason(){ $('enquiryPill').disabled = false; switch($('cproblem').value){ case "Order Enquiry": if(!$('cordernumber')){ alert("To make an enquiry related to an order placed online, please login first."); $('cdetails').value = "PLEASE LOGIN FIRST"; $('cdetails').disabled = true; show('login_div'); $('login_email').focus(); } else { $('cordernumber').disabled = false; } break; case "Catalogue Request": alert("Unfortunately we do not provide a printed catalogue at this time, please download the relevant sections of the catalogue from the links at the side of the page"); $('enquiryPill').disabled = true; break; default: break; } } function resetPriority(id){ setPriority(id, $('priority'+id).value, true); } function setPriority(id, level, store){ highlight = '#cbaacb'; nohighlight = '#ffffff'; if(store) $('priority'+id).value = level; switch (level){ case "High": $('high'+id).style.backgroundColor = highlight; $('mid'+id).style.backgroundColor = highlight; $('low'+id).style.backgroundColor = highlight; break; case "Medium": $('high'+id).style.backgroundColor = nohighlight; $('mid'+id).style.backgroundColor = highlight; $('low'+id).style.backgroundColor = highlight; break; case "Low": $('high'+id).style.backgroundColor = nohighlight; $('mid'+id).style.backgroundColor = nohighlight; $('low'+id).style.backgroundColor = highlight; break; } } function newVerify(){ loadPage('core_verify.php', 'verify_div'); } function includeSWF(div, url, width, height, extraparam){ objectparams = ""; document.getElementById(div).innerHTML = ''+ ''+ ''+ ''+ ''+ ''+ objectparams+ ''+ ''+ ''; //alert(document.getElementById(div).innerHTML); }