<!--
function getCookie (name)
{
  var dcookie = document.cookie;
  var cname = name + "=";
  var clen = dcookie.length;
  var cbegin = 0;
  while (cbegin < clen)
  {
    var vbegin = cbegin + cname.length;
    if (dcookie.substring(cbegin, vbegin) == cname)
    {
      var vend = dcookie.indexOf (";", vbegin);
      if (vend == -1) vend = clen;
      return unescape(dcookie.substring(vbegin, vend));
    }
    cbegin = dcookie.indexOf(" ", cbegin) + 1;
    if (cbegin == 0) break;
  }
  return null;
}

function setCookie (name, value, expires)
{
  if (!expires) expires = new Date();
  document.cookie = name + "=" + escape (value) + "; expires=" + expires.toGMTString() +  "; path=/";
}

function delCookie (name)
{
  var expireNow = new Date();
  document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=/";
}

var Alphabet = new initAlphaArray()
var NumOfWords = 34;
var SaveData = "";
var ImageNum = "";
var LettersSelected = "";
var RandomWord = "";
var DisplayWord = "";
var position = 0;
var word = new WordList();
var expdate = new Date();
var RandomNumber = (expdate.getSeconds())%NumOfWords;

function initAlphaArray()
{
  this.length = 26
  this[0] = "A"
  this[1] = "B"
  this[2] = "C"
  this[3] = "D"
  this[4] = "E"
  this[5] = "F"
  this[6] = "G"
  this[7] = "H"
  this[8] = "I"
  this[9] = "J"
  this[10] = "K"
  this[11] = "L"
  this[12] = "M"
  this[13] = "N"
  this[14] = "O"
  this[15] = "P"
  this[16] = "Q"
  this[17] = "R"
  this[18] = "S"
  this[19] = "T"
  this[20] = "U"
  this[21] = "V"
  this[22] = "W"
  this[23] = "X"
  this[24] = "Y"
  this[25] = "Z"
}

function WordList() 
{
    this.length = NumOfWords;
this[0] = "CHARLES JENCKS";
this[1] = "MICHEL FOUCAULT";
this[2] = "PRUITT IGOR";
this[3] = "SIGN-VALUE";
this[4] = "CHAOS THEORY";
this[5] = "FREDRIC JAMESON";
this[6] = "SIGN-VALUE ";
this[7] = "MIKE FEATHERSTONE";
this[8] = "CHARLES LEMERT";
this[9] = "PANOPTICON";
this[10] = "BAROQUE";
this[11] = "DECONSTRUCTION";
this[12] = "POST-STRUCTURALISM";
this[13] = "LANGUAGE-GAMES";
this[14] = "BIO-POLITICS";
this[15] = "DISCOURSE";
this[16] = "ZYGMUNT BAUMAN";
this[17] = "SCOTT LASH";
this[18] = "JEAN BAUDRILLARD";
this[19] = "HYPER-REALITY";
this[20] = "CONTINGENCY";
this[21] = "I SHOP THEREFORE I AM";
this[22] = "SIMULATION";
this[23] = "AMBIVALENCE";
this[24] = "SURVEILLANCE";
this[25] = "BONAVENTURA HOTEL";
this[26] = "META-NARRATIVES";
this[27] = "THE DEATH OF AUTHOR";
this[28] = "POST-FORDISM";
this[29] = "NEO-TRIBES";
this[30] = "NARRATIVES";
this[31] = "DISCOURSE";
this[32] = "FREDERICO DE ONIS";
this[33] = "C WRIGHT MILLS";
    
    
    }

function availableLetters(i)
{
  if (LettersSelected.charAt(i)==Alphabet[i])
    document.write('<TD ALIGN=CENTER VALIGN=CENTER WIDTH=20 HEIGHT=12>' + '<B><A HREF="javascript:LoadNextPage('+i+',\''+Alphabet[i]+'\')">'+Alphabet[i]+'</A></B></TD>');
  else
    document.write('<TD ALIGN=CENTER VALIGN=CENTER WIDTH=20 HEIGHT=12> </TD>');
}

