function newPopup(url) {
	popupWindow = window.open(
		url,'popUpWindow','height=500,width=400,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no')
}

function copyOverValues() {

    document.getElementById('pay').deliveryFirstName.value = document.getElementById('pay').billingFirstName.value;
    document.getElementById('pay').deliverySurname.value = document.getElementById('pay').billingSurname.value;
    document.getElementById('pay').deliveryAddress1.value = document.getElementById('pay').billingAddress1.value;
    document.getElementById('pay').deliveryAddress2.value = document.getElementById('pay').billingAddress2.value;
    document.getElementById('pay').deliveryCity.value = document.getElementById('pay').billingCity.value;
    document.getElementById('pay').deliveryPostcode.value = document.getElementById('pay').billingPostcode.value;
    document.getElementById('pay').deliveryCountry.value = document.getElementById('pay').billingCountry.value;

}



$(document).ready(function(){

	

    $('.copy-over-checkbox').click(function() {
        copyOverValues();
    });

    $('.show-all-on').click(function() {

        $('#show_all').val(1); 
        $('#page').val(0);
        $('#myform').submit();

    });

    $('.show-all-off').click(function() {

        $('#show_all').val(0);
        $('#page').val(0);
        $('#myform').submit();

    });

    $('.page-number').click(function() {

        $('#page').val($(this).html());
        $('#show_all').val(0);
        $('#myform').submit();

    });

     $('#continue-shopping-button').click(function() {
             disablePopup2();
    });




























    $('.input-value').click(function() {

        if(this.value == 'Search the site'){
            this.value='';
        }

    });

    $('.input-search').click(function() {

        if(this.value == 'Search'){
            this.value='';
        }

    });

    $('.input-newsletter-name').click(function() {

        if(this.value == 'Full name'){
            this.value='';
        }

    });

    $('.input-newsletter-email').click(function() {

        if(this.value == 'Email address'){
            this.value='';
        }

    });

    $('.input-category').click(function() {

        if($(this).attr('id') == 'view-all-sizes'){
            if($('#view-all-sizes').attr('checked') == true){
                $('.size').attr('checked', true);
            }else{
                $('.size').attr('checked', false);
            }
        }

        if($(this).attr('id') == 'view-all-categories'){
            if($('#view-all-categories').attr('checked') == true){
                $('.category').attr('checked', true);
            }else{
                $('.category').attr('checked', false);
            }
        }

        if($(this).attr('id') == 'view-all-colours'){
            if($('#view-all-colours').attr('checked') == true){
                $('.colour').attr('checked', true);
            }else{
                $('.colour').attr('checked', false);
            }
        }

        $('#page').val(1);
        $('#myform').submit();
    });

    $('#myform').submit(function() {
        ajaxPredictiveSearch();

      $('#black-screen').show();
      $('#black-screen').fadeOut(3000);
      
      return false;
    });

    $('#slider').click(function() {
        $(window).unbind('mousemove');
    });

    $('#view-all-sizes').click(function() {
        if($(this).attr('checked') == true){
            $('.size').attr('checked', true);
        }else{
            $('.size').attr('checked',false)
        }
    });

    $('#view-all-categories').click(function() {
        if($(this).attr('checked') == true){
            $('.category').attr('checked', true);
        }else{
            $('.category').attr('checked',false)
        }
    });

    $('#view-all-colours').click(function() {
        if($(this).attr('checked') == true){
            $('.colour').attr('checked', true);
        }else{
            $('.colour').attr('checked',false)
        }
    });

    $('.border').click(function() {
        $('.border').removeClass("on");
        $(this).addClass("on");
        $('#colour-input').val($(this).attr('title'));
    });

    $('.size-select span').click(function() {
        $('.size-select span').removeClass("on");
        $(this).addClass("on");
        $('#size-input').val($(this).html());
    });

    $('.thumbnail img').click(function() {
       $('#main-image').attr('src', $(this).attr('src').substr(0, 52) + $(this).attr('src').substr(55));
       $('#main-image-link').attr('href', $(this).attr('src').substr(0, 52) + $(this).attr('src').substr(55));
    });

	$('#product-top-menu').hover(function(){
		$('#products-link').addClass('product-on');
	},function(){
		$('#products-link').removeClass('product-on');
	});
	
});






 
