var ie = false;
$(function(){
	$('.news_container_link').find('.nc_link').hide();
	$('.news_container_link').click(function(){
		self.location=$(this).find('.nc_link').find('a').attr('href');
	});
	$('.news_container_link').addClass('ph');
	$('.news_container_link').hover(function(){
		$(this).find('.nt_rtable').addClass('nt_rtable_draw');
	},function(){
		$(this).find('.nt_rtable').removeClass('nt_rtable_draw');
	});
	
	
	$('.product_container').hover(function(){
		$(this).addClass('product_container_hover');
	},function(){
		//if($(this).data('sliding')!='1'){
			$(this).removeClass('product_container_hover');
		//}
	});
	$('.product_container').click(function(){
				
		var item_id = $(this).data('id');
		//$('#popup_content').html("<img src='"+popImg[item_id].src+"' />");
		
		$('.pc_img').click(tb_remove2);
		
		stepcarousel.stepTo('mygallery', $(this).data('panel_id'));
		
		//$('#pc_img').attr('src', popImg[item_id].src);
		//$('#pc_name').html($(this).data('name'));
		//$('#pc_text').html($(this).data('text'));
		
		//$(this).data('sliding', '1');
		//$(this).slideUp(250, function(){tb_show2(item_id);});
		tb_show2(item_id);
	});
	
	
jQuery.each(jQuery.browser, function(i) {
  if($.browser.msie){
     ie = true;
  }
});

	
});




function tb_remove2(){
	/*$('.product_container').each(function(){
		if($(this).data('sliding')=='1'){
			$(this).slideDown(250);
			$(this).removeClass('product_container_hover');
			$(this).data('sliding',0);
		}
										  });*/
	tb_remove();
}



function tb_show2(id) {//function called when the user clicks on a thickbox link

	try {
		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
			$("body","html").css({height: "100%", width: "100%"});
			$("html").css("overflow","hidden");
			if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
				$("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
				$("#TB_overlay").click(tb_remove2);
			}
		}else{//all others
			if(document.getElementById("TB_overlay") === null){
				$("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
				$("#TB_overlay").click(tb_remove2);
			}
		}
		if(!ie){
			$("#TB_overlay").hide();
		}
		$("#TB_window").hide();
		
		$("#TB_window").css({background:"none"}); 
		
		if(tb_detectMacXFF()){
			$("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
		}else{
			$("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
		}
		
		$("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
		$('#TB_load').show();//show loader
		

			TB_WIDTH = 454; //defaults to 630 if no paramaters were added to URL
			TB_HEIGHT = 440; //defaults to 440 if no paramaters were added to URL
			ajaxContentW = TB_WIDTH - 30;
			ajaxContentH = TB_HEIGHT - 45;





			$("#TB_overlay").unbind();
			
					
			$("#TB_closeWindowButton").click(tb_remove2);
			$("#TB_overlay").click(tb_remove2);
			
			
			$("#TB_window").empty();
			$("#TB_window").html("<div id='popup_window' class='popup_window'></div>");	
			$("#popup_window").append($("#myDiv").children());
			$("#TB_window").unload(function () {
				$('#myDiv').append( $("#popup_window").children() ); // move elements back when you're finished
			});
			tb_position();
			$("#TB_load").remove();
			//$("#TB_window").css({display:"block"}); 

		if(ie){
			$("#TB_window").slideDown(500);
		} else {
			$("#TB_overlay").fadeIn(350, function(){
				$("#TB_window").slideDown(300);
			});
		}
		//showPopup();

	} catch(e) {
		//nothing here
	}
}
