(function($) {
	scrollImage = function()
	{
		$.offset = $("#content_left").offset();
		if (($(window).scrollTop()>$.offset.top)&&(($(window).scrollTop()+$("#scroll_images").height())<($.offset.top+$("#content_left").height())))
		{
			$.scrollTo = $(window).scrollTop();
		}
		else if (($(window).scrollTop()+$("#scroll_images").height())<($.offset.top+$("#content_left").height()))
		{
			$.scrollTo = $.offset.top;
		}
		$("#scroll_images").stop().animate({
				top: $.scrollTo
		},"slow");
		/*$.offset = $("#content_text").offset();
		if ($(window).scrollTop()>300)
		{
			$("#scroll_images").stop().animate({
				top: $.offset.top+87+$(window).scrollTop()-300
			},200);
		}
		else
		{
			$("#scroll_images").stop().animate({
				top: $.offset.top+87
			},200);
		}
		$("#scroll_images").stop().animate({
				top: $.offset.top+87
		},200);*/
	}
	$(document).ready(function(){
		$(".menu_item > a").each(function(){
			$(this).mouseover(function(){
				$(this).parent().addClass("menu_hover");
			});
			$(this).mouseout(function(){
				$(this).parent().removeClass("menu_hover");
			});
		});
		$.offset = $("#main").offset();
		$("#flash").css("left",$.offset.left);
		$("#flash").css("visibility","visible");
		$("#menu").css("left",$.offset.left);
		if ($("#scroll_images").length)
		{
			$(window).scroll(function(){
				scrollImage();
			});
			$.offset = $("#content_left").offset();
			$("#scroll_images").css("left",$.offset.left+625);
			$("#scroll_images").css("top",$.offset.top);
			$("#scroll_images").css("display","block");
		}
	});
	$.ajaxLoadPopup = function(divId,url,param)
	{
		$("#bulgaria").css("color","#576062");
		$("#romania").css("color","#576062");
		$("#hungary").css("color","#576062");
		$("#turkey").css("color","#576062");
		$("#other").css("color","#576062");
		if (!$("#"+divId).length)
		{
			$("body").append('<div id="'+divId+'"></div>');
			$("#"+divId).hide();
			$("#"+divId).css("top",0);
			$("#"+divId).css("left",0);
			$("#"+divId).css("margin",0);
			$("#"+divId).css("padding",0);
			$("#"+divId).css("position","absolute");
			$("#"+divId).css("z-index",3);
		}
		$("body").append('<div id="temp"></div>');
		$("#temp").css("top",0);
		$("#temp").css("left",0);
		$("#temp").css("margin",0);
		$("#temp").css("padding",0);
		$("#temp").css("position","absolute");
		$("#temp").css("z-index",0);
		$("#temp").css("width",$(document).width());
		$("#temp").css("height",$(document).height());
		$.ajax({
			type: "POST",
			url: url,
			data: param,
			success: function(msg){
				$("#"+divId).html(msg);
				$.offset = $("#sales_representatives").offset();
				$("#"+divId).css("left",$.offset.left+44);
				$("#"+divId).css("top",$.offset.top-$("#"+divId).height()+35);
				$("#temp").click(function(){
					$("#"+divId).fadeOut(200,function(){
						$("#"+divId).remove();
					});
					$("#temp").remove();
					$("#bulgaria").css("color","#576062");
					$("#romania").css("color","#576062");
					$("#hungary").css("color","#576062");
					$("#turkey").css("color","#576062");
					$("#other").css("color","#576062");
				});
				$("#"+divId).fadeIn(200);
			}
		});
	}
})(jQuery)
