var accordionItems = new Array();

//Rolling tag line on index (BS)
var dislinks=new Array()
dislinks[0]=",<span class = blue>Pay as little as $80 (AUD) to start improving your professional practice and build your professional community."
dislinks[1]=",<span class = blue>Use DiscoverQuick.com to run your own clinical trials and manage your patients across the care continuum."
dislinks[2]=",<span class = blue>Support your clients in self-managed education.  Do all your professional training and credentialling."
dislinks[3]=",<span class = blue>Conduct all your research and create your own communities beyond the walls of your institution."
dislinks[4]=",<span class = blue>Continuously work towards the best outcomes in your organisation."
dislinks[5]=",<span class = blue>Assess and implement organisational well-being programs."
dislinks[6]=",<span class = blue>DiscoverQuick.com your one stop shop for all your on-demand web applications."
var count=0
//


    function init()
    {
	setTimeout("javaStart()",2000)
	//javaStart();
    }

    function javaStart()
	{

	//Rolling text tag line on index (BS)
	displaylink();
	//Start DQ of the month
	CoolLinks_click(3);

      // Grab the accordion items from the page
      var divs = document.getElementsByTagName( 'div' );
      for ( var i = 0; i < divs.length; i++ ) {
        if ( divs[i].className == 'accordionItem' ) accordionItems.push( divs[i] );
      }

      // Assign onclick events to the accordion item headings
      for ( var i = 0; i < accordionItems.length; i++ ) {
        var h2 = getFirstChildWithTagName( accordionItems[i], 'H2' );
        h2.onclick = toggleItem;
      }

      // Hide all accordion item bodies except the first
      for ( var i = 1; i < accordionItems.length; i++ ) {
        accordionItems[i].className = 'accordionItem hide';
      }
    }

    function toggleItem() {
      var itemClass = this.parentNode.className;

      // Hide all items
      for ( var i = 0; i < accordionItems.length; i++ ) {
        accordionItems[i].className = 'accordionItem hide';
      }

      // Show this item if it was previously hidden
      if ( itemClass == 'accordionItem hide' ) {
        this.parentNode.className = 'accordionItem';
      }
    }

    function getFirstChildWithTagName( element, tagName ) {
      for ( var i = 0; i < element.childNodes.length; i++ ) {
        if ( element.childNodes[i].nodeName == tagName ) return element.childNodes[i];
      }
    }

     //

//Rolling Tagline display on index (BS)
function displaylink()
{
     	ranlink=dislinks[count].split(",") // separate the address and name
     	dlink="<A>"+ranlink[1]+"</A>";
     	if(document.layers) // Netscape 4.0+
     	{
        // For NNS 4.0+ you will have to set the left and top properties to position the link on your page. 
        // For IE5+ and NS6+ the link will be positioned by the table.

		document.dislink.left=350 
      	document.dislink.top=25
            document.dislink.document.write(dlink)
            document.dislink.document.close()
     	}
     	if(document.getElementById("dislink")) // Netscape 6.0+ and IE5+
    	{
		var elm=document.getElementById("dislink");
		elm.innerHTML=dlink;
    	}
    	count++
    	if(count>=dislinks.length)
         {count=0}

	if (document.getElementById)
	{
		if (document.getElementById("dislink"))
		{
			setTimeout("displaylink()",8000) 
		}
		else
	   		{count=0}
	}
	else
	{
		setTimeout("displaylink()",8000)
	}
     // Set the speed of the link display here.  Currently set to change every 8 seconds.
     // setTimeout("displaylink()",8000) 

	
}

//iframe video links
function CoolLinks_click(Num)  //number comes from onclick in aspx
{
	if (Num == 3)  //DQ month
	{
		var vidLink = '<iframe name = IFrameContent frameborder=no height=100% width=255 scrolling=no src= http://www.discoverquick.com/images/Helpness_small.jpg></iframe>';
		playVideo(vidLink, Num);
	}
	else if (Num == 1) //Did you know?
	{
		var vidLink = '<iframe name = IFrameContent frameborder=no height=300 width=100% scrolling=yes src= http://www.youtube.com/v/cL9Wu2kWwSY&hl=en&fs=1&rel=0></iframe>';
		playVideo(vidLink, Num);
	}
	else if (Num == 2) //Origins of the Internet
	{
		var vidLink = '<iframe name = IFrameContent frameborder=no height=300 width=100% scrolling=yes src= http://www.youtube.com/v/QViJxJBEK4k&hl=en&fs=1></iframe>';
		playVideo(vidLink, Num);

	}

	document.body.style.cursor = "default";

}

//plays selected video
function playVideo(vidLink, Num)
{
	if (Num == 3)
	{

		var playSelectedVideo = "<br><table><tr><td>This month's winner is the Canberra Orthopaedic Group.   Over the last few months the group launched an extensive program on joint replacement and patient-professional interaction.  The team wanted to explore ways of improving patient outcomes while provding an efficient process for managing patients over the long term.<br>The group designed its own system using DiscoverQuick, branding it as JointView.  The whole process has been a great success, with patient logins, home assessments, clinical data and imaging coming together to support evidence-based decision making.  Next steps include real time automated outcome predictions.</td>";
		playSelectedVideo += "<td></td></tr></table>";

	}
	else
	{
		var playSelectedVideo = "<br><table><tr><td>" + vidLink + "</td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr></table>";
	}

     	if(document.getElementById("playVideo")) // Netscape 6.0+ and IE5+
    	{
		var playVideo=document.getElementById("playVideo");
		playVideo.innerHTML=playSelectedVideo;
    	}	
}



