// JavaScript Document

$(document).ready(function() {
													 
	//external links
	$("a[rel=external]").attr('target', '_blank');
	$("a[rel=external nofollow]").attr('target', '_blank');
	
	$(".block .full").hide();
	$(".block p.more span").text('Read more');
	$(".block p.more span").click(function() {
			$(this).parent().parent().find(".full").toggle(); // First click should toggle to 'show'
			$(this).text($(this).text() == 'Read more' ? 'Hide' : 'Read more');
      return false;
	});
	
	$("#productListing a.contactbutton").click(function() {
			if ($(this).attr('href').indexOf('?product='+$(this).parent().parent().find(".productListing-data h3.itemTitle").text().replace("\"", "")) < 1) {
					$(this).attr('href',$(this).attr('href') + '?product='+$(this).parent().parent().find(".productListing-data h3.itemTitle").text().replace("\"", ""));
			};
	});
	
	$("#productGeneral a.contactbutton").click(function() {																
			if ($(this).attr('href').indexOf('?product='+$(this).parents('.column-center-background').find(".title_box h1#productName").text().replace("\"", "")) < 1) {
					$(this).attr('href',$(this).attr('href') + '?product='+$(this).parents('.column-center-background').find(".title_box h1#productName").text().replace("\"", ""));
			};
	});
	
	$("#productMainImage a").colorbox({opacity:0.8});
	$('a.colorbox-element').colorbox({opacity:0.8});
	$(".contactbutton").colorbox({iframe:true, innerWidth:440, innerHeight:480, opacity:0.8});

	$('.user_menu ul li.drop').hover(
		function() { $('ul', this).css('display', 'block'); },
		function() { $('ul', this).css('display', 'none'); }
	);
	
	$('#diagram .hover').hover(
		function() { $('span.desc', this).css('display', 'block'); },
		function() { $('span.desc', this).css('display', 'none'); }
	);
	
	/*fncHideMenu();
	$(".user_menu ul li").hover(function() {
			$(this).parent().find("li ul").hide();
			$(this).find("ul").show();
			window.clearTimeout();
			window.setTimeout(fncHideMenu, 500);
	});
	$(".user_menu ul li ul li").hover(function() {
			$(this).parent().find("ul").show();
			window.clearTimeout();
			window.setTimeout(fncHideMenu, 500);
	});
	
	function fncHideMenu() {
		$(".user_menu ul li ul").hide();
	}*/
	
 });


