/*
/* advintage.co.nz
/* created by jericho.co.nz
/* 
/* base scripts for main template 
*/

var ui = {
	
	init: function() {
		
//		ui.extLinks();
	
		if ($('.striped')[0]) ui.stripeTables();
		
		if ($('.dblstriped')[0]) ui.dblStripeTables();
		
		if ($('.hover')[0]) ui.hoverRows();

    },
		
//	extLinks: function() {
//		// applies title attributes and target="_blank" for external links	
//		$('a[href^="http"]').each(function(i,el) {									   
//			var el = $(el);	
//			title = el.attr('title') ? el.attr('title') + ' [in new window or tab]' : el.attr('href') + ' [in new window or tab]';
//			el.attr({'title': title,'target': '_blank'});
//		})
//	},
	
	stripeTables: function() {	
		// add the class "striped" to a <tbody> (or <table>) and all child rows will be zebra-striped
		$('.striped tr:even').addClass('alt-row');
		
	},
	
	dblStripeTables: function() {
		// double table stripes for previous orders page
		var x = 0;
		$('.dblstriped tr').each(function(i,el){if (i === x) {$(el).addClass('alt-row').next().addClass('alt-row'); x += 4}});	
	},
	
	hoverRows: function() {
		// add the class "hover" on a <tbody> element and all child rows will be highlighted on mouseover
		$('tbody.hover tr').hover(function(){$(this).addClass('over')},function(){$(this).removeClass('over')});	
	}

} // ui
	
// on dom ready run init method
jQuery(function($){ui.init()});

/* other scripts */
jQuery(function($){function isCookieSet(){if(document.cookie.length>0){var i=document.cookie.indexOf("updateie6=");return(i!=-1);}
return false;}
var needUpgrade = /(MSIE 6|MSIE 5.(\d+))/i.test(navigator.userAgent); if (needUpgrade && !isCookieSet()) { $("body").prepend('<div class="updateie6" style="display:none;text-align:left;line-height:1.3em" ><h3 style="margin: 0px;">Your Internet Explorer 6 web browser is not fully supported</h3>You can easily upgrade to the latest version by clicking <a href="http://www.microsoft.com/windows/internet-explorer/default.aspx" target="_blank">here</a>. <div id="whyupcontent" style="display:none;"> <h3>Why should I upgrade?</h3> <ul><li><strong>Websites load faster</strong>, often double the speed of this older version</li> <li><strong>Websites look better</strong> with more web standards compliance</li> <li><strong>Tabs</strong> let you view multiple sites in one window</li> <li><strong>Safer browsing</strong> with phishing protection and other security enhancements</li> <li><strong>Convenient Printing</strong> with fit-to-page capability</li><li><strong>We recommend:</strong> <strong><a href="http://www.mozilla-europe.org/en/firefox/">Firefox</a></strong>, <strong><a href="http://www.apple.com/safari/">Safari</a></strong>, <a href="http://www.google.com/chrome">Google <strong>Chrome</strong></a> or<strong> <a href="http://www.microsoft.com/ie">Internet Explorer 8</a></strong></li> </ul></div><span id="hideme" style="display: none;"><a href="#" id="whyupgrade">Why should I upgrade?</a> - <a href="#" id="goaway">No thanks!</a></span></div>'); $('div.updateie6').slideDown('slow'); $("span#hideme").fadeIn("slow"); $("a#whyupgrade").click(function () { $("div#whyupcontent").slideDown("slow"); }); $("a#goaway").click(function () { $("div.updateie6").slideUp("fast", function () { $(this).remove() }); var exp = new Date(); exp.setTime(exp.getTime() + (7 * 24 * 3600000)); document.cookie = "updateie6=hide; expires=" + exp.toUTCString(); }); };
});
