﻿<!-- // Fathers.com JSON API
 /*
 * Copyright 2009 Fathers.com
 *
 * Requests the Cf object using a cross domain call.
 * This function is to be called via  page load or script tag to get the JSON response    
 */
  function getCF(optional) {    if(optional == null )
        optional = 1;
  
		//URL of the Championship Fathers.com JSON widget
		var request = "http://wdgt.fathers.com/dispid/"+optional+"/cb/showCF/";
		
		//Build the script node that performs the JSON request
		
		//Check for the existing script node
		var prevScript = document.getElementById("dynamic_CFscript_injection");

	  // Get the script tag, if it exists
		  var head = document.getElementsByTagName("head").item(0);
	   // Remove existing tag, reduces file size
	  if (prevScript) {           
			head.removeChild(prevScript);
	  }

		script = document.createElement("script");
		script.setAttribute("id", "dynamic_CFscript_injection");
		script.setAttribute("type", "text/javascript");
		script.setAttribute("src", request);
		head.appendChild(script);
  }
  /*
   * THis function is called when the JSON string is returned from getCF call
   */
  function showCF(Cf) {
   
   // Get target node to display Fathers.com widget
   var divElem = document.getElementById ("cfDisplay");
   
   //Parse JSON results via dot "." notation method
   var content = Cf.CF_Body.Content;

   //Output the results to the page
   divElem.innerHTML = content;       
  }


//-->
