var sq_answers = new Array();
var sq_cur, sq_i;

 for (sq_i = 0; sq_i < 10; sq_i++)
  sq_answers[sq_i] = "3";
 sq_cur = 0;

function sq_whichgreatest(n1, n2, n3, n4, n5)
{
 if ((n1 >= n2) && (n1 >= n3) && (n1 >= n4) && (n1 >= n5))
  return(1);
 if ((n2 >= n1) && (n2 >= n3) && (n2 >= n4) && (n2 >= n5))
  return(2);
 if ((n3 >= n1) && (n3 >= n2) && (n3 >= n4) && (n3 >= n5))
  return(3);
 if ((n4 >= n1) && (n4 >= n2) && (n4 >= n3) && (n4 >= n5))
  return(4);
 return(5); 
}

function sq_countanswers(x)
{
var r = 0;
 for (sq_i = 0; sq_i < 10; sq_i++)
 {
  if (sq_answers[sq_i] == x)
   r++;
 }
 return(r);
}

function sq_onsubmit()
{
var gotanswer = '';
var sqc = document.getElementById("sqc");
var h = '';
var n1, n2, n3, n4, n5;

var ts = '</strong></p><table width="100%" border="0" cellspacing="5" cellpadding="0">';

var r1 = '<tr><td width="35%" align="right" valign="top"><input type="radio" name="sqa" value="1" /></td><td width="65%">';
var r2 = '<tr><td width="35%" align="right" valign="top"><input type="radio" name="sqa" value="2" /></td><td width="65%">';
var r3 = '<tr><td width="35%" align="right" valign="top"><input type="radio" name="sqa" value="3" /></td><td width="65%">';
var r4 = '<tr><td width="35%" align="right" valign="top"><input type="radio" name="sqa" value="4" /></td><td width="65%">';
var r5 = '<tr><td width="35%" align="right" valign="top"><input type="radio" name="sqa" value="5" /></td><td width="65%">';

 if ((sq_cur < 0) || (sq_cur > 9))
 {
  alert('Invalid Question')
  window.location.href = 'index.html';
  return(false);
 }

 for (sq_i = 0; sq_i < 3; sq_i++)
 {
  if (document.sqf.sqa[sq_i].checked == true)
  {
   gotanswer = document.sqf.sqa[sq_i].value;
   sq_answers[sq_cur] = gotanswer;
   break;
  }
 }

 if (gotanswer == '')
 {
  alert('Please Pick an Answer!');
  return(false);
 }

 sq_i = sq_cur + 2;
 if (sq_i <= 10)
  h = '<h2>Question ' + sq_i + ' of 10</h2><p style="margin-bottom:5px;"><strong>';

 switch(sq_cur++)
 {
  case 0:  /* Q2 */
   h += 'What&rsquo;s your favourite sporting activity?' + ts;
   h += r4 + 'Anything and everything </td></tr>';
   h += r5 + 'Something extreme like rock climbing</td></tr>';
   h += r2 + 'Does channel surfing count?</td></tr>';
   h += '<tr><td colspan="2" align="center"><input type="submit" value="Next Question" /></td></tr></table>';
   break;

  case 1:  /* Q3 */
   h += 'What do you like doing in the evening?' + ts;
   h += r4 + 'A kickaround with your mates </td></tr>';
   h += r3 + 'Guitar lessons</td></tr>';
   h += r1 + 'Watching Gok&quot;s Fashion Fix </td></tr>';
   h += '<tr><td colspan="2" align="center"><input type="submit" value="Next Question" /></td></tr></table>';
   break;

  case 2:  /* Q4 */
   h += 'What&rsquo;s your favourite type of holiday?' + ts;
   h += r4 + 'Action-packed </td></tr>';
   h += r5 + 'Off the beaten track </td></tr>';
   h += r1 + 'Trawling foreign markets</td></tr>';
   h += '<tr><td colspan="2" align="center"><input type="submit" value="Next Question" /></td></tr></table>';
   break;

  case 3:  /* Q5 */
   h += 'Who would you most like to meet? ' + ts;
   h += r4 + 'Lewis Hamilton</td></tr>';
   h += r2 + 'Daniel Radcliffe</td></tr>';
   h += r3 + 'Kanye West</td></tr>';
   h += '<tr><td colspan="2" align="center"><input type="submit" value="Next Question" /></td></tr></table>';
   break;

  case 4:  /* Q6 */
   h += 'What&rsquo;s your dream destination?' + ts;
   h += r1 + 'Milan</td></tr>';
   h += r5 + 'Brazil</td></tr>';
   h += r2 + 'LA</td></tr>';
   h += '<tr><td colspan="2" align="center"><input type="submit" value="Next Question" /></td></tr></table>';
   break;

  case 5:  /* Q7 */
   h += 'Which is your favourite TV show?' + ts;
   h += r3 + 'X Factor</td></tr>';
   h += r5 + 'Shipwrecked</td></tr>';
   h += r4 + 'Grand Prix</td></tr>';
   h += '<tr><td colspan="2" align="center"><input type="submit" value="Next Question" /></td></tr></table>';
   break;
  
  case 6:  /* Q8 */
   h += 'Which is your favourite subject?' + ts;
   h += r1 + 'Art</td></tr>';
   h += r5 + 'Geography</td></tr>';
   h += r4 + 'PE</td></tr>';
   h += '<tr><td colspan="2" align="center"><input type="submit" value="Next Question" /></td></tr></table>';
   break;

  case 7:  /* Q9 */
   h += 'What would be your ideal Christmas pressie?' + ts;
   h += r2 + 'The top ten DVDs </td></tr>';
   h += r3 + 'The top ten CDs </td></tr>';
   h += r1 + 'Topshop / Topman vouchers </td></tr>';
   h += '<tr><td colspan="2" align="center"><input type="submit" value="Next Question" /></td></tr></table>';
   break;

  case 8:  /* Q10 */
   h += 'Which of these tickets would you most like to receive?' + ts;
   h += r5 + 'A trip to Paris on Eurostar </td></tr>';
   h += r3 + 'Backstage tickets for your fave band at the 02 </td></tr>';
   h += r2 + 'VIP tickets to a celeb-filled film premier </td></tr>';
   h += '<tr><td colspan="2" align="center"><input type="submit" value="Finish Quiz" /></td></tr></table>';
   break;

  default:  /* Results */

   n1 = sq_countanswers('1');
   n2 = sq_countanswers('2');
   n3 = sq_countanswers('3');
   n4 = sq_countanswers('4');
   n5 = sq_countanswers('5');

   gotanswer = sq_whichgreatest(n1, n2, n3, n4, n5);
   
   document.sqi.src = 'images/job/q' + gotanswer + '.jpg';

   if (gotanswer == 1)
   {
    h = '<h2>It looks like you&rsquo;re heading for a glamorous career in the world of fashion. </h2>';
    h += '<p>With your interest and knowledge, it&rsquo;ll come as no surprise that you&rsquo;d be suited to the glamorous world of fashion. In such a competitive, jetset industry, understanding a language (other than fashion-speak) is invaluable if you want to take full advantage of all the amazing opportunities available. So whether you fancy strutting the catwalks of Paris, working in a top Italian fashion house or travelling the world discovering up and coming new designers, speaking another language is a real perk.';
   }
   else if (gotanswer == 2)
   {
    h = '<h2>It&rsquo;s lights, camera, action in the film industry for you.</h2>';
    h += '<p>It looks like Hollywood is calling! It might be hard work but what could be more satisfying than seeing your name in the credits on the big screen? Whether you&rsquo;ve a talent for acting, fancy sitting in the director&rsquo;s chair or want the power to say &rsquo;Next!&rsquo; at a casting, a talent for languages is as useful as an actor&rsquo;s talent for accents. No wonder so many of the big names (Charlize Theron, Orlando Bloom, Eva Mendes) have another language under their belts.';
   }
   else if (gotanswer == 3)
   {
    h = '<h2>A job in the music industry will hit just the right note.</h2>';
    h += '<p>You obviously have a passion for the fast-paced world of music, so a career in the industry is a no brainer. Whether your ear is more tuned in to classical or hip hop, a language can be a distinct advantage. For example, Shakira speaks English, Spanish, Portuguese, Italian and Arabic and has topped the charts in several languages. Or maybe you fancy promoting a top star&rsquo;s world tour, following in Simon Cowell&rsquo;s music mogul footsteps or organising artist&rsquo;s stadium appearances? Speaking another language would be a great asset in this industry.';
   }
   else if (gotanswer == 4)
   {
    h = '<h2>A career in sport will set your pulse racing.</h2>';
    h += '<p>Your love for sport is apparent to all, and the good news is you don&rsquo;t have to possess Beckham&rsquo;s left foot to have a career in the industry. If you are incredibly talented, then many sports will see you travel around the world, and speaking a language will obviously help you communicate with your competitors (and fans!). If you&rsquo;re better on the bench, you could become a physio for your favourite team/star, organise international PR for F1 or the Athletics World Championships or earn mega bucks being a football agent. Speaking a language will give you a valuable leg up in this competitive market.';
   }
   else 
   {
    h = '<h2>Get ready to jet off into the world of travel.</h2>';
    h += '<p>With your natural curiosity about the world, it looks like you&rsquo;re heading for a career in travel. Whether you fancy following Sir David Attenborough&rsquo;s footsteps and making naturalist documentaries or discovering unchartered territory like spaceman Neil Armstrong or explorer Sir Ranulph Fiennes, travel is an amazing sector to work in. You could organise surf trips around Brazil, foodie trips around Italy or work for a charity in Africa. A language can really help you get under the skin of a country and its people and can help you see the world through a very different light.';
   }
    h += '<p align="center" ><a href="/entertainment/t4/advertorial/try-life-in-another-language/quiz.html" title="Take Quiz Again">Take Quiz Again &raquo;</a></p>';
	
   break;
 }
 sqc.innerHTML = h;
 return(false);
}