// JavaScript Document

var SelectedStability = Stability;


function getNoPicPath(){return NoPicPath;}

function fixDeadImage(objectname, extension){
var OriginalImageString = new String(''+document.images[objectname].src+'');
changeimage(objectname,''+getNoPicPath()+extension+'');
setBigAndBiggerImages();

}//end fix dead image
	
function loadPageVariables(){
changeimage('StabilityPicture','../images/MoreInfo/Stability_'+SelectedStability+'_'+Hand+'.gif');
changeimage('MainPicture',getTopColorPicture(getColor(1),'Med2.gif'));

changeimage('Durability_Rating','../images/MoreInfo/Rating_'+Durability_Rating+'_Animation_Plain.gif');
changeimage('Grip_Rating','../images/MoreInfo/Rating_'+Grip_Rating+'_Animation_Plain.gif');
changeimage('Class_Rating','../images/MoreInfo/Rating_'+Class_Rating+'_Animation_Plain.gif');
changeimage('ChainLove_Rating','../images/MoreInfo/Rating_'+ChainLove_Rating+'_Animation_Plain.gif');
changeimage('Skip_Rating','../images/MoreInfo/Rating_'+Skip_Rating+'_Animation_Plain.gif');
changeimage('Mold_Rating','../images/MoreInfo/Rating_'+Mold_Rating+'_Animation_Plain.gif');
changeimage('Consistancy_Rating','../images/MoreInfo/Rating_'+Consistancy_Rating+'_Animation_Plain.gif');
changeimage('Roller_Rating','../images/MoreInfo/Rating_'+Roller_Rating+'_Animation_Plain.gif');
changeimage('Windy_Rating','../images/MoreInfo/Rating_'+Windy_Rating+'_Animation_Plain.gif');
changeimage('Hammer_Rating','../images/MoreInfo/Rating_'+Hammer_Rating+'_Animation_Plain.gif');

changeimage('FirstColor', getTopColorPicture(getColor(1),'Small.gif'));
changeimage('SecondColor', getTopColorPicture(getColor(2),'Small.gif'));
changeimage('ThirdColor', getTopColorPicture(getColor(3),'Small.gif'));
changeimage('FourthColor', getTopColorPicture(getColor(4),'Small.gif'));
changeimage('FifthColor', getTopColorPicture(getColor(5),'Small.gif'));
changeimage('SixthColor', getTopColorPicture(getColor(6),'Small.gif'));
changeimage('SeventhColor', getTopColorPicture(getColor(7),'Small.gif'));
changeimage('EighthColor', getTopColorPicture(getColor(8),'Small.gif'));
setBigAndBiggerImages();
}

function getChosenColor(){
return ChosenColor;
}
function setChosenColor(newcolor){
ChosenColor = newcolor;
changeimage('MainPicture','../images/'+Make+'/'+Type+'_'+Model+'_'+ChosenColor+'_Med2.gif');
setBigAndBiggerImages();
}

function getColor(whichone){
var tempColor = FirstColor;
if(whichone == '1'){
tempColor = FirstColor;
}else if(whichone == '2'){
tempColor = SecondColor;
}else if(whichone == '3'){
tempColor = ThirdColor;
}else if(whichone == '4'){
tempColor = FourthColor;
}else if(whichone == '5'){
tempColor = FifthColor;
}else if(whichone == '6'){
tempColor = SixthColor;
}else if(whichone == '7'){
tempColor = SeventhColor;
}else if(whichone == '8'){
tempColor = EighthColor;
}
return tempColor;
}
function getColorName(which){
var WhichColor = 'FirstColor';
if(which == 1){ WhichColor = 'FirstColor';}
else if(which == 2){ WhichColor = 'SecondColor';}
else if(which == 3){ WhichColor = 'ThirdColor';}
else if(which == 4){ WhichColor = 'FourthColor';}
else if(which == 5){ WhichColor = 'FifthColor';}
else if(which == 6){ WhichColor = 'SixthColor';}
else if(which == 7){ WhichColor = 'SeventhColor';}
else if(which == 8){ WhichColor = 'EighthColor';}
else{WhichColor = 'FirstColor';}
return WhichColor;
}

function getTopColorPicture(whichcolor,picextension){

var imagesource = ''+NoPicPath+picextension+'';

if(whichcolor == getColor(1)){
  imagesource = new String('../images/'+Make+'/'+Type+'_'+Model+'_'+whichcolor+'_'+picextension+'');
}else if(whichcolor == getColor(2)){
  imagesource = new String('../images/'+Make+'/'+Type+'_'+Model+'_'+whichcolor+'_'+picextension+'');
}else if(whichcolor == getColor(3)){
  imagesource = new String('../images/'+Make+'/'+Type+'_'+Model+'_'+whichcolor+'_'+picextension+'');
}else if(whichcolor == getColor(4)){
  imagesource = new String('../images/'+Make+'/'+Type+'_'+Model+'_'+whichcolor+'_'+picextension+'');
}else if(whichcolor == getColor(5)){
  imagesource = new String('../images/'+Make+'/'+Type+'_'+Model+'_'+whichcolor+'_'+picextension+'');
}else if(whichcolor == getColor(6)){
  imagesource = new String('../images/'+Make+'/'+Type+'_'+Model+'_'+whichcolor+'_'+picextension+'');
}else if(whichcolor == getColor(7)){
  imagesource = new String('../images/'+Make+'/'+Type+'_'+Model+'_'+whichcolor+'_'+picextension+'');
}else if(whichcolor == getColor(8)){
  imagesource = new String('../images/'+Make+'/'+Type+'_'+Model+'_'+whichcolor+'_'+picextension+'');
}

return imagesource;
}

function changeHand(){
 var HandTemp = Hand;
 Hand = OtherHand;
 OtherHand = HandTemp;
}

function changeToBrandNew(){
SelectedStability = Stability;
changeimage('StabilityPicture','../images/MoreInfo/Stability_'+SelectedStability+'_'+Hand+'.gif');
changeimage('BrandNewButton','../images/MoreInfo/BrandNewButton_Over.gif');
changeimage('ExperiencedButton','../images/MoreInfo/ExperiencedButton.gif');
}

function changeToExperienced(){
SelectedStability = ExperiencedStability;
changeimage('StabilityPicture','../images/MoreInfo/Stability_'+SelectedStability+'_'+Hand+'.gif');
changeimage('BrandNewButton','../images/MoreInfo/BrandNewButton.gif');
changeimage('ExperiencedButton','../images/MoreInfo/ExperiencedButton_Over.gif');
}

var BigImage = '#';
var BiggerImage = '#';

function setBigAndBiggerImages(){

var TempImageString = new String(''+document.images['MainPicture'].src+'');
var NewBigImage = new String( TempImageString.replace('Med2','Med') );
var NewBiggerImage = new String( TempImageString.replace('Med2','Big') );

BigImage = ''+NewBigImage+'';
BiggerImage = ''+NewBiggerImage+'';
}

function getChosenBigImage(){
return BigImage;
}

function getChosenBiggerImage(){
return BiggerImage;
}