﻿//var $jq = jQuery.noConflict(); $jq(document).ready(function () { $jq('#vslider').coinslider({ width: 653, height: 253, spw: 7, sph: 5, delay: 5000, sDelay: 30, opacity: 0.7, titleSpeed: 1500, effect: 'rain', navigation: false, links: false, hoverPause: false }); });


function SlideToggle() {
    $('#clickk').show();
    $('#search').click(function (event) {
        var $target = $(event.target);
        if ($target.is("H1")) {
            slideToggleDiv();
        }

    });
}

function SlideOn() {
    $("#drM").hide();
    $("#backgr").hide();
    $('#clickk').show();
    hidden = false;
}


function SlideOff() {
    $("#drM").show();
    $("#backgr").show();
    $('#clickk').hide();
    hidden = true;
}


function SlideIndex() {
    $("#drM").show();
    $("#backgr").show();
    $('#clickk').hide();
    hidden = true;
}

function GalleryInit() {
$(document).ready(
			function () {
				$("#pikame").PikaChoose();

				$("#pikame").jcarousel({ scroll: 3,
				    vertical: true,
				    initCallback: function (carousel) {
				        $(carousel.list).find('img').click(function () {
				            //console.log($(this).parents('.jcarousel-item').attr('jcarouselindex'));
				            carousel.scroll(parseInt($(this).parents('.jcarousel-item').attr('jcarouselindex')));

				        });
				    }
				});

			});
}



// JScript File
// Removes leading whitespaces
function LTrim(value) {

    var re = /\s*((\S+\s*)*)/;
    return value.replace(re, "$1");

}

// Removes ending whitespaces
function RTrim(value) {

    var re = /((\s*\S+)*)\s*/;
    return value.replace(re, "$1");

}

// Removes leading and ending whitespaces
function trim(value) {

    return LTrim(RTrim(value));

}
function app_submit() {

    var txtFName = document.getElementById("FirstName");
    var txtLName = document.getElementById("LastName");
    var txtEmail = document.getElementById("Email");

    var lblFName = "First Name";

    var lblLName = "last Name";
    var lblEmail = "Email";

    var chkAgree = document.getElementById("agree");


    var validation_summary = "Please complete and answer the required fields:\n";

    if (chkAgree != null && chkAgree.checked == false) {
        validation_summary = validation_summary + "Please agree to the terms and conditions.\n";
    }

    if (trim(txtFName.value) == "") {
        validation_summary = validation_summary + "First Name\n";
        lblFName.innerHTML = "*";
    }
    if (trim(txtLName.value) == "") {
        validation_summary = validation_summary + "Last Name\n";
        lblLName.innerHTML = "*";
    }
    if (trim(txtEmail.value) == "") {
        validation_summary = validation_summary + "Email\n";
        lblEmail.innerHTML = "*";
    }
    else {
        retxtname = new RegExp(/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/);
        if (!(retxtname.test(trim(txtEmail.value)))) {
            validation_summary = validation_summary + "Email address is not valid\n";
            lblEmail.innerHTML = "*";
        }
    }
  

    if (validation_summary == "Please complete and answer the required fields:\n") {
        return true;
    }
    else {
        alert(validation_summary);
        return false;
    }
}


function refer_submit() {

    var txtFName = document.getElementById("ctl00_Body_tbName");
    var txtEmail = document.getElementById("ctl00_Body_tbEmail");
    var txtFrindsName = document.getElementById("ctl00_Body_tbFrindsName");
    var txtFrindsEmail = document.getElementById("ctl00_Body_tbFrindsEmail");

    var lblFName = "Name";
    var lblEmail = "Email";
    var lblFrindsName = "Frinds Name";
    var lblFrindsEmail = "Frinds Email";


    var validation_summary = "Please complete and answer the required fields:\n";

  

    if (trim(txtFName.value) == "") {
        validation_summary = validation_summary + "Name\n";
    }
    if (trim(txtFrindsName.value) == "") {
        validation_summary = validation_summary + "Frinds Name\n";
    }
    if (trim(txtEmail.value) == "") {
        validation_summary = validation_summary + "Email\n";
    }
    else {
        retxtname = new RegExp(/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/);
        if (!(retxtname.test(trim(txtEmail.value)))) {
            validation_summary = validation_summary + " Email address is not valid\n";
        }
    }


    if (trim(txtFrindsEmail.value) == "") {
        validation_summary = validation_summary + "Frinds Email\n";
    }
    else {
        retxtname = new RegExp(/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/);
        if (!(retxtname.test(trim(txtFrindsEmail.value)))) {
            validation_summary = validation_summary + "Frinds Email address is not valid\n";
        }
    }


    if (validation_summary == "Please complete and answer the required fields:\n") {
        return true;
    }
    else {
        alert(validation_summary);
        return false;
    }
}


var hidden = false;

function slideToggleDiv() {

   // alert(this);

    if (hidden == false) {
        $('#drM:hidden').slideToggle();
        $('#backgr:hidden').slideToggle();
        $('#clickk').stop(true, true).fadeOut();
        hidden = true;
    }
    else {

        $('#drM').slideToggle();
        $('#backgr').slideToggle();
        $('#clickk').stop(true, true).fadeIn();
        hidden = false;
    }
}


//window.onload = function() {
//    document.body.onclick = function(event) {
//        alert(event.target.id);
//    }
//}




 
