//////////////////////////////////////////////////////////////////////
//								    //
//  This functions helps the user to select there own PageRank-bar  //
//  changePIC(theID, onORoff)					    //
//  getHTMLcode(type, bar)					    //
//  gerPageRankBars()						    //
//								    //
//////////////////////////////////////////////////////////////////////


// This function changes a picture 
function changePIC(theID, onORoff)
{
  document.getElementById(theID).src = "pic/previewbar/"+theID+onORoff+".gif";
}

// When a user select a button and clicks on it this function will generate and print the page
// where the user can get the HTML-code
var Buttons = '';
function getHTMLcode(type, bar)
{
  document.getElementById("HTMLcode_info").style.visibility = "hidden";
  document.getElementById("HTMLcode_info").style.position = "absolute";
  
  Buttons = document.getElementById("buttons").innerHTML;
  
  var HTMLcode = "<center>";  
  var HTMLcode = HTMLcode+"  <b>Preview</b><span class='smaller'><br /><br /></span>";
  var HTMLcode = HTMLcode+"  <a href='http://www.pagerank-info.com' target='_blank' title='Google PageRank. Click here to check you PageRank'><img src='http://www.pagerank-info.com/"+type+"bar.gif' onload=\"this.src='http://www.pagerank-info.com/bars/"+type+"/"+bar+"/?url='+location.hostname; this.onload='false'\" border='0' alt='Google PageRank. Click here to check you PageRank' /></a><span class='small'><br /><br /></span>";
  var HTMLcode = HTMLcode+"  <a href='javascript: gerPageRankBars();' class='text'>Go back and select<br />an other PageRankBar</a><br />";
  var HTMLcode = HTMLcode+"</center><br />";
  var HTMLcode = HTMLcode+"<b>Copy the HTMLcode on to your page</b><br />";
  var HTMLcode = HTMLcode+"<i>Use this to show your domain-PageRank</i><br />";
  var HTMLcode = HTMLcode+"<textarea class='HTMLcode'>&lt;a href=\"http://www.pagerank-info.com\" target=\"_blank\" title=\"Google PageRank. Click here to check you PageRank\"&gt;&lt;img src=\"http://www.pagerank-info.com/"+type+"bar.gif\" onload=\"this.src='http://www.pagerank-info.com/bars/"+type+"/"+bar+"/?url='+location.hostname; this.onload='false'\" border=\"0\" alt=\"Google PageRank. Click here to check you PageRank\" /&gt;&lt;/a&gt;</textarea><br /><br />";
  var HTMLcode = HTMLcode+"<i>Use this to show the PageRank for subpages</i><br />";
  var HTMLcode = HTMLcode+"<textarea class='HTMLcode'>&lt;a href=\"http://www.pagerank-info.com\" target=\"_blank\" title=\"Google PageRank. Click here to check you PageRank\"&gt;&lt;img src=\"http://www.pagerank-info.com/"+type+"bar.gif\" onload=\"this.src='http://www.pagerank-info.com/bars/"+type+"/"+bar+"/?url='+window.location; this.onload='false'\" border=\"0\" alt=\"Google PageRank. Click here to check you PageRank\" /&gt;&lt;/a&gt;</textarea>";
  document.getElementById("buttons").innerHTML = HTMLcode;
}



// If a user selects a button and want to choose an other.
// This function will get the user back on the page where he can select a new button
function gerPageRankBars()
{
  if(Buttons != "")
  {
    document.getElementById("HTMLcode_info").style.position = "static";
    document.getElementById("HTMLcode_info").style.visibility = "";
    
    document.getElementById("buttons").innerHTML = Buttons;
  }
}