$(function () { 
	if($('#autogallery').length){
	  jQuery('#autogallery').jcarousel();
	}
	if($('.submenu').length) {
	    $(".submenu").click(function(){
        	$(this).next(".sublist").slideToggle("slow")
	        .siblings(".sublist:visible").slideUp("slow");
	        $(this).toggleClass("active");
	        $(this).siblings(".submenu").removeClass("active");
	     });
	}
	zebra();
	if($('.services').length){
		dement();
		$(window).bind("resize", function() {dement();});
	}
	if($('#feedbackform').length) {
		if (!$('.err').length) {
		$("#feedbackform").hide();
		}
		$("#feedbackshow").click(function(){	 
			$("#feedbackform").slideToggle("slow");
		 });
	}
});

function zebra(){
	$('table.zebra').each(function(){
		$('tr:even', this).addClass('light');
	});	 
}
function dement() {
	var bodywidth = $('html').width();
	if (bodywidth < 1270 && bodywidth > 1024) {
		$('.services a').css('padding','18px 30px 13px');
	}
	else {
		if (bodywidth <= 1024) {
			$('.services a').css('padding','18px 23px 13px')
		}
	}
}

function activatemenu(id){
	$("div#m"+id).addClass("active"); 
	$("ul#s"+id).addClass("active");
	$(".sublist:not(#s"+id+")").hide();
} 
function hidemenu(id){
	$(".sublist").hide();
} 
function add_field(id) {
	var todo = "dd.field" + (id-1) + " a";
	$(todo).hide();
	$("dt.field"+id).show();
	$("dd.field"+id).show();
}
// =fixing png for IE. now you should only add class "png" to show the transparent *.png image in IE6
function PNG(element){
	if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent)){
	var src;
	if (element.tagName=='IMG'){
			if (/\.png$/.test(element.src)){
				src = element.src;
				element.src = "/img/i/t.gif"; // = 1*1px  transparent image and path for it
			}
		}
		else {
			src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i)
			if(src){
				src = src[1];
				element.runtimeStyle.backgroundImage="none";
			}
		}
	if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
	}
}
