// JavaScript Document
$(document).ready(function () {
    $('.TERMS').click(function () {
        TermsPopup();
    });

    $('.mailsignup').fadeOut();

    $('.MAILINGLIST').click(function () {
        $('.mailsignup').fadeIn();
    });
    
    $(this).delay(1000, function () { // wait half a sec
        $(".vscrollerbar").addClass('fix').css({
            height: '10px',
            overflow: 'hidden',
            padding: '0px',
            maegin: '0px'
        });
    });
});
// Delay Function
jQuery.fn.delay = function (time, func) {
    this.each(function () {
        setTimeout(func, time);
    });
    return this;
};
function LightBox() {
    var width = document.documentElement.clientWidth + document.documentElement.scrollLeft;
    var layer = document.createElement('div');
    layer.style.zIndex = 90;
    layer.id = 'layer';
    layer.style.position = 'absolute';
    layer.style.top = '0px';
    layer.style.left = '0px';
    layer.style.height = /* document.documentElement.scrollHeight +  */'100%';
    layer.style.width = width + 'px';
    layer.style.backgroundColor = 'transparent';
    layer.style.opacity = '.6';
    layer.style.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=60)");
    document.body.appendChild(layer);
    /*  var div = document.createElement('div');  div.style.zIndex = 3;  div.id = 'box';  div.style.position = (navigator.userAgent.indexOf('MSIE 6') > -1) ? 'absolute' : 'fixed';  div.style.top = '200px';  div.style.left = (width / 2) - (400 / 2) + 'px';   div.style.height = '50px';  div.style.width = '400px';  div.style.backgroundColor = 'white';  div.style.border = '2px solid silver';  div.style.padding = '20px';  document.body.appendChild(div);  var p = document.createElement('p');  p.innerHTML = '<span class="title">Sign In</span>';  div.appendChild(p);  var a = document.createElement('a');  a.innerHTML = 'Sign In';  a.href = 'javascript:void(0)';  a.onclick = function()  {    document.body.removeChild(document.getElementById('layer'));    document.body.removeChild(document.getElementById('box'));  };  div.appendChild(a);  */
}
function CloseLightBox() {
    if (document.getElementById('layer')) { document.body.removeChild(document.getElementById('layer')) };
}
function ShowCustomerForm() {
    LightBox();
    $("#CustomerDetailsBox").fadeIn("fast");
}
function HideCustomerForm() {
    CloseLightBox();
    $("#CustomerDetailsBox").fadeOut("fast");
}
function TermsPopup() {
    var stringVar = "I am a string that \extends \beyond a single line";
    var page1 = '<h2>Terms and Conditions</h2> \	<p>In these Terms and Conditions the reference to "we" and "us" means Kitt off Limited trading as Kitch Clothing and "you" is the reference for the purchaser of Goods from us.</p> \	<p>"Contract" means the Contract between us and the purchaser you which incorporate these Terms and Conditions.</p> \	<p>"Goods" means the garments and other items purchased from us by you.</p> \	<p>"Terms" means these Terms and Conditions.</p> \	<p>"P&P" means Postage and Packaging.</p> \	<p>These are the only Terms and Conditions under which we operate. If there are any variations to these terms for any reason,  \	these variations must have written confirmation from our representative to you.</p> \	<h3>1.	Prices</h3> \	<dl> \		<dt>1.1</dt> <dd>The price of Goods on our website is inclusive of VAT. If VAT has not been included for any reason it will be added at the checkout and payable by you at the appropriate rate.</dd> \		<dt>1.2</dt> <dd>The cost of P&P is shown separately from the price of the Goods. Quotations will be provided on request for overseas P&P.</dd> \		<dt>1.3</dt> <dd>All published prices may be subject to change without prior notification.</dd> \	</dl> \	<h3>2. Order Information</h3> \	<dl> \		<dt>2.1</dt> <dd>All information that you are required to provide at the time of order must be accurate and complete. It must apply to you only and not to any third party.</dd> \		<dt>2.1</dt> <dd>You will receive a confirmation of order acknowledging the details of your order together with a payment reference acknowledging acceptance of the credit debit card transaction.</dd> \		<dt>2.3</dt> <dd>Any error in any ordering process due to technical or other reasons beyond our control allows us to treat the order as not binding to us.</dd> \	</dl> \	';
    var page2 = '<h3>3. Privacy</h3> \	<dl> \		<dt>3.1</dt> <dd>When placing an order you will need to provide us with personal information. We will not disclose this information to any third party other than for the purpose of processing the order and arranging delivery.</dd> \	</dl> \	<h3>4. Payment</h3> \	<dl> \		<dt>4.1</dt> <dd>We accept payment from Visa, Visa Electron, MasterCard, Maestro, Switch and AMEX. On receiving your order we will carry out a pre-authorisation check on your payment card to ensure that there are sufficient  \		funds to fulfil the transaction. Goods will not be dispatched until this authorisation has been completed.</dd> \		<dt>4.2</dt> <dd>All payment for Goods and for the cost of P&P must be received before dispatch can take place.</dd> \	</dl> \	<h3>5. Delivery</h3> \	<dl> \		<dt>5.1</dt> <dd>We will give you an estimated delivery date but no times or dates can be guaranteed. All Goods are sent via Royal Mail Registered mail service unless otherwise requested.  \		On occasion items may become lost in the post. We will try to replace the item if it remains in stock but no guarantees can be given for this.</dd>  \		<dt>5.2</dt> <dd>Kitt off Limited cannot be held responsible for delays incurred whilst Goods are in transit with Royal Mail.</dd> \		<dt>5.3</dt> <dd>You must notify us promptly and in any event within 48 hours of receipt of any Goods if they appear to be damaged in transit. In these circumstances you  \		must also keep and return the packaging as this may be required when making a claim.</dd>  \		<dt>5.4</dt> <dd>Any order placed over the weekend or bank holiday will not be processed until the next working day.</dd> \	</dl> \	';
    var page3 = '<h3>6. Returns</h3> \	<dl> \		<dt>6.1</dt> <dd>If you wish to return an item then you must email us at <a href="mailto:info@kitchclothing.co.uk">info@kitchclothing.co.uk</a> to notify us of the return within 7  \		days of receiving the Goods. You must make it clear if you require an exchange, credit note or refund for the item.</dd> \		<dt>6.2</dt> <dd>You must take reasonable care of the Goods while in your possession and return these to us appropriately packaged to avoid \		damage and within 7 days from the date of receipt with all Kitch labels and designer tags still attached. Items will not be accepted without these conditions in place.</dd> \		<dt>6.3</dt> <dd>We will refund the purchase price to you within 30 days of the cancellation notice providing all returns conditions are met. </dd> \	</dl> \	<h3>7. Colours</h3> \	<dl> \		<dt>7.1</dt> <dd>We have made all efforts to ensure that colours of Goods are accurately represented. We cannot accept responsibility for different \		representations of colours due to the nature of reproduction on different monitors.</dd> \	</dl> \	<h3>8. Faulty Goods </h3> \	<dl> \		<dt>8.1</dt> <dd>Goods are classified as faulty if they are received damaged, or where a manufacturing fault occurs within six months of purchase. \		Please note that items that are damaged due to wear and tear will not be considered faulty.</dd> \		<dt>8.2</dt> <dd>We will only replace faulty items with the same product in the same size subject to availability. Where possible we will offer to repair faulty products at our cost.</dd> \	</dl> \	<h3>9.Late Returns </h3> \	<dl> \		<dt>9.1</dt> <dd>Goods returned outside of the above time frames will not be accepted and will be returned to the customer.</dd> \	</dl> \	';
    var page4 = '<h3>10.Risk and Ownership </h3> \	<dl> \		<dt>10.1</dt> <dd>The risk of loss or damage to Goods passes to you upon receipt of delivery. If you have agreed to collect the Goods the risk passes to you on collection.</dd> \		<dt>10.2</dt> <dd>Ownership of all Goods remains with us until full and complete payment has been received by us.</dd> \	</dl> \	<h3>11. Warranties and Liabilities</h3> \	<dl> \		<dt>11.1</dt> <dd>We warrant to you that the Goods ordered by you will meet the description as shown on our website.</dd> \		<dt>11.2</dt> <dd>We will not have any responsibility for any damage which occurs to the Goods after delivery.</dd> \		<dt>11.3</dt> <dd>If any defect in any Goods appears within 6 months of delivery, you must notify us as soon as you become aware of the defect, giving us full details. We will then decide, \		in consultation with you, whether the defect is our responsibility. If so, we may offer to repair the Goods or replace them with similar Goods. Any defective Goods returned to us may be returned at your expense.</dd> \		<dt>11.4</dt> <dd>We do not accept responsibility for any wear and tear, accidental damage or failure by you or any third party to adhere to any written recommendation provided in relation to the Goods.</dd> \		<dt>11.5</dt> <dd>Liability to you for loss or damage will under no circumstances exceed the amount you have originally paid for the Goods.</dd> \	</dl> \	<h3>12.	Notices</h3> \	<dl> \		<dt>12.1</dt> <dd>If you wish to give us any notice relating to a matter covered by these Terms, whether or not you have telephoned us, \		you must confirm that notice in writing. In the case of email notices these should be sent to Info@kitchclothing.co.uk and you must \		send them so as to return an acknowledgement of receipt. Notice may be sent by post to Kitch, 1 High Street, Tunbridge Wells, TN1 1UL </dd> \	</dl> \	';
    var page5 = '<h3>13.	 Customer Default</h3> \	<dl> \		<dt>If you:</dt> \		<dd> \		give us any incorrect personal information, or <br /> \		fail to make any payment when it is due, or <br /> \		cancel any payment, or <br /> \		become insolvent, or <br /> \		commit any breach of these Terms <br /> \		then in any of these events we have the right to cancel the Contract and recover possession <br />  \		of any Goods which have been supplied for which payment has not been received in full. <br /> \		</dd> \	</dl> \	<h3>14. Force Majeure</h3> \	<dl> \		<dt>14.1</dt> <dd>We will not have any liability to you if we are prevented from performing any of our obligations on account of any \		circumstances out of our control which includes, but is not limited to, extreme weather conditions, act of God, terrorism, \		war, strike or difficulty in obtaining materials and/or labour. In any of these circumstances we reserve the right to terminate the Contract.</dd> \	</dl> \	<h3>15.	 General</h3> \	<dl> \	<dt></dt> \		<dd>Severance: If any provision in these Terms is held by a court to be unenforceable, that will not affect the remaining provisions of the Terms.\		Entire Agreement: These Terms govern our relationship with you and in accepting them, you confirm that no other arrangement, agreement or representation applies. </dd> \	</dl> \	<h3>16.	  Disputes</h3> \	<dl> \		<dt>16.1</dt> <dd>If there is a dispute which we cannot settle by direct negotiation it may be referred to mediation if agreed between us. In that event,  \		the mediation will be conducted in accordance with the CEDR (Centre for Effective Dispute Resolution) mediation rules current at the date of the dispute. </dd> \		<dt>16.2</dt> <dd>Any dispute between us will be finally determined by the English courts and you agree to submit to the jurisdiction of these courts.</dd> \	</dl> \	<h3>17.	 Governing Law</h3> \	<dl> \		<dt></dt> \		<dd>These Terms and the Contract between us are governed by English law.</dd> \	</dl> \	';
    var temp = {
        state0: {
            html: page1,
            buttons: { Close: false, Next: true },
            focus: 1,
            submit: function (v, m, f) {
                if (!v)
                    return true;
                else $.prompt.goToState('state1'); //go forward
                return false;
            }
        },
        state1: {
            html: page2,
            buttons: { Close: 0, Previous: -1, Next: 1 },
            focus: 2,
            submit: function (v, m, f) {
                if (v == 0)
                    $.prompt.close()
                else if (v == 1)
                    $.prompt.goToState('state2'); //go forward
                else if (v = -1)
                    $.prompt.goToState('state0'); //go back
                return false;
            }
        },
        state2: {
            html: page3,
            buttons: { Close: 0, Previous: -1, Next: 1 },
            submit: function (v, m, f) {
                if (v == 0)
                    $.prompt.close()
                else if (v == 1)
                    $.prompt.goToState('state3'); //go forward
                else if (v = -1)
                    $.prompt.goToState('state1'); //go back
                return false;
            }
        },
        state3: {
            html: page4,
            buttons: { Close: 0, Previous: -1, Next: 1 },
            submit: function (v, m, f) {
                if (v == 0)
                    $.prompt.close()
                else if (v == 1)
                    $.prompt.goToState('state4'); //go forward
                else if (v = -1)
                    $.prompt.goToState('state2'); //go back
                return false;
            }
        },
        state4: {
            html: page5,
            buttons: { Done: false },
            submit: function (v, m, f) {
                if (!v)
                    return true;
                else $.prompt.goToState('state4'); //go back
                return false;
            }
        }
    }
    //$.prompt.setStateDefaults(options)
    //Sets the defaults for states.
    $.prompt.setDefaults({
        top: 31
    });
    $.prompt(temp);
}


function MailingListPopup() {
    var stringVar = "I am a string that \extends \beyond a single line";
    var page1 = '<h2>Sign up to our mailing list.</h2> \    Email Address:in \
    <input type="text" name="SignUpEmail" id="SignUpEmail" /> \
    ';
    var temp = {
        state0: {
            html: page1,
            buttons: { Close: false, Next: true },
            focus: 1,
            submit: function (v, m, f) {
                if (!v)
                    return true;
                else $.prompt.goToState('state1'); //go forward
                return false;
            }
        }
    }
    //$.prompt.setStateDefaults(options)
    //Sets the defaults for states.
    $.prompt.setDefaults({
        top: 31
    });
    $.prompt(temp);
}
