$(document).ready(
				function() {

					$(".answer-button a").click(function(){
						
						if ($(this).parent().is(".expanded"))
						{
							$(this).parent().removeClass("expanded").addClass("normal");
							$(this).parent().next(".description").slideUp();
							return false;
						}else
							$(this).parent().removeClass("normal").addClass("expanded");
							$(this).parent().next(".description").slideDown();
						return false;
					});

					if ($.browser.opera) {
						setInterval(function() {
							$("#importantNews").newsChangerOpera();
						}, 5500);
					} else {
						setInterval(function() {
							$("#importantNews").newsChanger();
						}, 5500);
					}

					$('#accordion .item-binder .item-data')
							.hover(
									function() {
										if (!($("#accordion").find(
												"div:animated").length)) {
											if (!$(this)
													.parents(".item-binder")
													.is(".active")) {
												$("#accordion")
														.find(".active")
														.find(".data-binder")
														.slideUp(
																200,
																function() {
																	$(this)
																			.parents(
																					".active")
																			.removeClass(
																					"active");
																});
												$(this)
														.find(".data-binder")
														.slideDown(
																100,
																function() {
																	$(this)
																			.parents(
																					".item-binder")
																			.addClass(
																					"active");
																});
											}
										}
									}).css("cursor", "pointer");

					

					
					
					$("#HeaderTime").defineTime("HeaderTime");
					
					$("#tbilisiTime").defineTime("tbilisiTime");
					$("#londonTime").defineTime("londonTime");
					$("#newYorkTime").defineTime("newYorkTime");
										
					$("#HotlineBlock").hotline();

					$(".level1-menu .sub").hover(function() {
						$(this).children("ul").slideDown(100).css('z-index',99);
					}, function(event) {
								$(this).children("ul").slideUp(100);
					});

					$(".print").children("a").click(
							function() {

								window.open($(this).attr("href"),
										'PrintVersion', 'scrollbars=1,width=970');
								return false;
								return false;
							});
				});

$.fn.hotline = function() {
	$(this).css("height", $(this).height());
	$(this).children("dt").css("height", $(this).height() - 10);

	doWork();
};
hotline = new Object();
function doWork() {
	hotline.activeNumber = $("#HotlineBlock").find(".active");
	hotline.nextNumber = ($(hotline.activeNumber).next("dd").length) ? $(
			hotline.activeNumber).next("dd") : $("#HotlineBlock")
			.children("dd");

	exit($(hotline.activeNumber));
	enter($(hotline.nextNumber));

	setTimeout("doWork()", 5000);
}

function exit(el) {
	el = el[0];
	$(el).slideUp(1000, function() {
		$(this).removeClass("active");
	});
}
function enter(el) {
	el = el[0];
	$(el).slideDown(1000, function() {
		$(this).addClass("active");
	});
}

$.fn.defineTime = function(id) {
	if ($(this).length)
	{
	this.myTime = $(this).html();
	this.myTime = this.myTime.match(/0?([0-9]+):0?([0-9]+):0?([0-9]+)/);

	this.myH = this.myTime[1];
	this.myM = this.myTime[2];
	this.myS = this.myTime[3];

	startTime(this.myH, this.myM, this.myS, id);
	}
};

function startTime(hr, min, sec, id) {
	hr = parseFloat(hr);
	min = parseFloat(min);
	sec = parseFloat(sec);
	if (++sec == 60) {
		sec = 0;
		min++;
	}
	if (min == 60) {
		min = 0;
		hr++;
	}
	if (hr == 24) {
		hr = 0;
	}
	sec = (sec < 10) ? "0" + sec : sec;
	min = (min < 10) ? "0" + min : min;
	hr = (hr < 10) ? "0" + hr : hr;

	$("#" + id).html(hr + ":" + min + ":" + sec);

	setTimeout("startTime('" + hr + "','" + min + "','" + sec + "','" + id	+ "')", 1000);

};

$.fn.newsChangerOpera = function() {
	// Define Active Block
	this.act = $(this).children(".active");

	// Gadaiqceva Absolutat
	$(this).children(".data-binder").css( {
		position : "relative",
		width : "238px"
	});

	// Gverdit wava da waeshleba klasi Active
	$(this.act).animate( {
		opacity : "0"
	}, 1000, function() {
		$(this).removeClass("active");

		if ($(this).next().length) {
			this.nextAct = $(this).next();
		} else
			this.nextAct = $("#importantNews").children(".data-binder")[0];

		// Shemdegi shemova da dameateba klasi aqtivi
			$(this.nextAct).css( {
				opacity : "0"
			}).addClass("active");
			$(this.nextAct).animate( {
				opacity : "1"
			}, 1000);

		});
};

$.fn.newsChanger = function() {
	// Define Active Block
	this.act = $(this).children(".active");

	// Hide Active Block

	// Gadaiqceva Absolutat
	$(this).children(".data-binder").css( {
		position : "absolute",
		width : "238px"
	});

	// Gverdit wava da waeshleba klasi Active
	$(this.act).animate( {
		left : "-258px"
	}, 800,
	// "linear",
			function() {
				$(this).removeClass("active");
			});

	// alert ($(this.act).next().length);
	if ($(this.act).next().length) {
		// alert ("ok");
		this.nextAct = $(this.act).next();
	} else
		this.nextAct = $(this).children(".data-binder")[0];

	// Shemdegi shemova da dameateba klasi aqtivi
	$(this.nextAct).css( {
		left : "258px"
	}).addClass("active");
	$(this.nextAct).animate( {
		left : "0"
	}, 800);

};