//Set Checked property 
function yes_on(radio1,radio2)
{radio1.checked = true;
 radio2.checked = false; 
}

//Turn off Check Property
function yes_off(radio1,radio2)
{radio1.checked = false;
 radio2.checked = true;
}
 
//Calculate score for the self test
function calculateScore(){
 var total = 0;
 if (Answer1[0].checked) total = total + 1;
 if (Answer2[0].checked) total = total + 1;
 if (Answer3[0].checked) total = total + 1;
 if (Answer4[0].checked) total = total + 1;
 if (Answer5[0].checked) total = total + 1;
 if (Answer6[0].checked) total = total + 1;
 if (Answer7[0].checked) total = total + 1;
 if (Answer8[0].checked) total = total + 1;
 if (Answer9[0].checked) total = total + 1;
 if (Answer10[0].checked) total = total + 1;
 if (Answer11[0].checked) total = total + 1;
 if (Answer12[0].checked) total = total + 1;
 if (Answer13[0].checked) total = total + 1;
 if (Answer14[0].checked) total = total + 1;
 if (Answer15[0].checked) total = total + 1;
 if (Answer16[0].checked) total = total + 1;
 if (Answer17[0].checked) total = total + 1;
 if (Answer18[0].checked) total = total + 1;
 if (Answer19[0].checked) total = total + 1;
 if (Answer20[0].checked) total = total + 1;
 if (Answer21[0].checked) total = total + 1;
 if (Answer22[0].checked) total = total + 1;
 if (Answer23[0].checked) total = total + 1;
 if (Answer24[0].checked) total = total + 1;
 if (Answer25[0].checked) total = total + 1;
 if (Answer26[0].checked) total = total + 1;
 if (Answer27[0].checked) total = total + 1;
 if (Answer28[0].checked) total = total + 1;
 if (Answer29[0].checked) total = total + 1;
 if (Answer30[0].checked) total = total + 1;
    
  document.selfTest.score.value = total;
  
}

//Writes the score in the table
function writeScore(score) {
 testField = document.getElementById("scoreField");
 testField.innerHTML = "<font face='Verdana' size='2' color='#800080'><b>" + score+ "</b></font>";
}

function getScore() {
 var url;
 var startPos;
 var stopPos;
 var lngth;
 var finalResult="Not Ready";
 
 url = location.search.substring(1);
 startPos = url.indexOf("=");
 stopPos = url.indexOf("&");
 lngth = stopPos - startPos;
 
 finalResult = url.substr(startPos+1,lngth-1)
 
 return finalResult;
}

//Add the page to favourites
function addToFavorites() 
{var urlAddress = "http://www.pornaddiction.ca"; 
 var pageName = "The Solution to Porn Addiction"; 

 if (window.external) 
  { window.external.AddFavorite(urlAddress,pageName)}
   else { alert("Sorry! Your browser doesn't support this function."); 
  } 
}

//Copy text to clipboard on the site link page
function ClipBoard()
{
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("Copy");
}
