﻿
function BannerClicked(bannerId) {
    jQuery.ajax({
        type: "get",
        url: location.protocol + "/SfCmsB2CUi/bannerTest.aspx",
        data: "bannerId=" + bannerId,
        dataType: "html",
        success: function (msg) {  },
        error: function (xhr, ajaxOptions, thrownError) { }
    });
}
 
 
 function LoadHotelRotator(RotatorId,pageSize,currentPage)
 {
    var root = location.protocol + '//' + location.host;
    jQuery.ajax({
    type: "post",
    url: root + "/ExecuteUserControl.aspx",
    data: "uc=hotelRotator&pageSize="+pageSize+"&RotatorId="+RotatorId+"&currentPage="+currentPage,
    dataType: "html",
    success: function(msg) {
        $("#hotelRotatorWrapper").html(msg);
    },
    error: function (xhr, ajaxOptions, thrownError){
        $("#hotelRotatorWrapper").html("Hata Oluştu.");
    }
    });
 }
 
  function LoadTourRotator(RotatorId,pageSize,currentPage)
 {
    var root = location.protocol + '//' + location.host;
    jQuery.ajax({
    type: "post",
    url: root + "/ExecuteUserControl.aspx",
    data: "uc=tourRotator&pageSize="+pageSize+"&RotatorId="+RotatorId+"&currentPage="+currentPage,
    dataType: "html",
    success: function(msg) {
        $("#tourRotatorWrapper").html(msg);
    },
    error: function (xhr, ajaxOptions, thrownError){
        $("#tourRotatorWrapper").html("Hata Oluştu.");
    }
    });
 }

 function AnswerOneQuestionSurvey(surveryId,questionId,answer) {
     var root = location.protocol + '//' + location.host;
     jQuery.ajax({
         type: "post",
         url: root + "/ExecuteUserControl.aspx",
         data: "uc=survey&answerSurvery=true&questionId=" + questionId + "&answer=" + answer,
         dataType: "html",
         success: function(msg) {
             LoadSurveyResult(surveryId);
         },
         error: function(xhr, ajaxOptions, thrownError) {
             $("#tourRotatorWrapper").html("An Error Occured");
         }
     });
 }

 function LoadSurveyResult(surveyId) {
     var root = location.protocol + '//' + location.host;
     jQuery.ajax({
         type: "post",
         url: root + "/ExecuteUserControl.aspx",
         data: "uc=surveyResult&surveyId=" + surveyId,
         dataType: "html",
         success: function(msg) {
             $("#surverWrapper").html(msg);
         },
         error: function(xhr, ajaxOptions, thrownError) {
            $("#surverWrapper").html("An Error Occured");
         }
     });
}

function isMouseLeaveOrEnter(e, handler) {
    var reltg = e.relatedTarget ? e.relatedTarget : e.type == 'mouseout' ? e.toElement : e.fromElement;
    while (reltg && reltg != handler) reltg = reltg.parentNode;
    return (reltg != handler);
}

var timeout;

function timeout_clear() {
    clearTimeout(timeout);
}

function trim(str) {
    if (!str || typeof str != 'string')
        return null;

    return str.replace(/^[\s]+/, '').replace(/[\s]+$/, '').replace(/[\s]{2,}/, ' ');
}
