// global values
count = 1;
countF = 1;
countM = 1;
countBoth = 1;
currGender = 1;
b=3; // 1=females 2=males 3=both

// default values
brand = 'r';
product ='a';
community = 'd';
context = 'adrr';
imagesBase= "http://www.lavalife.com/pictures/cool/";
photo_directory = imagesBase  + product + community + '/';
suffix = 'ss.jpeg'; 
id='viewProfile';
a='0';
showInterrupt = true;

function init(){
  // set the maxium no of picture
  maxPicF = slideShowPics[1].length - 1;
  maxPicM = slideShowPics[2].length - 1;
  maxPicBoth = maxPicF ;
  if (maxPicM < maxPicF) maxPicBoth = maxPicM ;
  if (brand != null && community != null){
   context = 'a' + community + brand + brand;
  }
  countF = 1 + Math.floor(Math.random() * maxPicF);
  countM = 1 + Math.floor(Math.random() * maxPicM);
  if (b == 1) {
	count = countF;
  } else {
	count = countM;
  }	
}

function setInterruptPage(n) {
    styleChange(ss_picture).innerHTML = interruptPage;
    styleChange(ss_name).innerHTML = '<img src="/images/xxxx-pixel.gif" width="1" border=0>';
}

function go(dir, gender) {
  ss_picture = 'ss_picture_both';
  ss_name    = 'ss_name_both';
  if ( showInterrupt && (intrpCount == 0 || intrpCountM == 0 || intrpCountF == 0 )) {
     if (dir != 0) {
        if (gender == 1) {
           intrpCountF = intervalInterruptPage ;
        } else if (gender == 2) {
           intrpCountM = intervalInterruptPage ;
        } else{
           intrpCount = intervalInterruptPage ;
        }
        setInterruptPage(1);
     }
  } else {
     if (dir != 0 && showInterrupt) {
        if (gender == 1) {
           intrpCountF--; 
        } else if (gender == 2) {
           intrpCountM-- 
        } else {
           intrpCount--
        }
     }
     if (gender == 1) {
       count  = countF + dir;
       if (count > maxPicF) count = 1;
       if (count < 1) count = maxPicF;
       countF = count;
       currGender =1;
     } else if (gender==2){
       count  = countM + dir;
       if (count > maxPicM) count = 1;
       if (count < 1) count = maxPicM;
       countM = count;
       currGender = 2;
     } else {
        if ((currGender == 2 && dir == 1) || (currGender == 1 && dir == -1))
        count  = countBoth + dir;
        if (count > maxPicBoth && currGender == 2)
                     count = 1;
        if (count < 1 && currGender == 1)
                     count = maxPicBoth;
        countBoth = count;
        if (currGender ==1)
         currGender = 2 ;
        else
         currGender = 1 ;
        }
     styleChange(ss_picture).innerHTML = '<a href="javascript:{}" onClick="goToMember();return false;"><img src="' + photo_directory + slideShowPics[currGender][count] + suffix +  '" border="0" class="vertAlign"></a>';
     styleChange(ss_name).innerHTML = '<a href="javascript:{}" onClick="goToMember();return false;">'+ slideShowIds[currGender][count] + '</a>';
  }

}

function styleChange(id) {
   return element(id);
}


