/* this is the Central control of all jquery functionalities */


	function show_me_more($ob){
		jQuery($ob).find('.hover_view').slideToggle('slow');
	}
	function hover_show(){
		jQuery(".hover_view").hide();
		jQuery(".gallery3_box_img").hover(function(){
			show_me_more(this);
		},function(){
			show_me_more(this);
		});
	}
	
	function show_product_tip(){
		jQuery(".product_tooltip").hide();
		jQuery(".gallery_box_img").hover(function(){
			jQuery(this).find('.product_tooltip').slideToggle('slow');
		},function(){
			jQuery(this).find('.product_tooltip').slideToggle('slow');
		});
	}
	
	broken_slashers = function(){
		jQuery('.thumbs img').each(function() {
		if((typeof this.naturalWidth != "undefined" && this.naturalWidth == 0 ) || this.readyState == 'uninitialized' ) {
			jQuery(this).parent().parent().remove();
		}
		}); 
	}

			
	function get_parents_ul_show(){
		var urls = location.pathname;
		jQuery('#nav_725497 li:has(ul) li').each(function(){
			var thethis = jQuery(this);
			var thisval = jQuery(this).find('a').attr('href');
			 if(thisval == urls){
			   thethis.parents().show();
			   return false;
			 }else{
			}
		});
	}
	
	function product_downloadmore(){
		var havemore = jQuery(".dowloadmore a").attr("href");
		if(havemore == ''){
			jQuery('.dowloadmore').hide();
		}
	}
	
	function images_begone(){
      var chriscounter = 0;
		jQuery('.thumbs img').each(function() {
			if((typeof this.naturalWidth != "undefined" && this.naturalWidth == 0 ) || this.readyState == 'uninitialized' ) {
				jQuery(this).parent().parent().remove();
						  chriscounter++;
			}
		}); 
	}
	
	function images_pagination_goner(){
		var coco = jQuery(".thumbs img").size()/8;
		jQuery('.bottom a').each(function(){
			var url_eq = jQuery('.bottom a').index(this);
			if(url_eq >= parseInt(coco)){
				jQuery('.bottom a:eq('+url_eq+')').remove();
			}
		});	
	}
	
	function product_pagination(){
		jQuery('a.ft-button-products_showing_details').each(function(){
		var themaking = jQuery(this).text();
		var limitka = themaking.substr(0,2);
			if(limitka >= 10){
				jQuery(this).css('padding','6px 3px');
			}
		});
	}
	
	function newsletter_trapping(){
		jQuery("input[id^='CLFullName']").focus(function(){
			jQuery(this).val('');
		});
		jQuery("input[id^='CLEmailAddress']").focus(function(){
			jQuery(this).val('');
		})
	}

	//this is for removing product sliders in the more info category 
	function product_moreinfo_sliders(){
		var location_url = window.location.pathname;
	
		switch(location_url){
			case "/_webapp_1490365/Warranty":
				jQuery("#slider").remove();
			break;
			case "/_webapp_1490342/Fabrics_and_Finishes":
				jQuery("#slider").remove();
			break;
			case "/_webapp_1490348/Anodised_Aluminium":
				jQuery("#slider").remove();
			break;
			case "/_webapp_1490365/Warranty":
				jQuery("#slider").remove();
			break;
		}
	}
	
	function openNewWindow(page) {
		OpenWin = this.open(page, "CtrlWindow", "height=800,toolbar=no,menubar=no,location=yes,scrollbars=yes,resizable=yes");
	}
	
	// this is for the customer page
	function customer_alignment(){
		jQuery(".customerdesc:even,.customerimg:even").addClass('left');
		jQuery(".customerdesc:odd,.customerimg:odd").addClass('right');
	}
	
	//this is for the product outdoor iola
	function outdoor_showtooltip(){
		jQuery(".iola").hover(function(){
			jQuery(this).find('.outdoor_tooltip').fadeIn('slow');
		},function(){
			jQuery(this).find('.outdoor_tooltip').fadeOut('slow');
		});
	}
	
	jQuery(document).ready(function(){

		jQuery('#nav_725497 li.selected:first > ul').show();
		jQuery('#nav_725880 li.selected:first > ul').show();		
		
		hover_show();
		show_product_tip();
		get_parents_ul_show();
		product_downloadmore();
		product_pagination();
		newsletter_trapping();
		product_moreinfo_sliders();
		customer_alignment();
		outdoor_showtooltip();
	});
