Resources/functions.js
//Set background color for Main Buttons
Set background color for Main Buttons
Set background color for Main Buttons
function changeMainBtnState(e){
	var whichBtn;
	whichBtn = e.source.title;
	if(e.source.value == 1){
		if(whichBtn == 'Like'){
			e.source.image = 'images/main_buttons/state1/smiley_like.png';
		} else if(whichBtn == 'Yes'){
			e.source.image = 'images/main_buttons/state1/tick_yes.png';
		} else if(whichBtn == 'More'){	
			e.source.image = 'images/main_buttons/state1/plus_more.png';
		} else if(whichBtn == 'DontLike'){	
			e.source.image = 'images/main_buttons/state1/smiley_dont_like.png';
		} else if(whichBtn == 'No'){	
			e.source.image = 'images/main_buttons/state1/cross_no.png';
		} else if(whichBtn == 'Less'){	
			e.source.image = 'images/main_buttons/state1/minus_less.png';
		}
	} else if (e.source.value == 2){
		if(whichBtn == 'Like'){
			e.source.image = 'images/main_buttons/state2/smiley_like.png';
		} else if(whichBtn == 'Yes'){
			e.source.image = 'images/main_buttons/state2/tick_yes.png';
		} else if(whichBtn == 'More'){	
			e.source.image = 'images/main_buttons/state2/plus_more.png';
		} else if(whichBtn == 'DontLike'){	
			e.source.image = 'images/main_buttons/state2/smiley_dont_like.png';
		} else if(whichBtn == 'No'){	
			e.source.image = 'images/main_buttons/state2/cross_no.png';
		} else if(whichBtn == 'Less'){	
			e.source.image = 'images/main_buttons/state2/minus_less.png';
		}
	}
    for(var i = 0; i < mainBtn.length; i++){
        if(e.source !== mainBtn[i]){
        	otherBtnTitle = mainBtn[i].title;
			if(otherBtnTitle == 'Like'){
				mainBtn[i].image = 'images/main_buttons/smiley_like.png';
			} else if(otherBtnTitle == 'Yes'){
				mainBtn[i].image = 'images/main_buttons/tick_yes.png';
			} else if(otherBtnTitle == 'More'){	
        		mainBtn[i].image = 'images/main_buttons/plus_more.png';
			} else if(otherBtnTitle == 'DontLike'){
				mainBtn[i].image = 'images/main_buttons/smiley_dont_like.png';
			} else if(otherBtnTitle == 'No'){
				mainBtn[i].image = 'images/main_buttons/cross_no.png';
			} else if(otherBtnTitle == 'Less'){
				mainBtn[i].image = 'images/main_buttons/minus_less.png';
			}
        }
    }  
}
function changeMainBtnState ( e ) { var whichBtn ; whichBtn = e . source . title ; if ( e . source . value == 1 ) { if ( whichBtn == 'Like' ) { e . source . image = 'images/main_buttons/state1/smiley_like.png' ; } else if ( whichBtn == 'Yes' ) { e . source . image = 'images/main_buttons/state1/tick_yes.png' ; } else if ( whichBtn == 'More' ) { e . source . image = 'images/main_buttons/state1/plus_more.png' ; } else if ( whichBtn == 'DontLike' ) { e . source . image = 'images/main_buttons/state1/smiley_dont_like.png' ; } else if ( whichBtn == 'No' ) { e . source . image = 'images/main_buttons/state1/cross_no.png' ; } else if ( whichBtn == 'Less' ) { e . source . image = 'images/main_buttons/state1/minus_less.png' ; } } else if ( e . source . value == 2 ) { if ( whichBtn == 'Like' ) { e . source . image = 'images/main_buttons/state2/smiley_like.png' ; } else if ( whichBtn == 'Yes' ) { e . source . image = 'images/main_buttons/state2/tick_yes.png' ; } else if ( whichBtn == 'More' ) { e . source . image = 'images/main_buttons/state2/plus_more.png' ; } else if ( whichBtn == 'DontLike' ) { e . source . image = 'images/main_buttons/state2/smiley_dont_like.png' ; } else if ( whichBtn == 'No' ) { e . source . image = 'images/main_buttons/state2/cross_no.png' ; } else if ( whichBtn == 'Less' ) { e . source . image = 'images/main_buttons/state2/minus_less.png' ; } } for ( var i = 0 ; i < mainBtn . length ; i ++ ) { if ( e . source !== mainBtn [ i ] ) { otherBtnTitle = mainBtn [ i ] . title ; if ( otherBtnTitle == 'Like' ) { mainBtn [ i ] . image = 'images/main_buttons/smiley_like.png' ; } else if ( otherBtnTitle == 'Yes' ) { mainBtn [ i ] . image = 'images/main_buttons/tick_yes.png' ; } else if ( otherBtnTitle == 'More' ) { mainBtn [ i ] . image = 'images/main_buttons/plus_more.png' ; } else if ( otherBtnTitle == 'DontLike' ) { mainBtn [ i ] . image = 'images/main_buttons/smiley_dont_like.png' ; } else if ( otherBtnTitle == 'No' ) { mainBtn [ i ] . image = 'images/main_buttons/cross_no.png' ; } else if ( otherBtnTitle == 'Less' ) { mainBtn [ i ] . image = 'images/main_buttons/minus_less.png' ; } } } }
Set background color for Main Buttons
Set background color for Main Buttons
//Title of the button //Changing Button images to indicate state change //User clicked on any of the main buttons //Change Mainbuttons state images //Changing inactive buttons back to normal button state //Other button titles //User clicked on any of the main buttons