		jQuery.fn.tabs = function () {
		  return this.each(function (){
		  	$(this).find('ul.content li.tab').hide();
		  	var selected = $(this).find('ul.tabs').attr('title');
		  	$(this).find('ul.tabs').attr('title', '');
			var tabnum = 1;
				$(this).find('ul.tabs li').each(function () {
					$(this).addClass("tab" + tabnum);
					if (tabnum == selected) { $(this).removeClass().addClass('selected'); } 
					tabnum++;
				});
				tabnum = 1;
				$(this).find('ul.content li.tab').each(function () {
					$(this).addClass('tab' + tabnum);
					if (tabnum == selected) { $(this).show(); }
					tabnum++; 
				});		  	
				$('ul.tabs li a').click(function() {
					tabnum = 1;
					var tabName = $(this).parent();
					$(this).parent().parent().find("li").each(function () {
							$(this).removeClass().addClass('tab' + tabnum);
							if ($(this).attr('class') == tabName.attr('class')) { 
								selected = tabnum; 
								$(this).removeClass().addClass('selected');	
							}
							tabnum++;
					});
					tabnum = 1;
					$(this).parent().parent().parent().parent().find('li.tab').each(function () {
						if (tabnum == selected) { $(this).show(); } 
						else { $(this).hide(); }
						tabnum++;
					});					
					return false;
				});	
				
				var pageHash = window.location.hash;
				var hashTab;
				if (pageHash == "#Overview") { gototab("Overview"); return false; }
				if (pageHash == "#Technical_specs") { gototab("Specs"); return false; }
				if (pageHash == "#Upgrade_options") { gototab("Upgrades"); return false; }
				if (pageHash == "#Current_specials") { gototab("Specials"); return false; }
				if (pageHash == "#Warranty") { gototab("Warranty"); return false; }
				
				$('a.tab_overview').click(function() { gototab("Overview"); return false; });			
				$('a.tab_specs').click(function() { gototab("Specs"); return false; });			
				$('a.tab_upgrades').click(function() { gototab("Upgrades"); return false; });			
				$('a.tab_specials').click(function() { gototab("Specials"); return false; });			
				$('a.tab_warranty').click(function() { gototab("Warranty"); return false; });			
		 	});
		}

		jQuery.fn.fasttabs = function () {
			return this.each(function (){
		  		$('body').find('ul#tab_content li').hide();
		  		var currentSelection = $(this).find('li.selected').index('li');
		  		// alert (currentSelection);
	  			$('body').find('ul#tab_content li').hide();
	  			$('body').find('ul#tab_content li:eq(' + currentSelection + ')').show();
		  		
				$(this).find('li a').click(function() {
		  			currentSelection = $(this).parent().index('li');
		  			// alert (currentSelection);
		  			$(this).parent().parent().find('li.selected').removeClass('selected');
		  			$(this).parent().addClass('selected');
		  			$('body').find('ul#tab_content li').hide();
		  			$('body').find('ul#tab_content li:eq(' + currentSelection + ')').show();
		  			return false;
				});
		  		
			});
		}


		jQuery.fn.subbanner = function () {
			$("#subbanner li").hide();
			var currentbanner = 0;
			var gotobanner = 100;
			var setsecs = 8;
			var pause = setsecs;
			var totalbanners = $("#subbanner li").length - 1;
			$("#subbanner li:eq(" + currentbanner + ")").show();
			$("#subbanner_nav li:eq(" + currentbanner + ") a").attr("class", "sel");
			setInterval(move, 1000);
			$("#subbanner_nav li a").click(function() {
				gotobanner = $("#subbanner_nav li a").index(this); 
				pause = 0;
				move();
				return false;
			});
			function move() { 
				if (pause != 0) { pause--; } else {
					pause = setsecs;
					$("#subbanner li:eq(" + currentbanner + ")").fadeOut("slow");
					
					if (gotobanner == 100) { 
						if (currentbanner != totalbanners) { currentbanner++; } else { currentbanner=0; } 
					} else { currentbanner = gotobanner; gotobanner = 100; } 
					$("#subbanner li:eq(" + currentbanner + ")").fadeIn("slow"); 
					$("#subbanner_nav li a").removeClass();
					$("#subbanner_nav li:eq(" + currentbanner + ") a").attr("class", "sel");
				}
			}
		}

		jQuery.fn.inputhint = function () {
			return this.each(function (){
				var hintvalue = $(this).attr('value');
				$(this).css('color', '#666');
				$(this).focus(function() {
					$(this).css('color', '#333');
					if ($(this).attr('value') == hintvalue) { $(this).attr('value', ''); }
				});
				$(this).blur(function() {
					if ($(this).attr('value') == "") { $(this).attr('value', hintvalue); $(this).css('color', '#666'); }
					if ($(this).attr('value') == hintvalue) { $(this).css('color', '#666'); }
				});
			});
		}

		jQuery.fn.inputhint2 = function () {
		  return this.each(function (){
				var hintvalue = $(this).attr('value');
				$(this).css('color', '#666');
				$(this).focus(function() {
					$(this).css('color', '#333');
					if ($(this).attr('value') == hintvalue) { $(this).attr('value', ''); }
				});
		   });
		}


		jQuery.fn.form_numbersonly = function () {
			return this.each(function (){
				$(this).keypress(function (e){
					  if ( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57)) { return false; }
				});
			});
		}

		jQuery.fn.form_required = function () {
			return this.each(function (){
				if ($(this).attr('value') != "") { $(this).css("border-color", "#bbb").parent().find('.error').hide(); }
				else { $(this).css("border-color", "#db0000").parent().find('.error').show(); }		  
			});
		}
				

		jQuery.fn.form_realemail = function () {
			return this.each(function (){
				if ($(this).attr('value') != "") { 
						error2 = 0;
						
						if ($(this).is("[value$='@hotmail.com']")) { error2 = 1; }
						if ($(this).is("[value$='@gmail.com']")) { error2 = 1; }
						if ($(this).is("[value$='@yahoo.com']")) { error2 = 1; }
						if ($(this).is("[value$='@msn.com']")) { error2 = 1; }
						if ($(this).is("[value$='@bellsouth.net']")) { error2 = 1; }
						if ($(this).is("[value$='@comcast.net']")) { error2 = 1; }
						if ($(this).is("[value$='@aol.com']")) { error2 = 1; }
						if ($(this).is("[value$='@earthlink.net']")) { error2 = 1; }
						if ($(this).is("[value$='@everymail.com']")) { error2 = 1; }
						if ($(this).is("[value$='@lycos.com']")) { error2 = 1; }
						if ($(this).is("[value$='@netzero.net']")) { error2 = 1; }
						if ($(this).is("[value$='@HOTMAIL.COM']")) { error2 = 1; }
						if ($(this).is("[value$='@GMAIL.COM']")) { error2 = 1; }
						if ($(this).is("[value$='@YAHOO.COM']")) { error2 = 1; }
						if ($(this).is("[value$='@MSN.COM']")) { error2 = 1; }
						if ($(this).is("[value$='@BELLSOUTH.NET']")) { error2 = 1; }
						if ($(this).is("[value$='@COMCAST.NET']")) { error2 = 1; }
						if ($(this).is("[value$='@AOL.COM']")) { error2 = 1; }
						if ($(this).is("[value$='@EARTHLINK.NET']")) { error2 = 1; }
						if ($(this).is("[value$='@EVERYMAIL.COM']")) { error2 = 1; }
						if ($(this).is("[value$='@LYCOS.COM']")) { error2 = 1; }
						if ($(this).is("[value$='@NETZERO.NET']")) { error2 = 1; }							
						if ($(this).is("[value*='@']")) { } else { error2 = 2; }
						if ($(this).is("[value*='.']")) { } else { error2 = 2; }
						
						if (error2 == "0") { $(this).css("border-color", "#bbb").parent().find('.error').hide(); }
						if (error2 == "1") { $(this).css("border-color", "#db0000").parent().find('.error').text("Company Emails Only.").show(); }
						if (error2 == "2") { $(this).css("border-color", "#db0000").parent().find('.error').text("Enter A Valid Email Address.").show(); }
				} 
				if ($(this).attr('value') == "") {	
					$(this).parent().find('.error').text("Email Address is Required.").show();
				}
			});
		}


		jQuery.fn.form_realemail2 = function () {
			return this.each(function (){
				if ($(this).attr('value') != "") { 
					error2 = 0;
					if ($(this).is("[value*='@']")) { } else { error2 = 1; }
					if ($(this).is("[value*='.']")) { } else { error2 = 1; }
					if (error2 == "0") { $(this).css("border-color", "#ccc").parent().find('.error').hide(); }
					if (error2 == "1") { $(this).css("border-color", "#db0000").parent().find('.error').show(); $(this).parent().find('.error').text("Enter A Valid Email Address."); }
				} else {	
					$(this).parent().find('.error').hide();;
				}		  
			});
		}
	
		$(document).ready(function(){
			$('a.newwindow').click(function(){
				window.open(this.href);
				return false;
			}); 
			$(".startform").click(highlight_name);

		});

	function userinteraction(name, email, phone, notes, siteAddr, userid, pageid) {
		$.post(siteAddr + "include/userinteraction.php", {name: ""+name+"", email: ""+email+"", phone: ""+phone+"", notes: ""+notes+"", userid: ""+userid+"", pageid: ""+pageid+""}, function(data) {});
	}

	function livesearch(searchQuery, siteAddr) {
		if (searchQuery.length == 0) {
			$('#livesearch').fadeOut();
		} else {
			$.post(siteAddr + "include/livesearch.php", {q: ""+searchQuery+""}, function(data) { 
				$('#livesearch').fadeIn();	         
				$('#livesearch').html(data);
	      	});
		}
	}

	function gototab(tabTitle) {	
		tabnum = 1;
		$("ul.tabs li").each(function () {
			$(this).removeClass().addClass('tab' + tabnum);
			if ($(this).attr('title') == tabTitle) { 
				selected = tabnum; 
				$(this).removeClass().addClass('selected');	
			}
			tabnum++;
		});
		tabnum = 1;
		$('ul.content li.tab').each(function () {
			if (tabnum == selected) { $(this).show(); } 
			else { $(this).hide(); }
			tabnum++;
		});					
		return false;
	}


	function calculateCost() {
		var totalCost = 0;
		$(".c_qty input").each( function() {
			var quantity = $(this).val();
			var eachCost = $(this).parent().parent().find(".c_ttl .each").html();
			var cost = eachCost * quantity;
			var displayCost = addCommas(cost.toFixed(2));
			$(this).parent().parent().find(".c_ttl .ttl").html(displayCost);
			
			totalCost += parseInt(cost);
		});
		var totalCostDisplay = addCommas(totalCost.toFixed(2));
		$(".subtotal .c_ttl .ttl").html(totalCostDisplay);
		
		if (totalCost == 0) { $(".emptycart").show(); $(".cart").hide(); }
	}

	function addCommas(nStr) {
		nStr += '';
		x = nStr.split('.');
		x1 = x[0];
		x2 = x.length > 1 ? '.' + x[1] : '';
		var rgx = /(\d+)(\d{3})/;
		while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); }
		return x1 + x2;
	}
	
	function highlight_name() {	
		$("#quote_name").focus(); 
		if ($(".productpop").is(":visible")) { $(".productpop").hide(); }
		return false; 
	}

	function addToCart(itemTitle, itemDesc, itemPrice, itemTotal, itemQty, finalTotal, thisId, siteAddr) {
		siteAddr = siteAddr + "form_submit.php";
		$.post(siteAddr, { type: "addtocart", uid: thisId, itemqty: itemQty });
		checkRight(itemTitle, itemDesc, itemPrice, itemTotal, itemQty, finalTotal, thisId, siteAddr);		
	}
	
	function rightCartTotal() {
		var totalCost = 0;
		$(".rightcart_item .ic_left").each( function() {
			var quantity = $(this).attr('title');
			var eachCost = $(this).parent().find('.ic_right').attr('title');
			var cost = eachCost * quantity;
			totalCost += parseInt(cost);			
		});
		var totalCostDisplay = addCommas(totalCost.toFixed(2));
		$('#rightincart .ic_total .ic_right').html('$' + totalCostDisplay);
	}
	
	function addBookmark(siteAddr, pid, uid) {
	 	title = document.title; 
	 	url = window.location.href;

	    if (window.sidebar) { // Mozilla Firefox Bookmark
	        window.sidebar.addPanel(title, url,"");
	    } else if( window.external ) { // IE Favorite
	        window.external.AddFavorite( url, title); 
	    } else if(window.opera && window.print) { // Opera Hotlist
	        return true; }
	        
	    siteAddr = siteAddr + "form_submit.php";    
		$.post(siteAddr, { type: "bookmarked", uid: uid, pid: pid });
	}

	function checkRight(itemTitle, itemDesc, itemPrice, itemTotal, itemQty, finalTotal, thisId, siteAddr) {	
		siteAddr = siteAddr + "form_submit.php";
		$.post(siteAddr, { type: "addtocart", uid: thisId, itemqty: itemQty });
		
		if ($('#rightincart').is(':visible')) { 
			$('#rightincart .rightcart_item:last').after('<div class="rightcart_item"><div class="ic_left" title="' + itemQty + '"><strong>' + itemTitle + '</strong><br />' + itemDesc + ' - Qty: ' + itemQty + '<div class="sep"></div></div><div class="ic_right" title="' + itemPrice + '">$' + finalTotal + '</div><div class="sep"></div></div>');
			rightCartTotal();						
		} else {
			$('#rightincart').slideDown();
			$('#rightincart .col_head').after('<div class="rightcart_item"><div class="ic_left" title="' + itemQty + '"><strong>' + itemTitle + '</strong><br />' + itemDesc + ' - Qty: ' + itemQty + '<div class="sep"></div></div><div class="ic_right" title="' + itemPrice + '">$' + finalTotal + '</div><div class="sep"></div></div>');
			rightCartTotal();
		}
	 }