  function StartCountDown(myDiv,myTargetDate, action, lang)
  {
  	var lang = (lang == null) ? "EN" : lang;
    CountBack2(myDiv,myTargetDate, action, lang);
  }
  
  function Calcage(secs, num1, num2)
  {
    s = ((Math.floor(secs/num1))%num2).toString();
    if (s.length < 2) 
    {	
      s = "0" + s;
    }
    return (s);
  }
  
  function CountBack2(myDiv, secs, action, lang)
  {
  	
    var DisplayStr;
    
    if (lang == "AR") {
    	var d_prefix = "ي";
    	var h_prefix = "س";
    	var m_prefix = "د";
    	var s_prefix = "ث";
    }
    else {
    	var d_prefix = "d";
    	var h_prefix = "h";
    	var m_prefix = "m";
    	var s_prefix = "s";
    }
    
    if (secs >= 86400) {
      var DisplayFormat = "%%D%% day(s) %%H%%:%%M%%:%%S%%";
    }
    else {
	  var DisplayFormat = "%%H%%:%%M%%:%%S%%";
    }
    
    
	if ((action == 'Auction Closed')||(action == 'Item Closed')) {
		 if (secs >= 86400) {
	  		var  DisplayFormat = "%%D%%"+d_prefix+":%%H%%"+h_prefix+":%%M%%"+m_prefix+":%%S%%"+s_prefix+"";
		 }
		 else {
		 	var  DisplayFormat = "%%H%%"+h_prefix+":%%M%%"+m_prefix+":%%S%%"+s_prefix+"";
		 }
	}
	
    DisplayStr = DisplayFormat.replace(/%%D%%/g,	Calcage(secs,86400,100000));
    DisplayStr = DisplayStr.replace(/%%H%%/g,		Calcage(secs,3600,24));
    DisplayStr = DisplayStr.replace(/%%M%%/g,		Calcage(secs,60,60));
    DisplayStr = DisplayStr.replace(/%%S%%/g,		Calcage(secs,1,60));
    
    //Red color in the last 3 mins
    if (secs <= 180) {
    	if (action == 'Item Closed') {
    		var  DisplayStr = "<font color=red>"+DisplayStr+" (<b>Closing</b>)</font>";
    		var isClosed = "<font color=red><b>Closed</b></font>";
    	}
    	else if (action == 'Closed') {
    		var  DisplayStr = "<font color=red>"+DisplayStr+"</font>";
    		isClosed = 'Closed';
    	}
    	else if (action == 'Auction Closed') {
    		var  DisplayStr = "<font color=red>"+DisplayStr+"</font>";
    		isClosed = 'Closed';
    	}
    	if (isClosed == '') {
    		isClosed = action;
    	}
    }
    
    if(secs > 0)
    { 
      document.getElementById(myDiv).innerHTML = DisplayStr;
      setTimeout("CountBack2('" + myDiv + "'," + (secs-1) + ", '" + action + "', '" + lang + "');", 990);
    }
    else
    {
      document.getElementById(myDiv).innerHTML = isClosed;
    }
  }

