
var login = 0;
if (parent.refreshed == false)
{
	parent.refreshed = true;
	location.reload(true);
}

var uri = 'http://www.jottercms.com/';
var showid = 4168;
var draftid = false;
var canedit = false;
var alternate = true;

function save()
{
	tinyMCE.triggerSave();
	document.forms[0].submit();
}

window.onunload = function() { if(top.nopage) top.nopage(); };

speed=1000;
len=40;
tid = 0;
num=0;
clockA = new Array();
timeA = new Array();
formatA = new Array();
dd = new Date();
var d,x;

function doDate(x)
{
  for (i=0;i<num;i++) {
	dt = new Date();

	if (timeA[i] != 0) {
	  v1 = Math.round(( timeA[i] - dt )/1000) ;
	  if (v1 < 0)
		clockA[i].date.value = "**BANG!**";
	  if (formatA[i] == 1)
		clockA[i].date.value = v1;
	  else if (formatA[i] ==2) {
		sec = v1%60;
	v1 = Math.floor( v1/60);
	min = v1 %60 ;
	hour = Math.floor(v1 / 60);
	if (sec < 10 ) sec = "0"+sec;
	if (min < 10 ) min = "0"+min;
		clockA[i].date.value = hour+"h "+min+"m "+sec+"s";
		}
	  else if (formatA[i] ==3) {
		sec = v1%60;
	v1 = Math.floor( v1/60);
	min = v1 %60 ;
	v1 = Math.floor(v1 / 60);
	hour = v1 %24 ;
	day = Math.floor(v1 / 24);
	if (sec < 10 ) sec = "0"+sec;
	if (min < 10 ) min = "0"+min;
	if (hour < 10 ) hour = "0"+hour;
		clockA[i].date.value = day+"d "+hour+"h "+min+"m "+sec+"s";
		}
	  else if (formatA[i] ==4 ) {
		sec = v1%60;
	v1 = Math.floor( v1/60);
	min = v1 %60 ;
	v1 = Math.floor(v1 / 60);
	hour = v1 %24 ;
	day = Math.floor(v1 / 24);
		clockA[i].date.value = day+(day==1?"day ":" days ")+hour+(hour==1?"hour ":" hours ")+min+(min==1?"min ":" mins ")+sec+(sec==1?"sec ":" secs ")
		}
	  else
		clockA[i].date.value = "Invalid Format spec";
	  }
	else
	  clockA[i].date.value = "Countdown till when?";
	}

  tid=window.setTimeout("doDate()",speed);
}

function start(d,x,format) {
  clockA[num] = x
  timeA[num] = new Date(d);
  formatA[num] = format;
  if (num == 0)
	tid=window.setTimeout("doDate()",speed);
  num++;
}

function CountdownLong(t,format,len)
{
  document.write('<FORM name=form'+num+'><input name=date size=')
  document.write(len)
  document.write(' value="Countdown: Requires Javascript" style="text-align: center" readonly></FORM>')
  start(t,document.forms["form"+num],format);
}
function hangman(words,index,divid,all_letters,description)
{
	var splits = words.split(",");
	var word = splits[index];
	
	var descriptionsplits = description.split(",");
	var descp = descriptionsplits[index];
	
			
	var done = 1;
	var matched = 0;
	var max = 6;
	var wrong = 0;
	var alpha = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
	alpha = alpha.split(",");
	var len_alpha = alpha.length;
	var html = "";
	var html3 = "";
	var html4 = "Hint: "+descp;
	for (var x=0; x < word.length; x++)
	{
		var letters = all_letters.split(word.substr(x,1));
		if(letters.join('').length==all_letters.length)//not matched
		{
			if (word.substr(x,1)==" ")
				html3+="&nbsp;<font size=1>&nbsp;</font>";
			else
				html3+="_<font size=1>&nbsp;</font>";
				
			done=0;
			
		}
		else//matched
		{
			if (word.substr(x,1)==" ")
				html3+="&nbsp;&nbsp;";
			else
				html3+=word.substr(x,1);
			
			matched++;
		}
		
		if(matched==word.replace(" ","").length)
			done=1;
		
	}
	
	if (done==0)
	{
		var html2= "<BR/><H4>";
		for (var c=0; c<len_alpha; c++)
		{
			var letters = all_letters.split(alpha[c]);
			if(letters.join('').length==all_letters.length)//not matched
			{
					html2+= "<A HREF=\"#hangman1\" onClick=\"hangman('"+words+"',"+index+",'"+divid+"','"+(alpha[c]+all_letters)+"','"+description+"');\">"+alpha[c]+"</A>&nbsp;";
					//href='javascript:self.scroll(0,0);			   
			}
			else//matched
			{
				var letters2 = word.split(alpha[c]);
				if(letters2.join('').length==word.length)//not matched
				{
					html2+= "<FONT color='red'>"+alpha[c]+"</font>&nbsp;";					
					wrong++;
				}
				else
				{
					html2+= "<B>"+alpha[c]+"</B>&nbsp;";				  
				}
			}
		}
		html2+="</H4>";
		var nwrong=wrong; if (nwrong>6) nwrong=6;
		if (wrong >=max)
		{
		  index = index+1;
		  if (index>(splits.length-1)) index=0;
		  html+= "<p><BR><IMG SRC='" + uri + "images/hangman_"+nwrong+".gif' ALIGN='MIDDLE' BORDER='0' WIDTH='100' HEIGHT='100'/></P>";
		  
		  html+="<p><H1>"+html3+"</H1><BR><FONT color=\"red\"><BIG>SORRY, YOU ARE HANGED!!!</BIG></FONT><BR><BR>";
		  html+="The phrase was \"<B>"+word+"</B>\"</div>";
		  html2="<P><A href='#hangman1' onClick=\"hangman('"+words+"',"+index+",'"+divid+"','','"+description+"');\">Play again</A></P>";
		  document.getElementById(divid).innerHTML=html2+html;
		}
		else
		{
			html+= "<p><BR><IMG SRC='" + uri + "images/hangman_"+nwrong+".gif' ALIGN='MIDDLE' BORDER='0' WIDTH='100' HEIGHT='100'/>&nbsp; # Wrong Guesses Left: <B>"+(max-wrong)+"</B>";
			document.getElementById(divid).innerHTML="<div id='hangman'>Choose a letter:"+html2+html+"<BR/><BR/>"+html4+"<BR/><H1>"+html3+"</H1><BR/></div>";
		}
	}
	
	
	else
	{
		
		index = index+1;
		if (index>(splits.length-1)) index=0;
		html+="<H1><font size=5>Congratulations!!! You win!!!</font></H1>";	  
		html+="<A HREF=\"#hangman1\" onClick=\"hangman('"+words+"',"+index+",'"+divid+"','','"+description+"');\">Play again</A></div>";
		document.getElementById(divid).innerHTML=html;
	}
	//parent.window.scroll(0,800);
}	 
function Countdown2001seconds()
{
  CountdownLong("January 01, 2001 00:00:00",1,8);
}

function Countdown2001()
{
  CountdownLong("January 01, 2001 00:00:00",4,30);
}

function Countdown(t)
{
  CountdownLong(t,4,30);
}
