// JavaScript Document
 

	function CreateTimerCounter (iTimeInSeconds,Name, iStatus,iDivID,displayMode,PageRedirct)
				{
					this.name = Name
					this.obj = "o" + this.name
					eval(this.obj + "=this")
					this.TimeSeconds = iTimeInSeconds
					this.Tick = ctTick
					this.StopTick = ctStopTick
					
					this.ClockTime = ""
					this.going1  = 180
					this.going2  = 120
					this.going3  = 60
					this.Status = iStatus
					this.divID = iDivID;      
					this.dMode = displayMode
					this.ClockDisplay = ctDisplay 
					this.PageRedirct = PageRedirct
					this.Calc = ctClockCalcCounter
					
				}
  
			function CreateTimer (iTimeInSeconds,Name, iStatus,iDivID,displayMode)
				{
					this.name = Name
					this.obj = "o" + this.name
					eval(this.obj + "=this")
					this.TimeSeconds = iTimeInSeconds
					this.Tick = ctTick
					this.StopTick = ctStopTick
					this.Calc = ctClockCalc
					this.ClockTime = ""
					this.going1  = 180
					this.going2  = 120
					this.going3  = 60
					this.Status = iStatus
					this.divID = iDivID;      
					this.dMode = displayMode
					this.ClockDisplay = ctDisplay 
				}  
				 
				function ctTick ()
				{
					oInterval=window.setInterval(this.obj+".Calc()",1000);
				}
			  
				function ctStopTick ()
				{
					window.clearInterval(oInterval);
					oInterval = "";
					this.ClockDisplay("");	
				}
				
				function ctDisplay(sTime)
				{
					document.getElementById(this.divID).innerHTML = sTime;
				} 
				
				function ctClockCalc()
						{
							
							//daysRound = Math.floor(this.TimeSeconds  / 86400);
							daysRound=0;
							hoursRound = Math.floor(this.TimeSeconds  / 3600 - (24 * daysRound));
							minutesRound = Math.floor(this.TimeSeconds  / 60 - (1440 * daysRound) - (60 * hoursRound));
							secondsRound = Math.floor(this.TimeSeconds  - (86400 * daysRound) - (3600 * hoursRound) - (60 * minutesRound));
							var sec = (secondsRound == 1) ? ' שניה ': ' שניות ';
							var min = (minutesRound == 1) ? ' דקה ' : ' דקות ';
							var hr = (hoursRound == 1) ? ' שעה ' : ' שעות ';
							var dy = (daysRound == 1)  ? ' יום ' : ' ימים ';
							this.ClockTime = ""
							switch (this.dMode)
							{
								case 1:
									if (daysRound > 0) this.ClockTime +=  '<span class=timerDays>'+daysRound + '</span><span class=timetSeparator>:</span>';
									this.ClockTime += (hoursRound > 0)  ? ((hoursRound < 10) ? '<span class=timerHours>0'+hoursRound+'</span><span class=timetSeparator>:</span>' : '<span class=timerHours>'+hoursRound+'</span><span class=timetSeparator>:</span>' )  : '<span class=timerHours>00</span><span class=timetSeparator>:</span>' ;
									this.ClockTime += (minutesRound > 0)  ? ((minutesRound < 10) ? '<span class=timerMinutes>0'+minutesRound+'</span><span class=timetSeparator>:</span>' : '<span class=timerMinutes>'+minutesRound+'</span><span class=timetSeparator>:</span>')  : '<span class=timerMinutes>00</span><span class=timetSeparator>:</span>' ;
									this.ClockTime += (secondsRound > 0) ? ((secondsRound < 10) ? '<span class=timerSeconds>0'+secondsRound+'</span> ' : '<span class=timerSeconds>'+secondsRound+'</span> ' ) :  '<span class=timerSeconds>00</span>'  ;
								break;
								case 2:
									if (daysRound > 0) this.ClockTime += dy ;
									if (hoursRound > 0)this.ClockTime +=  hr ;
									if(minutesRound > 0)this.ClockTime += min ;
									if(secondsRound > 0)  this.ClockTime += sec; 
								break;
								case 3:
									var endStr = "";
									if (daysRound > 0 )
									{
										endStr= 'ימים';
									}
									else if (hoursRound > 0)
									{
										endStr= 'שעות';
									}
									else if(minutesRound > 0)
									{
										endStr = 'דקות';
									}
									else if(secondsRound > 0)
									{
										endStr= 'שניות';
									}
									this.ClockTime +=endStr;
								break;
								default:
											if (daysRound > 0) this.ClockTime +=  daysRound + ':';
											this.ClockTime += (hoursRound > 0)  ? ((hoursRound < 10) ? '0'+hoursRound+':' : hoursRound+':' )  : '00:' ;
											this.ClockTime += (minutesRound > 0)  ? ((minutesRound < 10) ? '0'+minutesRound+':' : minutesRound+':')  : '00:' ;
											this.ClockTime += (secondsRound > 0) ? ((secondsRound < 10) ? '0'+secondsRound+' ' : secondsRound+' ' ) :  '00 ';
								break;
							}
							
							this.ClockDisplay(this.ClockTime);
							if (this.TimeSeconds > 0)
							{ 
								this.TimeSeconds--;
							}
							else
							{
								if(this.TimeSeconds <= 0 && this.TimeSeconds >= -10)
								{
									//GetHighBidders()
									//this.Status = 2; Sale is active now()
									
									
									document.location.reload();
									
									   
									//added by firas   
 										
//									document.location="http://www.ynet.co.il";
								}
								else 
								{
									this.Status = 3;
								}
								//this.Header();	apllay to : oTimer.Header(); TO DO xmlHTTP
								
							}
						}
						var flagHREF = true;
						
						function ctClockCalcCounter()
						{
							
							//daysRound = Math.floor(this.TimeSeconds  / 86400);
							
							daysRound=0;
							hoursRound = Math.floor(this.TimeSeconds  / 3600 - (24 * daysRound));
							minutesRound = Math.floor(this.TimeSeconds  / 60 - (1440 * daysRound) - (60 * hoursRound));
							secondsRound = Math.floor(this.TimeSeconds  - (86400 * daysRound) - (3600 * hoursRound) - (60 * minutesRound));
							var sec = (secondsRound == 1) ? ' שניה ': ' שניות ';
							var min = (minutesRound == 1) ? ' דקה ' : ' דקות ';
							var hr = (hoursRound == 1) ? ' שעה ' : ' שעות ';
							var dy = (daysRound == 1)  ? ' יום ' : ' ימים ';
							this.ClockTime = ""
							switch (this.dMode)
							{
								case 1:
									if (daysRound > 0) this.ClockTime +=  '<span class=timerCounter>'+daysRound + '</span><span class=timerCounter>:</span>';
									this.ClockTime += (hoursRound > 0)  ? ((hoursRound < 10) ? '<span class=timerCounter>0'+hoursRound+'</span><span class=timerCounter>:</span>' : '<span class=timerCounter>'+hoursRound+'</span><span class=timerCounter>:</span>' )  : '<span class=timerCounter>00</span><span class=timerCounter>:</span>' ;
									this.ClockTime += (minutesRound > 0)  ? ((minutesRound < 10) ? '<span class=timerCounter>0'+minutesRound+'</span><span class=timerCounter>:</span>' : '<span class=timerCounter>'+minutesRound+'</span><span class=timerCounter>:</span>')  : '<span class=timerCounter>00</span><span class=timerCounter>:</span>' ;
									this.ClockTime += (secondsRound > 0) ? ((secondsRound < 10) ? '<span class=timerCounter>0'+secondsRound+'</span> ' : '<span class=timerCounter>'+secondsRound+'</span> ' ) :  '<span class=timerCounter>00</span>'  ;
								break;
								case 2: 
									if (daysRound > 0) this.ClockTime += dy ;
									if (hoursRound > 0)this.ClockTime +=  hr ;
									if(minutesRound > 0)this.ClockTime += min ;
									if(secondsRound > 0)  this.ClockTime += sec; 
								break;
								case 3:
									var endStr = "";
									if (daysRound > 0 )
									{
										endStr= 'ימים';
									}   
									else if (hoursRound > 0)
									{
										endStr= 'שעות';
									}
									else if(minutesRound > 0)
									{
										endStr = 'דקות';
									}
									else if(secondsRound > 0)
									{
										endStr= 'שניות';
									}
									this.ClockTime +=endStr;
								break;
								default:
											if (daysRound > 0) this.ClockTime +=  daysRound + ':';
											this.ClockTime += (hoursRound > 0)  ? ((hoursRound < 10) ? '0'+hoursRound+':' : hoursRound+':' )  : '00:' ;
											this.ClockTime += (minutesRound > 0)  ? ((minutesRound < 10) ? '0'+minutesRound+':' : minutesRound+':')  : '00:' ;
											this.ClockTime += (secondsRound > 0) ? ((secondsRound < 10) ? '0'+secondsRound+' ' : secondsRound+' ' ) :  '00 ';
								break;
							}
							
							this.ClockDisplay(this.ClockTime);
							if (this.TimeSeconds > 0)
							{ 
								this.TimeSeconds--;
							}
							else  
							{
								if(flagHREF && this.TimeSeconds <= 0 && this.TimeSeconds >= -10)
								{
									location="/category/" + this.PageRedirct;
									flagHREF = false;
								}
								else 
								{
									this.Status = 3;
								}
								//this.Header();	apllay to : oTimer.Header(); TO DO xmlHTTP
								
							}
						}    
						  