// Ensure 'undefined' is defined.
var undefined;

//==============================================================================
// HELP RELATED FUNCTIONS

//------------------------------------------------------------------------------
function OnHelpWindow(bOnTab)
{
   var szAnchor = "Overview.htm";

   OpenHelpWindow(szAnchor, bOnTab);
}

//------------------------------------------------------------------------------
function onPageLoad()
{
   onPageLoadGlobal();
   if (!document.layers)
      setTimeout("document.body.style.cursor = 'auto';", 1);

   onLayoutResize(true);
   
   //Focus for Tutorial page
   if (typeof(ObjWdsForm.Cancel) != 'undefined')
      ObjWdsForm.Cancel.focus();

   // Focus for the demo page, default focus is on the close button
   if (typeof(ObjWdsForm.Close) != 'undefined')
      ObjWdsForm.Close.focus();
      
   if (typeof(ObjWdsForm.NextDemo) != 'undefined') {
      if (!ObjWdsForm.NextDemo.isDisabled) {
		ObjWdsForm.NextDemo.focus();
	  }
   }

	if (PWdsapp_bIsIE) 
	{
		var dlgSpan=document.getElementById("SpanModal");
		if(dlgSpan!=null) //not in Help 
			dlgSpan.scrollTop=0;
	}
	else
		window.scrollTo(0,0);
}

// ----------------------------------------------------------------------------
// The request to cancel the flash demo operation will take user back to 
// the original page where they came from.
// ------------------------------------------------------------------------------
function OnCancelThisPage()
{   
	//this needs to be done for the case when user goes to the tutorials page directly (url)
    if(ObjWdsForm.CS_TargetPage.value == "") {
        ObjWdsForm.CS_TargetPage.value =  G_strRootPath + "/HomePage.aspx";
    }
    ObjWdsForm.action = ObjWdsForm.CS_TargetPage.value;

	executeWait(ObjWdsForm);
}

//------------------------------------------------------------------------------
function OnDisplayDemo(nTutorialTopicIndex)
{
	var szTutorialPath = "/Common/Tutorials/DemoPage.aspx";

	if (typeof(ObjWdsForm.CS_demoIndex) != "undefined") {
		ObjWdsForm.CS_demoIndex.value = nTutorialTopicIndex;
	}
	
	ObjWdsForm.action = G_strRootPath + szTutorialPath;
	ObjWdsForm.CS_InHelp.value = "False";
	executeWait(ObjWdsForm);
}