﻿// JScript File

//These functions are used for Timer
//----------------------------------
  function display( notifier, str ) {
    document.getElementById(notifier).innerHTML = str;
  }
	
  function toMinuteAndSecond( x ) {
    
    var day = 0;
    var hrs = 0;
    var min = 0;
    var sec = 0;
    sec = x%60;
    var tmin = (x/60);
    min = tmin%60;
    var thrs = tmin/60;
    hrs = thrs%24;
    day = thrs/24;
    if(Math.floor(x)>0)
    {        
        return "<span class='timer-white'>"+Math.floor(day) + "</span> Days <span class='timer-white'>" + Math.floor(hrs) + "</span> Hrs <span class='timer-white'>" + Math.floor(min) + "</span> Min <span class='timer-white'>" + Math.floor(sec) + " </span> Sec";
    }
    else
    {
        return "";
    }
  }
	
  function setTimer( remain )
   {
    (function countdown()
	 {
       display("countdown", toMinuteAndSecond(remain));		
      (remain -= 1) >= 0 && setTimeout(arguments.callee, 1000);
    })();
  }
//---------------------------------------
 function Confirmation()
    {
       return(confirm("?פעולה זו תשנה את מצב חלון העברות. האם אתה בטוח"));
    }
function OpenPopup(pageName,pageTitle,height,width,querystring,queryStringValue)
    {
      var varUrl =  pageName + "?"+ querystring + "="+ queryStringValue;
      window.open(varUrl,pageTitle,"width="+width+",height="+height+";scroll=1");
      return false;
    }
 function CheckMaxLength(textBox,maxLimit)
    { 
        var str=textBox.value;
        if(textBox.value.length > maxLimit)
        {
           str  = str.substring(0,maxLimit);
           textBox.value = str;
        }
    }
    
  function CreateBookmarkLink() 
    {
     
     if (document.all)
            window.external.AddFavorite(location.href, document.title);
else if (window.sidebar)
        window.sidebar.addPanel(document.title, location.href, "");

    }
    
   
