//begin sid check
function chkSid () {

  	if (document.sid.num.value == "")
  	{
    alert("Sid numarası eksik!");
    document.sid.num.focus();
    return false;
  	}

 	 var chkZ = 1;
 	 for (i = 0; i < document.sid.num.value.length; ++i)
   	 if (document.sid.num.value.charAt(i) < "0" ||
        document.sid.num.value.charAt(i) > "9")
      chkZ = -1;
  	if (chkZ == -1) {
    alert("Lütfen sadece Rakam yazın!");
    document.sid.num.focus();
    return false;
  	}
 }


 //sid check end

 //begin timer

var countDown = {
	onFinish: function(){
		location = "reload.php" ;;
	},
	countDownId: new Array("countDown", "countDown2"),
	toggleId: new Array("toggle"),
	toggleText: {
		isRunning: "Zaman&#305; durdur",
		notRunning: "Devam et"
	},
	remaining: 900 * 1000,

	//Interieur functions
	lastTime: false,
	show: function(){
		if (!this.lastTime) return;
		var d = new Date();
		this.remaining -= d - this.lastTime;
		this.lastTime = d;
		if (this.remaining <= 0){
			this.onFinish();
			this.remaining = 0;
			this.run = false;
		}
		d = new Date(this.remaining);
		var str = "";
		var el;
		if ((el = d.getUTCHours()) != 0) str += el + ":";
		str += d.getMinutes().toZeros(2) + ":";
		str += d.getSeconds().toZeros(2);

		if (this.countDownId.constructor == Array){
			for (var i = 0; i < this.countDownId.length; i++){
				document.getElementById(this.countDownId[i]).innerHTML = str;
			}
		}
		else{
			document.getElementById(this.countDownId).innerHTML = str;
		}

		if (this.run){
			var This = this;
			window.setTimeout(function(){
				This.show();
			}, 100);
		}
		else{
			this.lastTime = false;
		}
	},
	run: false,
	toggle: function(){
		if (this.run){
			this.run = false;
			var str = this.toggleText.notRunning;
		}
		else{
			this.run = true;
			var str = this.toggleText.isRunning;
			this.lastTime = new Date();
			this.show();
		}
		if (this.toggleId.constructor == Array){
			for (var i = 0; i < this.toggleId.length; i++){
				document.getElementById(this.toggleId[i]).innerHTML = str;
			}
		}
		else{
			document.getElementById(this.toggleId).innerHTML = str;
		}
	}
};

Number.prototype.toZeros = function(nr){
	var ret = this.toString();
	while(ret.length < nr){
		ret = "0" + ret;
	}
	return ret;
};

//end timer