function LoadNextPage(selected,letter)
{
  if (RandomWord.indexOf(letter) == -1)
  {
    if (ImageNum == "A") ImageNum = "B";
		else if (ImageNum =="B") ImageNum = "C";
		else if (ImageNum =="C") ImageNum = "D";
		else if (ImageNum =="D") ImageNum = "E";
		else if (ImageNum =="E") ImageNum = "F";
		else if (ImageNum =="F") ImageNum = "G";
		else if (ImageNum =="G") ImageNum = "H";
		else if (ImageNum =="H") ImageNum = "I";
		else if (ImageNum =="I") ImageNum = "J";
		else ImageNum = "A";
  }

  var j=0;
  var HoldLettersSelected = LettersSelected;
  LettersSelected = "";
  if (selected == 0)
  {
    for (j=1; j<=25; j++)
    {
      LettersSelected += HoldLettersSelected.charAt(j);
    }
    LettersSelected = "^" + LettersSelected;
  }
  else if (selected == 25)
  {
    for (j=0; j<=24; j++)
    {
      LettersSelected += HoldLettersSelected.charAt(j);
    }
    LettersSelected += "^";
  }
  else
  {
    for (j=0; j<selected; j++)
    {
      LettersSelected += HoldLettersSelected.charAt(j);
    }
    LettersSelected += "^";
    for (j=selected+1; j<=25; j++)
    {
      LettersSelected += HoldLettersSelected.charAt(j);
    }
  }
  SaveData = ImageNum + LettersSelected + RandomWord + "*";
  setCookie("_HangMan", SaveData, expdate);
  history.go(0);
}

expdate.setTime (expdate.getTime() + (1000*60*60*24*10));

if(getCookie("_HangMan") == null)
{
  ImageNum = "A";
  LettersSelected = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  RandomWord = word[RandomNumber];
  SaveData = ImageNum + LettersSelected + RandomWord + "*";
  setCookie("_HangMan", SaveData, expdate);
}

else
{
  SaveData = getCookie("_HangMan");
  ImageNum = SaveData.charAt(0);
  for (position=1; position<=26; position++)
  {
    LettersSelected += SaveData.charAt(position);
  }
  for (position=27; position<SaveData.indexOf("*"); position++)
  {
    RandomWord += SaveData.charAt(position);
  }
}

DisplayWord = "";
for (i=0; i<RandomWord.length; i++)
{
  if (RandomWord.charAt(i) == ' ')
  {
    DisplayWord += " ";
  }
  else
  {
    MatchFound = false;
    for (j=0; j<=25; j++)
    {
      if ((LettersSelected.charAt(j) == "^") && (RandomWord.charAt(i) == Alphabet[j]))
      {
        DisplayWord += RandomWord.charAt(i);
	MatchFound = true;
      }
    }
    if (!MatchFound) DisplayWord += "-";
  }
}

document.write('<TITLE>SociologyOnline Hangman: Post-modernism</TITLE>');
document.write('<BODY BGCOLOR="#FFFFFF"');
document.write('<CENTER><TABLE BORDER=0 BGCOLOR="#FF6666"'+' WIDTH=60% CELLSPACING=0>');
document.write('<TR><TD>');
document.write('<CENTER><FONT SIZE=6>SociologyOnline Hangman</FONT>');
document.write('<BR><B>');
document.write('<FONT COLOR=2c448b SIZE=4>Post-modernism</FONT><BR>');
document.write('<FONT COLOR=2c448b SIZE=2>Click on the letters of your choice</FONT><BR>');
document.write('<FONT COLOR=FFFFFF SIZE=2>Remember,  you are only allowed 10 errors, before the rope tightens!</FONT>');
document.write('</B></CENTER>');
document.write('</TD></TR>');
document.write('</TABLE></CENTER><BR>');
document.write('<IMG HEIGHT=280 WIDTH=306 ALIGN=RIGHT ALT="Hangman"'+'SRC="hangman'+ImageNum+'.gif" >');
document.write('<CENTER>');

if (ImageNum == "J")
{
  document.write('<FONT COLOR=RED SIZE=4>You lose!<BR>Answer =:  "' + RandomWord + '"</FONT>');
}
else if (RandomWord == DisplayWord)
{
  document.write('<FONT COLOR=RED SIZE=8>You Win!</FONT>');
}
else
{
  document.write('<BR><FONT SIZE=3><br></FONT>');
  document.write('<TABLE>');
  document.write('<TR>');

  for (i=0; i<13; i++) availableLetters(i);
  document.write('</TR>');
  document.write('<TR>');
  for (i=13; i<26; i++) availableLetters(i);
  document.write('</TR>');
  document.write('</TABLE>');
}

document.write('<BR>');
document.write('<BR>');
document.write('<FONT SIZE=9><TT>');
document.write(DisplayWord);
document.write('</TT></FONT>');
document.write('<FORM>');
document.write('<INPUT TYPE="button" VALUE="New Game"'+ 'ONCLICK="delCookie(\'_HangMan\');history.go(0);">');
document.write('</FORM>');
document.write('</CENTER>');
// -->

