﻿    $(function(){
        //LoadMenu();
        $(".cmbLang").msDropDown();
    });

    function LoadMenu(){
      $(".myMenu").buildMenu(
      {
        template:"menuVoices.html",
        additionalData:"pippo=1",
        menuWidth:200,
        openOnRight:false,
        menuSelector: ".menuContainer",
        iconPath:xPathBase+"_theme/"+xThemeID+"/image/icon/",
        hasImages:true,
        fadeInTime:100,
        fadeOutTime:300,
        adjustLeft:2,
        minZindex:"auto",
        adjustTop:10,
        opacity:.95,
        shadow:true,
        openOnClick:false,
        closeOnMouseOut:true,
        closeAfter:1000
      });
    }

    function languageChange(langKey)
    {
        $('#'+xPreID+'_LanguageKey').val(langKey);
        $('#'+xPreID+'btnLanguage').click();    
    }
    
    function scrlTo(objID){
        if(objID==null){
            objID=$('.btnNext').eq(0).attr("id");
        }
        if(objID!="")
            $('body').scrollTo($('#'+objID),800);
    }
    
    function navigatePage(url,menuID)
    {
        window.location=url;
    }
    
    
    var messageBusy=false;
    function setMessageCount()
    {
        if(!showMessage) return;
        try{
        if(!messageBusy)
        {
            messageBusy=true;
            $.getJSON(xPathBase+"data/notice.ashx",
              {nd:new Date().getTime()
              ,parType: "GetMessageCount"
              },
              function(data){
                if(data=="0" || data=="null"|| data==null){
                    $('.notifyMessage').hide();
                }else{
                    $('.notifyMessage').show();
                    if($('.notifyMessage').attr("data")!=data)
                    {
                        $('.notifyMessage').cyclicFade({
                            repeat: 4,
                            params: [
                                {fadeout:200, stayout:100, opout:0, fadein:200, stayin:300, opin:1.0}
                            ]
                        });
                        setNotify(true);
                        setTimeout('setNotify(false);',5000);
                    }
                    $('.notifyMessage').attr("data",data);
                    $('.notifyMessage').text(data+_langNotMesaj);
                }
                messageBusy=false;
              }
            );
        }
        }catch(err){}
    }

    setInterval('setMessageCount()',15000);    

    var cancelBusy=false;
    function setCancelCount()
    {
        if(!showMessage) return;
        try{
        if(!cancelBusy)
        {
            cancelBusy=true;
            $.getJSON(xPathBase+"data/notice.ashx",
              {nd:new Date().getTime()
              ,parType: "GetCancelCount"
              },
              function(data){
                //data="7";
                if(data=="0"){
                    $('.notifyCancel').hide();
                }else{
                    $('.notifyCancel').show();
                    if($('.notifyCancel').attr("data")!=data)
                    {
                        $('.notifyCancel').cyclicFade({
                            repeat: 4,
                            params: [
                                {fadeout:200, stayout:100, opout:0, fadein:200, stayin:300, opin:1.0}
                            ]
                        });
                        setNotify(true);
                        setTimeout('setNotify(false);',5000);
                    }
                    $('.notifyCancel').attr("data",data);
                    $('.notifyCancel').text(data+_langNotIptal);
                }
                cancelBusy=false;
              }
            );
        }
        }catch(err){}
    }
    setInterval('setCancelCount()',15000);    
    
    var showMessage=false;
    
    function initMessage(visible)
    {
        showMessage=visible;
        if(visible){
            setMessageCount();
            setCancelCount();
            $('#barTop').show();
        }else{
            $('#barTop').hide();
        }
    }
    
    
    var winID=0;
    function winOpen(url,width,height)
    {
        winID++;
        var left   = (screen.width  - width)/2;
        var top    = (screen.height - height)/2;
        var params = 'width='+width+', height='+height;
        params += ', top='+top+', left='+left;
        params += ', directories=no';
        params += ', location=no';
        params += ', menubar=no';
        params += ', resizable=1';
        params += ', scrollbars=yes';
        params += ', status=no';
        params += ', toolbar=no';
        newwin = window.open(url,'window'+winID.toString()+new Date().getTime(), params);
        if (window.focus) {newwin.focus()}
    }
    
    
    
    
    
jQuery(document).ready(function(){
    $("#barTopInner").hover(
        function () {
            setNotify(true);
          },
        function () {
            setNotify(false);
          }
    );
})

function setNotify(open){
    var top=(open?0:-35);
    $('#barTop').animate({top:top}, {duration: 1000, easing: 'easeOutBounce'})
}

    

function _hotelDetail(hotelCode,supplierCode,pointID,pointType){
    var url="Hotel.aspx?hotelID="+hotelCode+"&supplierID="+supplierCode+"&pointID="+pointID+"&pointType="+pointType;
    winOpen(url,1020,600);
}

function hotelDetail(hotelCode){
    var url="Hotel.aspx?hotelID="+hotelCode;
    winOpen(url,1020,600);
}




    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        
    
    
    
    
    
    
function disableFormSubmit() {
    var forms = document.getElementsByTagName('form');
    for (var i = 0; i < forms.length; i++) {                  
        var input = forms[i].getElementsByTagName('input');
        for (var j = 0; j < input.length; j++) 
        {
            if (input[j].type.toLowerCase() == 'submit') {
                input[j].disabled=true;
            }
        }
    }
    return true;
}    

function enableFormSubmit() {
    var forms = document.getElementsByTagName('form');
    for (var i = 0; i < forms.length; i++) {                  
        var input = forms[i].getElementsByTagName('input');
        for (var j = 0; j < input.length; j++) 
        {
            if (input[j].type.toLowerCase() == 'submit') {
                input[j].disabled=false;
            }
        }
    }
    return true;
}    

function helpClick(id)
{
    url="http://www.unisec.com.tr/v3/unitravel"+id;
    langKey=$('#'+xPreID+'cmbLanguage').val();
    if(langKey==1033)
    {
        url+="_en";
    }
    url+=".pdf";
    window.open(url,'_blank');
}
