/* Script for viewing pdf's and other documents plus download*/
function submitValue(Edition,Type)
 {
  document.frm.txtDownloadEdition.value = Edition;
  document.frm.txtDownloadType.value = Type;
  document.frm.submit();
  return false;
 }

/* Script for online demo pop up for NCache*/
function OnlineDemoClick() {
	window.open("../ncache/demos/NCacheSessionDemo_viewlet_swf.html","OnlineDemo","scrollbars=no,width=990, height=681, center=yes");
	return;
}
/* Script for online NCache Video*/
function OnlineDemo1Click() {
	window.open("../ncache/demos/caching_video_viewlet_swf.html","OnlineDemo","scrollbars=yes,width=900, height=659, center=yes");
	return;
}
function OnlineDemo2Click() {
	window.open("../ncache/demos/ncache_getting_started_video.html","OnlineDemo","scrollbars=no,width=1009, height=650, center=yes");
	return;
}
/* Script for online demo pop up for TDev*/
function OnlineDemoClicktdev(demoName) {

	demoURL = "demos/" + demoName + "_viewlet_swf.html"
	window.open(demoURL,"OnlineDemo","scrollbars=no,width=830, height=640, center=yes");

	return;
}


/* Script for Rounded Corners*/
  window.onload = function()
  {
    settings = {
      tl: { radius: 7 },
      tr: { radius: 7 },
      bl: { radius: 7 },
      br: { radius: 7 },
      antiAlias: true,
      autoPad: false
    }

    var divObj = document.getElementById("box");

    var cornersObj = new curvyCorners(settings, "box");
    cornersObj.applyCornersToAll();
  }



function isEmail (s)
{
    // there must be >= 1 character before @, so we
    // start looking at character position 1 
    // (i.e. second character)
    var i = 1;
    var sLength = s.length;

    // look for @
    while ((i < sLength) && (s.charAt(i) != "@"))
    { 
		i++
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) 
		return false;
    else 
		i += 2;

    // look for .
    while ((i < sLength) && (s.charAt(i) != "."))
    {	
		i++
    }
    // there must be at least one character after the .
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) 
	{
		return false;
	}
	else 
	{
		return true;
	}
}
function OnSendClick()
{
	if ((!isEmail(document.MailingForm.fromemail.value))||(!isEmail(document.MailingForm.toemail.value))) {
		alert("Please specify correct email address.");
	}
	else {
		document.MailingForm.action = "tellafriend.php";
		document.MailingForm.submit();
	}		
	return;
}

//jsd
function download_onsubmit()
{
	var validInputFlag;

	validInputFlag = validateInput();

	return validInputFlag;
}

function validateInput()
{
	if (isBlank(document.form1.Numb_Developers.value))
	{
		alert("You must enter Number of Developers.");
		document.form1.Numb_Developers.focus ();
		return false;
	}
	
	if (isBlank(document.form1.Numb_Servers.value))
	{
		alert("You must enter Number of Production Servers.");
		document.form1.Numb_Servers.focus ();
		return false;
	}


	if (document.form1.InterestLevel[0].checked == false &&
		document.form1.InterestLevel[1].checked == false &&
		document.form1.InterestLevel[2].checked == false)
	{
		alert("You must select a Level of Interest value. Please check the specific option value for Level of Interest.");
		return false;
	}

	return true;
}


function isBlank(srcString)
{
	var index, length;

	if (srcString == "") {
		return true;
	}

	length = srcString.length;
	for (index=0; index < length; index++)
	{
		if (srcString.charAt(index) != " ")
		{
			return false;
		}
	}
	return true;
}

function view_sla()
{
	var ed = document.form1.txtDownloadEdition.value;
if(ed.charAt(0) == "N" && ed.charAt(1) == "C")
  window.open("/ncache/nc_sla.html", "_blank");
 else if(ed.charAt(0) == "N" && ed.charAt(1) == "W")
  window.open("/nwebcache/nwc_sla.html", "_blank");
else if(ed.charAt(0) == "T" && ed.charAt(1) == "D")
  window.open("/tdev/td_sla.html", "_blank");
		
}