/*

This script powers the accordion widget on the homepage
Had to replace $ with jQuery and then use jQuery.noConflict() so this script does not
interfere or break the mootools code on the home page
*/

jQuery.noConflict();

jQuery(document).ready(function(){
	
	//jQuery('img.top').css("border","1px solid red");
	jQuery('#pft .combo_desc, #pft .mobile_desc, .btm').css('display','none');
	
	var imgPath = "/shared/css/img/hp-accordion/";
	var laptop	= jQuery('#pft .laptop');
	var laptopDesc = jQuery('#pft .laptop_desc');
	var mobile 	= jQuery('#pft .mobile');
	var mobileDesc = jQuery('#pft .mobile_desc');
	var combo 	= jQuery('#pft .combo');
	var comboDesc = jQuery('#pft .combo_desc');
	var btm = jQuery('#pft .btm');
	
	laptop.mousedown(function(){
		
		laptopDesc.slideToggle();
		mobileDesc.slideUp();
		comboDesc.slideUp();
		combo.slideDown();
		
		if (laptop.attr('src')==imgPath + 'laptop.png') {
			laptop.attr('src',imgPath + 'laptop_on.png');
		} else if (laptop.attr('src')==imgPath + 'laptop_on.png') {
			laptop.attr('src',imgPath + 'laptop.png');
		}
		
		if (mobile.attr('src')==imgPath + 'mobile_on.png') {
			mobile.attr('src',imgPath + 'mobile.png');
		}
		
		if (combo.attr('src')==imgPath + 'combo_on.png') {
			combo.attr('src',imgPath + 'combo.png');
		}
		
		if (combo.attr('src')==imgPath + 'combo.png') {
			btm.slideUp();
		}
		
	});	
	
	mobile.mousedown(function(){
		
		mobileDesc.animate({height: 'toggle'},500);
		laptopDesc.slideUp();
		comboDesc.slideUp();
		combo.slideDown();
		
		if (mobile.attr('src')==imgPath+'mobile.png') {
			mobile.attr('src',imgPath+'mobile_on.png');
		} else if (mobile.attr('src')==imgPath+'mobile_on.png') {
			mobile.attr('src',imgPath+'mobile.png');
		}
		
		if (laptop.attr('src')==imgPath+'laptop_on.png') {
			laptop.attr('src',imgPath+'laptop.png');
		}
		
		if (combo.attr('src')==imgPath+'combo_on.png') {
			combo.attr('src',imgPath+'combo.png');
		}
		
		if (combo.attr('src')==imgPath+'combo.png') {
			btm.slideUp();
		}
		
	});
	
	combo.mousedown(function(){
		
		comboDesc.animate({height: 'toggle'},500);
		mobileDesc.slideUp();
		laptopDesc.slideUp();
		btm.toggle();
		
		if (combo.attr('src')==imgPath+'combo.png') {
			combo.attr('src',imgPath+'combo_on.png');
		} else if (combo.attr('src')==imgPath+'combo_on.png') {
			combo.attr('src',imgPath+'combo.png');
		}
		
		if (mobile.attr('src')==imgPath+'mobile_on.png') {
			mobile.attr('src',imgPath+'mobile.png');
		}
		
		if (laptop.attr('src')==imgPath+'laptop_on.png') {
			laptop.attr('src',imgPath+'laptop.png');
		}
		
	});	
		
})
