﻿function popLocal(iTabIndex, iTabID, iSubNav, iWidth, iHeight)
{
	var winLocal = null;
		var sURL = "http://www.slingshot.co.nz/DesktopDefault.aspx?TabIndex=" + iTabIndex + "&TabID=" + iTabID
	if (iSubNav != '') {
		sURL += "&SubNav=" + iSubNav;
	}
	sURL += "&PageMode=Popup";
	winLocal = open(sURL,'winLocal','toolbar=no,location=0,directories=0,status=no,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=' + iWidth + ',height=' + iHeight);
	if (winLocal) winLocal.focus();
}

function SetUniqueRadioButton(nameregex, current, bbPlanOption, toggle)
{
   re = new RegExp(nameregex);
   for(i = 0; i < document.forms[0].elements.length; i++)
   {
      elm = document.forms[0].elements[i]
      if (elm.type == 'radio')
      {
         if (re.test(elm.name))
         {
            elm.checked = false;
         }
      }
   }
   current.checked = true;
}

function popLink(sUrl)
{
    win = open(sUrl,'win','toolbar=no,location=0,directories=0,status=yes,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=800,height=600');
}

function openWindow(page, width, height) {
	x = (640 - width)/2, y = (480 - height)/2;

	if (screen) {
		y = (screen.availHeight - height)/2;
		x = (screen.availWidth - width)/2;
	}

	window.open(page,'','width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x+', toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no');
}
