function showhidediv(divid) {
	$("."+divid).css('display').toggle;
}


//::: show tooltips using a title="" attr  ::://
function simple_tooltip(target_items, name){
 $(target_items).each(function(i){
		//$("#wrapper #body").append("<div class='"+name+"' id='"+name+i+"'><p>"+$(this).attr('title')+"</p></div>");
		$("body").append("<div class='"+name+"' id='"+name+i+"'><p>"+$(this).attr('name')+"</p></div>");
 		
		//console.log($(this).attr('name'));
		
		var my_tooltip = $("#"+name+i);

		if($(this).attr("name") != "" && $(this).attr("name") != "undefined" ){

		$(this).removeAttr("name").mouseover(function(){
					my_tooltip.css({opacity:0.8, display:"none"}).fadeIn(400);
		}).mousemove(function(kmouse){
				var border_top = $(window).scrollTop();
				var border_right = $(window).width();
				//var border_right = 985;
				
			
				
				var left_pos;
				var top_pos;
				var offset = 15;
				if(border_right - (offset *2) >= my_tooltip.width() + kmouse.pageX){
					left_pos = kmouse.pageX+offset;
					} else{
					left_pos = border_right-my_tooltip.width()-offset;
					}

				if(border_top + (offset *2)>= kmouse.pageY - my_tooltip.height()){
					top_pos = border_top +offset;
					} else{
					top_pos = kmouse.pageY-my_tooltip.height()-offset;
					}	

				my_tooltip.css({left:left_pos, top:top_pos});
		}).mouseout(function(){
				my_tooltip.css({left:"-9999px"});
		});

		}

	});
}


//::: thumbnail preview swap ::://
$(document).ready(function(){
						   
						   
//::: lets sniff browser width and hide the page fold if the size is too small to accomodate it ::://
	   $(window).resize(setWidth);
       $(document).ready(setWidth);

		/* lets hide the page fold if the browser window is too small to accomodate it */
       function setWidth() {
         var de = document.documentElement;
         if  (window.innerWidth  < 1170|| (de && de.clientWidth) < 1170 || (document.body.clientWidth) < 1170 ) {
			//$("#pageFold").css("display","none");
			$("#logo").css("left","100px");
		 }else{
			 //$("#pageFold").css("display","block");
			 $("#logo").css("left","0px");
		 }
       }
	
//::: Product page functionality ::://
	$(".jqzoom").hover(
      function () {
		 $("#product-spec").css('display','none');
		 $("#linernav").css('display','none');
		 $("#techspec").css('display','block');
	
      }, 
      function () {
        $("#product-spec").css('display','block');
		$("#linernav").css('display','block');
		$("#techspec").css('display','none');
      }
    );

						  
	$(".swatch a").click(function(){					  
		 
		 //$(".jqzoomimg").attr("title","gggggggg");	

		img = $(this).children("img").attr("src").replace('/xsmall/','/medium/');
		$(".jqzoomimg").attr("src",img);		
		
		img = $(this).children("img").attr("src").replace('/xsmall/','/xlarge/');
		$(".jqzoom").attr("href",img);
		
		//console.log ($(this).attr("title"));
		
		img = $(this).children("img").attr("src").replace('/xsmall/','/download.asp?filename=large/');
		$("#download").attr("href",img);
		
		title = $(this).attr("href").replace("#_","");
		$("#swatchname").html(title);
		
	});
	


//::: Navigation drop down and overlay ::://
   //::: if we have js enables lets hide the drop mene so we can animate it later :::'
   $("#nav li ul").addClass("jqhide");
   
    //::: Use hover intent to stop loop bug :::'
    $("#nav li").hoverIntent(
   	function(){
		$(this).addClass("sfhover","1000").fadeIn();
	 	$(this).children("ul").slideToggle("fast");		
		
		if ( $(this).hasClass("menu") ) {
			//$(".overlaytrans").stop();
			//$('.overlaytrans').css('display','block');
	  		//$('.overlaytrans').css('opacity','0');
			//$('.overlaytrans').css('moz-opacity','0');
			//$('.overlaytrans').css('filter','alpha(opacity=0)');
			//$('.overlaytrans').fadeTo("fast",.6); 
		}
	},
	function(){	
		$(this).removeClass("sfhover","1000");
		$(this).children("ul").slideToggle("fast");
		//$(".overlaytrans").stop();
		//$('.overlaytrans').fadeTo("slow",0.0);
		//$('.overlaytrans').css('display','none'); 
	 });
	 
	$("#nav li li").hover(
   	function(){
		$(this).removeClass("sub").fadeIn(); 
		$(this).addClass("subhover").fadeIn();   
	},
	function(){	
		$(this).removeClass("subhover");
		$(this).addClass("sub");
	 });
	 
	$.fn.hoverClass = function(c) {
		return this.each(function(){
			$(this).hover( 
				function() { $(this).addClass(c);  },
				function() { $(this).removeClass(c); }
			);
		});
	}; 
	
	});





