﻿

function moveRight(page) {
    var sch = document.body.offsetHeight;
    $('.rightsegment').css({ 'opacity': '0.3', 'overflow':'visible', 'height': '600px' });
    $('#rs' + page).css({'opacity': '1', 'overflow':'visible', 'height':'auto'});
    var mp = Number(page) * 500;
    $('#rightlong').css('marginLeft', "-" + mp+"px");
}

function sendMail() {

    var name = $('#ename').val();
    var email = $('#email').val();
    var message = $('#emessage').val();

    var regex = new RegExp(/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/);
    var errorm = "";
    if (name != undefined && name.length > 1) {
        if (regex.test(email)) {
            if (message != undefined && message.length > 1) {
                $('#errorwrap').css({ 'opacity': 0, 'display': 'none' });
                $.ajax({
                    url: '/sendmail',
                    data: { name: name, email: email, message: message },
                    success: function (data) {

                        if (jQuery.trim(data) == "true") {
                            $('.csendwrap').css({ 'opacity': 0, 'display': 'none' });
                            $('#successwrap').css({ 'opacity': 1, 'display': 'block' });
                        }
                    }
                });
            }
            else {
                errorm += "Please include a message";
            }
        }
        else {
            errorm += "Please include a valid email address";
        }
    }
    else {
        errorm += "Please include your name";

    }
    if (errorm.length > 0){
        $('#cerror').html(errorm);
        $('#errorwrap').css({'opacity':1, 'display':'block'});
    }
}


function displayP(site) {
    var sites = new Array();
    sites.push('<h2>The Reptilarium</h2><br /><p><img src="/Content/images/reptilarium.jpg" />' +
    'The Reptilarium is a reptile and fish shop, supplying live animals and equipment for animal keepers. ' +
    'The website was built for my degree project at university and consists of a content management system for keeping ' +
    'stock of both live animals and dry goods that visitors can buy through the website using paypal payment integration.<br /><br />' +
    'The entire design was from scratch, including the logo design.' +
    '<br /><br />Link: <a href="http://www.thereptilarium.com">www.thereptilarium.com</a>' +
    '</p>');
    sites.push('<h2>Double Eight Tattoo</h2><br /><p><img src="/Content/images/double8.jpg" />' +
    'Double Eight Tattoo Studio is a local tattoo and piercing studio, providing original designs and high quality inking. ' +
    'The website created was designed to include elements from the tattoo studios design, with a black and green theme. ' +
    'The site contains a gallery showing a selection of recent tattoos, with a guestbook for customers to comment on the studio.' +
    '<br /><br />Link: <a href="http://www.doubleight.co.uk">www.doubleight.co.uk</a>' +
    '</p>');
    sites.push('<h2>Road to FA Cup</h2><br /><p><img src="/Content/images/rtfac.jpg" />' +
    'Road to FA Cup is a "mockumentary" based around a local team going on a run in the prestigious F.A. Cup. ' +
    'The concept for the site was to provide the producers with a way to display their creation to potential purchasers for the series. ' +
    'The main element on the page is the video area where youtube videos are embedded so visitors can view trailers and other media.' +
    '<br /><br />Link: <a href="http://www.roadtofacup.co.uk">www.roadtofacup.co.uk</a>' +
    '</p>');
    sites.push('<h2>T and S Parrots</h2><br /><p><img src="/Content/images/tands.jpg" />' +
    'T&amp;S Parrots is a website designed and developed for a local parrot breeder. ' +
    'Parrot breeding is a niche market and it was important to get the largest area coverage for their business to increase sales. ' +
    'The site is built around several simple pages documenting exactly what services are available, encouraging propspective customers to get in touch. ' +
    'A guestbook is also included to let previous customers leave feedback on the service they recieved.'+
    '<br /><br />Link: <a href="http://www.tandsparrots.com">www.tandsparrots.com</a>' +
    '</p>');
    $('#darkcontent').html(sites[site]);
    $('#darkbackground').fadeIn();
}

$(function () {
    $('#darkbackground').click(function () {
        $('#darkbackground').fadeOut();
    });
});
