﻿/// <reference path="jquery-1.3.2-vsdoc2.js" />
//jquery to handle include files for top navigation and left navigation
$(document).ready(function() {
    $('#client form').hide();
    $('#client a.clientBtn').click(function(event) {
        $('#client form').toggle(active);

    });
    //$("#lMenuMeetTheFirm").removeClass("hide");
    //$("#liContactUs").addClass("active");
    //$("#main_firm").addClass("active");
    //$("#contact").addClass("active");


    var emailTo = $.cookie('emailTo');
    var subject = $.cookie('subject');

    $("#to_name").val(emailTo);
    $("#subject").val(subject);

    $("#sendForm").click(function() {
        var userName = $('#user').val();
        var email = $('#emailAddress').val();
        $("#sendForm").text("Please wait...");

        $.ajax({
            type: 'POST',
            url: basePath + 'shared/GipsPresentationRegisHandler.ashx',
            data: { 'user': userName,
                'emailAddress': email,
                'productType': prodType
            },
            dataType: 'html',
            cache: false,
            success: function(data, textStatus) {
                if (data == "success") {
                    //alert('Thank you for contact us.');
                    $("#sendForm").text("Send");
                    window.location.href = window.location.href;

                }
                else {
                    $('#errorContainer').html('').append(data);
                    $("#sendForm").text("Send");
                }
            },
            error: function(xhr, textStatus, errorThrown) {
                alert('An unknown error occurred.please try again. ' + textStatus);
                $("#sendForm").text("Send");
                window.location.href = "../index.html";
            }
        });
        return false;
    });
});

function setValuesForLocation(spanId, header) {
    var url = window.location.href;
    var filename = url.substring(url.lastIndexOf('/') + 1);

    $.cookie('pageId', filename);
    $.cookie('emailTo', $("#" + spanId).html());
    $.cookie('subject', header);
}
function printDiv() {
    self.print();
}	
