function submitSuggestion(catId, divName)
{
    var name, email, city, countryId, subject, content;
    
    name = $("#" + divName + " #txtName").val() ;
    email = $("#" + divName + " #txtEmail").val() ; 
    city = $("#" + divName + " #txtCity").val() ; 
    countryId = $("#" + divName + " #cmbCountries").val() ; 
    subject = $("#" + divName + " #txtSubject").val() ; 
    content = $("#" + divName + " #txtSuggestion").val() ; 
    
    if (name == "")
    {
        alert("Please enter your name!");
        return false;
    }
    if (! validate_email(email, ""))
    {
        alert("Please enter a valid email!");
        return false;
    }
    if (subject == "")
    {
        alert("Please enter a subject!");
        return false;
    }    
    
    var dataToPost = "action=SubmitSuggestion&categoryId=" + catId + "&name=" + name + "&email=" + email 
    + "&city=" + city + "&countryId=" + countryId + "&subject=" + subject+ "&content=" + content ;

    //alert(dataToPost) ;
    
    $.ajax({
        type: "POST",
        url: "../ajax/ajax_actions.php",
        data:  dataToPost,
        success: function(html){
            $("#" + divName).html(html);         
        }
    });        
}

function videoSectionChanged()
{
    var dataToPost = "action=VideoCatChanged&videoSection=" + $("#cmbVideoSections").val() ; 

    $.ajax({
        type: "POST",
        url: "../ajax/ajax_actions.php",
        data:  dataToPost,
        success: function(html){
            $("#divVideos").html(html);         
        }
    });     
    
}

function SubmitVote(questId)
{
    var selChoiceId = $("#frmPoll input[type='radio']:checked").val();
    if (selChoiceId > 0) {
        $.ajax({
            type: "POST",
            url: "../ajax/ajax_actions.php",  //we put a local path according to the page that is called this JS 
            data:   "selChoiceId=" + selChoiceId +
                    "&questId=" + questId +
                    "&action=Vote",
            success: function(html){
                $("#divMainPoll").html(html);             
            }
        });
    } else {
        alert("الرجاء اختيار جواب قبل التصويت. شكرا") ;
    }       
}

function PlayVideo(filePath, thumbnail, fileType)
{
    var dataToPost = "action=PlayVod&filePath=" + filePath + "&thumbnail=" + thumbnail + "&fileType=" + fileType ;  
    //alert(dataToPost) ;
    $.ajax({
        type: "POST",
        url: "../ajax/ajax_actions.php",
        data:   dataToPost,
        success: function(html){
            $("#divVideoHolder").html(html);             
        }
    });     
    
}
