﻿validationComment = commonValidationMessage;
validationTypeCommentFields = [
							              ["data", true, "email", null, emailComment, "Please enter a valid e-mail address", "inputError"],
							              ["data", true, "string", null, nameComment, "Please enter name", "inputError"],
							              ["data", true, "string", null, comment, "Please enter your comment", "inputError"]
									  ];


validationTypeCommentFieldsLoggedIn = [
							               ["data", true, "string", null, comment, "Please enter your comment", "textNewsletterError"]
									  ];


function CallBackFB(arg) {
    if (buttonToClickId == null) {
        window.location = '?';
    }
    else {
        document.getElementById(buttonToClickId).click();
    }
}

//function GetPermissionDialog(buttonToClick) {
//    buttonToClickId = buttonToClick;
//    
//    FB.Bootstrap.requireFeatures(["Connect"],function(){
//        FB.ensureInit(function() { FB.Connect.showPermissionDialog("publish_stream", function(x) { CallBackFB(x); })});
//    });
//}

function UpdateUserBox() 
{
    window.location = urlPageToReload;
}

function ClearCommentForm(commentId, emailId, nameId)
{

    try
    {
        var objEmail = document.getElementById(emailId);
        var objName = document.getElementById(nameId);

        if (objEmail.value == 'Email') {
            objEmail.value = '';
        }

        if (objName.value == 'Name') {
            objName.value = '';
        }
    }
    catch(e){}

    var objComment = document.getElementById(commentId);

    if (objComment.value == 'Type your comments here...') {
        objComment.value = '';
    }    
}

function ClearCommentFormShort(commentId) 
{

    var objComment = document.getElementById(commentId);

    if (objComment.value == 'Type your comments here...') {
        objComment.value = '';
    }
}

function SetFieldDefaultValue(fieldId, defaultText, textState)
{
    
    var objField = document.getElementById(fieldId);

    if (textState == 'focus' && objField.value == defaultText)
    {
        objField.value = '';
    }
    else if (textState == 'blur' && objField.value == '') {
        objField.value = defaultText;
    }
}