//<!--

function bookmarkPage()
{
  if ((navigator.appVersion.indexOf("MSIE") > 0) && (parseInt(navigator.appVersion) >= 4))
  {
	  window.external.AddFavorite("http://www.myfuturewise.org.uk/","Futurewise");
	}
}

function formSubmit(event, button)
{
  if(event.keyCode == 13)
	{
	  document.getElementById(button).click();
		return false;
	}
}

function dynamicPopup(foto)
{ 
  alpha=window.open("","DynaWin"," toolbar=no,directories=no,menubar=no,resizable=no"); 
  x=alpha.document; 
  x.write("<head><SCRI"+"PT>") 
  x.write("function dymanicResize(){") 
  x.write("window.resizeTo(") 
  x.write("document.im1.width+11,") 
  x.write("document.im1.height+29);") 
  x.write("};document.title=document.im1.src;</SCRIP"+"T></head>") 
  x.write("<body topmargin=0 leftmargin=0 scroll=no>") 
  x.write("<img src='"+foto+"' name='im1' onLoad='dymanicResize()'>") 
  x.write("</body>") 
  x.close() 
  alpha.focus() 
 }
 
 function confirm_delete()
{
				if (confirm("Are you sure you want to delete this item?")==true)
					return true;
				else
					return false;
} 

function CheckOpenText(textarea, text)
{
    if (textarea.value == text)
    {
        textarea.select();
    }
}

function CheckOpenTextValues(id1,id2,id3,id4,text)
{
    var txtCount = 0
    var txt1 = document.getElementById(id1);
    var txt2 = document.getElementById(id2);
    var txt3 = document.getElementById(id3);
    var txt4 = document.getElementById(id4);
    txtCount = ((txt1.value == text)||(txt1.value == "")) ? txtCount : txtCount + 1;
    txtCount = ((txt2.value == text)||(txt2.value == "")) ? txtCount : txtCount + 1;
    txtCount = ((txt3.value == text)||(txt3.value == "")) ? txtCount : txtCount + 1;
    txtCount = ((txt4.value == text)||(txt4.value == "")) ? txtCount : txtCount + 1;
    if (txtCount > 0)
    {
        return true;
    }
    else
    {
        alert("Please enter at least one answer.");
        return false;
    }    
}

function ShowNextStep(id1,id2,id3,id4,text,btn)
{
//    var txtCount = 0
//    var txt1 = document.getElementById(id1);
//    var txt2 = document.getElementById(id2);
//    var txt3 = document.getElementById(id3);
//    var txt4 = document.getElementById(id4);
//    txtCount = ((txt1.value == text)||(txt1.value == "")) ? txtCount : txtCount + 1;
//    txtCount = ((txt2.value == text)||(txt2.value == "")) ? txtCount : txtCount + 1;
//    txtCount = ((txt3.value == text)||(txt3.value == "")) ? txtCount : txtCount + 1;
//    txtCount = ((txt4.value == text)||(txt4.value == "")) ? txtCount : txtCount + 1;
//    if (txtCount == 4) 
//    {
//        document.getElementById(btn).disabled = false;
//        document.getElementById(btn).className = "fmbutton";
//    }
//    else
//    {
//        document.getElementById(btn).disabled = true;
//        document.getElementById(btn).className = "fmbutton_disabled";
//    }
}


function CheckOpenTextValues2(id1,id2,id3,id4,id5,id6,id7,text)
{
    var txtCount = 0
    var txt1 = document.getElementById(id1);
    var txt2 = document.getElementById(id2);
    var txt3 = document.getElementById(id3);
    var txt4 = document.getElementById(id4);
    var txt5 = document.getElementById(id5);
    var txt6 = document.getElementById(id6);
    var txt7 = document.getElementById(id7);
    txtCount = ((txt1.value == text)||(txt1.value == "")) ? txtCount : txtCount + 1;
    txtCount = ((txt2.value == text)||(txt2.value == "")) ? txtCount : txtCount + 1;
    txtCount = ((txt3.value == text)||(txt3.value == "")) ? txtCount : txtCount + 1;
    txtCount = ((txt4.value == text)||(txt4.value == "")) ? txtCount : txtCount + 1;
    txtCount = ((txt5.value == text)||(txt5.value == "")) ? txtCount : txtCount + 1;
    txtCount = ((txt6.value == text)||(txt6.value == "")) ? txtCount : txtCount + 1;
    txtCount = ((txt7.value == text)||(txt7.value == "")) ? txtCount : txtCount + 1;    
    if (txtCount > 0)
    {
        return true;
    }
    else
    {
        alert("Please enter at least one answer.");
        return false;
    }    
}

function ShowNextStep2(id1,id2,id3,id4,id5,id6,id7,text,btn)
{
//    var txtCount = 0
//    var txt1 = document.getElementById(id1);
//    var txt2 = document.getElementById(id2);
//    var txt3 = document.getElementById(id3);
//    var txt4 = document.getElementById(id4);
//    var txt5 = document.getElementById(id5);
//    var txt6 = document.getElementById(id6);
//    var txt7 = document.getElementById(id7);
//    txtCount = ((txt1.value == text)||(txt1.value == "")) ? txtCount : txtCount + 1;
//    txtCount = ((txt2.value == text)||(txt2.value == "")) ? txtCount : txtCount + 1;
//    txtCount = ((txt3.value == text)||(txt3.value == "")) ? txtCount : txtCount + 1;
//    txtCount = ((txt4.value == text)||(txt4.value == "")) ? txtCount : txtCount + 1;
//    txtCount = ((txt5.value == text)||(txt5.value == "")) ? txtCount : txtCount + 1;
//    txtCount = ((txt6.value == text)||(txt6.value == "")) ? txtCount : txtCount + 1;
//    txtCount = ((txt7.value == text)||(txt7.value == "")) ? txtCount : txtCount + 1;    
//    if (txtCount == 7) 
//    {
//        document.getElementById(btn).disabled = false;
//        document.getElementById(btn).className = "fmbutton";
//    }    
//    else
//    {
//        document.getElementById(btn).disabled = true;
//        document.getElementById(btn).className = "fmbutton_disabled";
//    }
}


function CheckNumberOfSymbols(txt, maxlength)
{
	if (txt.value.length > maxlength)
		txt.value = txt.value.substring(0, maxlength)
	
}
//-->