function checkPhoneError(a) {
	switch (country) {
	case "BIH":
		var b = /^(((\+|00)387)|0)(61|62|63|65|66|3[0-9])([0-9]{6})$/;
		if (b.test(a) == false) {
			return "Unesite ispravan broj telefona"
		}
		break;
	case "SR":
		var b = /^(((\+|00)381)|0)(60|61|62|63|64|65|66|69)([0-9]{6,7})$/;
		if (b.test(a) == false) {
			return "Unesite ispravan broj telefona"
		}
		break;
	case "MK":
		var b = /^(((\+|00)389)|0)(70|71|72|75|76|77|78)([0-9]{6})$/;
		if (b.test(a) == false) {
			return "напишете го точниот телефонски број"
		}
		break
	}
	return false
}
function getProviderError() {
	switch (country) {
	case "BIH":
		return "Izaberite operatera";
		break;
	case "SR":
		return "Izaberite operatera";
		break;
	case "MK":
		return "Одберете оператор";
		break
	}
	return false
}
function sendData() {
	var a = "";
	if ($("#kontakt_name").length > 0) {
		var b = $.trim($("#kontakt_name").val());
		a += "&kontakt_name=" + b
	}
	
	if ($("#kontakt_phone").length > 0) {
		var c = $.trim($("#kontakt_phone").val());
		if(c=='065123456')
    c='';
		var d = false;
	if ((phoneRequired || (!phoneRequired && c.length > 0)) && (d = checkPhoneError(c)) != false) {
			alert(d);
			return false
		}
		a += "&kontakt_phone=" + c;
		if ($("#kontakt_provider").length > 0) {
			var e = $.trim($("#kontakt_provider").val());
			if (e == "") {
				alert(getProviderError());
				return false
			}
			a += "&kontakt_provider=" + e
		}
	}
	a += "&alias=" + $.trim($("#alias").val());
	formshowhide("send");
	$.post("kontakt.deamon.php", a, function (a) {
		if (a == "OK") {
			setTimeout("show02()", 4e3)
		} else {
			setTimeout("showError()", 4e3)
		}
		$("body").append('<iframe src="ad.php" width="1" height="1"></iframe>')
	})
}
function showError() {
	document.getElementById("ek1").style.display = "none";
	document.getElementById("ek2").style.display = "block";
	document.getElementById("ek3").style.display = "none"
}
function show02(a) {
	document.getElementById("ek1").style.display = "none";
	document.getElementById("ekSuccess").style.display = "block";
	document.getElementById("ek3").style.display = "none"
}
function formshowhide(a) {
	if (a == "send") {
		document.getElementById("ek1").style.display = "none";
		document.getElementById("ek2").style.display = "none";
		document.getElementById("ek3").style.display = "block"
	}
}
var country = "SR";
var phoneRequired = true

function MM_showHideLayers() {
	var i, p, v, obj, args = MM_showHideLayers.arguments;
	for (i = 0; i < args.length - 2; i += 3) with(document) if (getElementById && (obj = getElementById(args[i])) != null) {
		v = args[i + 2];
		if (obj.style) {
			obj = obj.style;
			v = v == "show" ? "visible" : v == "hide" ? "hidden" : v
		}
		obj.visibility = v
	}
}
function thumbStop(a, b, c) {
	rotateThumbs[a] = false;
	document.getElementById(a).src = b + c + ".jpg"
}
function thumbStart(a, b, c) {
	rotateThumbs[a] = true;
	changeThumb(a, 1, b, c)
}
function changeThumb(a, b, c, d) {
	if (rotateThumbs[a]) {
		if (b <= c) {
			document.getElementById(a).src = d + b + ".jpg";
			b++;
			setTimeout("changeThumb('" + a + "'," + b + ", " + c + ", '" + d + "')", 1e3)
		} else {
			changeThumb(a, 1, c, d)
		}
	}
}
var rotateThumbs = new Array
var _gaq = _gaq || [];
_gaq.push(["_setAccount", "UA-23398467-19"]);
_gaq.push(["_trackPageview"]);
(function () {
	var a = document.createElement("script");
	a.type = "text/javascript";
	a.async = true;
	a.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";
	var b = document.getElementsByTagName("script")[0];
	b.parentNode.insertBefore(a, b)
})()
