// JavaScript Document

(function($) {

$(document).ready(function(){
	$('#SERV_consult_con, #SERV_projectman_con, #SERV_system_con, #SERV_support_con, #SERV_instal_con, #SERV_train_con, #SERV_supply_con, #SERV_managed_con').hide();
	$("#SERV_service").css("backgroundImage", "url(images/Q_greybg.gif)");
	$('#PROD_leisure_con, #PROD_retail_con, #PROD_gaap_con, #PROD_smart_con').hide();
	$("#PROD_summary").css("backgroundImage", "url(images/Q_greybg.gif)");
	$('#HOME_SLIDE') 
		.cycle({ 
		fx:     'fade',
    	speed:  750, 
    	timeout: 5000, 
		type: 'random_start',
    	pager:  '#HOME_SLIDE_NUMBERS' 
	});
	$('#ABOUT_SLIDE') 
		.cycle({ 
		fx:     'fade',
    	speed:  750, 
    	timeout: 5000, 
		type: 'random_start'
	});
		
	$('div.NEWS_accordionButton').click(function() {
		$('div.NEWS_accordionContent').slideUp('normal');	
		$(this).next().slideDown('normal');
	});
	$("div.NEWS_accordionContent").hide();
	$("#open").trigger('click');
	
	
	
	$("#PROD_summary_but").click(function() {
		$("#PROD_leisure_con, #PROD_retail_con, #PROD_gaap_con, #PROD_smart_con").fadeOut(0);
		$("#PROD_summary_con").fadeIn(0);
		$("#PROD_summary").css("backgroundImage", "url(images/Q_greybg.gif)");
		$("#PROD_leisure, #PROD_retail, #PROD_gaap, #PROD_smart").css("backgroundImage", "url(images/spacer.gif)");
	})
	$("#PROD_leisure_but, #PROD_leisure_but2").click(function() {
		$("#PROD_summary_con, #PROD_retail_con, #PROD_gaap_con, #PROD_smart_con").fadeOut(0);
		$("#PROD_leisure_con").fadeIn(0);
		$("#PROD_leisure").css("backgroundImage", "url(images/Q_greybg.gif)");
		$("#PROD_summary, #PROD_retail, #PROD_gaap, #PROD_smart").css("backgroundImage", "url(images/spacer.gif)");
	})
	$("#PROD_retail_but, #PROD_retail_but2").click(function() {
		$("#PROD_summary_con, #PROD_leisure_con, #PROD_gaap_con, #PROD_smart_con").fadeOut(0);
		$("#PROD_retail_con").fadeIn(0);
		$("#PROD_retail").css("backgroundImage", "url(images/Q_greybg.gif)");
		$("#PROD_summary, #PROD_leisure, #PROD_gaap, #PROD_smart").css("backgroundImage", "url(images/spacer.gif)");
	})
	$("#PROD_gaap_but, #PROD_gaap_but2").click(function() {
		$("#PROD_summary_con, #PROD_leisure_con, #PROD_retail_con, #PROD_smart_con").fadeOut(0);
		$("#PROD_gaap_con").fadeIn(0);
		$("#PROD_gaap").css("backgroundImage", "url(images/Q_greybg.gif)");
		$("#PROD_summary, #PROD_leisure, #PROD_retail, #PROD_smart").css("backgroundImage", "url(images/spacer.gif)");
	})
	$("#PROD_smart_but, #PROD_smart_but2").click(function() {
		$("#PROD_summary_con, #PROD_leisure_con, #PROD_retail_con, #PROD_gaap_con").fadeOut(0);
		$("#PROD_smart_con").fadeIn(0);
		$("#PROD_smart").css("backgroundImage", "url(images/Q_greybg.gif)");
		$("#PROD_summary, #PROD_leisure, #PROD_retail, #PROD_gaap").css("backgroundImage", "url(images/spacer.gif)");
	})
	
	
	$("#SERV_service_but").click(function() {
		$("#SERV_consult_con, #SERV_projectman_con, #SERV_system_con, #SERV_support_con, #SERV_instal_con, #SERV_train_con, #SERV_supply_con, #SERV_managed_con").fadeOut(0);
		$("#SERV_service_con").fadeIn(0);
		$("#SERV_service").css("backgroundImage", "url(images/Q_greybg.gif)");
		$("#SERV_consult, #SERV_projectman, #SERV_system, #SERV_support, #SERV_instal, #SERV_train, #SERV_supply, #SERV_managed").css("backgroundImage", "url(images/spacer.gif)");
	})
	$("#SERV_consult_but").click(function() {
		$("#SERV_service_con, #SERV_projectman_con, #SERV_system_con, #SERV_support_con, #SERV_instal_con, #SERV_train_con, #SERV_supply_con, #SERV_managed_con").fadeOut(0);
		$("#SERV_consult_con").fadeIn(0);
		$("#SERV_consult").css("backgroundImage", "url(images/Q_greybg.gif)");
		$("#SERV_service, #SERV_projectman, #SERV_system, #SERV_support, #SERV_instal, #SERV_train, #SERV_supply, #SERV_managed").css("backgroundImage", "url(images/spacer.gif)");
	})
	$("#SERV_projectman_but").click(function() {
		$("#SERV_service_con, #SERV_consult_con, #SERV_system_con, #SERV_support_con, #SERV_instal_con, #SERV_train_con, #SERV_supply_con, #SERV_managed_con").fadeOut(0);
		$("#SERV_projectman_con").fadeIn(0);
		$("#SERV_projectman").css("backgroundImage", "url(images/Q_greybg.gif)");
		$("#SERV_service, #SERV_consult, #SERV_system, #SERV_support, #SERV_instal, #SERV_train, #SERV_supply, #SERV_managed").css("backgroundImage", "url(images/spacer.gif)");
	})
	$("#SERV_system_but").click(function() {
		$("#SERV_service_con, #SERV_consult_con, #SERV_projectman_con, #SERV_support_con, #SERV_instal_con, #SERV_train_con, #SERV_supply_con, #SERV_managed_con").fadeOut(0);
		$("#SERV_system_con").fadeIn(0);
		$("#SERV_system").css("backgroundImage", "url(images/Q_greybg.gif)");
		$("#SERV_service, #SERV_consult, #SERV_projectman, #SERV_support, #SERV_instal, #SERV_train, #SERV_supply, #SERV_managed").css("backgroundImage", "url(images/spacer.gif)");
	})
	$("#SERV_support_but").click(function() {
		$("#SERV_service_con, #SERV_consult_con, #SERV_projectman_con, #SERV_system_con, #SERV_instal_con, #SERV_train_con, #SERV_supply_con, #SERV_managed_con").fadeOut(0);
		$("#SERV_support_con").fadeIn(0);
		$("#SERV_support").css("backgroundImage", "url(images/Q_greybg.gif)");
		$("#SERV_service, #SERV_consult, #SERV_projectman, #SERV_system, #SERV_instal, #SERV_train, #SERV_supply, #SERV_managed").css("backgroundImage", "url(images/spacer.gif)");
	})
	$("#SERV_instal_but").click(function() {
		$("#SERV_service_con, #SERV_consult_con, #SERV_projectman_con, #SERV_system_con, #SERV_support_con, #SERV_train_con, #SERV_supply_con, #SERV_managed_con").fadeOut(0);
		$("#SERV_instal_con").fadeIn(0);
		$("#SERV_instal").css("backgroundImage", "url(images/Q_greybg.gif)");
		$("#SERV_service, #SERV_consult, #SERV_projectman, #SERV_system, #SERV_support, #SERV_train, #SERV_supply, #SERV_managed").css("backgroundImage", "url(images/spacer.gif)");
	})
	$("#SERV_train_but").click(function() {
		$("#SERV_service_con, #SERV_consult_con, #SERV_projectman_con, #SERV_system_con, #SERV_support_con, #SERV_instal_con, #SERV_supply_con, #SERV_managed_con").fadeOut(0);
		$("#SERV_train_con").fadeIn(0);
		$("#SERV_train").css("backgroundImage", "url(images/Q_greybg.gif)");
		$("#SERV_service, #SERV_consult, #SERV_projectman, #SERV_system, #SERV_support, #SERV_instal, #SERV_supply, #SERV_managed").css("backgroundImage", "url(images/spacer.gif)");
	})
	$("#SERV_supply_but").click(function() {
		$("#SERV_service_con, #SERV_consult_con, #SERV_projectman_con, #SERV_system_con, #SERV_support_con, #SERV_instal_con, #SERV_train_con, #SERV_managed_con").fadeOut(0);
		$("#SERV_supply_con").fadeIn(0);
		$("#SERV_supply").css("backgroundImage", "url(images/Q_greybg.gif)");
		$("#SERV_service, #SERV_consult, #SERV_projectman, #SERV_system, #SERV_support, #SERV_instal, #SERV_train, #SERV_managed").css("backgroundImage", "url(images/spacer.gif)");
	})
	$("#SERV_managed_but").click(function() {
		$("#SERV_service_con, #SERV_consult_con, #SERV_projectman_con, #SERV_system_con, #SERV_support_con, #SERV_instal_con, #SERV_train_con, #SERV_supply_con").fadeOut(0);
		$("#SERV_managed_con").fadeIn(0);
		$("#SERV_managed").css("backgroundImage", "url(images/Q_greybg.gif)");
		$("#SERV_service, #SERV_consult, #SERV_projectman, #SERV_system, #SERV_support, #SERV_instal, #SERV_train, #SERV_supply").css("backgroundImage", "url(images/spacer.gif)");
	})
	$("#SERV_annual_but").click(function() {
		$("#SERV_service_con, #SERV_consult_con, #SERV_projectman_con, #SERV_system_con, #SERV_support_con, #SERV_instal_con, #SERV_train_con, #SERV_supply_con, #SERV_managed_con").fadeOut(0);
		$("#SERV_annual_con").fadeIn(0);
		$("#SERV_annual").css("backgroundImage", "url(images/Q_greybg.gif)");
		$("#SERV_service, #SERV_consult, #SERV_projectman, #SERV_system, #SERV_support, #SERV_instal, #SERV_train, #SERV_supply, #SERV_managed").css("backgroundImage", "url(images/spacer.gif)");
	})
})

//This line will update our URL anytime a tab is selected - Thanks Mike!
		//setting this before now will cause odd behavior
		$("#TABS").bind('tabsshow', function(event, ui){document.location =$(document).attr('location').pathname + "#" + ui.panel.id; });
 


//
// var blank = new Image();
// blank.src = 'images/spacer.gif';
// 
// $(document).ready(function() {
//   var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
//   if (badBrowser) {
//     // get all pngs on page
//     $('img[src$=.png]').each(function() {
//       if (!this.complete) {
//         this.onload = function() { fixPng(this) };
//       } else {
//         fixPng(this);
//       }
//     });
//   }
// });
// 
// function fixPng(png) {
//   // get src
//   var src = png.src;
//   // set width and height
//   if (!png.style.width) { png.style.width = $(png).width(); }
//   if (!png.style.height) { png.style.height = $(png).height(); }
//   // replace by blank image
//   png.onload = function() { };
//   png.src = blank.src;
//   // set filter (display original image)
//   png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
// }

})(jQuery);

