$(document).ready(function() {


	$("#productfinder select").change(function(){
		$("#productfinder").submit();
	});

// table zebra

	$(".node tr:nth-child(odd)").addClass("zebra");
	$(".node .productfinder_table tr:nth-child(even)").addClass("zebra-dark");

// main menu style
	
	$("#mainnav ul.menu li a").wrapInner("<span>" + "</span>");
	$("#mainnav ul.menu li:first").addClass("first-item");
	$("#mainnav ul:first>li.last").addClass("last-item");
	$("#mainnav ul:first a.active-trail").addClass("active");
		
// language drop-down behavior	

	$('#form-language select').change(function(){
		var url = $(this).val();
		window.location.replace(url);
	});

// download link style
	
	$("a[@href$=pdf]").addClass("pdf");
	$("a[@href$=zip]").addClass("zip");
	$("a[@href$=psd]").addClass("psd");
	
// product pages style

	$("h4").addClass("features");
	$("h4 + ul").addClass("features");

// tool button (print)

	$("#btn-tool-print").click(function(){
		window.print();
	});
	

// cycle

	try
	{
		$('.section_home #header-image').cycle({ 
			fx: 'fade', 
			speed: 500, 
			timeout: 5000,
			pause: 0 
		});
		$('.section_products_gk #header-image').cycle({ 
			fx: 'fade', 
			speed: 2000, 
			timeout: 4000,
			pause: 0 
		});
	}
	catch (err) {}


// track mail links , outgoing links and  downloads
	
//     _uacct = "UA-1111111-1";
//     urchinTracker();
// 
//     // The slashes are to ensure the period is in the url, the $ is to make sure it is the end of the url, the i is to make it case insensitive.
//     filetypes = /\.doc$|\.xls$|\.exe$|\.zip$|\.pdf$|\.mp3$|\.psd$/i;
//     $("a").each(function(){
//         // Track mailto links
//         if ($(this).attr("href").match(/^mailto\:/i)) {
//             var url = $(this).attr("href").replace(/^mailto\:/i, "")
//             $(this).click(function() {urchinTracker("/mailto/" + url);})
//         }
//         // Track external links
//         else if (location.host != this.host.replace(/\:80$/i, "")) {
//             var url = $(this).attr("href").replace(/^http\:\/\/(www\.)*/i, "")
//             $(this).click(function() {urchinTracker("/outgoing/" + url);})
//         }
//         // Track downloads (links with a given extension)
//         else if ($(this).attr("href").match(filetypes)) {
//             // The URL needs to be changed for each site this is applied to.
//             var url = $(this).attr("href").replace(/^(http\:\/\/)*(www\.)*(permanentinkdesign\.com")*\//i, "")
//             $(this).click(function() {urchinTracker("/downloads/" + url);})
//         }
//     });


});

